using ET; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace GFGGame { public static class AccountSProxy { public static async ETTask ReqDeleteAccount(string name, string identityNum) { A2C_ReqDeleteAccount response = null; bool notLogin = false; Session accountSession = GameGlobal.zoneScene.GetComponent().AccountSession; if (accountSession == null || accountSession.IsDisposed) { notLogin = true; accountSession = GameGlobal.zoneScene.GetComponent().Create(NetworkHelper.ToIPEndPoint(GameConfig.LoginAddress)); } try { AccountInfoComponent accountInfoComponent = GameGlobal.zoneScene.GetComponent(); response = (A2C_ReqDeleteAccount)await accountSession?.Call(new C2A_ReqDeleteAccount() { Account = accountInfoComponent.Account, Name = name, IdentityNum = identityNum, PlatformId = LauncherConfig.platformId, ChannelId = LauncherConfig.ChannelId }); } catch(Exception e) { Log.Debug(e.ToString()); ErrorCodeController.Handler(ErrorCode.ERR_NetWorkError); if (notLogin) { accountSession?.Dispose(); } return false; } if(response.Error != ErrorCode.ERR_Success) { ErrorCodeController.Handler(response.Error); if (notLogin) { accountSession?.Dispose(); } return false; } if (notLogin) { accountSession?.Dispose(); } return true; } } }