/*-------------------------------------------------------------------------------------
--- 创建人:
--- 描 述:
--- 创建时间: 2022年12月30日
-------------------------------------------------------------------------------------*/
using System.Collections;
using UnityEngine;
using UnityEngine.UI;
namespace Game
{
///
/// xx 功能界面
///
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() 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();
//UIAutoBuild_CtrlBind
rectTransform = this.GetComponent();
anim = this.GetComponent();
}
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);
}
}
}