private void RspLogin(object sender, GameEventArgs e) { OnReceiveSCPacketBaseEventArgs ne = e as OnReceiveSCPacketBaseEventArgs; if (ne.msgID != CMD.RspLogin) { return; } RspLogin rspLogin = (RspLogin)ne.scPacketBase; if (rspLogin.PlayerData == null) { Debug.LogError("kongxiaoxi"); return; } PECommon.SetPlayerData(rspLogin); if (rspLogin.PlayerData.Name == "") { GameEntry.UI.OpenUIForm(UIFormId.CreateForm); } else { m_GetPlayerSuccess = true; } }
private void PshPower(object sender, GameEventArgs e) { OnReceiveSCPacketBaseEventArgs ne = e as OnReceiveSCPacketBaseEventArgs; if (ne.msgID != CMD.PshPower) { return; } PshPower data = ne.scPacketBase as PshPower; PECommon.SetPlayerDataByPower(data); UGuiForm mainCityForm = GameEntry.UI.GetUIForm(UIFormId.MainCityForm); if (!mainCityForm) { return; } if (mainCityForm.Visible) { OnRefreshUIFormEventArgs eventArgs = ReferencePool.Acquire <OnRefreshUIFormEventArgs>(); eventArgs.Fill(UIFormId.MainCityForm); GameEntry.Event.FireNow(this, eventArgs); } }
public void ProcessMsg(SCPacketBase msg) { m_LastPongTime = GameEntry.Timer.GetTimeStamp(); Debug.Log("receive from server:" + (CMD)msg.Id); if (msg.error != (int)ErrorCode.None) { switch ((ErrorCode)msg.error) { case ErrorCode.ServerDataError: PECommon.Log("服务器数据异常", LogType.Error); GameEntry.UI.AddTips("客户端数据异常"); break; case ErrorCode.UpdateDBError: PECommon.Log("数据库更新异常", LogType.Error); GameEntry.UI.AddTips("网络不稳定"); break; case ErrorCode.ClientDataError: PECommon.Log("客户端数据异常", LogType.Error); break; case ErrorCode.AcctIsOnline: GameEntry.UI.AddTips("当前账号已经上线"); break; case ErrorCode.WrongPass: GameEntry.UI.AddTips("密码错误"); break; case ErrorCode.LackLevel: GameEntry.UI.AddTips("角色等级不够"); break; case ErrorCode.LackCoin: GameEntry.UI.AddTips("金币数量不够"); break; case ErrorCode.LackCrystal: GameEntry.UI.AddTips("水晶数量不够"); break; case ErrorCode.LackDiamond: GameEntry.UI.AddTips("钻石数量不够"); break; case ErrorCode.LackPower: GameEntry.UI.AddTips("体力值不足"); break; } return; } OnReceiveSCPacketBaseEventArgs eventArgs = ReferencePool.Acquire <OnReceiveSCPacketBaseEventArgs>(); eventArgs.Fill((CMD)msg.Id, msg); GameEntry.Event.FireNow(this, eventArgs); }
private void PshChat(object sender, GameEventArgs e) { OnReceiveSCPacketBaseEventArgs ne = e as OnReceiveSCPacketBaseEventArgs; if (ne.msgID != CMD.PshChat) { return; } PshChat pshChat = (PshChat)ne.scPacketBase; RefreshChatUIEventArgs eventArgs = ReferencePool.Acquire <RefreshChatUIEventArgs>(); eventArgs.Fill(pshChat.Name, pshChat.Chat); GameEntry.Event.Fire(this, eventArgs); }
public void PshTaskPrgs(object sender, GameEventArgs e) { OnReceiveSCPacketBaseEventArgs ne = e as OnReceiveSCPacketBaseEventArgs; if (ne.msgID != CMD.PshTaskPrgs) { return; } PshTaskPrgs data = (PshTaskPrgs)ne.scPacketBase; PECommon.SetPlayerDataByTaskPsh(data); OnRefreshUIFormEventArgs eventArgs = ReferencePool.Acquire <OnRefreshUIFormEventArgs>(); eventArgs.Fill(UIFormId.TaskForm); GameEntry.Event.FireNow(this, eventArgs); }
private void RspGuide(object sender, GameEventArgs e) { OnReceiveSCPacketBaseEventArgs ne = e as OnReceiveSCPacketBaseEventArgs; if (ne.msgID != CMD.RspGuide) { return; } RspGuide data = (RspGuide)ne.scPacketBase; GameEntry.UI.AddTips(Constants.Color("任务奖励 金币+" + m_CurtTaskData.coin + " 经验+" + m_CurtTaskData.exp, TxtColor.Blue)); switch (m_CurtTaskData.actID) { case 0: //与智者对话 break; case 1: EnterFuben(); break; case 2: //进入强化界面 OpenStrongWnd(); break; case 3: //进入体力购买 OpenBuyWnd(0); break; case 4: //进入金币铸造 OpenBuyWnd(1); break; case 5: //进入世界聊天 OpenChatWnd(); break; } PECommon.SetPlayerDataByGuide(data); OnRefreshUIFormEventArgs eventArgs = ReferencePool.Acquire <OnRefreshUIFormEventArgs>(); eventArgs.Fill(UIFormId.MainCityForm); GameEntry.Event.Fire(this, eventArgs); }
private void RspRename(object sender, GameEventArgs e) { OnReceiveSCPacketBaseEventArgs ne = e as OnReceiveSCPacketBaseEventArgs; if (ne.msgID != CMD.RspRename) { return; } RspRename rspRename = (RspRename)ne.scPacketBase; PECommon.SetPlayerName(rspRename.Name); //跳转场景进入主城 m_procedureOwner.SetData <VarInt>(Constant.ProcedureData.NextSceneId, (int)SceneId.SceneMainCity); ChangeState <ProcedureChangeScene>(m_procedureOwner); //关闭创建界面 GameEntry.UI.CloseUIForm(UIFormId.CreateForm); }
private void RspFBFightEnd(object sender, GameEventArgs e) { OnReceiveSCPacketBaseEventArgs ne = e as OnReceiveSCPacketBaseEventArgs; if (ne.msgID != CMD.RspFBFightEnd) { return; } RspFBFightEnd data = (RspFBFightEnd)ne.scPacketBase; PECommon.SetPlayerDataByFBEnd(data); m_BattleEndFormData.Fbid = data.Fbid; m_BattleEndFormData.CostTime = data.Costtime; m_BattleEndFormData.RestHp = data.Resthp; SetBattleEndWndState(FBEndType.Win); }
private void RspBuy(object sender, GameEventArgs e) { OnReceiveSCPacketBaseEventArgs ne = e as OnReceiveSCPacketBaseEventArgs; if (ne.msgID != CMD.RspBuy) { return; } RspBuy rspBuy = (RspBuy)ne.scPacketBase; PECommon.SetPlayerDataByBuy(rspBuy); GameEntry.UI.AddTips("购买成功"); OnRefreshUIFormEventArgs eventArgs = ReferencePool.Acquire <OnRefreshUIFormEventArgs>(); eventArgs.Fill(UIFormId.MainCityForm); GameEntry.Event.Fire(this, eventArgs); GameEntry.UI.CloseUIForm(UIFormId.BuyForm); }
private void RspStrong(object sender, GameEventArgs e) { OnReceiveSCPacketBaseEventArgs ne = e as OnReceiveSCPacketBaseEventArgs; if (ne.msgID != CMD.RspStrong) { return; } int zhanliPre = PECommon.GetFightByProps(PECommon.PlayerData); PECommon.SetPlayerDataByStrong((RspStrong)ne.scPacketBase); int zhanliNow = PECommon.GetFightByProps(PECommon.PlayerData); GameEntry.UI.AddTips(Constants.Color("战力提升 " + (zhanliNow - zhanliPre), TxtColor.Blue)); OnRefreshUIFormEventArgs eventArgs = ReferencePool.Acquire <OnRefreshUIFormEventArgs>(); eventArgs.Fill(UIFormId.StrongForm); GameEntry.Event.FireNow(this, eventArgs); eventArgs.Fill(UIFormId.MainCityForm); GameEntry.Event.FireNow(this, eventArgs); }
private void RspFBFight(object sender, GameEventArgs e) { OnReceiveSCPacketBaseEventArgs ne = e as OnReceiveSCPacketBaseEventArgs; if (ne.msgID != CMD.RspFBFight) { return; } RspFBFight rspFBFight = (RspFBFight)ne.scPacketBase; PECommon.SetPlayerDataByFBStart(rspFBFight); GameEntry.UI.CloseUIForm(UIFormId.FubenForm); if (PECommon.InSecene(SceneId.SceneMainCity)) { m_ProcedureOwner.SetData <VarInt>(Constant.ProcedureData.NextSceneId, (int)SceneId.SceneOrge); m_ProcedureOwner.SetData <VarInt>(Constant.ProcedureData.FubenId, rspFBFight.Fbid); ChangeState <ProcedureChangeScene>(m_ProcedureOwner); } else { ChangeState <ProcedureBattle>(m_ProcedureOwner); } }
private void RspTakeTaskReward(object sender, GameEventArgs e) { OnReceiveSCPacketBaseEventArgs ne = e as OnReceiveSCPacketBaseEventArgs; if (ne == null) { return; } if (ne.msgID != CMD.RspTakeTaskReward) { return; } RspTakeTaskReward data = (RspTakeTaskReward)ne.scPacketBase; PECommon.SetPlayerDataByTask(data); OnRefreshUIFormEventArgs eventArgs = ReferencePool.Acquire <OnRefreshUIFormEventArgs>(); eventArgs.Fill(UIFormId.TaskForm); GameEntry.Event.FireNow(this, eventArgs); eventArgs.Fill(UIFormId.MainCityForm); GameEntry.Event.FireNow(this, eventArgs); }