void SetNpcTipsByTaskID(uint nTaskID, bool checkAcceptNpc) { QuestTraceInfo questInfo = QuestTranceManager.Instance.GetQuestTraceInfo(nTaskID); if (questInfo == null) { return; } SetNpcTipsByTraceInfo(questInfo); //如果是接受了任务 检测提交跟接受npc一不一样 不一样移除接受npc特效 if (checkAcceptNpc) { if (questInfo.endNpc != questInfo.beginNpc) { Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("实体系统为null"); return; } Client.INPC npc = es.FindNPCByBaseId((int)questInfo.beginNpc); DeleteEffectByNpc(npc); } } }
public void SetSettingScreenPriority(uint priority) { SettingDataBase data = GameTableManager.Instance.GetTableItem <SettingDataBase>(priority); if (data != null) { //草地扰动 bool grassIsOpen = (data.GrassMoveGrade != 0) ? true : false; IMapSystem mapSys = ClientGlobal.Instance().GetMapSystem(); mapSys.EnableGrassForce(grassIsOpen); Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem(); if (rs != null) { //实时阴影 rs.SetShadowLevel((Engine.ShadowLevel)data.RealTime_Shadow); //特效等级 rs.effectLevel = (int)data.ParticleGrade; } //同屏人数 Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); int value = (int)data.PlayerNum; if (es != null) { if (value > MAX_PLAYER || value < MIN_PLAYER) { value = MIN_PLAYER; } es.MaxPlayer = value; } } }
/// <summary> /// 全局UI事件处理器 /// </summary> /// <param name="eventType"></param> /// <param name="data"></param> public void GlobalEventHandler(int eventType, object data) { switch (eventType) { case (int)Client.GameEventID.SYSTEM_LOADSCENECOMPELETE: { Client.stLoadSceneComplete loadScene = (Client.stLoadSceneComplete)data; if (loadScene.nMapID == 159) { DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.CampFightingPanel); } } break; case (int)Client.GameEventID.ENTITYSYSTEM_LEVELUP: { CaculateCampSectionIndex(); } break; case (int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY: { // if (isEnterScene == false) // { // return; // } Client.stCreateEntity npcEntity = (Client.stCreateEntity)data; Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } Client.IEntity npc = es.FindEntity(npcEntity.uid); if (npc == null) { return; } int npcBaseId = npc.GetProp((int)Client.EntityProp.BaseID); //采集物 table.NpcDataBase npctable = GameTableManager.Instance.GetTableItem <table.NpcDataBase>((uint)npcBaseId); if (npctable != null && npctable.dwType == (uint)GameCmd.enumNpcType.NPC_TYPE_COLLECT_PLANT) //采集物 { GameCmd.eCamp camp = (GameCmd.eCamp)npc.GetProp((int)Client.CreatureProp.Camp); if (m_CampCombatResultInfo != null && m_CampCombatResultInfo.m_MyCampCombatInfo.camp != camp) { CampNpcOnTrigger callback = new CampNpcOnTrigger(); npc.SetCallback(callback); } } } break; } }
//同屏人数 public void SetScreenNumberslider() { Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); int value = ClientGlobal.Instance().gameOption.GetInt("OneScreen", "ScreenNumberslider", 0); if (es != null) { if (value > MAX_PLAYER || value < MIN_PLAYER) { value = MIN_PLAYER; } es.MaxPlayer = value; } }
private void ClearSequencerTempObject() { for (int i = 0; i < m_SequencerTempObject.Count; i++) { GameObject temp = m_SequencerTempObject[i]; if (temp != null) { GameObject.DestroyObject(temp); } } m_SequencerTempObject.Clear(); for (int i = 0; i < m_SequencerTempRender.Count; i++) { Engine.IRenderObj temp = m_SequencerTempRender[i]; if (temp != null) { m_RenderSystem.RemoveRenderObj(temp); } } m_SequencerTempRender.Clear(); for (int i = 0; i < m_SequencerTempEffect.Count; i++) { Engine.IEffect temp = m_SequencerTempEffect[i]; if (temp != null) { m_RenderSystem.RemoveEffect(temp); } } m_SequencerTempEffect.Clear(); Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } for (int i = 0; i < m_SequencerTempEntity.Count; i++) { Client.IEntity entity = m_SequencerTempEntity[i]; if (entity != null) { es.RemoveEntity(entity); } } m_SequencerTempEntity.Clear(); }
/// <summary> /// 移除特效 /// </summary> /// <param name="nTaskID"></param> void DeleteEffectByTaskID(uint nTaskID) { table.QuestDataBase questDB = GameTableManager.Instance.GetTableItem <table.QuestDataBase>(nTaskID); if (questDB == null) { return; } Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("实体系统为null"); return; } Client.INPC npc = es.FindNPCByBaseId((int)questDB.dwEndNpc); DeleteEffectByNpc(npc); }
public GameCmd.enumPKMODE GetEntityPkMode(uint uid) { Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error(" EntitySystem is NULL"); return(GameCmd.enumPKMODE.PKMODE_M_NONE); } Client.IPlayer player = es.FindPlayer(uid); if (player != null) { int currMode = player.GetProp((int)Client.PlayerProp.PkMode); return((GameCmd.enumPKMODE)currMode); } return(GameCmd.enumPKMODE.PKMODE_M_NONE); }
public void Reset() { Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es != null) { if (m_DictNpceffect != null) { foreach (var item in m_DictNpceffect) { Client.IEntity en = es.FindNPC(item.Key); if (en != null) { en.SendMessage(Client.EntityMessage.EntityCommand_RemoveLinkEffect, item.Value.effectid); } } m_DictNpceffect.Clear(); } } }
void SetCampNpOnTrigger(GameCmd.eCamp mycamp) { Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es != null) { es.FindAllEntity <Client.INPC>(ref m_lstNpc); for (int i = 0; i < m_lstNpc.Count; i++) { Client.INPC npc = m_lstNpc[i]; GameCmd.eCamp camp = (GameCmd.eCamp)npc.GetProp((int)Client.CreatureProp.Camp); if (mycamp != camp) { CampNpcOnTrigger callback = new CampNpcOnTrigger(); npc.SetCallback(callback); UnityEngine.Debug.Log("SetCallback : " + npc.GetName()); } } m_lstNpc.Clear(); } }
void SetNpcTipsByTraceInfo(QuestTraceInfo questInfo) { Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("实体系统为null"); return; } GameCmd.TaskProcess process = questInfo.GetTaskProcess(); uint npcid = 0; uint effectID = 0; if (process == GameCmd.TaskProcess.TaskProcess_None)//可接 { npcid = questInfo.beginNpc; effectID = EFFECT_CANACCEPT; } else if (process == GameCmd.TaskProcess.TaskProcess_CanDone) { npcid = questInfo.endNpc; effectID = EFFECT_CANCOMMIT; } else if (process == GameCmd.TaskProcess.TaskProcess_Doing) { npcid = questInfo.endNpc; effectID = EFFECT_DOING; } Client.INPC npc = es.FindNPCByBaseId((int)npcid); if (npc == null) { Engine.Utility.Log.Info("查找不到npc{0}", npcid); return; } AddNpcTip(npc, effectID, questInfo.taskId, process); }
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); } }
/// <summary> /// 附近的人(从服务器获取数据,当前地图的人)先注释,改为获取9屏幕 /// </summary> /// <returns></returns> /* * public List<People> GetNearbyPeopleList() * { * List<People> peopleList = new List<People>(); * * for (int i = 0; i < m_InvitePeopleList.Count; i++) * { * if (Client.ClientGlobal.Instance().IsMainPlayer(m_InvitePeopleList[i].id))//排除自己 * { * continue; * } * * if (DataManager.Manager<TeamDataManager>().IsMember(m_InvitePeopleList[i].id))//排除已经加入的队员 * { * continue; * } * * peopleList.Add(new People * { * peopleType = PeopleType.Nearby, * id = m_InvitePeopleList[i].id, * name = m_InvitePeopleList[i].name, * profession = m_InvitePeopleList[i].job, * lv = m_InvitePeopleList[i].level, * alreadyInvite = false * }); * } * return peopleList; * } */ /// <summary> /// 附近的人(9屏数据) /// </summary> /// <returns></returns> public List <People> GetNearbyPeopleList() { List <People> peopleList = new List <People>(); Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); m_lstPlayer.Clear(); if (es != null) { es.FindAllEntity <Client.IPlayer>(ref m_lstPlayer); } for (int i = 0; i < m_lstPlayer.Count; i++) { if (Client.ClientGlobal.Instance().IsMainPlayer(m_lstPlayer[i]))//排除自己 { continue; } if (DataManager.Manager <TeamDataManager>().IsMember(m_lstPlayer[i].GetID()))//排除已经加入的队员 { continue; } peopleList.Add(new People { peopleType = PeopleType.Nearby, id = m_lstPlayer[i].GetID(), name = m_lstPlayer[i].GetName(), profession = (uint)m_lstPlayer[i].GetProp((int)Client.PlayerProp.Job), lv = (uint)m_lstPlayer[i].GetProp((int)Client.CreatureProp.Level), alreadyInvite = false }); } return(peopleList); }
public void OnEvent(int nEventId, object param) { if (nEventId == (int)Client.GameEventID.ENTITYSYSTEM_CREATEENTITY) { Client.stCreateEntity createEntity = (Client.stCreateEntity)param; Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return; } Client.IEntity en = es.FindEntity(createEntity.uid); if (en != null && en is Client.INPC) { List <QuestTraceInfo> traceTask; DataManager.Manager <TaskDataManager>().GetAllQuestTraceInfo(out traceTask); int index; Client.INPC npc = en as Client.INPC; if (IsNeedSetTip(npc, ref traceTask, out index)) { SetNpcTipsByTraceInfo(traceTask[index]); } } } else if (nEventId == (int)Client.GameEventID.ENTITYSYSTEM_REMOVEENTITY) { Client.stRemoveEntity removeEntiy = (Client.stRemoveEntity)param; Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { Engine.Utility.Log.Error("严重错误:EntitySystem is null!"); return; } Client.IEntity en = es.FindEntity(removeEntiy.uid); if (en != null && en is Client.INPC) { Client.INPC npc = en as Client.INPC; DeleteEffectByNpc(npc); } } else if (nEventId == (int)Client.GameEventID.TASK_ACCEPT) { uint taskId = (uint)param; SetNpcTipsByTaskID(taskId, true); } else if (nEventId == (int)Client.GameEventID.TASK_DELETE) { uint taskId = (uint)param; DeleteEffectByTaskID(taskId); } else if (nEventId == (int)Client.GameEventID.TASK_DONE) { Client.stTaskDone td = (Client.stTaskDone)param; DeleteEffectByTaskID(td.taskid); } else if (nEventId == (int)Client.GameEventID.TASK_CANSUBMIT) { Client.stTaskCanSubmit tcs = (Client.stTaskCanSubmit)param; SetNpcTipsByTaskID(tcs.taskid, false); } else if (nEventId == (int)Client.GameEventID.SYSTEM_GAME_READY) { RefreshAllNpcTips(); } else if (nEventId == (int)Client.GameEventID.TASK_CANACCEPT) { uint taskId = (uint)param; SetNpcTipsByTaskID(taskId, false); } }
public void Execute(stBroadCastRideUserCmd_S cmd) {//广播的发的是坐骑的baseid Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es == null) { return; } Client.IEntity entity = es.FindPlayer(cmd.user_id); if (entity != null) { if (Client.ClientGlobal.Instance().IsMainPlayer(entity)) {//主角不处理 通过stStatusRideUserCmd_S 唯一决定 return; } if (cmd.type == 0)//下马 { bool bRide = (bool)entity.SendMessage(Client.EntityMessage.EntityCommond_IsRide, null); if (bRide) { entity.SendMessage(Client.EntityMessage.EntityCommond_UnRide, null); } entity.SetProp((int)Client.PlayerProp.RideBaseId, 0); #region 主角废弃 //if (Client.ClientGlobal.Instance().IsMainPlayer(entity)) //{ // RideMgr.UsingRide = 0; // if (RideMgr.UnRideCallback != null) // { // RideMgr.UnRideCallback(RideMgr.UnRideCallbackParam); // RideMgr.UnRideCallback = null; // RideMgr.UnRideCallbackParam = null; // } //} #endregion } else if (cmd.type == 1)//上马 { bool bRide = (bool)entity.SendMessage(Client.EntityMessage.EntityCommond_IsRide, null); if (bRide) { return; } entity.SetProp((int)Client.PlayerProp.RideBaseId, (int)cmd.ride_id); entity.SendMessage(Client.EntityMessage.EntityCommond_Ride, (int)cmd.ride_id); #region 主角废弃 //if (Client.ClientGlobal.Instance().IsMainPlayer(entity)) //{ // RideMgr.UsingRide = RideMgr.Auto_Ride; // Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem(); // if (cs != null) // { // Client.ICombatRobot robot = cs.GetCombatRobot(); // if (robot != null && robot.Status != Client.CombatRobotStatus.STOP) // { // robot.Stop(); // } // } //} #endregion } } }
//正常播放完成 public void PlaybackFinished(WellFired.USSequencer sequencer) { m_IsPlay = false; if (m_SequencerCamera != null) { GameObject obj = GameObject.Find("MainCamera"); Camera camera = obj.GetComponent <Camera>(); if (camera != m_SequencerCamera) { camera.enabled = true; } } m_SequencerCamera = null; m_SequencerData = null; // 取消回调 if (sequencer != null) { sequencer.PlaybackFinished -= this.PlaybackFinished; sequencer.BeforeUpdate -= this.BeforeUpdate; } try { //显示npc Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es != null) { es.ShowEntity(true); } //删除剧情gameobject if (m_SequencerGameObject != null) { GameObject.Destroy(m_SequencerGameObject); m_SequencerGameObject = null; } Debug.Log("清理剧情对象"); //清理剧情对象 ClearSequencerTempObject(); //打开声音 Client.ClientGlobal.Instance().MuteGameSound(false); } catch { goto Exit0; } Exit0: //隐藏提示 TipsManager.Instance.EnableTips(true); //DataManager.Manager<UIPanelManager>().ShowStoryCachePanel(); Debug.Log("剧情结束显示UI"); RoleStateBarManager.ShowHeadStatus(); //剧情结束隐藏黑边 DataManager.Manager <UIPanelManager>().HideStory(); Debug.Log("剧情结束隐藏黑边"); Engine.Utility.EventEngine.Instance().DispatchEvent((int)Client.GameEventID.STORY_PLAY_OVER, null); //却换到原场景 Engine.IRenderSystem rs = Engine.RareEngine.Instance().GetRenderSystem(); if (m_MapID != 0) { // 剧情播放完毕加载原场景 table.MapDataBase data = GameTableManager.Instance.GetTableItem <table.MapDataBase>(m_MapID); if (data == null) { return; } table.ResourceDataBase resDB = GameTableManager.Instance.GetTableItem <table.ResourceDataBase>(data.dwResPath); if (resDB == null) { return; } if (rs != null) { string str = resDB.strPath; Engine.IScene scene = rs.EnterScene(ref str, SequencerManager.Instance()); if (scene != null) { ///加载场景 SequencerManager.Instance().Pause(); scene.StartLoad(Vector3.one); } } m_MapID = 0; } }
public void PlaySequencer(string strSequencer) { if (m_IsPlay) { return; } if (strSequencer == "") { return; } //隐藏npc //Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); //if (es != null) // es.ShowEntity(false); try { m_SequencerGameObject = WellFired.USSequencerLoad.LoadSequencerFromXml(strSequencer); } catch { PlaybackFinished(null); goto Exit0; } if (m_SequencerGameObject != null) { WellFired.USSequencer sequencer = m_SequencerGameObject.GetComponent <WellFired.USSequencer>(); if (sequencer != null) { sequencer.PlaybackFinished += this.PlaybackFinished; sequencer.BeforeUpdate += this.BeforeUpdate; m_IsPlay = true; if (m_IsPlay == true) { RoleStateBarManager.HideHeadStatus();//隐藏npc血条 //隐藏提示 TipsManager.Instance.EnableTips(false); //关闭声音 //IClientGlobal的MuteGameSound方法 Client.ClientGlobal.Instance().MuteGameSound(true); ///显示黑边 StoryPanel.StoryData data = new StoryPanel.StoryData(); data.Des = ""; data.ShowSkip = SequencerManager.Instance().IsShowSkipSequencerBtn(); data.SkipDlg = SequencerManager.Instance().OnSkipSequencer; data.ColliderClickDlg = SequencerManager.Instance().OnClickSequencer; ////隐藏npc Client.IEntitySystem es = Client.ClientGlobal.Instance().GetEntitySystem(); if (es != null) { es.ShowEntity(false); } } sequencer.Play(); } } Exit0: return; }