35 lines
870 B
C#
35 lines
870 B
C#
using TMPro;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Game;
|
|
|
|
[UIType(UIType.InputNameUI)]
|
|
public class InputNameUI : UIBase
|
|
{
|
|
private TMP_InputField _inputField;
|
|
private Button _button;
|
|
|
|
public override void Init()
|
|
{
|
|
base.Init();
|
|
this._inputField = self.transform.FindChildDeep<TMP_InputField>("inp_Name");
|
|
this._button = self.transform.FindChildDeep<Button>("btn_Sure");
|
|
|
|
this._button.onClick.AddListener(ClickSureButton);
|
|
}
|
|
|
|
public override void Dispose()
|
|
{
|
|
base.Dispose();
|
|
this._button.onClick.RemoveListener(ClickSureButton);
|
|
}
|
|
|
|
private void ClickSureButton()
|
|
{
|
|
var inputFieldText = this._inputField.text;
|
|
if (string.IsNullOrEmpty(inputFieldText))
|
|
return;
|
|
|
|
EventManager.Instance.FireNow(this, new InputNameFinishEventArgs(inputFieldText));
|
|
}
|
|
} |