63 lines
1.8 KiB
C#
63 lines
1.8 KiB
C#
using Cysharp.Threading.Tasks;
|
|
using TMPro;
|
|
using uMVVM.Sources.Infrastructure;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Game.MVVM.Model
|
|
{
|
|
public class GameSceneMainView : UnityGuiView<GameSceneMainViewModel>
|
|
{
|
|
public Button btnBack;
|
|
public Button btnHelp;
|
|
public Button btnInvestment;
|
|
public TMP_Text txtJinBei;
|
|
public TMP_Text txtMessage;
|
|
public TMP_Dropdown dropdown;
|
|
public Image imgTips;
|
|
|
|
protected override void OnInitialize()
|
|
{
|
|
base.OnInitialize();
|
|
this.btnBack.onClick.AddListener(this.ClickBack);
|
|
this.btnHelp.onClick.AddListener(this.ClickHelp);
|
|
this.btnInvestment.onClick.AddListener(this.ClickInvestment);
|
|
|
|
this.Binder.Add<float>("JinBei", JinBeiValueChanged);
|
|
this.Binder.Add<string>("Message", MessageValueChanged);
|
|
}
|
|
|
|
private void MessageValueChanged(string oldvalue, string newvalue)
|
|
{
|
|
this.txtMessage.text = newvalue;
|
|
}
|
|
|
|
private void JinBeiValueChanged(float oldvalue, float newvalue)
|
|
{
|
|
this.txtJinBei.text = newvalue.ToString();
|
|
}
|
|
|
|
private void ClickBack()
|
|
{
|
|
this.BindingContext.OnClickBack?.Invoke();
|
|
}
|
|
|
|
private void ClickHelp()
|
|
{
|
|
this.BindingContext.OnClickHelp?.Invoke();
|
|
}
|
|
|
|
private void ClickInvestment()
|
|
{
|
|
var captionTextText = this.dropdown.captionText.text;
|
|
var f = float.Parse(captionTextText);
|
|
this.BindingContext.OnClickInvestment?.Invoke(f);
|
|
}
|
|
|
|
public async UniTask WaitTimeCloseTips()
|
|
{
|
|
this.imgTips.gameObject.SetActive(true);
|
|
await UniTask.Delay(4000);
|
|
this.imgTips.gameObject.SetActive(false);
|
|
}
|
|
}
|
|
} |