75 lines
1.8 KiB
C#
75 lines
1.8 KiB
C#
using System;
|
|
using Runtime;
|
|
using UnityEngine.UI;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using ZGame;
|
|
|
|
namespace HK
|
|
{
|
|
public class Product5ConfirmItem : UIItemBase
|
|
{
|
|
[SerializeField] private TMP_Text txtPrice;
|
|
[SerializeField] private Button btnConfirm;
|
|
Book_M book;
|
|
public Action ClickAction;
|
|
|
|
public override void OnInit()
|
|
{
|
|
base.OnInit();
|
|
|
|
#region AutoGen_Init
|
|
|
|
txtPrice = GetValue<TMP_Text>("txtPrice");
|
|
btnConfirm = GetValue<Button>("btnConfirm");
|
|
|
|
btnConfirm.onClick.AddListener(OnClickbtnConfirm);
|
|
|
|
#endregion
|
|
|
|
EventManager.Instance.Subscribe(BookPlayAnimatorFinishEventArgs.EventId,BookPlayAnimatorFinishEvent);
|
|
}
|
|
|
|
private void BookPlayAnimatorFinishEvent(object sender, GameEventArgs e)
|
|
{
|
|
var args = e as BookPlayAnimatorFinishEventArgs;
|
|
btnConfirm.gameObject.SetActive(true);
|
|
}
|
|
|
|
public void SetBook(Book_M book)
|
|
{
|
|
this.book = book;
|
|
}
|
|
|
|
public override void OnShow()
|
|
{
|
|
base.OnShow();
|
|
book.SetIndex(4);
|
|
btnConfirm.gameObject.SetActive(false);
|
|
}
|
|
|
|
#region AutoGen_Method
|
|
|
|
private void OnClickbtnConfirm()
|
|
{
|
|
ClickAction?.Invoke();
|
|
}
|
|
|
|
#endregion
|
|
|
|
public override void OnDispose()
|
|
{
|
|
base.OnDispose();
|
|
EventManager.Instance.Unsubscribe(BookPlayAnimatorFinishEventArgs.EventId,BookPlayAnimatorFinishEvent);
|
|
|
|
#region AutoGen_Dispose
|
|
|
|
btnConfirm.onClick.RemoveListener(OnClickbtnConfirm);
|
|
|
|
txtPrice = null;
|
|
btnConfirm = null;
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
} |