Files
taptap2024_GJ_chidouren/Assets/Scripts/System/StateSystem/State/StateCertification.cs
2024-10-16 00:03:41 +08:00

85 lines
2.9 KiB
C#

using System.Collections.Generic;
using Framework.FSMLite;
using Framework.UI;
using StateSystem;
using UnityEngine;
using Views;
namespace System.StateSystem.State
{
public class StateCertification : StateMachine<GameGlobalState>
{
// 是否启用时长限制功能
// ReSharper disable once InconsistentNaming
public bool useTimeLimit = true;
// 是否启用消费限制功能
// ReSharper disable once InconsistentNaming
public bool usePaymentLimit = true;
// 是否显示切换账号按钮
// ReSharper disable once InconsistentNaming
public bool showSwitchAccount = true;
#pragma warning disable CS1998
protected override async void OnEnter(params object[] args)
#pragma warning restore CS1998
{
EnterGame();
return;
#if UNITY_EDITOR || DisCertification
Debug.Log("实名认证模块{模拟完成,跳过实名认证}");
EnterGame();
#else
// // AnalysisEventMgr.Instance.EventLog("certification" , new KeyValuePair<string, object>("channel" , GameGlobalConfig.Instance.Channel));
// string gameIdentifier = GameGlobalConfig.Instance.TapClientId;
// AntiAddictionConfig config = new AntiAddictionConfig()
// {
// gameId = GameGlobalConfig.Instance.TapClientId, // TapTap 开发者中心对应 Client ID
// showSwitchAccount = this.showSwitchAccount, // 是否显示切换账号按钮
// };
// AntiAddictionUIKit.Init(config, OnCertiffication);
// #if UNITY_EDITOR
// TapTap.AntiAddiction.TapTapAntiAddictionManager.AntiAddictionConfig.gameId = gameIdentifier;
// #endif
// string userIdentifier = Account.Instance.UserID;
// if (Account.Instance.IsLogin)
// {
// AntiAddictionUIKit.Startup( userIdentifier , true);
// }
// else
// {
// AntiAddictionUIKit.Startup(userIdentifier, false);
// }
// this.EnterGame();
#endif
}
private void OnCertiffication (int code, string errorMsg)
{
if (code == 500)
{
EnterGame ();
}
else if (code == 9002)
{
// MessageBox.CloseAll ();
// var messageBox = MessageBox.Show ("错误", "无法通过实名认证! 进入游戏失败!" , "确认" , null);
// messageBox.onComplete = id =>
// {
// GameManager.Instance.ExitGame ();
// };
}
}
protected override void OnExit()
{
BeginStaticPanel.ReleasePanel ();
}
protected void EnterGame()
{
this.stateMachineRunner.OpenState(GameGlobalState.GameHome);
}
}
}