Forest_Client/Forest/Assets/Scripts/Gameplay/Login/LoginManager.cs

63 lines
1.6 KiB
C#
Raw Normal View History

2024-06-12 15:01:54 +08:00
using PhxhSDK;
namespace Gameplay.Login
{
public class LoginManager : Singlenton<LoginManager>, IInitable
{
private LoginStatus[] _mStatusList;
public string Account
{
get => CurrentStatus.GetProfileName();
}
/// <summary>
/// 是否登录
/// </summary>
public bool IsLogin;
/// <summary>
/// 是否需要同步数据
/// </summary>
public bool NeedSyncData;
/// <summary>
/// 是否打开过登录界面
/// </summary>
public bool ShowLogin;
public LoginStatus CurrentStatus { get; private set; }
public void Init()
{
_mStatusList = new LoginStatus[(int)LoginStatusID.Max];
_mStatusList[(int)LoginStatusID.None] = new LoginStatus();
_mStatusList[(int)LoginStatusID.Facebook] = new LoginStatusFaceBook();
_mStatusList[(int)LoginStatusID.Apple] = new LoginStatusApple();
CurrentStatus = _mStatusList[(int)LoginStatusID.None];
}
public void Login(LoginStatusID id)
{
CurrentStatus = _mStatusList[(int)id];
CurrentStatus.Login();
}
public void QuickLogin(LoginStatusID id)
{
CurrentStatus = _mStatusList[(int)id];
CurrentStatus.QuickLogin();
}
public void Logout()
{
CurrentStatus.Logout();
IsLogin = false;
AppInfoManager.Instance.Logout();
}
public void Release()
{
}
}
}