91 lines
2.4 KiB
C#
91 lines
2.4 KiB
C#
/*-------------------------------------------------------------------------------------
|
|
--- 创建人:
|
|
--- 描 述:
|
|
--- 创建时间: 2022年12月30日
|
|
-------------------------------------------------------------------------------------*/
|
|
using System.Collections;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Game
|
|
{
|
|
|
|
/// <summary>
|
|
/// xx 功能界面
|
|
/// </summary>
|
|
public class TouchButtonEffectUI : UIBase
|
|
{
|
|
//UIAutoBuild_CtrlDefine
|
|
public Image imgEff;
|
|
//UIAutoBuild_CtrlDefine
|
|
public RectTransform rectTransform;
|
|
public Animator anim;
|
|
|
|
//public static void ShowEff()
|
|
//{
|
|
// TouchButtonEffectUI effUI = GamePlayEntry.UI.OpenUI<TouchButtonEffectUI>() as TouchButtonEffectUI;
|
|
// effUI.rectTransform.position = Input.mousePosition;
|
|
// effUI.anim.Play("TouchEff");
|
|
// effUI.StartWaitClose();
|
|
// effUI.transform.SetAsLastSibling();
|
|
//}
|
|
|
|
public override void Awake()
|
|
{
|
|
//UIAutoBuild_CtrlBind
|
|
base.Awake();
|
|
Transform tf = transform;
|
|
imgEff = tf.Find("imgEff").GetComponent<Image>();
|
|
//UIAutoBuild_CtrlBind
|
|
rectTransform = this.GetComponent<RectTransform>();
|
|
anim = this.GetComponent<Animator>();
|
|
}
|
|
|
|
|
|
void OnEnable()
|
|
{
|
|
rectTransform.position = Input.mousePosition;
|
|
anim.Play("TouchEff");
|
|
StartWaitClose();
|
|
transform.SetAsLastSibling();
|
|
|
|
//UIAutoBuild_EventReg
|
|
//UIAutoBuild_EventReg
|
|
}
|
|
|
|
void OnDisable()
|
|
{
|
|
//UIAutoBuild_EventUnReg
|
|
//UIAutoBuild_EventUnReg
|
|
}
|
|
|
|
public void StartWaitClose()
|
|
{
|
|
if (IEnumerator_WaitClose != null)
|
|
StopCoroutine(IEnumerator_WaitClose);
|
|
|
|
IEnumerator_WaitClose = StartCoroutine(WaitClose());
|
|
}
|
|
|
|
Coroutine IEnumerator_WaitClose;
|
|
IEnumerator WaitClose()
|
|
{
|
|
yield return new WaitForSeconds(0.2f);
|
|
GamePlayEntry.UI.Hide(this);
|
|
IEnumerator_WaitClose = null;
|
|
}
|
|
|
|
void Start()
|
|
{
|
|
}
|
|
|
|
// 每次显示都执行, 可定义参数
|
|
public override void Show(params object[] _params)
|
|
{
|
|
base.Show(_params);
|
|
|
|
}
|
|
|
|
}
|
|
}
|