|
@@ -6,7 +6,10 @@ namespace GFGGame
|
|
|
public class LoginController
|
|
|
{
|
|
|
public static string ageTipsTitle = "适龄提示说明";
|
|
|
- public static string ageTips = "1)本游戏是一款角色扮演类游戏,适用于年满16周岁及以上的用户,建议未成年人在家长监护下使用游戏产品。\n2)本游戏基于架空的故事背景和幻想世界观,剧情简单且积极向上,没有基于真实历史和现实事件的改编内容游戏玩法以收集不同服装进行搭配展开,有较为简单的竞技和对抗玩法,游戏中有基于文字的陌生人社交系统。\n3)本游戏中有用户实名认证系统,认证为未成年人的用户将接受以下管理:游戏中部分玩法和道具需要付费。未满8周岁的用户不能付费; 8周岁以上未满16周岁的未成年人用户,单次充值金额不得超过50元人民币,每月充值金额累计不得超过200元人民币; 16周岁以上的未成年人用户,单次充值金额不得超过100元人民币,每月充值金额累计不得超过400元人民币。\n4)本游戏以服装收集及搭配为主要玩法,有助于玩家开阔眼界、进一步提升审美能力。游戏中很多服装融入了中华传统元素,可以有助于中华传统文化的传播,体验中国的古典美。";
|
|
|
+
|
|
|
+ public static string ageTips =
|
|
|
+ "1)本游戏是一款角色扮演类游戏,适用于年满16周岁及以上的用户,建议未成年人在家长监护下使用游戏产品。\n2)本游戏基于架空的故事背景和幻想世界观,剧情简单且积极向上,没有基于真实历史和现实事件的改编内容游戏玩法以收集不同服装进行搭配展开,有较为简单的竞技和对抗玩法,游戏中有基于文字的陌生人社交系统。\n3)本游戏中有用户实名认证系统,认证为未成年人的用户将接受以下管理:游戏中部分玩法和道具需要付费。未满8周岁的用户不能付费; 8周岁以上未满16周岁的未成年人用户,单次充值金额不得超过50元人民币,每月充值金额累计不得超过200元人民币; 16周岁以上的未成年人用户,单次充值金额不得超过100元人民币,每月充值金额累计不得超过400元人民币。\n4)本游戏以服装收集及搭配为主要玩法,有助于玩家开阔眼界、进一步提升审美能力。游戏中很多服装融入了中华传统元素,可以有助于中华传统文化的传播,体验中国的古典美。";
|
|
|
+
|
|
|
public static void ShowLogin()
|
|
|
{
|
|
|
ViewManager.Show<LoginView>();
|
|
@@ -15,7 +18,8 @@ namespace GFGGame
|
|
|
public static async ET.ETTask LoginTest(string account, bool cancelDelete = false)
|
|
|
{
|
|
|
ViewManager.Show<ModalStatusView>("登录中...");
|
|
|
- (int errorCode, long deleteTime) = await ET.LoginHelper.LoginTest(GameGlobal.zoneScene, GameConfig.LoginAddress, account, cancelDelete);
|
|
|
+ (int errorCode, long deleteTime) = await ET.LoginHelper.LoginTest(GameGlobal.zoneScene,
|
|
|
+ GameConfig.LoginAddress, account, cancelDelete);
|
|
|
|
|
|
if (errorCode == ET.ErrorCode.ERR_Success)
|
|
|
{
|
|
@@ -34,6 +38,7 @@ namespace GFGGame
|
|
|
PlayerPrefs.SetString(GameConst.ACCOUNT_LAST_LOGIN_KEY, account);
|
|
|
PlayerPrefs.SetString(GameConst.PASSWORD_LAST_LOGIN_KEY, "");
|
|
|
}
|
|
|
+
|
|
|
GameController.CheckSpecialAccount("sygfg");
|
|
|
LocalCache.SetBool(GameConst.LAST_LOGIN_IS_VISITOR_KEY, GameGlobal.isVisitor);
|
|
|
PlayerPrefs.Save();
|
|
@@ -47,10 +52,12 @@ namespace GFGGame
|
|
|
}
|
|
|
|
|
|
|
|
|
- public static async ET.ETTask Login(string account, string password, bool isMD5 = false, bool cancelDelete = false)
|
|
|
+ public static async ET.ETTask Login(string account, string password, bool isMD5 = false,
|
|
|
+ bool cancelDelete = false)
|
|
|
{
|
|
|
ViewManager.Show<ModalStatusView>("登录中...");
|
|
|
- (int errorCode, long deleteTime) = await ET.LoginHelper.Login(GameGlobal.zoneScene, GameConfig.LoginAddress, account, password, isMD5, cancelDelete);
|
|
|
+ (int errorCode, long deleteTime) = await ET.LoginHelper.Login(GameGlobal.zoneScene, GameConfig.LoginAddress,
|
|
|
+ account, password, isMD5, cancelDelete);
|
|
|
|
|
|
if (errorCode == ET.ErrorCode.ERR_Success)
|
|
|
{
|
|
@@ -72,9 +79,11 @@ namespace GFGGame
|
|
|
{
|
|
|
passwordMD5 = MD5Helper.stringMD5(password);
|
|
|
}
|
|
|
+
|
|
|
PlayerPrefs.SetString(GameConst.ACCOUNT_LAST_LOGIN_KEY, account);
|
|
|
PlayerPrefs.SetString(GameConst.PASSWORD_LAST_LOGIN_KEY, passwordMD5);
|
|
|
}
|
|
|
+
|
|
|
GameController.CheckSpecialAccount(account);
|
|
|
LocalCache.SetBool(GameConst.LAST_LOGIN_IS_VISITOR_KEY, GameGlobal.isVisitor);
|
|
|
PlayerPrefs.Save();
|
|
@@ -97,25 +106,27 @@ namespace GFGGame
|
|
|
ViewManager.Hide<ModalStatusView>();
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
await ReqNoticeInfo();
|
|
|
|
|
|
ViewManager.Hide<ModalStatusView>();
|
|
|
}
|
|
|
+
|
|
|
private static void OnLoginFail(int errorCode, string account, long deleteTime, string password, bool isMD5)
|
|
|
{
|
|
|
ViewManager.Hide<ModalStatusView>();
|
|
|
- if(errorCode == ErrorCode.ERR_LoginIsLimit && deleteTime > 0)
|
|
|
+ if (errorCode == ErrorCode.ERR_LoginIsLimit && deleteTime > 0)
|
|
|
{
|
|
|
//删除账号提示
|
|
|
AlertSystem.Show("账号注销处理中,若确定登录将取消账号注销,是否确定登录游戏?")
|
|
|
- .SetLeftButton(true, "取消", (o)=>
|
|
|
+ .SetLeftButton(true, "取消", (o) =>
|
|
|
{
|
|
|
GameController.QuitToLoginView(true);
|
|
|
EventAgent.DispatchEvent(ConstMessage.LOGIN_FAIL, account);
|
|
|
})
|
|
|
- .SetRightButton(true, "确定", (o)=>
|
|
|
+ .SetRightButton(true, "确定", (o) =>
|
|
|
{
|
|
|
- if(string.IsNullOrEmpty(password))
|
|
|
+ if (string.IsNullOrEmpty(password))
|
|
|
{
|
|
|
LoginTest(account, true).Coroutine();
|
|
|
}
|
|
@@ -126,10 +137,12 @@ namespace GFGGame
|
|
|
});
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
if (ErrorCodeController.Handler(errorCode))
|
|
|
{
|
|
|
GameController.QuitToLoginView(true);
|
|
|
}
|
|
|
+
|
|
|
EventAgent.DispatchEvent(ConstMessage.LOGIN_FAIL, account);
|
|
|
}
|
|
|
|
|
@@ -142,24 +155,32 @@ namespace GFGGame
|
|
|
// Debug.Log("noticeTime:" + noticeInfo.time + " currentTime:" + (TimeInfo.Instance.ServerNow() / 1000));
|
|
|
|
|
|
long noticeTime = TimeUtil.GetDayTimeBySec(noticeInfo.time, GlobalCfgArray.globalCfg.refreshTime);
|
|
|
- long currentTime = TimeUtil.GetDayTimeBySec(TimeInfo.Instance.ServerNow(), GlobalCfgArray.globalCfg.refreshTime);
|
|
|
+ long currentTime =
|
|
|
+ TimeUtil.GetDayTimeBySec(TimeInfo.Instance.ServerNow(), GlobalCfgArray.globalCfg.refreshTime);
|
|
|
// Debug.Log("noticeTime:" + noticeTime + " currentTime:" + currentTime);
|
|
|
if ((currentTime - noticeTime) / 1000 / TimeUtil.SECOND_PER_DAY < 3)
|
|
|
{
|
|
|
- ViewManager.Show<SystemNoticeView>(new object[] { NoticeDataManager.Instance.LastNoticeInfo.title, NoticeDataManager.Instance.LastNoticeInfo.content });
|
|
|
+ ViewManager.Show<SystemNoticeView>(new object[]
|
|
|
+ {
|
|
|
+ NoticeDataManager.Instance.LastNoticeInfo.title,
|
|
|
+ NoticeDataManager.Instance.LastNoticeInfo.content
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
ErrorCodeController.Handler(result);
|
|
|
}
|
|
|
+
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- public static async ETTask Register(string account, string password, string name, string identityNum, string code)
|
|
|
+ public static async ETTask Register(string account, string password, string name, string identityNum,
|
|
|
+ string code)
|
|
|
{
|
|
|
ViewManager.Show<ModalStatusView>("注册中...");
|
|
|
- int errorCode = await LoginHelper.Register(GameGlobal.zoneScene, GameConfig.LoginAddress, account, password, name, identityNum, code);
|
|
|
+ int errorCode = await LoginHelper.Register(GameGlobal.zoneScene, GameConfig.LoginAddress, account, password,
|
|
|
+ name, identityNum, code);
|
|
|
|
|
|
if (errorCode == ErrorCode.ERR_Success)
|
|
|
{
|
|
@@ -183,17 +204,16 @@ namespace GFGGame
|
|
|
await ETTask.Create();
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
var serverInfosComponent = GameGlobal.zoneScene.GetComponent<ServerInfosComponent>();
|
|
|
if (serverInfosComponent.ServerInfoList.Count <= 0)
|
|
|
{
|
|
|
AlertSystem.Show("服务器列表为空:\n请检查网络和服务器状态")
|
|
|
- .SetRightButton(true, "知道啦", (object data) =>
|
|
|
- {
|
|
|
- Application.Quit();
|
|
|
- });
|
|
|
+ .SetRightButton(true, "知道啦", (object data) => { Application.Quit(); });
|
|
|
await ETTask.Create();
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
if (serverInfosComponent.CurrentServerId <= 0)
|
|
|
{
|
|
|
var serverInfo = serverInfosComponent.ServerInfoList[0];
|
|
@@ -203,7 +223,8 @@ namespace GFGGame
|
|
|
|
|
|
public static async ETTask GetRoles()
|
|
|
{
|
|
|
- GameGlobal.OpenServerTime = GameGlobal.zoneScene.GetComponent<ServerInfosComponent>().GetCurrentServerInfo().OpenServerTime;
|
|
|
+ GameGlobal.OpenServerTime = GameGlobal.zoneScene.GetComponent<ServerInfosComponent>().GetCurrentServerInfo()
|
|
|
+ .OpenServerTime;
|
|
|
ViewManager.Show<ModalStatusView>("获取角色信息...");
|
|
|
int errorCode = await LoginHelper.GetRoles(GameGlobal.zoneScene);
|
|
|
if (errorCode != ErrorCode.ERR_Success)
|
|
@@ -211,6 +232,7 @@ namespace GFGGame
|
|
|
ErrorCodeController.Handler(errorCode);
|
|
|
await ETTask.Create();
|
|
|
}
|
|
|
+
|
|
|
var roleInfosComponent = GameGlobal.zoneScene.GetComponent<RoleInfosComponent>();
|
|
|
if (roleInfosComponent.RoleInfos != null && roleInfosComponent.RoleInfos.Count > 0)
|
|
|
{
|
|
@@ -233,16 +255,18 @@ namespace GFGGame
|
|
|
{
|
|
|
return name;
|
|
|
}
|
|
|
+
|
|
|
ErrorCodeController.Handler(result);
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
public static async ETTask ReqCreateRole(string roleName = null)
|
|
|
{
|
|
|
- if(string.IsNullOrEmpty(roleName))
|
|
|
+ if (string.IsNullOrEmpty(roleName))
|
|
|
{
|
|
|
roleName = await ReqRandomRoleName();
|
|
|
}
|
|
|
+
|
|
|
ViewManager.Show<ModalStatusView>("创建角色中...");
|
|
|
int errorCode = await ET.LoginHelper.CreateRole(GameGlobal.zoneScene, roleName);
|
|
|
if (errorCode != ErrorCode.ERR_Success)
|
|
@@ -251,6 +275,7 @@ namespace GFGGame
|
|
|
ErrorCodeController.Handler(errorCode);
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
ViewManager.Hide<CreateRoleView>();
|
|
|
var roleInfosComponent = GameGlobal.zoneScene.GetComponent<RoleInfosComponent>();
|
|
|
var roleInfo = roleInfosComponent.RoleInfos[0];
|
|
@@ -270,12 +295,14 @@ namespace GFGGame
|
|
|
ErrorCodeController.Handler(errorCode);
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
errorCode = await LoginHelper.EnterGame(GameGlobal.zoneScene);
|
|
|
if (errorCode != ErrorCode.ERR_Success)
|
|
|
{
|
|
|
ErrorCodeController.Handler(errorCode);
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
ViewManager.Hide<ModalStatusView>();
|
|
|
ViewManager.Hide<LoginView>();
|
|
|
ViewManager.Show<LoadingView>(0.01f);
|
|
@@ -297,27 +324,23 @@ namespace GFGGame
|
|
|
{
|
|
|
string errMessage = "与服务器连接失败。";
|
|
|
Log.Error($"Reconnect fail, errorCode {errorCode}!");
|
|
|
- if(errorCode == ErrorCode.ERR_TokenError)
|
|
|
+ if (errorCode == ErrorCode.ERR_TokenError)
|
|
|
{
|
|
|
errMessage = "登录已过期,请重新登录";
|
|
|
AlertSystem.Show(errMessage)
|
|
|
- .SetRightButton(true, "好的", (object data) =>
|
|
|
- {
|
|
|
- GameController.QuitToLoginView(false);
|
|
|
- });
|
|
|
+ .SetRightButton(true, "好的", (object data) => { GameController.QuitToLoginView(false); });
|
|
|
return;
|
|
|
}
|
|
|
- else if(errorCode == ErrorCode.ERR_NetWorkError)
|
|
|
+ else if (errorCode == ErrorCode.ERR_NetWorkError)
|
|
|
{
|
|
|
errMessage = "网络异常,与服务器连接失败。";
|
|
|
}
|
|
|
+
|
|
|
AlertSystem.Show(errMessage)
|
|
|
- .SetRightButton(true, "重新连接", (object data) =>
|
|
|
- {
|
|
|
- ReqReConnectGate().Coroutine();
|
|
|
- });
|
|
|
+ .SetRightButton(true, "重新连接", (object data) => { ReqReConnectGate().Coroutine(); });
|
|
|
return;
|
|
|
}
|
|
|
+
|
|
|
await GameGlobal.zoneScene.GetComponent<ObjectWait>().Wait<ET.WaitType.Wait_SceneChangeFinish>();
|
|
|
EventAgent.DispatchEvent(ConstMessage.NUMERIC_CHANGE, NumericType.All);
|
|
|
GameController.OnReconnected();
|
|
@@ -325,5 +348,23 @@ namespace GFGGame
|
|
|
ViewManager.Hide<ModalStatusView>();
|
|
|
GameController.CheckUpdateVersion();
|
|
|
}
|
|
|
+
|
|
|
+ //玩家账号信息登记
|
|
|
+ public static async ETTask RegisterRoleInfo(string account, string password, string name, string identityNum,
|
|
|
+ string code, string phoneNumber)
|
|
|
+ {
|
|
|
+ int errorCode =
|
|
|
+ await LoginHelper.RegisterRoleInfo(GameGlobal.zoneScene, account, password, name, identityNum, code,
|
|
|
+ phoneNumber);
|
|
|
+
|
|
|
+ // if (errorCode != ErrorCode.ERR_Success)
|
|
|
+ // {
|
|
|
+ // // ErrorCodeController.Handler(errorCode);
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // AlertSystem.Hide();
|
|
|
+ // }
|
|
|
+ }
|
|
|
}
|
|
|
-}
|
|
|
+}
|