57 lines
1.6 KiB
C#
57 lines
1.6 KiB
C#
|
using TMPro;
|
|||
|
using uMVVM.Sources.Infrastructure;
|
|||
|
using UnityEngine.UI;
|
|||
|
|
|||
|
namespace Game.MVVM.Model
|
|||
|
{
|
|||
|
public class GlobalTipsView : UnityGuiView<GlobalTipsUIViewModel>
|
|||
|
{
|
|||
|
public TMP_Text txtTips;
|
|||
|
public TMP_Text txtSure;
|
|||
|
public TMP_Text txtClose;
|
|||
|
public Button btnSure;
|
|||
|
public Button btnClose;
|
|||
|
|
|||
|
protected override void OnInitialize()
|
|||
|
{
|
|||
|
base.OnInitialize();
|
|||
|
this.Binder.Add<string>("TipsContent", this.TipsContentValueChange);
|
|||
|
this.Binder.Add<string>("TipsSure", this.TipsSureValueChange);
|
|||
|
this.Binder.Add<string>("TipsClose", this.TipsCloseValueChange);
|
|||
|
this.btnSure.onClick.AddListener(this.ClickSure);
|
|||
|
this.btnClose.onClick.AddListener(this.ClickClose);
|
|||
|
}
|
|||
|
|
|||
|
private void TipsSureValueChange(string oldvalue, string newvalue)
|
|||
|
{
|
|||
|
this.txtSure.text = newvalue;
|
|||
|
}
|
|||
|
|
|||
|
private void TipsCloseValueChange(string oldvalue, string newvalue)
|
|||
|
{
|
|||
|
this.txtClose.text = newvalue;
|
|||
|
}
|
|||
|
|
|||
|
private void TipsContentValueChange(string oldvalue, string newvalue)
|
|||
|
{
|
|||
|
this.txtTips.text = newvalue;
|
|||
|
}
|
|||
|
|
|||
|
public override void OnDestroy()
|
|||
|
{
|
|||
|
base.OnDestroy();
|
|||
|
this.btnSure.onClick.RemoveListener(this.ClickSure);
|
|||
|
this.btnClose.onClick.RemoveListener(this.ClickClose);
|
|||
|
}
|
|||
|
|
|||
|
private void ClickClose()
|
|||
|
{
|
|||
|
this.BindingContext.OnClickClose?.Invoke();
|
|||
|
}
|
|||
|
|
|||
|
private void ClickSure()
|
|||
|
{
|
|||
|
this.BindingContext.OnClickSure?.Invoke();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|