|
@@ -1,5 +1,6 @@
|
|
using System;
|
|
using System;
|
|
using GFGGame;
|
|
using GFGGame;
|
|
|
|
+using OfficeOpenXml.FormulaParsing.Excel.Functions.RefAndLookup;
|
|
|
|
|
|
namespace ET
|
|
namespace ET
|
|
{
|
|
{
|
|
@@ -415,9 +416,16 @@ namespace ET
|
|
public static async ETTask<(int, string)> ReqRandomRoleName()
|
|
public static async ETTask<(int, string)> ReqRandomRoleName()
|
|
{
|
|
{
|
|
A2C_GetRandomRoleName response = null;
|
|
A2C_GetRandomRoleName response = null;
|
|
|
|
+ bool notLogin = false;
|
|
|
|
+ Session accountSession = GameGlobal.zoneScene.GetComponent<SessionComponent>().AccountSession;
|
|
|
|
+ if (accountSession == null || accountSession.IsDisposed)
|
|
|
|
+ {
|
|
|
|
+ notLogin = true;
|
|
|
|
+ accountSession = GameGlobal.zoneScene.GetComponent<NetKcpComponent>().Create(NetworkHelper.ToIPEndPoint(GameConfig.LoginAddress));
|
|
|
|
+ }
|
|
try
|
|
try
|
|
{
|
|
{
|
|
- response = (A2C_GetRandomRoleName)await GameGlobal.zoneScene.GetComponent<SessionComponent>().AccountSession?.Call(new C2A_GetRandomRoleName()
|
|
|
|
|
|
+ response = (A2C_GetRandomRoleName)await accountSession?.Call(new C2A_GetRandomRoleName()
|
|
{
|
|
{
|
|
ServerId = GameGlobal.zoneScene.GetComponent<ServerInfosComponent>().CurrentServerId
|
|
ServerId = GameGlobal.zoneScene.GetComponent<ServerInfosComponent>().CurrentServerId
|
|
});
|
|
});
|
|
@@ -425,15 +433,27 @@ namespace ET
|
|
catch (Exception e)
|
|
catch (Exception e)
|
|
{
|
|
{
|
|
Log.Debug(e.ToString());
|
|
Log.Debug(e.ToString());
|
|
|
|
+ if(notLogin)
|
|
|
|
+ {
|
|
|
|
+ accountSession?.Dispose();
|
|
|
|
+ }
|
|
return (ErrorCode.ERR_NetWorkError, "");
|
|
return (ErrorCode.ERR_NetWorkError, "");
|
|
}
|
|
}
|
|
|
|
|
|
if (response.Error != ErrorCode.ERR_Success)
|
|
if (response.Error != ErrorCode.ERR_Success)
|
|
{
|
|
{
|
|
//Log.Error(response.Error.ToString());
|
|
//Log.Error(response.Error.ToString());
|
|
|
|
+ if (notLogin)
|
|
|
|
+ {
|
|
|
|
+ accountSession?.Dispose();
|
|
|
|
+ }
|
|
return (ErrorCode.ERR_NetWorkError, "");
|
|
return (ErrorCode.ERR_NetWorkError, "");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (notLogin)
|
|
|
|
+ {
|
|
|
|
+ accountSession?.Dispose();
|
|
|
|
+ }
|
|
return (ErrorCode.ERR_Success, response.Name);
|
|
return (ErrorCode.ERR_Success, response.Name);
|
|
}
|
|
}
|
|
}
|
|
}
|