/// <summary> /// 事件处理 /// </summary> /// <param name="nEventID"></param> /// <param name="param"></param> public void GlobalEventHandler(int eventID, object param) { switch (eventID) { case (int)Client.GameEventID.ENTITYSYSTEM_CHANGE: { if (null != param && param is Client.stPlayerChange) { Client.stPlayerChange change = (Client.stPlayerChange)param; IEntity entity = RoleStateBarManager.GetEntityByUserID <IPlayer>(change.uid); if (null == entity) { entity = RoleStateBarManager.GetEntityByUserID <INPC>(change.uid); } if (null != entity) { LateUpdateChangePos(entity.GetUID()); } } } break; case (int)Client.GameEventID.ENTITYSYSTEM_UNRIDE: { if (null != param && param is stEntityUnRide) { stEntityUnRide unride = (stEntityUnRide)param; LateUpdateChangePos(unride.uid); } } break; case (int)Client.GameEventID.ENTITYSYSTEM_RIDE: { if (null != param && param is stEntityRide) { stEntityRide ride = (stEntityRide)param; LateUpdateChangePos(ride.uid); } } break; case (int)Client.GameEventID.ENTITYSYSTEM_ENTITYBEGINMOVE: { if (null != param && param is stEntityBeginMove) { stEntityBeginMove move = (stEntityBeginMove)param; OnEntityMoving(move.uid); } } break; case (int)Client.GameEventID.ENTITYSYSTEM_ENTITYMOVE: { if (null != param && param is stEntityMove) { stEntityMove move = (stEntityMove)param; OnEntityMoving(move.uid); } } break; case (int)Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE: { if (null != param && param is stEntityStopMove) { stEntityStopMove move = (stEntityStopMove)param; OnEntityMoving(move.uid); } } break; case (int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY: { //实体创建 Client.stCreateEntity ce = (Client.stCreateEntity)param; OnCretateEntity(ce); } break; case (int)Client.GameEventID.ENTITYSYSTEM_REMOVEENTITY: { //实体删除 Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param; RemoveRoleBar(removeEntiy.uid); } break; case (int)Client.GameEventID.ENTITYSYSTEM_PROPUPDATE: { //实体属性变更 stPropUpdate prop = (stPropUpdate)param; OnPropUpdate(ref prop); } break; case (int)Client.GameEventID.ENTITYSYSTEM_HPUPDATE: { //实体属性变更 stPropUpdate prop = (stPropUpdate)param; OnPropUpdate(ref prop); } break; case (int)Client.GameEventID.ENTITYSYSTEM_CHANGENAME: { //实体名称改变 stEntityChangename e = (stEntityChangename)param; UpdateHeadStaus(e.uid, HeadStatusType.Name); } break; case (int)Client.GameEventID.ENTITYSYSTEM_SETHIDE: { //实体名称改变 stEntityHide st = (stEntityHide)param; //UpdateHeadStaus(e.uid, HeadStatusType.Name); OnSetEntityHide(ref st); } break; case (int)Client.GameEventID.TITLE_WEAR: { Client.stTitleWear data = (Client.stTitleWear)param; IPlayer player = RoleStateBarManager.GetEntityByUserID <IPlayer>(data.uid); if (null != player) { //佩戴称号 UpdateHeadStaus(player.GetUID(), HeadStatusType.Title); } } break; case (int)Client.GameEventID.SKILLGUIDE_PROGRESSSTART: { //引导技能开始 } break; case (int)Client.GameEventID.SKILLGUIDE_PROGRESSBREAK: { //引导技能中断 } break; case (int)Client.GameEventID.SKILLGUIDE_PROGRESSEND: { //引导技能结束 } break; case (int)Client.GameEventID.CLANQUIT: case (int)Client.GameEventID.CLANJOIN: case (int)Client.GameEventID.CLANREFRESHID: case (int)Client.GameEventID.CITYWARWINERCLANID: case (int)Client.GameEventID.CLANDeclareInfoAdd: case (int)Client.GameEventID.CLANDeclareInfoRemove: { //氏族状态改变 OnRefreshAllClan(); } break; case (int)Client.GameEventID.CITYWARTOTEMCLANNAMECHANGE: { long uid = EntitySystem.EntityHelper.MakeUID(EntityType.EntityType_NPC, (uint)param); UpdateHeadStaus(uid, HeadStatusType.Clan); } break; case (int)Client.GameEventID.SYSTEM_GAME_READY: { OnRefresAllHp(); } break; case (int)Client.GameEventID.CAMERA_MOVE_END: { UpdateAllPos(); } break; case (int)Client.GameEventID.RFRESHENTITYHEADSTATUS: { HeadStatusType status = (HeadStatusType)param; RefreshAllHeadStatus(status); } break; //npc头顶任务状态 case (int)Client.GameEventID.TASK_ACCEPT: { uint taskId = (uint)param; OnUpdateNpcTaskStatus(taskId, Client.GameEventID.TASK_ACCEPT); } break; case (int)Client.GameEventID.TASK_DELETE: { uint taskId = (uint)param; OnUpdateNpcTaskStatus(taskId, Client.GameEventID.TASK_DELETE); } break; case (int)Client.GameEventID.TASK_DONE: { Client.stTaskDone td = (Client.stTaskDone)param; OnUpdateNpcTaskStatus(td.taskid, Client.GameEventID.TASK_DONE); } break; case (int)Client.GameEventID.TASK_CANSUBMIT: { Client.stTaskCanSubmit tcs = (Client.stTaskCanSubmit)param; OnUpdateNpcTaskStatus(tcs.taskid, Client.GameEventID.TASK_CANSUBMIT); } break; case (int)Client.GameEventID.TASK_CANACCEPT: { uint taskId = (uint)param; OnUpdateNpcTaskStatus(taskId, Client.GameEventID.TASK_CANACCEPT); } break; } }
void OnEvent(int nEventId, object param) { Client.GameEventID eid = (Client.GameEventID)nEventId; if (eid == Client.GameEventID.TASK_ACCEPT) { uint nTaskID = (uint)param; OnTaskAccept(nTaskID); return; } else if (eid == Client.GameEventID.TASK_CANSUBMIT) { Client.stTaskCanSubmit cs = (Client.stTaskCanSubmit)param; OnTaskCanCommit(cs.taskid); } else if (eid == Client.GameEventID.TASK_DONE) { Client.stTaskDone td = (Client.stTaskDone)param; OnTaskDone(td.taskid); } else if (eid == Client.GameEventID.TASK_DONING) { Client.stDoingTask dt = (Client.stDoingTask)param; DataManager.Manager <TaskDataManager>().DoingTaskID = dt.taskid; OnExecuteTask(dt.taskid); } else if (eid == Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE) { Client.stEntityStopMove stopEntity = (Client.stEntityStopMove)param; OnPlayerStopMove(ref stopEntity, nEventId); return; } else if (eid == Client.GameEventID.SKILLNONESTATE_ENTER) { Client.stSkillStateEnter sse = (Client.stSkillStateEnter)param; OnSkillPlayOver(ref sse, nEventId); return; } else if (eid == Client.GameEventID.ENTITYSYSTEM_CHANGE) { Client.stPlayerChange pc = (Client.stPlayerChange)param; if (!Client.ClientGlobal.Instance().IsMainPlayer(pc.uid)) { return; } Engine.Utility.EventEngine.Instance().RemoveEventListener(nEventId, OnEvent); QuestTraceInfo questInfo = QuestTranceManager.Instance.GetQuestTraceInfo(m_nDoingTaskID); if (questInfo == null) { return; } m_bAddChangeListener = false; Engine.Utility.Log.Info("{0} 变身完毕 执行任务{1}", TAG, m_nDoingTaskID); ProcessTask(questInfo); m_nDoingTaskID = 0; } else if (eid == Client.GameEventID.ENTITYSYSTEM_RESTORE) { Client.stPlayerChange pc = (Client.stPlayerChange)param; if (!Client.ClientGlobal.Instance().IsMainPlayer(pc.uid)) { return; } Engine.Utility.EventEngine.Instance().RemoveEventListener(nEventId, OnEvent); Engine.Utility.Log.Info("{0}变身回来 执行任务{1}", TAG, m_nDoingTaskID); OnTaskDone(m_nDoingTaskID); m_nDoingTaskID = 0; m_bAddRestoreListener = false; } }