63 lines
1.6 KiB
C#
63 lines
1.6 KiB
C#
|
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()
|
||
|
{
|
||
|
}
|
||
|
}
|
||
|
}
|