12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- 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<bool> ReqDeleteAccount(string name, string identityNum)
- {
- A2C_ReqDeleteAccount 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
- {
- AccountInfoComponent accountInfoComponent = GameGlobal.zoneScene.GetComponent<AccountInfoComponent>();
- 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;
- }
- }
- }
|