45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
using System;
|
|
using Game.MVVM.Model;
|
|
|
|
namespace Game
|
|
{
|
|
[UIType(UIType.GlobalTipsUI)]
|
|
public class GlobalTipsUI : UIBase
|
|
{
|
|
private GlobalTipsView _view;
|
|
private Action sureAction;
|
|
|
|
public override void Init()
|
|
{
|
|
base.Init();
|
|
this._view = this.self.GetComponentInChildren<GlobalTipsView>();
|
|
this._view.BindingContext = new GlobalTipsUIViewModel();
|
|
this._view.BindingContext.OnClickSure += this.ClickSureButton;
|
|
this._view.BindingContext.OnClickClose += this.ClickCloseButton;
|
|
}
|
|
|
|
private void ClickCloseButton()
|
|
{
|
|
Game.uiManager.CloseLast();
|
|
}
|
|
|
|
private void ClickSureButton()
|
|
{
|
|
Game.uiManager.CloseLast();
|
|
sureAction?.Invoke();
|
|
}
|
|
|
|
public void SetContent(string content, string btnSure = "确定", Action sure = null, string btnClose = "关闭")
|
|
{
|
|
sureAction = sure;
|
|
this._view.BindingContext.SetTips(content, btnSure, btnClose);
|
|
}
|
|
|
|
public override void Dispose()
|
|
{
|
|
base.Dispose();
|
|
this._view.BindingContext.OnClickSure -= this.ClickSureButton;
|
|
this._view.BindingContext.OnClickClose -= this.ClickCloseButton;
|
|
}
|
|
}
|
|
} |