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

67 lines
1.9 KiB
C#

using System;
using System.Collections.Generic;
using System.StateSystem;
// using com.taptap.tapsdk.bindings.csharp;
using FJson;
using Framework.FSMLite;
using Framework.UI;
// using TapTap.Connect;
// using TapTap.Moment;
// using TapTap.Common;
// using TapTap.Login;
using UnityEngine;
using Views;
namespace StateSystem.State
{
public class StateLogin : StateMachine<GameGlobalState>
{
#pragma warning disable CS1998
protected override async void OnEnter(params object[] args)
#pragma warning restore CS1998
{
#if UNITY_EDITOR || DisCertification
LocalLogin ();
// TapTapLoginCheck ();
return;
#endif
LocalLogin ();
//测试版本阶段不启用tap登录
// TapTapLoginCheck();
}
private async void TapTapLoginCheck()
{
}
protected override void OnExit()
{
// UIManager.Instance.CloseView(UIPanel.LoginPanel);
}
public async void LoginSuccess(string openId)
{
//tap内嵌动态
// TapMoment.Init(GameGlobalConfig.Instance.TapClientId);
//tap悬浮窗
// TapConnect.Init(GameGlobalConfig.Instance.TapClientId, GameGlobalConfig.Instance.TapToken , true);
Debug.Log ("初始化悬浮窗");
// TapConnect.SetEntryVisible (true);
// var profile = await TapLogin.Authorize ();
var accession = openId;
Account.Instance.SetLogin(accession, 1);
this.stateMachineRunner.OpenState(GameGlobalState.Certification);
}
public async void LocalLogin()
{
// await TDSUser.LoginAnonymously();
//登录失败后走单机模式
PlayerPrefs.SetInt("FirstTip", 1);
Account.Instance.SetLogout();
this.stateMachineRunner.OpenState(GameGlobalState.Certification);
}
}
}