public void Excute(GameCmd.stMainUserRelivePropertyUserCmd_S cmd) { // GameCmd.stReliveColdMagicUserCmd Engine.Utility.Log.Info("复活玩家 id: " + cmd.dwUserTempID); IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return; } IPlayer player = es.FindPlayer(cmd.dwUserTempID); if (player == null) { return; } // MapVector2 mapPos = MapVector2.FromCoordinate(cmd.x, cmd.y); Vector3 pos = new Vector3(cmd.x, 0, -cmd.y); // 服务器到客户端坐标转换 player.SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos); player.ChangeState(CreatureState.Normal); stEntityRelive stRelive = new stEntityRelive(); stRelive.uid = player.GetUID(); Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_RELIVE, stRelive); }
void DoGameEvent(int eventID, object param) { if (eventID == (int)GameEventID.ENTITYSYSTEM_RELIVE) { stEntityRelive stRelive = (stEntityRelive)param; if (ClientGlobal.Instance().IsMainPlayer(stRelive.uid)) { PanelID panelId = UIFrameManager.Instance.CurrShowPanelID; DataManager.Manager <UIPanelManager>().HidePanel(PanelID.ReLivePanel); } } else if (eventID == (int)GameEventID.SKILL_RELIVE) { stSkillRelive skillRe = (stSkillRelive)param; if (!ClientGlobal.Instance().IsMainPlayer(skillRe.id)) { return; } //武斗场不使用技能复活 if (DataManager.Manager <ArenaManager>().EnterArena) { return; } DataManager.Manager <UIPanelManager>().HidePanel(PanelID.ReLivePanel); //如果人是活的 if (false == Client.ClientGlobal.Instance().MainPlayer.IsDead()) { return; } uint time = GameTableManager.Instance.GetGlobalConfig <uint>("ReliveCountdown"); TipsManager.Instance.ShowTipWindow(0, time, TipWindowType.CancelOk, "是否复活", () => { GameCmd.stOKReliveUserCmd_C cmd = new GameCmd.stOKReliveUserCmd_C(); cmd.byType = (uint)GameCmd.ReliveType.ReliveType_Skill; cmd.dwUserTempID = ClientGlobal.Instance().MainPlayer.GetID(); cmd.dwNpcID = 0; NetService.Instance.Send(cmd); }, () => { GameCmd.stOKReliveUserCmd_C cmd = new GameCmd.stOKReliveUserCmd_C(); cmd.byType = (uint)GameCmd.ReliveType.ReliveType_Home; cmd.dwUserTempID = ClientGlobal.Instance().MainPlayer.GetID(); cmd.dwNpcID = 0; NetService.Instance.Send(cmd); }); } else if (eventID == (int)GameEventID.RECONNECT_SUCESS) { stReconnectSucess reconnectSucess = (stReconnectSucess)param; if (reconnectSucess.isLogin) { MainPlayerRelive(); } } else if (eventID == (int)GameEventID.ENTITYSYSTEM_ENTITYDEAD) { stEntityDead ed = (stEntityDead)param; if (ClientGlobal.Instance().IsMainPlayer(ed.uid)) { this.m_deadTime = Time.realtimeSinceStartup; } } }
private void OnEvent(int nEventID, object param) { // 地表没有创建成功的时候,就已经收到了角色和NPC的创建 这里重新设置位置和地表做碰撞 if (nEventID == (int)GameEventID.SYSTEM_LOADSCENECOMPELETE) { //List<IPlayer> lstPlayer; FindAllEntity <IPlayer>(ref lstPlayer); for (int i = 0; i < lstPlayer.Count; ++i) { Vector3 pos = lstPlayer[i].GetPos(); lstPlayer[i].SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos); } lstPlayer.Clear(); //List<INPC> lstNPC; FindAllEntity <INPC>(ref lstNPC); for (int i = 0; i < lstNPC.Count; ++i) { Vector3 pos = lstNPC[i].GetPos(); lstNPC[i].SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos); } lstNPC.Clear(); //List<IBox> lstBox; FindAllEntity <IBox>(ref lstBox); for (int i = 0; i < lstBox.Count; ++i) { Vector3 pos = lstBox[i].GetPos(); pos.y += 0.2f; lstBox[i].SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos); } lstBox.Clear(); //List<IRobot> lstRobot; FindAllEntity <IRobot>(ref lstRobot); for (int i = 0; i < lstRobot.Count; ++i) { Vector3 pos = lstRobot[i].GetPos(); lstRobot[i].SendMessage(EntityMessage.EntityCommand_SetPos, (object)pos); } lstRobot.Clear(); // 请求同步移动时间 ReqMoveServerTime(); } else if (nEventID == (int)GameEventID.RECONNECT_SUCESS) // 重新连接成功 { stReconnectSucess st = (stReconnectSucess)param; if (st.isLogin) { Clear(false); // 不清理除主角 // 请求同步移动时间 ReqMoveServerTime(); } else {//强制同步 GameCmd.stUserMoveMoveUserCmd_C cmd = new GameCmd.stUserMoveMoveUserCmd_C(); cmd.client_time = 0; List <GameCmd.Pos> list = new List <GameCmd.Pos>(); GameCmd.Pos pp = new GameCmd.Pos(); pp.x = 0; pp.y = 0; list.Add(pp); cmd.poslist.AddRange(list); m_ClientGlobal.netService.Send(cmd); } } else if (nEventID == (int)GameEventID.NETWORK_CONNECTE_CLOSE)// 网络断开 { if (m_ClientGlobal.MainPlayer != null) { m_ClientGlobal.MainPlayer.SendMessage(EntityMessage.EntityCommand_RemoveLinkAllEffect); } } else if (nEventID == (int)GameEventID.ENTITYSYSTEM_ENTITYDEAD) // 实体死亡 { stEntityDead ed = (stEntityDead)param; if (m_ClientGlobal.IsMainPlayer(ed.uid)) { Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem(); if (rs != null) { rs.EnableGray(true); } } IEntity en = FindEntity(ed.uid); if (en != null) { AddEffectOnEntity(en, false); } } else if (nEventID == (int)GameEventID.ENTITYSYSTEM_RELIVE) { stEntityRelive ed = (stEntityRelive)param; if (m_ClientGlobal.IsMainPlayer(ed.uid)) { Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem(); if (rs != null) { rs.EnableGray(false); } } IEntity en = FindEntity(ed.uid); if (en != null) { AddEffectOnEntity(en, true); } } else if (nEventID == (int)GameEventID.PLAYER_LOGIN_SUCCESS) { Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem(); if (rs != null) { rs.EnableGray(false); } // 请求同步移动时间 ReqMoveServerTime(); } else if (nEventID == (int)GameEventID.ENTITYSYSTEM_LEAVEMAP) // 离开地图 { // 清理地图上所有对象 Clear(false); // 切地图时让主角停止移动 IPlayer mainPlayer = EntitySystem.m_ClientGlobal.MainPlayer; if (mainPlayer != null) { bool ismoving = (bool)mainPlayer.SendMessage(Client.EntityMessage.EntityCommand_IsMove, null); if (ismoving) { mainPlayer.SendMessage(Client.EntityMessage.EntityCommand_StopMove, mainPlayer.GetPos()); } } } else if (nEventID == (int)GameEventID.ENTITYSYSTEM_CHANGEAREA) // 区域变化 动作处理 { stEntityChangeArea changeArea = (stEntityChangeArea)param; IEntity en = FindEntity(changeArea.uid); if (en != null && en.GetEntityType() == EntityType.EntityType_Player) { string strCurAni = (string)en.SendMessage(EntityMessage.EntityCommand_GetCurAni, null); bool bChangeArea = false; if (changeArea.eType == MapAreaType.Safe || changeArea.eType == MapAreaType.Fish) { if (strCurAni == EntityAction.Stand_Combat) { strCurAni = EntityAction.Stand; bChangeArea = true; } if (strCurAni == EntityAction.Run_Combat) { strCurAni = EntityAction.Run; bChangeArea = true; } } else { if (strCurAni == EntityAction.Stand) { strCurAni = EntityAction.Stand_Combat; bChangeArea = true; } if (strCurAni == EntityAction.Run) { strCurAni = EntityAction.Run_Combat; bChangeArea = true; } } if (bChangeArea) { PlayAni anim_param = new PlayAni(); anim_param.strAcionName = strCurAni; anim_param.fSpeed = 1; anim_param.nStartFrame = 0; anim_param.nLoop = -1; anim_param.fBlendTime = 0.1f; en.SendMessage(EntityMessage.EntityCommand_PlayAni, anim_param); } } } else if (nEventID == (int)GameEventID.ENTITYSYSTEM_CREATEENTITY) { stCreateEntity create = (stCreateEntity)param; IEntity en = FindEntity(create.uid); if (en != null) { EntityManager.Instance().OnCreateEntity(en); } } }
private void OnEvent(int nEventID, object param) { GameEventID eventId = (GameEventID)nEventID; switch (eventId) { case GameEventID.ENTITYSYSTEM_MAINPLAYERCREATE: { SetTimer(MEDICAL_TIMEID, MEDICAL_TIME_INTERVAL); SetTimer(ATONCE_TIMERID, ATONCE_LEN); } break; case GameEventID.ENTITYSYSTEM_RELIVE: { stEntityRelive er = (stEntityRelive)param; if (ControllerSystem.m_ClientGlobal.IsMainPlayer(er.uid)) { SetTimer(MEDICAL_TIMEID, MEDICAL_TIME_INTERVAL); SetTimer(ATONCE_TIMERID, ATONCE_LEN); } } break; case GameEventID.ENTITYSYSTEM_ENTITYDEAD: { stEntityDead ed = (stEntityDead)param; if (ControllerSystem.m_ClientGlobal.IsMainPlayer(ed.uid)) { KillTimer(MEDICAL_TIMEID); KillTimer(ATONCE_TIMERID); } } break; case GameEventID.SKILLSYSTEM_SKILLLISTCHANE: case GameEventID.SKILLSYSTEM_ADDSKILL: InitSkill(); break; case GameEventID.SKILLNONESTATE_ENTER: { NextSkill = 0; OnCombat(); } break; //case GameEventID.ROBOTCOMBAT_NEXTCMD: // { // if (param != null) // { // Client.stSkillDoubleHit skillDhHit = (Client.stSkillDoubleHit)param; // OnUseDoubleHitSkill(skillDhHit); // } // } // break; case GameEventID.SKILLSYSTEM_STIFFTIMEOVER: { //挂机状态下 硬直结束(并且没有插入技能)只处理普攻前两招,第三招释放时如果有插入 就不播放收招 stNextSkill st = (stNextSkill)param; NextSkill = st.nextSkillID; if (m_status == CombatRobotStatus.RUNNING && NextSkill != 0) { DoAttack(); } if (m_status == CombatRobotStatus.RUNNING && NextSkill == 0 && InsertSkillID != 0) { DoAttack(); } } break; case GameEventID.SKILLGUIDE_PROGRESSBREAK: { if (param != null) { stGuildBreak skillFailed = (stGuildBreak)param; if (skillFailed.action == GameCmd.UninterruptActionType.UninterruptActionType_SkillCJ) { if (ControllerSystem.m_ClientGlobal.IsMainPlayer(skillFailed.uid)) { m_nIgnoreSkillid = skillFailed.skillid; // AddTips(string.Format("使用技能失败id:{0} ret{1}", skillFailed.skillid, skillFailed.msg)); } ChangeRoleAction(RoleAction.NONE); } } //ChangeRoleAction(RoleAction.USESKILL); //DoNextCMD(); } break; case GameEventID.JOYSTICK_UNPRESS: m_fStopTime = UnityEngine.Time.realtimeSinceStartup; break; case GameEventID.JOYSTICK_PRESS: m_fStopTime = 0; OnPause(true); break; case GameEventID.ENTITYSYSTEM_CREATEENTITY: { Client.stCreateEntity createEntity = (Client.stCreateEntity)param; Client.IEntitySystem es = ControllerSystem.m_ClientGlobal.GetEntitySystem(); Client.IEntity entity = es.FindEntity(createEntity.uid); if (entity != null) { if (entity.GetEntityType() == EntityType.EntityType_Box) { ShowBoxTips(entity.GetID()); OnPickUpItem(); } } } break; case GameEventID.ENTITYSYSTEM_REMOVEENTITY: { Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param; Client.IEntitySystem es = ControllerSystem.m_ClientGlobal.GetEntitySystem(); Client.IEntity entity = es.FindEntity(removeEntiy.uid); if (entity != null) { if (entity.GetEntityType() == EntityType.EntityType_Box) { OnPickUpItem(); } } } break; case GameEventID.ROBOTCOMBAT_COPYKILLWAVE: { if (param != null) { stCopySkillWave copyWave = (stCopySkillWave)param; if (m_bInCopy) { m_nLaskKillWave = copyWave.waveId; m_nLaskMovePosIndex = copyWave.posIndex; // AddTips(string.Format("副本wave{0} posIndex{1}", m_nLaskKillWave, m_nLaskMovePosIndex)); if (m_nLaskMovePosIndex != 0) { // SetTimer(COPYCOMBAT_TIMEID, 1600); //OnPause(false); } //DoNextCMD(); } } } break; case GameEventID.NETWORK_CONNECTE_CLOSE: { m_disconnectStatus = m_status; if (m_disconnectStatus != CombatRobotStatus.STOP) { Stop(); Engine.Utility.Log.Error("掉线了 挂机停止!!!"); } } break; case GameEventID.RECONNECT_SUCESS: { if (m_disconnectStatus != CombatRobotStatus.STOP) { Start(); if (m_disconnectStatus == CombatRobotStatus.PAUSE) { Pause(); } m_disconnectStatus = CombatRobotStatus.STOP; } } break; default: break; } }
void OnEvent(int eventID, object param) { switch ((Client.GameEventID)eventID) { case GameEventID.ENTITYSYSTEM_TARGETCHANGE: { OnTargetChange(param); } break; case GameEventID.SKILLSYSYTEM_TAB: { if (m_effctSelect != null) { Engine.RareEngine.Instance().GetRenderSystem().RemoveEffect(m_effctSelect); m_effctSelect = null; } string strSelectEffct = "effect/UI/[email protected]"; strSelectEffct = strSelectEffct.ToLower(); Engine.RareEngine.Instance().GetRenderSystem().CreateEffect(ref strSelectEffct, ref m_effctSelect, null); InitEffct(m_effctSelect); SetSelectTargetEffectPos(); } break; case GameEventID.SKILLSYSTEM_SHOWDAMAGE: { Client.IEntity entity = ClientGlobal.Instance().GetControllerSystem().GetActiveCtrl().GetCurTarget(); if (entity != null) { } } break; case GameEventID.ENTITYSYSTEM_HPUPDATE: { UpdateProprty(param); } break; case GameEventID.ENTITYSYSTEM_MPUPDATE: { UpdateProprty(param); } break; case GameEventID.ENTITYSYSTEM_PROPUPDATE: { UpdateProprty(param); } break; case GameEventID.PLAYER_FIGHTPOWER_REFRESH: { RefreshFightPower(param); } break; case GameEventID.SKILL_SHOWPETSKILL: { stShowPetSkill st = (stShowPetSkill)param; m_bShowPetQuick = st.bShow; // ShowPetQuickInfo(st.bShow); } break; case Client.GameEventID.CAMP_ADDCOLLECTNPC: { UpdateFBPickBtn(param); } break; case Client.GameEventID.ROBOTCOMBAT_STOP: { if (m_spriteEx_btnAutoFight != null) { m_spriteEx_btnAutoFight.ChangeSprite(1); } } break; case Client.GameEventID.ROBOTCOMBAT_START: { if (m_spriteEx_btnAutoFight != null) { m_spriteEx_btnAutoFight.ChangeSprite(2); } } break; case GameEventID.MAINPANEL_SHOWREDWARING: { stShowMainPanelRedPoint st = (stShowMainPanelRedPoint)param; WarningDirection direction = (WarningDirection)st.direction; WarningEnum model = (WarningEnum)st.modelID; bool bShow = (bool)st.bShowRed; GameObject redPointObj = null; switch ((WarningEnum)st.modelID) { case WarningEnum.LearnSkill: redPointObj = m_sprite_learnskill_warning.gameObject; break; case WarningEnum.SEVENDAY: redPointObj = m_sprite_seven_warning.gameObject; break; case WarningEnum.WELFARE: redPointObj = m_sprite_welfare_warning.gameObject; break; case WarningEnum.TITLE_NEWTITLE: redPointObj = m_sprite_prop_warning.gameObject; break; case WarningEnum.Question: redPointObj = m_sprite_question_warning.gameObject; break; case WarningEnum.Mail: redPointObj = m_sprite_friend_warning.gameObject; break; case WarningEnum.Noble: redPointObj = m_sprite_mall_warning.gameObject; m_sprite_Noble_warning.gameObject.SetActive(bShow); break; case WarningEnum.Clan: redPointObj = m_sprite_clan_warning.gameObject; break; case WarningEnum.Achievement: redPointObj = m_sprite_achievement_warning.gameObject; break; case WarningEnum.Daily: redPointObj = m_sprite_daily_warning.gameObject; break; case WarningEnum.GodWeapen: redPointObj = m_sprite_godweapen_warning.gameObject; break; case WarningEnum.OpenServer: redPointObj = m_sprite_openserver_warning.gameObject; break; case WarningEnum.FirstRechargeReward: redPointObj = m_sprite_FirstRecharge_warning.gameObject; break; case WarningEnum.Activity: redPointObj = m_sprite_activity_warning.gameObject; break; case WarningEnum.Forging: redPointObj = m_sprite_forging_warning.gameObject; break; case WarningEnum.Accumulative: redPointObj = m_sprite_Accumulative_warning.gameObject; break; case WarningEnum.Ride: redPointObj = m_sprite_ride_warning.gameObject; break; case WarningEnum.HttpDown: redPointObj = m_sprite_HttpDown_warning.gameObject; break; } if (redPointObj != null) { redPointObj.SetActive(bShow); } if (direction == WarningDirection.None) { //不涉及到三角标和头像红点提示的系统return; return; } if (!m_lstWarnningSystem.ContainsKey(direction)) { m_lstWarnningSystem.Add(direction, new List <WarningEnum>()); } if (bShow) { if (!m_lstWarnningSystem[direction].Contains(model)) { m_lstWarnningSystem[direction].Add(model); } } else { if (m_lstWarnningSystem[direction].Contains(model)) { m_lstWarnningSystem[direction].Remove(model); } } if (direction == WarningDirection.Right) { bool showRed = m_lstWarnningSystem[direction].Count > 0; m_sprite_leftbtn_warning.gameObject.SetActive(showRed); } else if (direction == WarningDirection.Left) { m_sprite_face_warning.gameObject.SetActive(m_lstWarnningSystem[direction].Count > 0); } } break; //摇杆 case GameEventID.ENTITYSYSTEM_LEAVEMAP: { ResetJoystick(); //小地图 ReleaseTexture(); } break; case GameEventID.SKLL_LONGPRESS: { stSkillLongPress press = (stSkillLongPress)param; //if (press.userID == MainPlayerHelper.GetPlayerUID()) { m_bSkillLongPress = press.bLongPress; } } break; case GameEventID.ENTITYSYSTEM_RELIVE: { stEntityRelive ed = (stEntityRelive)param; if (ed.uid == MainPlayerHelper.GetPlayerUID()) { ResetJoystick(); //清采集按钮 if (DataManager.Manager <ComBatCopyDataManager>().EnterCopyID != 0) { stCampCollectNpc npc = new stCampCollectNpc { enter = false, npcid = 0 }; UpdateFBPickBtn(npc); } } } break; case GameEventID.ENTITYSYSTEM_NEWNAME: { Client.stNewName name = (Client.stNewName)param; UserData.CurrentRole.name = name.newName; m_label_mainroleName.text = name.newName; } break; case GameEventID.EJOYSTICKSTABLE: { if (param != null) { m_bJoystickStable = (bool)param; } SetMainCollider(); } break; case GameEventID.REFRESHTRANSMITPUSHMSGSTATUS: { RefreshBtns(); } break; case GameEventID.SYSTEM_GAME_READY: { ControlMainBtnParticle(m_sprite_FanLi_warning.parent.transform, true); //ControlMainBtnParticle(m_sprite_FirstRecharge_warning.parent.transform, true); //ControlMainBtnParticle(m_sprite_activity_warning.parent.transform, true); //ControlMainBtnParticle(m_sprite_Noble_warning.parent.transform, true); //ControlMainBtnParticle(m_sprite_Accumulative_warning.parent.transform, true); } break; default: break; } }