void OnLeave() { if (Global.IsLoginGame) { if (bGameStation != 20 && bGameStation != 22) //非游戏状态 { waitOut = true; GameNetworkManager.Instance.getUp(); } else { if (!isMyBet && (currZhuangStation != (int)myInfo.bDeskStation)) //我自己是否下注了&&并且不是庄家 { waitOut = true; GameNetworkManager.Instance.getQuit(); } else { UI_Alert.ShowMsg("您现在退出将会被系统托管您的游戏,是否真的要退出?", () => { Leave(); }); } } } else //游戏还在登录中 { Leave(); } }
void Update() { if ((Input.GetKeyDown(KeyCode.Escape))) { OnLeave(); } if (Global.GameTryReConnTimes > GameSocket.MAXRETRYTTIMES) //重试 { Global.GameTryReConnTimes = 0; UI_Alert.ShowMsg("连接游戏服务器超时,是否重试?", () => { GameSocket.GetInstance().ManualShutDown(); GameSocket.GetInstance().Connect(); }, () => { Leave(); }); } EventMgr.ins.DispEvent(EventMgr.EnterFrame, null); if (Global.LastGameHeartBeatTime != 0 && Global.IsLoginGame) { ulong nowTime = TimeHelper.GetNowTime(); ulong left = nowTime - Global.LastGameHeartBeatTime; if (left > 15) //回包超时跳出提示,重新登录 { if (Global.CurrentGameId == 10301800) //重连 { GameSocket.GetInstance().ManualShutDown(); GameSocket.GetInstance().Connect(Global.CurrentSelGameRoom.GetSzServiceIP(), (int)Global.CurrentSelGameRoom.uServicePort); Global.LastGameHeartBeatTime = 0; } } } }
void OnNetError(string str, System.Object obj) { UI_Alert.ShowMsg("无法连接,请检查您的网络", () => { Leave(); }, () => { Leave(); }); }
void OnLoginError(string str, System.Object obj) { EventMgr.NetMsg netMsg = (EventMgr.NetMsg)obj; NetMessageHead head = netMsg.head; string msg = ""; if (head.bHandleCode == 0) { msg = "您的账号存在异常,请稍后再次登录,如仍然无效,请联系客服"; } if (head.bHandleCode == 3) { msg = "用户不存在或者密码错误"; } if (head.bHandleCode == 2) { //msg = "您是否在大厅游戏过程中更改了登录密码,请关闭大厅重新登录再进入游戏,如有疑问,请联系客服"; msg = "用户不存在或者密码错误"; } if (head.bHandleCode == 4) { msg = "您强退或频繁进出游戏房间,帐号被托管。您可以稍后返回游戏或再进入其他游戏房间!如仍然无效,请联系本站客服!"; } if (head.bHandleCode == 5) { msg = "登录IP禁止"; } if (head.bHandleCode == 6) { msg = "不是指定地址"; } if (head.bHandleCode == 7) { msg = "会员游戏房间"; } if (head.bHandleCode == 9) { msg = "此账号正在使用中"; } if (head.bHandleCode == 13) { msg = "暂停登录服务器"; } if (head.bHandleCode == 160) { msg = "比赛游戏房间"; } if (head.bHandleCode == 161) { msg = "时间到期"; } UI_Alert.ShowMsg(msg, () => { Leave(); }, () => { Leave(); }); }
void OnSitError(string str, System.Object obj) { EventMgr.NetMsg netMsg = (EventMgr.NetMsg)obj; NetMessageHead head = netMsg.head; string msg = "抱歉,服务器网络繁忙,请重新进入游戏房间后选择游戏桌位置!"; if (head.bHandleCode == 51) { msg = "坐下此位置失败,游戏已经开始了!"; } if (head.bHandleCode == 52) { msg = "坐下此位置失败,下次动作快一点喔!"; } if (head.bHandleCode == 53) { msg = "游戏桌密码错误,请在游戏设置中重新设置您的携带密码!"; } if (head.bHandleCode == 54) { msg = "同桌玩家不允许有相同IP地址的玩家一起进行游戏!"; } if (head.bHandleCode == 55) { msg = "同桌的玩家认为您的逃跑率太高,不愿意和您游戏!"; } if (head.bHandleCode == 56) { msg = "同桌的玩家认为您的积分太低,不愿意和您游戏!"; } if (head.bHandleCode == 57) { msg = "同桌的玩家认为您的积分太高,不愿意和您游戏!"; } if (head.bHandleCode == 58) { msg = "此桌有您不欢迎的玩家!"; } if (head.bHandleCode == 59) { msg = "此游戏桌需要至少%ld 的游戏积分,您的积分不够,不能游戏!"; } if (head.bHandleCode == 60) { if (waitOut) { UI_Alert.ShowMsg("您现在退出将会被系统托管您的游戏,是否真的要退出?", () => { Leave(); }); } else { mainUI.SetNotice("您正在游戏中..."); } return; } if (head.bHandleCode == 61) { msg = "您不能加入此游戏桌游戏!"; } if (head.bHandleCode == 62) { msg = "您的比赛已经结束了,不能继续参加比赛!"; } UI_Alert.ShowMsg(msg, () => { Leave(); }, () => { Leave(); }); }