public void Process(float deltaTime) { Dictionary <long, uint> .Enumerator iter = m_dicBoxTime.GetEnumerator(); while (iter.MoveNext()) { if ((long)iter.Current.Value <= DateTimeHelper.Instance.Now) { stEntityChangename e = new stEntityChangename(); e.uid = iter.Current.Key; Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ENTITYSYSTEM_CHANGENAME, e); m_dicBoxTime.Remove(iter.Current.Key); break; } } }
private object SetName(object param) { if (m_Owner == null) { return(null); } string strName = param as string; if (strName != null) { m_Owner.SetName(strName); stEntityChangename changeName = new stEntityChangename(); changeName.uid = m_Owner.GetUID(); // 发送事件 Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ENTITYSYSTEM_CHANGENAME, changeName); } else { Engine.Utility.Log.Error("设置实体{0}名称参数错误:不是字符串", m_Owner.GetName()); } return(null); }
/// <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; } }
[Execute]//Npc归属人列表返回信息 public void Execute(GameCmd.stNpcBelongListMapScreenUserCmd_S cmd) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return; } INPC npc = es.FindNPC(cmd.npcid); if (npc != null) { npc.OwnerID = cmd.userid; npc.TeamID = cmd.teamid; bool belongOther = false; if (cmd.userid != 0) { if (cmd.userid != ClientGlobal.Instance().MainPlayer.GetID()) { belongOther = true; } else { npc.BelongMe = true; } } if (!belongOther && (cmd.teamid != 0 || cmd.clanid != 0)) { if (DataManager.Manager <TeamDataManager>().IsJoinTeam == true) { if (DataManager.Manager <TeamDataManager>().TeamId != cmd.teamid) { belongOther = true; } } else if (DataManager.Manager <ClanManger>().IsJoinClan == true) { if (DataManager.Manager <ClanManger>().ClanId != cmd.clanid) { belongOther = true; } } else { belongOther = true; } } npc.BelongOther = belongOther; stEntityChangename e = new stEntityChangename(); e.uid = npc.GetUID(); Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ENTITYSYSTEM_CHANGENAME, e); stRefreshNPCBelongParam param = new stRefreshNPCBelongParam() { npcid = npc.GetUID(), teamid = cmd.teamid, ownerid = cmd.userid, clanid = cmd.clanid, ownerName = cmd.ownername, }; NpcAscription.Instance.OnBelongChanged(param); DataManager.Manager <UIPanelManager>().SendMsg(PanelID.MainPanel, UIMsgID.eRefreshNpcBelong, param); } }
/// <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(); } }