private void DoAcceptTask(QuestTraceInfo taskInfo) { table.QuestDataBase questDB = taskInfo.QuestTable; if (questDB == null) { Engine.Utility.Log.Error("QuestTable is null"); return; } if (taskInfo.taskType == GameCmd.TaskType.TaskType_Token) { PanelID pid; int tab = 0; int copyID; /* if (taskInfo.IsOpenUI(out pid, out tab,out copyID)) * { * // DataManager.Manager<UIPanelManager>().ShowPanel(pid); * // UIFrameManager.Instance.OnCilckTogglePanel(pid, UIPanelBase.FisrstTabsIndex, tab); * DataManager.Manager<UIPanelManager>().ShowPanel(pid, jumpData: new UIPanelBase.PanelJumpData() { Tabs = new int[] { tab } }); * * }*/ uint jumpId; if (taskInfo.IsOpenUI(out jumpId)) { ItemManager.DoJump(jumpId); } } if (taskInfo.taskSubType == TaskSubType.Guild) { Protocol.Instance.RequestAcceptTask(taskInfo.taskId); } else { DataManager.Manager <RideManager>().TryUsingRide(delegate(object o) { VisitNpc(questDB.dwHelpGoto, questDB.acceptMapID, questDB.dwBeginNpc, questDB.dwID); }, null); } }
private void OnDoingTask(QuestTraceInfo taskInfo) { DataManager.Manager <TaskDataManager>().DoingTaskID = taskInfo.taskId; Client.IController controller = Client.ClientGlobal.Instance().GetControllerSystem().GetActiveCtrl(); if (controller == null) { Engine.Utility.Log.Error("IController is null"); return; } table.QuestDataBase questDB = taskInfo.QuestTable; if (questDB == null) { Engine.Utility.Log.Error("QuestTable is null"); return; } UnityEngine.Vector2 pos; uint npcid = 0; PanelID pid; int copyID; int tab = 0; uint jumpId; //背包满了 无法执行任务 if (false == taskInfo.TaskItemCanPutInKanpsack()) { TipsManager.Instance.ShowTips(LocalTextType.Task_Commond_3); return; } if (MainPlayerIsChangeBody()) { return; } else if (taskInfo.taskSubType == TaskSubType.SubmitLimit) //断档任务 { if (taskInfo.IsOpenUI(out jumpId)) { ItemManager.DoJump(jumpId); } else { string des = string.Format("将等级提升到{0}级继续主线任务", taskInfo.finishLevel); TipsManager.Instance.ShowTips(des); } return; } else if (taskInfo.IsDynamicCommitItem) //动态道具递交(蚩尤乱世除外) { taskInfo.DoJump(); return; } else if (DataManager.Manager <ComBatCopyDataManager>().IsEnterCopy == false && taskInfo.IsOpenUI(out jumpId)) { ItemManager.DoJump(jumpId); return; } else if (taskInfo.IsMoveToTargetPos(out pos)) { //if (DataManager.Manager<TaskDataManager>().IsShowSlider) if (DataManager.Manager <SliderDataManager>().IsReadingSlider) { return; } Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem(); if (cs == null) { return; } if (!m_bAddStopMoveListener) { m_bAddStopMoveListener = true; Engine.Utility.EventEngine.Instance().AddEventListener((int)Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE, OnEvent); } if (EqualsMapID(questDB.destMapID)) { cs.GetCombatRobot().Stop(); DataManager.Manager <RideManager>().TryUsingRide(delegate(object o) { //if (!m_bAddStopMoveListener) //{ // m_bAddStopMoveListener = true; // Engine.Utility.EventEngine.Instance().AddEventListener((int)Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE, OnEvent); //} m_nDoingTaskID = taskInfo.taskId; controller.GotoMap(questDB.destMapID, new Vector3(pos.x, 0, -pos.y)); }, null); return; } else { DataManager.Manager <RideManager>().TryUsingRide(delegate(object o) { if (questDB.dwHelpDoing) { m_nDoingTaskID = taskInfo.taskId; //下载地图检查 if (!KHttpDown.Instance().SceneFileExists(questDB.destMapID)) { //打开下载界面 DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.DownloadPanel); return; } controller.GotoMapDirectly(questDB.destMapID, new Vector3(pos.x, 0, -pos.y), questDB.dwID); } }, null); } } else if (taskInfo.IsVisitCollectNpc(out npcid) || taskInfo.IsDeleverItem(out npcid)) { AddCollectNpcEffect(taskInfo); DataManager.Manager <RideManager>().TryUsingRide(delegate(object o) { VisitNpc(questDB.dwHelpDoing, questDB.destMapID, npcid, questDB.dwID); }, null); } else if (taskInfo.IsDirectlyVisitCopy(taskInfo.copyId) && false == EqualsMapID(questDB.destMapID)) { //直接跳副本 VisitCopy(taskInfo.copyId); } else if (taskInfo.IsKillMonster(out npcid)) { Client.ICombatRobot robot = Client.ClientGlobal.Instance().GetControllerSystem().GetCombatRobot(); if (robot == null) { Engine.Utility.Log.Error("robotis null"); return; } if (robot.Status == Client.CombatRobotStatus.RUNNING && robot.TargetId == npcid) { Engine.Utility.Log.Info("已经在挂机杀怪{0}", npcid); return; } //TODO 优化 bool getPos = false; if (EqualsMapID(questDB.destMapID)) { Client.IMapSystem ms = Client.ClientGlobal.Instance().GetMapSystem(); if (ms.GetClienNpcPos((int)npcid, out pos)) { getPos = true; Vector3 mainPos = Client.ClientGlobal.Instance().MainPlayer.GetPos(); if ((mainPos - new Vector3(pos.x, mainPos.y, -pos.y)).sqrMagnitude < 5) { Client.IControllerSystem cs = Client.ClientGlobal.Instance().GetControllerSystem(); if (cs != null) { cs.GetCombatRobot().StartWithTarget((int)npcid); Engine.Utility.Log.LogGroup("ZCX", "挂机杀怪物{0}", npcid); return; } } } } DataManager.Manager <RideManager>().TryUsingRide(delegate(object o) { if (!m_bAddStopMoveListener) { m_bAddStopMoveListener = true; Engine.Utility.EventEngine.Instance().AddEventListener((int)Client.GameEventID.ENTITYSYSTEM_ENTITYSTOPMOVE, OnEvent); } m_nDoingTaskID = taskInfo.taskId; if (getPos) { controller.MoveToTarget(new Vector3(pos.x, 0, -pos.y), null, true); } else if (EqualsMapID(questDB.destMapID)) { Client.IMapSystem ms = Client.ClientGlobal.Instance().GetMapSystem(); if (ms.GetClienNpcPos((int)npcid, out pos)) { controller.MoveToTarget(new Vector3(pos.x, 0, -pos.y), null, true); } } else { VisitNpc(questDB.dwHelpDoing, questDB.destMapID, npcid, questDB.dwID); } }, null); } }
private void OnCommitTask(QuestTraceInfo taskInfo) { table.QuestDataBase questDB = taskInfo.QuestTable; if (questDB == null) { Engine.Utility.Log.Error("QuestTable is null"); return; } if (taskInfo.taskSubType == TaskSubType.Guild) { DataManager.Manager <UIPanelManager>().ShowPanel(PanelID.MissionMessagePanel, data: taskInfo.taskId); return; } PanelID pid; int tab = 0; int copyId = 0; uint jumpId; if (taskInfo.IsOpenUI(out jumpId)) { ItemManager.DoJump(jumpId); return; } else if (taskInfo.IsChangeBodyTask()) { //bool isChange = (bool)Client.ClientGlobal.Instance().MainPlayer.SendMessage(Client.EntityMessage.EntityCommand_IsChange, null); //if (!isChange) //{ // m_nDoingTaskID = taskInfo.taskId; // if (m_bAddChangeListener) // { // return; // } // m_bAddChangeListener = true; // Engine.Utility.Log.Info("{0}CanDone 等待.......变身回来 执行任务{1}", TAG, m_nDoingTaskID); // Engine.Utility.EventEngine.Instance().AddEventListener((int)Client.GameEventID.ENTITYSYSTEM_CHANGE, OnEvent); // return; //} m_nDoingTaskID = taskInfo.taskId; if (false == m_bAddChangeListener && false == MainPlayerIsChangeBody()) { m_bAddChangeListener = true; Engine.Utility.Log.Info("{0}CanDone 等待.......变身回来 执行任务{1}", TAG, m_nDoingTaskID); Engine.Utility.EventEngine.Instance().AddEventListener((int)Client.GameEventID.ENTITYSYSTEM_CHANGE, OnEvent); } VisitNpc(questDB.dwHelpCommit, questDB.submitMapID, questDB.dwEndNpc, questDB.dwID); return; } uint npcid = 0; if (taskInfo.IsKillMonster(out npcid)) { Client.ISkillPart skillPart = Client.ClientGlobal.Instance().MainPlayer.GetPart(Client.EntityPart.Skill) as Client.ISkillPart; if (skillPart != null) { if (skillPart.GetCurSkillState() != (int)Client.SkillState.None) { m_nDoingTaskID = taskInfo.taskId; Engine.Utility.EventEngine.Instance().AddEventListener((int)Client.GameEventID.SKILLNONESTATE_ENTER, OnEvent); Engine.Utility.Log.Info("等待.......技能播放完毕 执行任务{0}", m_nDoingTaskID); return; } } } //令牌悬赏无交任务npc if (taskInfo.taskType != GameCmd.TaskType.TaskType_Token) { DataManager.Manager <RideManager>().TryUsingRide(delegate(object o) { VisitNpc(questDB.dwHelpCommit, questDB.submitMapID, questDB.dwEndNpc, questDB.dwID); }, null); } }