using GFGGame; using UnityEngine; namespace ET { public class A2C_DisconnectHandler : AMHandler { protected override async ETTask Run(Session session, A2C_Disconnect message) { session?.GetComponent()?.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: Alert.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; } } }