void UpdateMissionMapLabelPos(int missionId, int targetId, Vector3 pos) { UIMissionMgr.MissionView missview = UIMissionMgr.Instance.GetMissionView(missionId); if (missview == null) { return; } UIMissionMgr.TargetShow tarshow = missview.mTargetList.Find(ite => UIMissionMgr.MissionView.MatchID(ite, targetId)); if (tarshow != null) { MissionLabel label = PeMap.LabelMgr.Instance.Find(item => { if (item is MissionLabel) { MissionLabel misLabel = item as MissionLabel; if (misLabel.m_missionID == missionId && misLabel.m_type == MissionLabelType.misLb_target && misLabel.m_target == tarshow) { return(true); } } return(false); }) as MissionLabel; if (label != null) { label.SetLabelPos(pos, true); } } }
//处理MissionLabel #region MissionLabel void UpdateMisLabel() { if (null == m_Label || m_Label.GetType() != PeMap.ELabelType.Mission) { return; } MissionLabel misLabel = m_Label as MissionLabel; if (misLabel != null) { UIMissionMgr.MissionView view = UIMissionMgr.Instance.GetMissionView(misLabel.m_missionID); if (misLabel.m_type == MissionLabelType.misLb_target && misLabel.m_target != null) { if (misLabel.m_target.mComplete) { PeMap.LabelMgr.Instance.Remove(this._ILabel); return; } if (view != null) { mSpr.enabled = view.mMissionTag; } } else if (misLabel.m_type == MissionLabelType.misLb_end) { if (view != null && view.mComplete != misLabel.IsComplete) { misLabel.IsComplete = view.mComplete; SetColor(misLabel.GetMissionColor()); SetEnableClick(true); } } } }
void MissionNodeOnDelete(object sender) { UIMissionNode node = sender as UIMissionNode; if (node == null) { return; } delView = node.mData as UIMissionMgr.MissionView; if (delView == null) { return; } MissionCommonData data = MissionManager.GetMissionCommonData(delView.mMissionID); if (data == null) { return; } //else // MissionManager.Instance.m_PlayerMission.FailureMission(delView.mMissionID); if (!data.m_bGiveUp) { new PeTipMsg(PELocalization.GetString(8000174), PeTipMsg.EMsgLevel.Warning); return; } MessageBox_N.ShowYNBox(PELocalization.GetString(8000066), DeleteMissionOk); }
void UpdateNodeText(UIMissionNode node) { if (node.mData == null) { return; } if (node.mParent == null) { if (node.mData is UIMissionMgr.MissionView) { UIMissionMgr.MissionView view = node.mData as UIMissionMgr.MissionView; string colorFormat = view.mMissionType == MissionType.MissionType_Main ? mainMissionColor : sideMissionColor; string text = view.mComplete ? string.Format(complateTitleFormat, view.mMissionTitle, PELocalization.GetString(8000694)) : view.mMissionTitle; node.mLbTitle.text = string.Format(colorFormat, text); } } else { if (node.mData is List <UIMissionMgr.TargetShow> ) { List <UIMissionMgr.TargetShow> showList = node.mData as List <UIMissionMgr.TargetShow>; string text = string.Empty; foreach (UIMissionMgr.TargetShow target in showList) { string countStr = string.Empty; if (target.mMaxCount > 0) { countStr = string.Format(countFormat, target.mCount, target.mMaxCount); } text += string.Format(target.mComplete ? complateMissionColor : uncompletedMissionColor, target.mContent, countStr); } node.mLbTitle.text = text; } } }
void DeleteMissionOk() { if (UIMissionMgr.Instance) { UIMissionMgr.Instance.DeleteMission(delView); } delView = null; }
void OnDelMissionView(UIMissionMgr.MissionView view) { UIMissionNode node = FindMissionNode(view); if (node != null) { mMissionTree.DeleteMissionNode(node); } }
void OnCheckTagMission(UIMissionMgr.MissionView view) { if (view.mMissionTag) { OnAddMissionView(view); } else { OnDelMissionView(view); } }
void OnDeleteMission(UIMissionMgr.MissionView misView) { if (misView == null) { return; } //Remove MissionLabel List <PeMap.ILabel> RemoveList = PeMap.LabelMgr.Instance.FindAll(itr => RemoveMissionLabel(misView.mMissionID, itr)); foreach (PeMap.ILabel _ilabel in RemoveList) { PeMap.LabelMgr.Instance.Remove(_ilabel); } RemoveList.Clear(); }
void ReFlashMissionContent(UIMissionNode node) { if (mTargetScroll != null) { mTargetScroll.scrollValue = 0; } ClearMissionContent(); UIMissionMgr.MissionView view = node.mData as UIMissionMgr.MissionView; if (view == null) { return; } mDesLabel.text = view.mMissionDesc; int missionId = view.mMissionID; MissionCommonData mcd = MissionManager.GetMissionCommonData(missionId); if (mcd != null) { if (mcd.addSpValue > 0) { mSPLabel.text = "SP" + " " + "+" + " " + "[ffff00]" + mcd.addSpValue + "[-]"; } } SetGiver(view.mMissionStartNpc.mNpcIcoStr, view.mMissionStartNpc.mName); SetSubmit(view.mMissionReplyNpc.mNpcIcoStr, view.mMissionReplyNpc.mName); for (int i = 0; i < view.mTargetList.Count; i++) { AddTarget(view.mTargetList[i]); } mTargetGrid.Reposition(); //if (mTargetScroll != null) // mTargetScroll.scrollValue = 0; for (int i = 0; i < view.mRewardsList.Count; i++) { AddRewards(view.mRewardsList[i]); } mRewardsGrid.Reposition(); if (mRewardsScroll != null) { mRewardsScroll.scrollValue = 0; } }
public MissionLabel(int missionID, MissionLabelType type, Vector3 pos, string text, float raidus, bool needArrow, int attachOnId, UIMissionMgr.TargetShow target = null) { m_type = type; m_postion = pos; m_text = text; m_raidus = raidus; m_missionID = missionID; m_needArrow = needArrow; m_attachOnID = attachOnId; m_target = target; UIMissionMgr.MissionView view = UIMissionMgr.Instance.GetMissionView(m_missionID); if (null != view) { IsComplete = view.mComplete; } }
void MissionNodeOnCheckTag(object sender, bool isChecked) { UIMissionNode node = sender as UIMissionNode; if (node == null) { return; } UIMissionMgr.MissionView view = node.mData as UIMissionMgr.MissionView; if (view == null) { return; } view.mMissionTag = isChecked; UIMissionMgr.Instance.CheckMissionTag(view); }
bool ContainsMissionView(UIMissionMgr.MissionView view) { bool contains = false; foreach (UIMissionNode node in mMissionTree.mNodes) { if (node.mParent == null) { UIMissionMgr.MissionView dataView = node.mData as UIMissionMgr.MissionView; if (dataView.mMissionID == view.mMissionID) { return(true); } } } return(contains); }
//lz-2016.08.17 这个接口提供外部通过UIMissionMgr.MissionView来选中任务节点 public void SelectMissionNodeByData(object data) { if (null == data) { return; } if (data is UIMissionMgr.MissionView) { UIMissionMgr.MissionView misView = (UIMissionMgr.MissionView)data; if (misView.mMissionType == MissionType.MissionType_Main || misView.mMissionType == MissionType.MissionType_Time) { mCkMainStory.isChecked = true; mCkSideQuest.isChecked = false; BtnMainStroy(); UIMissionNode findNode = mMainStroyTree.mNodes.Find(a => (a.mParent == null && a.mData != null && a.mData is UIMissionMgr.MissionView && ((UIMissionMgr.MissionView)a.mData).mMissionID == misView.mMissionID)); if (null != findNode) { if (null != mMainStroyTree.mSelectedNode) { mMainStroyTree.mSelectedNode.Selected = false; } mMainStroyTree.mSelectedNode = findNode; findNode.Selected = true; ReFlashMissionContent(findNode); } } else if (misView.mMissionType == MissionType.MissionType_Sub) { mCkMainStory.isChecked = false; mCkSideQuest.isChecked = true; BtnSideQuest(); UIMissionNode findNode = mSideQuestTree.mNodes.Find(a => (a.mParent == null && a.mData != null && a.mData is UIMissionMgr.MissionView && ((UIMissionMgr.MissionView)a.mData).mMissionID == misView.mMissionID)); if (null != findNode) { if (null != mSideQuestTree.mSelectedNode) { mSideQuestTree.mSelectedNode.Selected = false; } mSideQuestTree.mSelectedNode = findNode; findNode.Selected = true; ReFlashMissionContent(findNode); } } } }
void DeleteMission(UIMissionMgr.MissionView misView) { UIMissionNode node = null; if (misView.mMissionType == MissionType.MissionType_Main || misView.mMissionType == MissionType.MissionType_Time) { node = mMainStroyTree.mNodes.Find( delegate(UIMissionNode nd) { UIMissionMgr.MissionView mv = nd.mData as UIMissionMgr.MissionView; return(mv == misView); }); mMainStroyTree.DeleteMissionNode(node); if (mMainStroyTree.mNodes.Count == 0) { node = null; } else { node = mMainStroyTree.mNodes[0]; } } else if (misView.mMissionType == MissionType.MissionType_Sub) { node = mSideQuestTree.mNodes.Find( delegate(UIMissionNode nd) { UIMissionMgr.MissionView mv = nd.mData as UIMissionMgr.MissionView; return(mv == misView); }); mSideQuestTree.DeleteMissionNode(node); if (mSideQuestTree.mNodes.Count == 0) { node = null; } else { node = mSideQuestTree.mNodes[0]; } } SelectMissionNode(node); }
void OnAddMissionView(UIMissionMgr.MissionView view) { if (view.mMissionTag && !ContainsMissionView(view)) { UIMissionNode rootNode = mMissionTree.AddMissionNode(null, "", false, false, false); rootNode.mData = view; rootNode.mLbTitle.maxLineCount = 1; UIMissionNode tragetNode = mMissionTree.AddMissionNode(rootNode, "", false, false, false); tragetNode.mData = view.mTargetList; tragetNode.mLbTitle.maxLineCount = 0; UpdateNodeText(rootNode); UpdateNodeText(tragetNode); Sort(); rootNode.ChangeExpand(); } }
UIMissionNode FindMissionNode(UIMissionMgr.MissionView view) { foreach (UIMissionNode node in mMissionTree.mNodes) { if (node.mParent == null) { UIMissionMgr.MissionView dataView = node.mData as UIMissionMgr.MissionView; if (dataView == null) { Debug.LogError("missionView data eroor!"); continue; } if (dataView.mMissionID == view.mMissionID) { return(node); } } } return(null); }
void AddMission(UIMissionMgr.MissionView misView) { UIMissionNode node = null; if (misView.mMissionType == MissionType.MissionType_Main || misView.mMissionType == MissionType.MissionType_Time) { node = mMainStroyTree.AddMissionNode(null, misView.mMissionTitle); } else if (misView.mMissionType == MissionType.MissionType_Sub) { node = mSideQuestTree.AddMissionNode(null, misView.mMissionTitle); } node.mCheckBoxTag.isChecked = misView.mMissionTag; node.mData = misView; node.e_BtnDelete += MissionNodeOnDelete; node.e_CheckedTg += MissionNodeOnCheckTag; SelectMissionNode(node); }
void OnAddMission(UIMissionMgr.MissionView misView) { if (misView == null) { return; } if (misView.mEndMisPos != Vector3.zero) { // Add MisEnd Label MissionLabel label = new MissionLabel(misView.mMissionID, MissionLabelType.misLb_end, misView.mEndMisPos, misView.mMissionTitle, -1f, misView.NeedArrow, misView.mAttachOnId); PeMap.LabelMgr.Instance.Add(label); } // Add MisTarget Label foreach (UIMissionMgr.TargetShow target in misView.mTargetList) { if (target.mComplete != true) { if (target.mPosition != Vector3.zero) { MissionLabel label = new MissionLabel(misView.mMissionID, MissionLabelType.misLb_target, target.mPosition, target.mContent, target.Radius, false, target.mAttachOnID, target); PeMap.LabelMgr.Instance.Add(label); } } } }
void Update() { //完成移动任务的触发 if (null != GameUI.Instance.mMainPlayer && !isMoveComplete) { if (Vector3.Distance(GameUI.Instance.mMainPlayer.position, mTarPos) <= 3f) { if (MissionManager.Instance.HasMission(TrainingRoomConfig.MoveID)) { isMoveComplete = true; TrainingTaskManager.Instance.CompleteMission(); DestroyMoveScene(); } } } //完成取药任务的触发 if (HasItemObj() && !isGetMedComplete) { isGetMedComplete = true; DestroyGetMedicineScene(); TrainingTaskManager.Instance.CompleteMission(); } ////完成返回任务的触发 if (TrainingTaskManager.Instance.currentMission == TrainingTaskType.BaseControl) { UIMissionMgr.MissionView missview = UIMissionMgr.Instance.GetMissionView(TrainingRoomConfig.BaseControlID); if (missview != null) { UIMissionMgr.TargetShow tarshow; if (player.motionMgr.IsActionRunning(PEActionType.Move)) { tarshow = missview.mTargetList.Find(ite => UIMissionMgr.MissionView.MatchID(ite, 4116)); if (tarshow != null) { tarshow.mComplete = true; } } if (player.motionMgr.IsActionRunning(PEActionType.Jump)) { tarshow = missview.mTargetList.Find(ite => UIMissionMgr.MissionView.MatchID(ite, 4117)); if (tarshow != null) { tarshow.mComplete = true; } } if (player.motionMgr.IsActionRunning(PEActionType.Sprint)) { tarshow = missview.mTargetList.Find(ite => UIMissionMgr.MissionView.MatchID(ite, 4118)); if (tarshow != null) { tarshow.mComplete = true; } } if (playerCmpt.AutoRun) { tarshow = missview.mTargetList.Find(ite => UIMissionMgr.MissionView.MatchID(ite, 4119)); if (tarshow != null) { tarshow.mComplete = true; } } bool complete = true; foreach (var item in missview.mTargetList) { if (item.mComplete == false) { complete = false; break; } } if (complete) { TrainingTaskManager.Instance.CompleteMission(); } } } }
void OnControlModeChange(PeCamera.ControlMode mode) { UIMissionMgr.MissionView missview = UIMissionMgr.Instance.GetMissionView(TrainingRoomConfig.ChangeControlModeID); if (missview == null) { MissionManager.Instance.CompleteMission(TrainingRoomConfig.ChangeControlModeID); PeCamera.onControlModeChange -= OnControlModeChange; } UIMissionMgr.TargetShow tarshow; switch (mode) { case PeCamera.ControlMode.MMOControl: tarshow = missview.mTargetList.Find(ite => UIMissionMgr.MissionView.MatchID(ite, 4114)); if (tarshow != null) { tarshow.mComplete = true; } completeCount++; if (MissionRepository.HaveTalkOP(722)) { GameUI.Instance.mNPCTalk.NormalOrSP(0); GameUI.Instance.mNPCTalk.UpdateNpcTalkInfo(722, 1); GameUI.Instance.mNPCTalk.PreShow(); } else if (MissionManager.Instance.IsGetTakeMission(722)) { MissionManager.Instance.SetGetTakeMission(722, null, MissionManager.TakeMissionType.TakeMissionType_Get); } break; case PeCamera.ControlMode.FirstPerson: tarshow = missview.mTargetList.Find(ite => UIMissionMgr.MissionView.MatchID(ite, 4115)); if (tarshow != null) { tarshow.mComplete = true; } completeCount++; if (MissionRepository.HaveTalkOP(723)) { GameUI.Instance.mNPCTalk.NormalOrSP(0); GameUI.Instance.mNPCTalk.UpdateNpcTalkInfo(723, 1); GameUI.Instance.mNPCTalk.PreShow(); } else if (MissionManager.Instance.IsGetTakeMission(723)) { MissionManager.Instance.SetGetTakeMission(723, null, MissionManager.TakeMissionType.TakeMissionType_Get); } break; default: break; } if (completeCount > 1) { TrainingTaskManager.Instance.CompleteMission(); PeCamera.onControlModeChange -= OnControlModeChange; } }
public void AddMission(Pathea.PeEntity npc) { if (!Pathea.PeGameMgr.IsMulti) { return; } NpcMissionData missionData = Pathea.PeEntityExt.PeEntityExt.GetUserData(npc) as NpcMissionData; if (missionData == null) { return; } MissionCommonData mcd; if (npc.proto == Pathea.EEntityProto.Npc) { foreach (var item in missionData.m_MissionList) { if (!m_GetableMissonMap.ContainsKey(item)) { continue; } ; mcd = MissionManager.GetMissionCommonData(item); if (mcd == null) { continue; } UIMissionMgr.GetableMisView gmv = new UIMissionMgr.GetableMisView(item, mcd.m_MissionName, npc.position, npc.Id); gmv.TargetNpcInfo.mName = npc.enityInfoCmpt.characterName.fullName; gmv.TargetNpcInfo.mNpcIcoStr = string.IsNullOrEmpty(npc.enityInfoCmpt.faceIconBig) ? "npc_big_Unknown" : npc.enityInfoCmpt.faceIconBig; UIMissionMgr.Instance.AddGetableMission(gmv, true); } foreach (var item in missionData.m_MissionListReply) { if (!m_MissonMap.ContainsKey(item)) { continue; } mcd = MissionManager.GetMissionCommonData(item); if (mcd == null) { continue; } Dictionary <string, string> missionFlagType = MissionManager.Instance.m_PlayerMission.GetMissionFlagType(item); if (missionFlagType == null) { continue; } UIMissionMgr.MissionView mv = new UIMissionMgr.MissionView(); mv.mMissionID = mcd.m_ID; mv.mMissionType = mcd.m_Type; mv.mMissionTitle = mcd.m_MissionName; npc = Pathea.EntityMgr.Instance.Get(mcd.m_iNpc); if (npc != null) { mv.mMissionStartNpc.mName = npc.enityInfoCmpt.characterName.fullName; mv.mMissionStartNpc.mNpcIcoStr = string.IsNullOrEmpty(npc.enityInfoCmpt.faceIconBig) ? "npc_big_Unknown" : npc.enityInfoCmpt.faceIconBig; } npc = Pathea.EntityMgr.Instance.Get(mcd.m_iReplyNpc); if (npc != null) { mv.mMissionEndNpc.mName = npc.enityInfoCmpt.characterName.fullName; mv.mMissionEndNpc.mNpcIcoStr = string.IsNullOrEmpty(npc.enityInfoCmpt.faceIconBig) ? "npc_big_Unknown" : npc.enityInfoCmpt.faceIconBig; mv.mEndMisPos = npc.position; mv.mAttachOnId = npc.Id; mv.NeedArrow = true; } MissionManager.Instance.ParseMissionFlag(mcd, missionFlagType, mv); UIMissionMgr.Instance.AddMission(mv, true); UIMissionMgr.Instance.RefalshMissionWnd(); } } else if (npc.proto == Pathea.EEntityProto.RandomNpc && Pathea.PeGameMgr.IsStory) { if (missionData.m_RandomMission != 0) { mcd = MissionManager.GetMissionCommonData(missionData.m_RandomMission); if (mcd != null) { if (m_GetableMissonMap.ContainsKey(missionData.m_RandomMission)) { UIMissionMgr.GetableMisView gmv = new UIMissionMgr.GetableMisView(missionData.m_RandomMission, mcd.m_MissionName, npc.position, npc.Id); gmv.TargetNpcInfo.mName = npc.enityInfoCmpt.characterName.fullName; gmv.TargetNpcInfo.mNpcIcoStr = string.IsNullOrEmpty(npc.enityInfoCmpt.faceIconBig) ? "npc_big_Unknown" : npc.enityInfoCmpt.faceIconBig; UIMissionMgr.Instance.AddGetableMission(gmv, true); } if (m_MissonMap.ContainsKey(missionData.m_RandomMission)) { Dictionary <string, string> missionFlagType = MissionManager.Instance.m_PlayerMission.GetMissionFlagType(missionData.m_RandomMission); if (missionFlagType != null) { UIMissionMgr.MissionView mv = new UIMissionMgr.MissionView(); mv.mMissionID = mcd.m_ID; mv.mMissionType = mcd.m_Type; mv.mMissionTitle = mcd.m_MissionName; npc = Pathea.EntityMgr.Instance.Get(mcd.m_iNpc); if (npc != null) { mv.mMissionStartNpc.mName = npc.enityInfoCmpt.characterName.fullName; mv.mMissionStartNpc.mNpcIcoStr = string.IsNullOrEmpty(npc.enityInfoCmpt.faceIconBig) ? "npc_big_Unknown" : npc.enityInfoCmpt.faceIconBig; } npc = Pathea.EntityMgr.Instance.Get(mcd.m_iReplyNpc); if (npc != null) { mv.mMissionEndNpc.mName = npc.enityInfoCmpt.characterName.fullName; mv.mMissionEndNpc.mNpcIcoStr = string.IsNullOrEmpty(npc.enityInfoCmpt.faceIconBig) ? "npc_big_Unknown" : npc.enityInfoCmpt.faceIconBig; mv.mEndMisPos = npc.position; mv.mAttachOnId = npc.Id; mv.NeedArrow = true; } MissionManager.Instance.ParseMissionFlag(mcd, missionFlagType, mv); UIMissionMgr.Instance.AddMission(mv, true); UIMissionMgr.Instance.RefalshMissionWnd(); } } } } } }