// ***********************************************************************
// Assembly : Game
// Author : Kimch
// Created : 2021-01-08
// Description :
// Last Modified By :
// Last Modified On :
// ***********************************************************************
//
//
// ***********************************************************************
namespace G.UI
{
using System;
using TMPro;
using UnityEngine.UI;
///
///
///
partial class TextBox
{
#region Field
#pragma warning disable CS0649 // 从未对字段赋值,字段将一直保持其默认值 null
[KUIFlag]
TextMeshProUGUI _tmpTitle;
[KUIFlag]
TextMeshProUGUI _tmpTitle2;
[KUIFlag]
TMP_InputField _inputFiled;
[KUIFlag]
Button _btnConfirm;
[KUIFlag]
Button _btnClose;
#pragma warning restore CS0649 // 从未对字段赋值,字段将一直保持其默认值 null
#endregion
#region Method
///
///
///
public void InitView()
{
SetViewData();
_btnConfirm.onClick.AddListener(this.OnConfirm);
_btnClose.onClick.AddListener(this.OnCloseBtnClick);
}
///
///
///
public void RefreshView()
{
if (this.data is Tuple> tuple)
{
_tmpTitle.text = tuple.Item1;
_tmpTitle2.text = tuple.Item2;
_inputFiled.text = tuple.Item3;
}
}
///
///
///
public void UpdateView()
{
}
private void OnConfirm()
{
SoundProxy.PlayFxAsync(GlobalDefine.BUTTON_CLICK_SOUND);
var str = _inputFiled.text;
if (str.Length == 0)
{
ToastBox.ShowText("字符数量不符合.");
return;
}
if (this.data is Tuple> tuple)
{
tuple.Item4?.Invoke(_inputFiled.text);
}
CloseWindow(this);
}
private void OnCloseBtnClick()
{
CloseWindow(this);
}
#endregion
}
}