void OnPingRsp(CSMsgResult result, net.DGPKG msg) { if (result != CSMsgResult.NoError) { m_iPingSuccCnt = 0; m_iPingFailCnt++; return; } CS.PRsp rsp = (CS.PRsp)msg.body; if (rsp.result == 0) { m_iPingFailCnt = 0; m_iPingSuccCnt++; m_fLastPingSuccTime = UnityEngine.Time.time; m_uPingInterval = rsp.interval; } if (rsp.result != 0) { /* * //TODO show login * UI3System.destroyAllWindowsOnLoadScene(); * SceneManager.LoadScene("Entry"); * * UILogin login = UI3System.createWindow<UILogin>(); * login.show(); */ //login.bringTop(); m_bNeedPing = false; } }
void ReConnRsp(CSMsgResult result, DGPKG msg) { //role login 成功 if (result == CSMsgResult.NoError) { // 开启加密解密开关 LoginMgr.Instance.ToggleGameServerMsgFilter(true); ReconnectRsp rsp = msg.body as ReconnectRsp; if (rsp == null) { return; } Debuger.LogError("reconnec rsp : " + rsp.result); if (rsp.result == 0) { Network.Instance.ReSendBeforeReconNotSendMsg(); //重连成功 return; } else { Debug.LogWarning("ReConnRsp, rsp.result: " + rsp.result); } } //SceneSys.Instance.GotoLoginScene(); m_bNeedPing = false; }
private void OnNotifyGiftBagItem(CSMsgResult result, DGPKG msg) { if (result != CSMsgResult.NoError || msg == null) { return; } CS.NotifyGiftBagItem rsp = (CS.NotifyGiftBagItem)msg.body; //PlayerDataMgrSys.Instance.AddGiftBagItem(rsp.gift_bag_item); }
private void OnNotifyRetryRoleLogin(CSMsgResult result, DGPKG msg) { LoginMgr.Instance.m_bNeedRecon = false; Network.Instance.Reset(); // 先解除锁屏(如果有的话) //UI3System.unlockScreen(); //UISystemTip.ShowTip(903/*"已退出登录,点击重新登录"*/, OnNotifyRetryRoleLoginCallback); }
private void OnNotifyGmRsp(CSMsgResult result, DGPKG msg) { CS.GmRsp rsp = (CS.GmRsp)msg.body; if (result != CSMsgResult.NoError || msg == null) { return; } if (rsp.result == 0) { //GmMgr.Instance.DisplayMsg(rsp.msg); } }
private void OnMineStateInfoNotify(CSMsgResult result, DGPKG msg) { Debug.LogError("OnMineStateInfoNotify " + result); if (result == CSMsgResult.NoError && msg != null && msg.header.msg_full_name == typeof(CS.MineStateInfoNotify).FullName) { Debug.LogError("OnMineStateInfoNotify " + msg.header.msg_full_name); var Rsp = (CS.MineStateInfoNotify)msg.body; if (Rsp == null) { Debug.LogError("OnMineStateInfoNotify Rsp == null"); return; } // 发送充值成功消息 //#if !UNITY_IPHONE //LuaManager.Instance.SendMsg(LuaMessage.MineStateInfoNotify,Rsp); //#endif } }
/// <summary> /// 清理登陆状态,关闭Socket,对于之前没有处理的消息统一回调 /// </summary> /// <param name="result"></param> public void HandleNetworkError(CSMsgResult result, int errorCode = 0, bool showTips = true) { mShowErrTips = false; for (int i = 0; i < kCSMsgCallArrayLength; i++) { MsgInfo info = GetMsgInfo(i); if (info != null && info.Callback != null) { try { info.Callback(result, null); } catch (Exception) { } RemoveAlreadySentMsg(info); RemoveWaitSendMsg(info); info.Reset(); UnlockScreen(); } } string msgContent = string.Empty; switch (result) { case CSMsgResult.MsgTimeOut: msgContent = LoginMgr.Instance.SvrHost + "MsgTimeOut"; break; case CSMsgResult.NetworkError: { msgContent = LoginMgr.Instance.SvrHost + "NetworkErrorWithCode :" + errorCode; } break; case CSMsgResult.InternalError: msgContent = LoginMgr.Instance.SvrHost + "InternalError"; break; } Debug.LogError(msgContent); }
private void OnNotifyRechargeResult(CSMsgResult result, DGPKG msg) { Debug.LogError("OnNotifyRechargeResult " + result); if (result == CSMsgResult.NoError && msg != null && msg.header.msg_full_name == typeof(CS.NotifyRechargeResult).FullName) { Debug.LogError("OnNotifyRechargeResult " + msg.header.msg_full_name); var Rsp = (CS.NotifyRechargeResult)msg.body; if (Rsp == null) { Debug.LogError("OnNotifyRechargeResult Rsp == null"); return; } Debug.LogError("OnNotifyRechargeResult " + Rsp.result); if (Rsp.result != 0) { //UITextSys.Instance.ShowText(Rsp.result); return; } /* * int amount = (int)(Rsp.new_diamond_num) - (int)(PlayerDataMgrSys.Instance.Diamond); * Debug.LogError("Rechage Rsp.result == 0 here " + Rsp.new_diamond_num + " " + Rsp.new_vip_exp + " " + Rsp.new_vip_level + " " + amount); * if (amount < 0) * amount = 0; * Debug.LogError("Rechage Rsp.result == 0 here " + Rsp.new_diamond_num + " " + Rsp.new_vip_exp + " " + Rsp.new_vip_level + " " + amount); * DCCoin.gain("充值", DCCoinType.DIAMOND, Rsp.add_diamond_num, Rsp.new_diamond_num); * DCVirtualCurrency.paymentSuccess(Rsp.order_id,"",Rsp.recharge_money_num, "CNY", "支付宝"); * PlayerDataMgrSys.Instance.Diamond = Rsp.new_diamond_num; * PlayerDataMgrSys.Instance.VipExp = Rsp.new_vip_exp; * PlayerDataMgrSys.Instance.VipLevel = Rsp.new_vip_level; * */ // Debug.LogError("Rechage Rsp.result == 0 here " + PlayerDataMgrSys.Instance.Diamond + " " + PlayerDataMgrSys.Instance.VipExp + " " + PlayerDataMgrSys.Instance.VipLevel); // EventDispatcher eventDistpatcher = EventDispatcher.Instance; // if (eventDistpatcher != null) // { // Debug.LogError("if (eventDistpatcher != null)"); // eventDistpatcher.Dispatch(EnmEvn.EVN_PAY_SUCCESSFUL, null); // } // UIRechargeSuccess recharge = UI3System.createWindow<UIRechargeSuccess>(); // if (recharge != null) // { // Debug.LogError("recharge != null"); // recharge.SetValue((int)Rsp.add_diamond_num); // recharge.bringTop(); // recharge.showWithScale(); // UIVIP uivip = UI3System.findWindow<UIVIP>(); // if (uivip != null && uivip.gameObject.activeInHierarchy == true) // { // Debug.LogError("uivip != null && uivip.gameObject.activeInHierarchy == true"); // uivip.updateObj(); // } // } // // 发送充值成功消息 //#if !UNITY_IPHONE // LuaManager.Instance.SendMsg(LuaMessage.RechargeSucceed); //#endif //UISdkSys.Instance.OnPay(LoginMgr.Instance.Roleid + "",Rsp.order_id,(int)Rsp.recharge_money_num,"CNY"); } }