void SkillEvent(int eventID, object param) { if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSSTART) { Client.stUninterruptMagic evenparam = (Client.stUninterruptMagic)param; if (ClientGlobal.Instance().IsMainPlayer(evenparam.uid)) { if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.SliderPanel) == false) { DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.SliderPanel, panelShowAction: (panel) => { DispatchValueUpdateEvent(new ValueUpdateEventArgs() { key = SliderDataEnum.Begin.ToString() }); }); } float dur = (float)(evenparam.time * 1f / 1000); if (dur > 0) { DataManager.Manager <SliderDataManager>().StartSliderByEvent(dur, evenparam.type); } else { Log.Error("进度条时间小于 0"); } } if (evenparam.type == GameCmd.UninterruptActionType.UninterruptActionType_CJ || evenparam.type == GameCmd.UninterruptActionType.UninterruptActionType_CampCJ || evenparam.type == GameCmd.UninterruptActionType.UninterruptActionType_SYDJ) { Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } Client.IEntity player = es.FindEntity(evenparam.uid); if (player == null) { return; } bool moving = (bool)player.SendMessage(Client.EntityMessage.EntityCommand_IsMove, null); if (moving) { player.SendMessage(EntityMessage.EntityCommand_StopMove); } Client.INPC npc = es.FindNPC(evenparam.npcId); if (npc != null) { player.SendMessage(EntityMessage.EntityCommand_LookTarget, npc.GetPos()); } PlayAni(player, EntityAction.Collect); } else if (evenparam.type == GameCmd.UninterruptActionType.UninterruptActionType_CangBaoTuCJ) { //采集 Log.Info("开始挖宝..."); Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } Client.IEntity player = es.FindEntity(evenparam.uid); if (player == null) { return; } bool moving = (bool)player.SendMessage(Client.EntityMessage.EntityCommand_IsMove, null); if (moving) { player.SendMessage(EntityMessage.EntityCommand_StopMove); } Client.INPC npc = es.FindNPC(evenparam.npcId); if (npc != null) { player.SendMessage(EntityMessage.EntityCommand_LookTarget, npc.GetPos()); } // PlayAni(player, EntityAction.Collect); //播放挖宝动作 PlayAni(player, EntityAction.Mining); //更换武器模型 DataManager.Manager <SuitDataManager>().OnMiningTreasureMapToChangeWeapon(player); } } else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSBREAK) { if (param != null) { stGuildBreak guildBreak = (stGuildBreak)param; if (ClientGlobal.Instance().IsMainPlayer(guildBreak.uid)) { DataManager.Manager <SliderDataManager>().HideSlider(guildBreak.action); DataManager.Manager <SliderDataManager>().IsBreak = true; DataManager.Manager <SliderDataManager>().IsReadingSlider = false; //DataManager.Manager<TaskDataManager>().IsShowSlider = false; } if (guildBreak.action == GameCmd.UninterruptActionType.UninterruptActionType_CJ || guildBreak.action == GameCmd.UninterruptActionType.UninterruptActionType_CampCJ) { //打断采集 Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } Client.IEntity entity = es.FindPlayer(guildBreak.uid); if (entity != null) { bool moving = (bool)entity.SendMessage(EntityMessage.EntityCommand_IsMove, null); if (!moving) { PlayAni(guildBreak.uid, EntityAction.Stand); } } } } } else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSEND) { DataManager.Manager <SliderDataManager>().IsReadingSlider = false; //DataManager.Manager<TaskDataManager>().IsShowSlider = false; stGuildEnd guildEnd = (stGuildEnd)param; if (ClientGlobal.Instance().IsMainPlayer(guildEnd.uid)) { //坐骑读条完毕后上马 if (guildEnd.action == GameCmd.UninterruptActionType.UninterruptActionType_DEMON) { DataManager.Instance.Sender.RideUsingRide(); } else { if (guildEnd.action != GameCmd.UninterruptActionType.UninterruptActionType_SkillCJ) { PlayStand(); } } } else { //播站立动作 PlayAni(guildEnd.uid, EntityAction.Stand); } } else if (eventID == (int)GameEventID.ENTITYSYSTEM_ENTITYDEAD) { stEntityDead ed = (stEntityDead)param; if (ClientGlobal.Instance().IsMainPlayer(ed.uid)) { // HideSprite(); DispatchValueUpdateEvent(new ValueUpdateEventArgs() { key = SliderDataEnum.End.ToString(), oldValue = m_UninterruptActionType }); DataManager.Manager <SliderDataManager>().IsBreak = true; DataManager.Manager <SliderDataManager>().IsReadingSlider = false; } } }
/// <summary> /// 事件处理 /// </summary> /// <param name="nEventID"></param> /// <param name="param"></param> public void GlobalEventHandler(int eventID, object param) { if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_NPCHEADSTATUSCHANGED) { if (null != param && param is Client.INPC) { UpdateNpcHeadMask((Client.INPC)param); } } else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY) { Client.stCreateEntity ce = (Client.stCreateEntity)param; OnCretateEntity(ref ce); } else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_REMOVEENTITY) { Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param; RemoveBar(removeEntiy); } else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_PROPUPDATE) { stPropUpdate prop = (stPropUpdate)param; OnPropUpdate(ref prop); } else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_HPUPDATE) { stPropUpdate prop = (stPropUpdate)param; OnPropUpdate(ref prop); } else if (eventID == (int)Client.GameEventID.ENTITYSYSTEM_CHANGENAME) { stEntityChangename e = (stEntityChangename)param; OnChangeName(e.uid); } else if (eventID == (int)(int)Client.GameEventID.ENTITYSYSTEM_SETHIDE) { stEntityHide st = (stEntityHide)param; OnSetEntityHide(ref st); return; } else if (eventID == (int)(int)Client.GameEventID.TITLE_WEAR)//佩戴称号 { Client.stTitleWear data = (Client.stTitleWear)param; OnTitleWear(data.uid); } else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSSTART) { Client.stUninterruptMagic uninterrupt = (Client.stUninterruptMagic)param; OnStartCollectSlider(ref uninterrupt); } else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSBREAK) { if (param != null) { stGuildBreak guildbreak = (stGuildBreak)param; if (ShowCollectTip(guildbreak.action)) { long uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_Player, guildbreak.uid); RoleStateBar bar = GetRoleBarByUID(uid); if (bar != null) { bar.SetWidgetState(HeadTipType.Collect, false); } } } } else if (eventID == (int)GameEventID.SKILLGUIDE_PROGRESSEND) { if (param != null) { stGuildEnd guildEnd = (stGuildEnd)param; if (ShowCollectTip(guildEnd.action)) { long uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_Player, guildEnd.uid); RoleStateBar bar = GetRoleBarByUID(uid); if (bar != null) { bar.SetWidgetState(HeadTipType.Collect, false); } } } } else if (eventID == (int)Client.GameEventID.CLANQUIT || eventID == (int)Client.GameEventID.CLANJOIN || eventID == (int)Client.GameEventID.CLANREFRESHID || eventID == (int)Client.GameEventID.CITYWARWINERCLANID || eventID == (int)Client.GameEventID.CLANDeclareInfoAdd || eventID == (int)Client.GameEventID.CLANDeclareInfoRemove) { OnRefreshAllClanTitile(); } else if (eventID == (int)Client.GameEventID.CITYWARTOTEMCLANNAMECHANGE) { long uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_NPC, (uint)param); RoleStateBar bar = GetRoleBarByUID(uid); if (bar != null) { Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } RefreshClanName(es.FindEntity(uid), bar); } } else if (eventID == (int)Client.GameEventID.SYSTEM_GAME_READY) { OnRefreshAllHpSlider(); } }
void OnCombotEvent(int nEventId, object param) { if (nEventId == (int)Client.GameEventID.ROBOTCOMBAT_SEARCHPATH) { Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem(); if (cs.GetCombatRobot().Status != Client.CombatRobotStatus.STOP) { return; } if (param != null) { bool bsearch = (bool)param; if (DataManager.Manager <SliderDataManager>().IsReadingSlider == false) { ShowTipsUIByState(TipsUIState.Path, bsearch); } } } else if (nEventId == (int)Client.GameEventID.ROBOTCOMBAT_START) { //自动战斗特效 ShowTipsUIByState(TipsUIState.Robot, true); } else if (nEventId == (int)Client.GameEventID.ROBOTCOMBAT_STOP) { ShowTipsUIByState(TipsUIState.Robot, false); } else if (nEventId == (int)Client.GameEventID.ROBOTCOMBAT_VISITNPC) { Client.stVisitNpc visit = (Client.stVisitNpc)param; if (visit.state == false) { ShowTipsUIByState(TipsUIState.None); } } else if (nEventId == (int)GameEventID.SKILLGUIDE_PROGRESSSTART) { Client.stUninterruptMagic uninterrupt = (Client.stUninterruptMagic)param; if (Client.ClientGlobal.Instance().IsMainPlayer(uninterrupt.uid) == false)//非本人 { return; } if (ShowCollectTip(uninterrupt.type)) { if (uninterrupt.type == GameCmd.UninterruptActionType.UninterruptActionType_SYDJ) { ShowTipsUIByState(TipsUIState.UseItem, true); } else if (uninterrupt.type == GameCmd.UninterruptActionType.UninterruptActionType_CangBaoTuCJ) { ShowTipsUIByState(TipsUIState.WaBao, true); } else if (uninterrupt.type == GameCmd.UninterruptActionType.UninterruptActionType_GOHOME) { ShowTipsUIByState(TipsUIState.ChuanSong, true); } else { ShowTipsUIByState(TipsUIState.Collect, true); } } } else if (nEventId == (int)GameEventID.SKILLGUIDE_PROGRESSBREAK) { if (param != null) { stGuildBreak guildbreak = (stGuildBreak)param; if (ShowCollectTip(guildbreak.action)) { ShowTipsUIByState(TipsUIState.None); } } } else if (nEventId == (int)GameEventID.SKILLGUIDE_PROGRESSEND) { if (param != null) { stGuildEnd guildEnd = (stGuildEnd)param; if (ShowCollectTip(guildEnd.action)) { ShowTipsUIByState(TipsUIState.None); } } } }
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; } }