126 lines
3.3 KiB
C#
126 lines
3.3 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;
|
|
using Gameplay;
|
|
|
|
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();
|
|
}
|
|
|
|
public override UniTask<bool> OnBack(object data = null)
|
|
{
|
|
EventManager.Instance.Send(EventManager.EventName.RealNameVerifyCancel);
|
|
return base.OnBack(data);
|
|
}
|
|
|
|
void OnClickButton_Confirm()
|
|
{
|
|
string name = InputField_Name.text;
|
|
string idCode = InputField_ID.text;
|
|
if (!string.IsNullOrEmpty(name) && idCode.Length == 18)
|
|
{
|
|
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);
|
|
UIManager.Instance.CloseWindow(UINameConst.UI_StartGameInterface);
|
|
if (status == (int)AAStatus.AasUnderEighteen && !CommonUtils.IsUnderagePlayTimeAllowed())
|
|
{
|
|
DebugUtil.Log("未成年人限制游玩时间段内");
|
|
WaitingForServer.Instance.EventClear();
|
|
return;
|
|
}
|
|
Actor.Instance.OnEnterGame();
|
|
}
|
|
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;
|
|
});
|
|
}
|
|
}
|
|
}
|