111 lines
2.7 KiB
C#
111 lines
2.7 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.UIElements;
|
|
using Button = UnityEngine.UI.Button;
|
|
using Image = UnityEngine.UI.Image;
|
|
using Toggle = UnityEngine.UI.Toggle;
|
|
using ScrollView = PhxhSDK.PhxhScrollView;
|
|
using Framework;
|
|
using Cysharp.Threading.Tasks;
|
|
using Gameplay.Net;
|
|
using NLDPB;
|
|
using DG.Tweening;
|
|
|
|
public class UI_RealNameIdentifyController : UIWindow
|
|
{
|
|
//UI GameObj
|
|
///Auto Gen Start///
|
|
public Image Image_Bg;
|
|
public TMP_Text Text_Title;
|
|
public TMP_Text Text_Info;
|
|
public TMP_InputField InputField_Name;
|
|
public TMP_InputField InputField_ID;
|
|
public Button Button_Confirm;
|
|
|
|
GameObject UI_ShortTip;
|
|
|
|
///Auto Gen End///
|
|
|
|
// deal with input data
|
|
public override void PreLoad(object data = null)
|
|
{
|
|
|
|
}
|
|
public static async UniTask<UIWindow> Open()
|
|
{
|
|
return await UIManager.Instance.CreateAndOpenWindow(UINameConst.UI_RealNameIdentify);
|
|
}
|
|
|
|
// Use this for initialization
|
|
public override void OnInit()
|
|
{
|
|
//bind UI GameObj
|
|
UI_RealNameIdentifyBinder.GetComponents(this);
|
|
UI_ShortTip = FindObj("UI_ShortTip");
|
|
|
|
BindButton(Button_Confirm, OnClickButton_Confirm);
|
|
EventManager.Instance.Register(EventManager.EventName.AdultAuthResult, CheckAdultAuthResult);
|
|
}
|
|
//invoke when open window
|
|
protected override void OnShowWindow(object data = null)
|
|
{
|
|
|
|
}
|
|
|
|
//invoke when reload window
|
|
protected override void OnReloadWindow(object data = null)
|
|
{
|
|
|
|
}
|
|
|
|
//invoke when close window
|
|
protected override void OnHideWindow()
|
|
{
|
|
|
|
}
|
|
|
|
//invoke when destroy
|
|
public override void OnRelease()
|
|
{
|
|
base.OnRelease();
|
|
}
|
|
|
|
void OnClickButton_Confirm()
|
|
{
|
|
string name = InputField_Name.text;
|
|
string idCode = InputField_ID.text;
|
|
if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(idCode))
|
|
{
|
|
DebugUtil.Log("·¢ËÍÇëÇó,ʵÃûÈÏÖ¤ÖÐ...");
|
|
Button_Confirm.interactable = false;
|
|
NetHelper.SendAdultAuth(name, idCode);
|
|
}
|
|
}
|
|
void CheckAdultAuthResult()
|
|
{
|
|
var status = (int)Actor.Instance.Logic.GetCount((uint)LogicID.AdultAuthStatus);
|
|
if (status != (int)AAStatus.AasNone)
|
|
{
|
|
DebugUtil.Log("ʵÃûÈÏÖ¤³É¹¦,µ±Ç°Óû§Éí·Ý״̬£º" + status);
|
|
EventManager.Instance.Unregister(EventManager.EventName.AdultAuthResult, CheckAdultAuthResult);
|
|
UIManager.Instance.CloseWindow(UINameConst.UI_RealNameIdentify);
|
|
}
|
|
else
|
|
{
|
|
DebugUtil.Log("ʵÃûÈÏ֤ʧ°Ü");
|
|
|
|
UI_ShortTip.SetActive(true);
|
|
//EventManager.Instance.Unregister(EventManager.EventName.ActorLogicDataUpdate, CheckAdultAuthResult);
|
|
Sequence se = DOTween.Sequence();
|
|
se.AppendInterval(2.0f);
|
|
se.AppendCallback(() => {
|
|
UI_ShortTip.SetActive(false);
|
|
Button_Confirm.interactable = true;
|
|
});
|
|
}
|
|
}
|
|
}
|