void OnEvent(int nEventId, object param) { if (nEventId == (int)Client.GameEventID.ENTITYSYSTEM_PROPUPDATE) { Client.stPropUpdate prop = (Client.stPropUpdate)param; if (Client.ClientGlobal.Instance().IsMainPlayer(prop.uid)) { if (prop.nPropIndex == (int)Client.CreatureProp.Level) { RefreshFunction(); } } } else if (nEventId == (int)Client.GameEventID.TASK_DONE) { Client.stTaskDone td = (Client.stTaskDone)param; if (m_currTrailerdata != null && m_currTrailerdata.task == td.taskid) { RefreshFunction(); } } else if (nEventId == (int)Client.GameEventID.REFRESHFUNCTIONPUSHOPEN) { RefreshFunction(); } else if (nEventId == (int)Client.GameEventID.REFRESHINVITEPUSHMSGSTATUS) { AddSysTip(); } else if (nEventId == (int)Client.GameEventID.REFRESHDAILYPUSHSTATUS) { dataMgr.StructDailyPushMsg(); RefreshDailyPushFunction(); } }
void OnEvent(int nEventId, object param) { if (nEventId == (int)Client.GameEventID.ENTITYSYSTEM_PROPUPDATE) { Client.stPropUpdate prop = (Client.stPropUpdate)param; if (Client.ClientGlobal.Instance().IsMainPlayer(prop.uid)) { if (prop.nPropIndex != (int)Client.CreatureProp.Level) { return; } UpdateCanReceiveTask(); for (int i = 0, imax = m_lstReceivedTask.Count; i < imax; i++) { if (m_lstReceivedTask[i].taskSubType == TaskSubType.SubmitLimit) { m_lstReceivedTask[i].UpdateDesc(); } } ////更新任务追踪界面 if (DataManager.Manager <UIPanelManager>().IsShowPanel(PanelID.MissionAndTeamPanel)) { DataManager.Manager <UIPanelManager>().SendMsg(PanelID.MissionAndTeamPanel, UIMsgID.eUpdateTaskList, null); } } } }
public void OnSetCampUser(GameCmd.stSetCampUserCmd_S cmd) { Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } //0是玩家,1是npc Client.IEntity entity = null; if (cmd.entry_type == 0) { entity = es.FindPlayer(cmd.entry_id); } else if (cmd.entry_type == 1) { entity = es.FindNPC(cmd.entry_id); } if (entity != null) { Client.stPropUpdate prop = new Client.stPropUpdate(); prop.uid = entity.GetUID(); prop.nPropIndex = (int)Client.CreatureProp.Camp; prop.oldValue = entity.GetProp((int)Client.CreatureProp.Camp); prop.newValue = (int)cmd.camp; entity.SetProp((int)Client.CreatureProp.Camp, (int)cmd.camp); Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ENTITYSYSTEM_PROPUPDATE, prop); } if (Client.ClientGlobal.Instance().IsMainPlayer(cmd.entry_id)) { if (cmd.camp == eCamp.CF_Green || cmd.camp == eCamp.CF_Red) { DataManager.Manager <CampCombatManager>().OnSetCamp(); } //进去就请求刷行数据 DataManager.Instance.Sender.RequestCampInfoCamp(0, 0, DataManager.Manager <CampCombatManager>().FightingIndex); } }
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); } }
////////////////////////////////////////////////////////////////////////////////////////////////////////// private Client.IPlayer CreatePlayer(GameCmd.t_MapUserData userData) { IEntitySystem es = ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return(null); } EntityCreateData data = RoleUtil.BuildCreateEntityData(EntityType.EntityType_Player, userData); IPlayer player = es.FindPlayer(userData.userdata.dwUserID); if (player != null) { uint clanIdLow = (uint)player.GetProp((int)CreatureProp.ClanIdLow); uint clanIdHigh = (uint)player.GetProp((int)CreatureProp.ClanIdHigh); uint clanid = (clanIdHigh << 16) | clanIdLow; // //uint clanid = (uint)player.GetProp((int)CreatureProp.ClanId); //玩家死亡 服务器会通过这里刷新 所以这里更新下玩家血条 if (userData.userdata.curhp <= 0) { stPropUpdate prop = new stPropUpdate(); prop.uid = player.GetUID(); prop.nPropIndex = (int)CreatureProp.Hp; prop.oldValue = player.GetProp((int)CreatureProp.Hp); player.UpdateProp(data); prop.newValue = player.GetProp((int)CreatureProp.Hp); Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_HPUPDATE, prop); } else { stPropUpdate prop = new stPropUpdate(); prop.uid = player.GetUID(); prop.nPropIndex = (int)CreatureProp.Hp; prop.oldValue = player.GetProp((int)CreatureProp.Hp); player.UpdateProp(data); prop.newValue = player.GetProp((int)CreatureProp.Hp); if (prop.oldValue < prop.newValue) { Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_HPUPDATE, prop); } } if (userData.userdata.clan_id != clanid) { Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.CLANREFRESHID, new Client.stClanUpdate() { uid = player.GetUID(), clanId = userData.userdata.clan_id }); } } else { if (UserData.IsMainRoleID(userData.userdata.dwUserID)) { data.nLayer = LayerMask.NameToLayer("MainPlayer"); data.bMainPlayer = true; // 设置主角标识 player = es.CreateEntity(EntityType.EntityType_Player, data, true) as IPlayer; if (player == null) { Engine.Utility.Log.Error("CreatePlayer:创建角色失败!"); return(null); } Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.ENTITYSYSTEM_MAINPLAYERCREATE, new Client.stCreateEntity() { uid = userData.userdata.dwUserID }); // 设置控制对象 Client.IControllerSystem cs = ClientGlobal.Instance().GetControllerSystem(); if (cs != null) { cs.GetActiveCtrl().SetHost(player); } // 补丁 服务器没有金钱没有放在角色属性上 { player.SetProp((int)PlayerProp.Money, (int)UserData.Money); player.SetProp((int)PlayerProp.Coupon, (int)UserData.Coupon); player.SetProp((int)PlayerProp.Cold, (int)UserData.Cold); player.SetProp((int)PlayerProp.Reputation, (int)UserData.Reputation); player.SetProp((int)PlayerProp.Score, (int)UserData.Score); player.SetProp((int)PlayerProp.CampCoin, (int)UserData.CampCoin); player.SetProp((int)PlayerProp.AchievePoint, (int)UserData.AchievePoint); player.SetProp((int)PlayerProp.ShouLieScore, (int)UserData.ShouLieScore); player.SetProp((int)PlayerProp.FishingMoney, (int)UserData.FishingMoney); player.SetProp((int)PlayerProp.YinLiang, (int)UserData.YinLiang); } // 设置主像机参数 SetupMainCamera(player); //玩家成功登陆回调 Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.PLAYER_LOGIN_SUCCESS, null); //Client.stCreateEntity createEntity = new Client.stCreateEntity(); //createEntity.uid = player.GetUID(); //Engine.Utility.EventEngine.Instance().DispatchEvent((int)GameEventID.ENTITYSYSTEM_CREATEENTITY, createEntity); //set hp DataManager.Manager <UIPanelManager>().SendMsg(PanelID.MainPanel, UIMsgID.eSetRoleProperty, player); //预加载资源 // PreLoadResource(player.GetProp((int)PlayerProp.Job)); } else { //Profiler.BeginSample("CreatePlayer"); player = es.CreateEntity(EntityType.EntityType_Player, data, !m_bDelayLoad) as IPlayer; //Profiler.EndSample(); Protocol.Instance.RequestName(userData.userdata.dwUserID); } if (player != null) { PlayAni anim_param = new PlayAni(); anim_param.strAcionName = EntityAction.Stand; anim_param.fSpeed = 1; anim_param.nStartFrame = 0; anim_param.nLoop = -1; anim_param.fBlendTime = 0.2f; player.SendMessage(EntityMessage.EntityCommand_PlayAni, anim_param); } } IBuffPart buffpart = player.GetPart(EntityPart.Buff) as IBuffPart; if (buffpart != null) { buffpart.ReceiveBuffList(userData.statelist.data); } return(player); }
void OnEvent(int nEvent, object param) { Client.GameEventID ge = (Client.GameEventID)nEvent; if (ge == Client.GameEventID.TASK_DONING || ge == GameEventID.UIEVENTGUIDESHOWOUT || ge == GameEventID.SKILLSYSTEM_USESKILL) { ResetArrow(); KillTimer(); } else if (ge == GameEventID.STORY_PLAY_OVER) { ShowArrow(); } else if (ge == GameEventID.ENTITYSYSTEM_ENTITYBEGINMOVE) { stEntityBeginMove move = (stEntityBeginMove)param; if (Client.ClientGlobal.Instance().IsMainPlayer(move.uid)) { ResetArrow(); KillTimer(); } } else if (ge == GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE) { Client.stEntityStopMove stopEntity = (Client.stEntityStopMove)param; if (ClientGlobal.Instance().IsMainPlayer(stopEntity.uid)) { if (CheckCondition()) { SetTime(); } } } else if (ge == Client.GameEventID.UIEVENT_PANELFOCUSSTATUSCHANGED) { UIPanelManager.PanelFocusData fdata = (UIPanelManager.PanelFocusData)param; if (fdata.ID == PanelID.MissionAndTeamPanel) { if (fdata.GetFocus) { if (CheckCondition()) { SetTime(); } } else { ResetArrow(); KillTimer(); } } } else if (ge == Client.GameEventID.ENTITYSYSTEM_PROPUPDATE) { Client.stPropUpdate prop = (Client.stPropUpdate)param; if (Client.ClientGlobal.Instance().IsMainPlayer(prop.uid)) { if (m_nignoreLevel <= MainPlayerHelper.GetPlayerLevel()) { RegisterEvent(false); ResetArrow(); KillTimer(); } } } else if (ge == GameEventID.SKILLNONESTATE_ENTER) { stSkillStateEnter state = (stSkillStateEnter)param; if (ClientGlobal.Instance().IsMainPlayer(state.uid)) { if (CheckCondition()) { SetTime(); } } } else if (ge == Client.GameEventID.COMBOT_ENTER_EXIT) { stCombotCopy cc = (stCombotCopy)param; if (cc.exit) { if (CheckCondition()) { SetTime(); } } else if (cc.enter) { ResetArrow(); KillTimer(); } } else if (ge == GameEventID.SKILLGUIDE_PROGRESSSTART) { ResetArrow(); KillTimer(); } else if (ge == GameEventID.SKILLGUIDE_PROGRESSEND) { if (CheckCondition()) { SetTime(); } } else if (ge == Client.GameEventID.TASK_MAIN_ARROWHIDE) { ResetArrow(); KillTimer(); } else if (ge == Client.GameEventID.UIEVENTGUIDECOMPLETE || ge == Client.GameEventID.UIEVENTGUIDESKIP) { if (CheckCondition()) { SetTime(); } } }