|
@@ -28,6 +28,33 @@ namespace ET
|
|
return ErrorCode.ERR_Success;
|
|
return ErrorCode.ERR_Success;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public static async ETTask<int> LoginTest(Scene zoneScene, string address, string account)
|
|
|
|
+ {
|
|
|
|
+ A2C_LoginAccount a2CLoginAccount = null;
|
|
|
|
+ Session accountSession = null;
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ accountSession = zoneScene.GetComponent<NetKcpComponent>().Create(NetworkHelper.ToIPEndPoint(address));
|
|
|
|
+
|
|
|
|
+ a2CLoginAccount = (A2C_LoginAccount)await accountSession.Call(new C2A_LoginTest() { Account = account });
|
|
|
|
+ }
|
|
|
|
+ catch (Exception e)
|
|
|
|
+ {
|
|
|
|
+ accountSession?.Dispose();
|
|
|
|
+ Log.Error(e.ToString());
|
|
|
|
+ return ErrorCode.ERR_NetWorkError;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (a2CLoginAccount.Error != ErrorCode.ERR_Success)
|
|
|
|
+ {
|
|
|
|
+ accountSession?.Dispose();
|
|
|
|
+ return a2CLoginAccount.Error;
|
|
|
|
+ }
|
|
|
|
+ OnLoginSuccess(zoneScene, a2CLoginAccount, accountSession);
|
|
|
|
+
|
|
|
|
+ return ErrorCode.ERR_Success;
|
|
|
|
+ }
|
|
|
|
+
|
|
public static async ETTask<int> Login(Scene zoneScene, string address, string account, string password, bool isMD5)
|
|
public static async ETTask<int> Login(Scene zoneScene, string address, string account, string password, bool isMD5)
|
|
{
|
|
{
|
|
A2C_LoginAccount a2CLoginAccount = null;
|
|
A2C_LoginAccount a2CLoginAccount = null;
|
|
@@ -55,6 +82,13 @@ namespace ET
|
|
accountSession?.Dispose();
|
|
accountSession?.Dispose();
|
|
return a2CLoginAccount.Error;
|
|
return a2CLoginAccount.Error;
|
|
}
|
|
}
|
|
|
|
+ OnLoginSuccess(zoneScene, a2CLoginAccount, accountSession);
|
|
|
|
+
|
|
|
|
+ return ErrorCode.ERR_Success;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static void OnLoginSuccess(Scene zoneScene, A2C_LoginAccount a2CLoginAccount, Session accountSession)
|
|
|
|
+ {
|
|
if (zoneScene.GetComponent<SessionComponent>() == null)
|
|
if (zoneScene.GetComponent<SessionComponent>() == null)
|
|
{
|
|
{
|
|
zoneScene.AddComponent<SessionComponent>();
|
|
zoneScene.AddComponent<SessionComponent>();
|
|
@@ -65,8 +99,6 @@ namespace ET
|
|
accountInfoComponent.Token = a2CLoginAccount.Token;
|
|
accountInfoComponent.Token = a2CLoginAccount.Token;
|
|
accountInfoComponent.AccountId = a2CLoginAccount.AccountId;
|
|
accountInfoComponent.AccountId = a2CLoginAccount.AccountId;
|
|
accountInfoComponent.Age = a2CLoginAccount.Age;
|
|
accountInfoComponent.Age = a2CLoginAccount.Age;
|
|
-
|
|
|
|
- return ErrorCode.ERR_Success;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
public static async ETTask<int> Register(Scene zoneScene, string address, string account, string password, string name, string identityNum, string code)
|
|
public static async ETTask<int> Register(Scene zoneScene, string address, string account, string password, string name, string identityNum, string code)
|