public void OnSelectTitle(stSelectTitlePropertyUserCmd_CS cmd) { //如果是玩家自己 if (Client.ClientGlobal.Instance().IsMainPlayer(cmd.dwUserID)) { this.WearTitleId = cmd.wdTitleID; TitleDataBase titleDataBase = GameTableManager.Instance.GetTableItem <TitleDataBase>(this.WearTitleId); if (titleDataBase != null) { TipsManager.Instance.ShowLocalFormatTips(LocalTextType.Title_Commond_peidaichenghao, titleDataBase.strName);//佩戴称号{0} } } Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es != null) { //设置人物身上称号 Client.IPlayer player = es.FindPlayer(cmd.dwUserID); if (player != null) { player.SetProp((int)PlayerProp.TitleId, (int)cmd.wdTitleID); } } //处理文字特效 Client.stTitleWear data = new Client.stTitleWear { uid = cmd.dwUserID, titleId = cmd.wdTitleID }; EventEngine.Instance().DispatchEvent((int)GameEventID.TITLE_WEAR, data);//抛出现在佩戴的称号 }
/// <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 EventCallBack(int nEventID, object param) { if (nEventID == (int)GameEventID.ENTITYSYSTEM_PROPUPDATE) { Client.stPropUpdate prop = (Client.stPropUpdate)param; //传过来的是Long型参数ID 强制转换不知道会不会有问题 IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return; } Client.IEntity entity = es.FindEntity(prop.uid); if (entity != null) { if (entity.GetEntityType() != EntityType.EntityType_Player) { return; } if (m_currShowUID == entity.GetID()) { ShowByPlayer(entity as Client.IPlayer); } } } else if (nEventID == (int)GameEventID.TITLE_WEAR) { Client.stTitleWear data = (Client.stTitleWear)param; if (Client.ClientGlobal.Instance().IsMainPlayer(data.uid)) { SetWearTitleItem(data.titleId); RefreshTitleGrids(data.titleId); } } else if (nEventID == (int)GameEventID.TITLE_ACTIVATE) { uint titleId = (uint)param; SetActivateTitleItem(titleId); RefreshTitleGrids(titleId); } else if (nEventID == (int)GameEventID.TITLE_TIMEOUT) { uint titleId = (uint)param; RefreshTitleGrids(titleId); } else if (nEventID == (int)GameEventID.TITLE_NEWTITLE) { uint titleId = (uint)param; CreateTopTabs(); RefreshTitleGrids(titleId); } else if (nEventID == (int)GameEventID.TITLE_DELETE) { uint titleId = (uint)param; CreateTopTabs(); if (m_lstTitleData.Exists((data) => { return(data == titleId ? true : false); })) { RefreshTitleGrids(titleId); //InitTitleGridListUI(); } } else if (nEventID == (int)GameEventID.TITLE_USETIMES) { uint titleId = (uint)param; //刷新界面使用次数 UpdateUseTimes(titleId); //刷新左侧的grid (次数为0,取消佩戴激活) RefreshTitleGrids(titleId); } }
/// <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(); } }