1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using GFGGame;
- using UnityEngine;
- namespace ET
- {
- public class A2C_DisconnectHandler : AMHandler<A2C_Disconnect>
- {
- protected override async ETTask Run(Session session, A2C_Disconnect message)
- {
- session?.GetComponent<DisConnectedCompnent>()?.CancelAlert();
- session.Dispose();
- switch (message.Error)
- {
- case ErrorCode.ERR_loginTimeOut:
- AlertSystem.Show("登录超时,请重新登录!")
- .SetLeftButton(true, "返回登录", (obj) =>
- {
- GameController.QuitToLoginView(false);
- });
- break;
- case ErrorCode.ERR_loginByOther:
- AlertSystem.Show("账号已在其他地方登录!")
- .SetLeftButton(true, "返回登录", (obj) =>
- {
- GameController.QuitToLoginView(true);
- });
- break;
- case ErrorCode.Err_ServerMaintain:
- AlertUI.Show("服务器维护中!")
- .SetLeftButton(true, "稍后再试", (obj) =>
- {
- Application.Quit();
- });
- break;
- default:
- if (string.IsNullOrEmpty(message.Message))
- {
- AlertSystem.Show(message.Message)
- .SetLeftButton(true, "返回登录", (obj) =>
- {
- GameController.QuitToLoginView(true);
- });
- }
- else
- {
- AlertSystem.Show("您已被迫下线!");
- }
- break;
- }
- await ETTask.CompletedTask;
- }
- }
- }
|