60 lines
1.2 KiB
C#
60 lines
1.2 KiB
C#
using GameWrapper.UI.Common;
|
|
using Framework;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEngine;
|
|
|
|
public class UI_CurrencyItem : MonoBehaviour
|
|
{
|
|
[SerializeField] [OnValueChanged("OnCurrencyIDChanged")]
|
|
private int _currencyID;
|
|
|
|
UI_CurrencyList.NumberType numberType = UI_CurrencyList.NumberType.Default;
|
|
public UI_CurrencyList.NumberType NumberType
|
|
{
|
|
get { return numberType; }
|
|
set
|
|
{
|
|
numberType = value;
|
|
}
|
|
}
|
|
|
|
public int currencyID
|
|
{
|
|
get { return _currencyID; }
|
|
set
|
|
{
|
|
_currencyID = value;
|
|
logic?.Refresh();
|
|
}
|
|
}
|
|
|
|
private ICurrencyItem _logic;
|
|
public ICurrencyItem logic
|
|
{
|
|
get
|
|
{
|
|
return _logic;
|
|
}
|
|
set
|
|
{
|
|
_logic = value;
|
|
_logic?.FakeAwake();
|
|
}
|
|
}
|
|
|
|
void OnCurrencyIDChanged()
|
|
{
|
|
logic?.OnCurrencyIDChanged();
|
|
}
|
|
|
|
private void Awake()
|
|
{
|
|
// 发送事件,通知逻辑层创建和绑定逻辑实例
|
|
EventManager.Instance.Send(EventManager.EventName.CurrencyItemCreated, this);
|
|
}
|
|
|
|
private void OnDestroy()
|
|
{
|
|
logic?.FakeOnDestroy();
|
|
}
|
|
} |