//处理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 AddArrowLabel(ILabel label) { if (label.GetShow() == EShow.All || label.GetShow() == EShow.MinMap) { MissionLabel ml = label as MissionLabel; if (ml == null) { return; } if (ml.m_target == null) { return; } GameObject obj = GameObject.Instantiate(mArrowLablePrefab) as GameObject; obj.transform.parent = mSubInfoPanel.transform; obj.transform.localPosition = Vector3.zero; obj.transform.localScale = Vector3.one; obj.transform.localRotation = Quaternion.identity; UIMapArrow uiArrow = obj.GetComponent <UIMapArrow>(); if (uiArrow != null) { uiArrow.SetLabel(label, UIMapArrow.EArrowType.Main); mMapArrowList.Add(uiArrow); uiArrow.visualWidth = mMapSize.x - 10; uiArrow.visualHeight = mMapSize.y - 10; } } }
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); } } }
void UpdateLabelPosByNPC() { if (m_NpcID == -1) { return; } Pathea.PeEntity npc = Pathea.EntityMgr.Instance.Get(m_NpcID); if (npc == null || (npc.proto != Pathea.EEntityProto.Npc && npc.proto != Pathea.EEntityProto.RandomNpc)) { return; } MissionLabel misLabel = m_Label as MissionLabel; if (misLabel != null) { misLabel.SetLabelPos(npc.position); } }
public void InitList(List <string> missions) { ClaerList(); foreach (string item in missions) { Mission m = Globals.campaign.GetMissionData(item); MissionLabel l = Instantiate(labelPrefab); l.InitMissionLabel(m, newMask); l.GetComponent <Button>().onClick.AddListener(delegate { MissionLabelClicked(m); }); switch (m.missionType) { case MissionType.Main: { l.transform.SetParent(mainContainer); ToggleContainer(mainContainer); break; } case MissionType.Side: { l.transform.SetParent(sideContainer); ToggleContainer(sideContainer); break; } case MissionType.Party: { l.transform.SetParent(partyContainer); ToggleContainer(partyContainer); break; } case MissionType.Reoccuring: { l.transform.SetParent(reoccuringContainer); ToggleContainer(reoccuringContainer); break; } } } }
bool RemoveGetableLabel(int missionID, PeMap.ILabel label) { if (label.GetType() != PeMap.ELabelType.Mission) { return(false); } if (!(label is MissionLabel)) { return(false); } MissionLabel msLabel = label as MissionLabel; if (msLabel.m_type != MissionLabelType.misLb_unActive) { return(false); } return(msLabel.m_missionID == missionID); }
void OnAddGetableMission(UIMissionMgr.GetableMisView getableView) { if (getableView == null) { return; } if (getableView.mPosition != Vector3.zero) { // Add MisEnd Label MissionLabel label = new MissionLabel(getableView.mMissionID, MissionLabelType.misLb_unActive, getableView.mPosition, getableView.mMissionTitle, -1f, false, getableView.mAttachOnId); PeMap.LabelMgr.Instance.Add(label); } }
void AddOrRemoveLable(object sender, LabelMgr.Args arg) { if (arg == null || arg.label == null) { return; } if (PeGameMgr.playerType == PeGameMgr.EPlayerType.Tutorial && arg.label.GetType() == ELabelType.Npc) { if (((MapCmpt)(arg.label)).Common.entityProto.proto == EEntityProto.Monster) { return; } } if (arg.add) { if (arg.label.GetType() == ELabelType.Mission) { MissionLabel tmp = (arg.label as MissionLabel); MinMapMissionLabelRealation(tmp, arg.add); } else { AddMapLabel(arg.label); AddArrowLabel(arg.label); } } else { if (arg.label.GetType() == ELabelType.Mission) { MissionLabel tmp = (arg.label as MissionLabel); MinMapMissionLabelRealation(tmp, arg.add); } else { RemvoeMapLabel(arg.label); RemvoArrowLabel(arg.label); } } }
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); } } } }
public bool CompareTo(PeMap.ILabel label) { if (label is MissionLabel) { MissionLabel missionLabel = (MissionLabel)label; //lz-2016.06.24 会有多个label的missionid,type,postion都一样,只是半径不一样比如421任务,所以这里再加入半径判断 if (this.m_missionID == missionLabel.m_missionID && this.m_type == missionLabel.m_type && missionLabel.m_postion == m_postion && missionLabel.m_raidus == m_raidus) { return(true); } else { return(false); } } else { return(false); } }
void UpdateCurAllLabelShow() { if (null == this.m_CurrentMapLabelList || this.m_CurrentMapLabelList.Count <= 0) { return; } for (int i = 0; i < this.m_CurrentMapLabelList.Count; i++) { UIMapLabel mapLabel = this.m_CurrentMapLabelList[i]; if (null != mapLabel && null != mapLabel._ILabel) { if (this.CheckInViewYRange(mapLabel._ILabel.GetPos().y)) { if (!mapLabel.gameObject.activeSelf) { mapLabel.gameObject.SetActive(true); } } else { if (mapLabel.gameObject.activeSelf) { mapLabel.gameObject.SetActive(false); } } //lz-2016.06.15 npc是任务跟随着或者仆从就不显示小地图任务相关图标 if (mapLabel.type == ELabelType.Mission) { //lz-2016.06.16 任务区域标类型的任务图标不隐藏,npc对象改为UIMapLabel所在的npc对象,而不是任务的归属npc对象 MissionLabel missionLabel = (MissionLabel)mapLabel._ILabel; //lz-2016.10.12 这里能return,return会结束循环,导致后面的Label不能正常遍历检测 if (missionLabel.m_type != MissionLabelType.misLb_target && mapLabel.NpcID != -1) { PeEntity entity = EntityMgr.Instance.Get(mapLabel.NpcID); if (null != entity && null != entity.NpcCmpt && entity.NpcCmpt.IsFollower) { if (mapLabel.gameObject.activeSelf) { mapLabel.gameObject.SetActive(false); } } else { if (!mapLabel.gameObject.activeSelf) { mapLabel.gameObject.SetActive(true); } } } } //lz-2018.01.03 队友更新朝向角度 if (PeGameMgr.IsMulti && mapLabel._ILabel.GetIcon() == MapIcon.AllyPlayer) { MapCmpt mapCmpt = (mapLabel._ILabel as MapCmpt); if (mapCmpt && mapCmpt.Entity && mapCmpt.Entity.peTrans) { mapLabel.transform.rotation = Quaternion.Euler(0, 0, -mapCmpt.Entity.peTrans.rotation.eulerAngles.y); } } } } }
void AddMapLabel(ILabel label) { if (label.GetShow() == EShow.All || label.GetShow() == EShow.MinMap) { UIMapLabel uiLabel = null; if (this.m_MapLabelPool.Count > 0) { uiLabel = this.m_MapLabelPool.Dequeue(); uiLabel.gameObject.SetActive(true); } else { GameObject obj = GameObject.Instantiate(mMapLabelPrefab) as GameObject; obj.transform.parent = mSubInfoPanel.transform; obj.transform.localPosition = Vector3.zero; obj.transform.localScale = Vector3.one; obj.transform.localRotation = Quaternion.identity; uiLabel = obj.GetComponent <UIMapLabel>(); } if (uiLabel != null) { uiLabel.transform.localScale = Vector3.one; uiLabel.SetLabel(label, true); uiLabel.gameObject.name = "MinMapLabel: " + uiLabel._ILabel.GetText(); this.m_CurrentMapLabelList.Add(uiLabel); } TryAddMonsterSiegeEffect(uiLabel); if (label.GetType() == ELabelType.Mission) { MissionLabel ml = label as MissionLabel; if (ml.m_attachOnID != 0) { uiLabel.SetLabelPosByNPC(ml.m_attachOnID); } //missionID = ml.m_missionID; //if ((label as MissionLabel).m_target != null) // targetID = ml.m_target.mID; //if (Pathea.PeGameMgr.IsStory) //{ // if (MissionRepository.m_MissionCommonMap.ContainsKey(missionID)) // { // if (ml.m_type == MissionLabelType.misLb_target) // { // if (MissionRepository.m_TypeFollow.ContainsKey(targetID)) // { // TypeFollowData fol = MissionManager.GetTypeFollowData(targetID); // if (fol.m_LookNameID != 0) // uiLabel.SetLabelPosByNPC(fol.m_LookNameID); // } // else if (MissionRepository.m_TypeSearch.ContainsKey(targetID)) // { // TypeSearchData ser = MissionManager.GetTypeSearchData(targetID); // if (ser.m_NpcID != 0) // uiLabel.SetLabelPosByNPC(ser.m_NpcID); // } // } // else if (ml.m_type == MissionLabelType.misLb_unActive) // { // uiLabel.SetLabelPosByNPC(MissionRepository.m_MissionCommonMap[missionID].m_iNpc); // } // else if (ml.m_type == MissionLabelType.misLb_end) // { // uiLabel.SetLabelPosByNPC(MissionRepository.m_MissionCommonMap[missionID].m_iReplyNpc); // } // } // else // { // foreach (var item in NpcMissionDataRepository.dicMissionData) // { // if (item.Value.m_RandomMission != missionID) // continue; // if (ml.m_type == MissionLabelType.misLb_unActive) // { // uiLabel.SetLabelPosByNPC(item.Key); // } // else if (ml.m_type == MissionLabelType.misLb_end) // { // uiLabel.SetLabelPosByNPC(item.Key); // } // } // } //} //else //{ // if (AdRMRepository.m_AdRandMisMap.ContainsKey(missionID)) // { // if (ml.m_type == MissionLabelType.misLb_target) // { // if (AdRMRepository.m_AdTypeFollow.ContainsKey(targetID)) // { // TypeFollowData fol = MissionManager.GetTypeFollowData(targetID); // if (fol.m_LookNameID != 0) // uiLabel.SetLabelPosByNPC(fol.m_LookNameID); // } // else if (AdRMRepository.m_AdTypeSearch.ContainsKey(targetID)) // { // TypeSearchData ser = MissionManager.GetTypeSearchData(targetID); // if (ser.m_NpcID != 0) // uiLabel.SetLabelPosByNPC(ser.m_NpcID); // } // } // else if (ml.m_type == MissionLabelType.misLb_unActive) // { // uiLabel.SetLabelPosByNPC(AdRMRepository.m_AdRandMisMap[missionID].m_iNpc); // } // else if (ml.m_type == MissionLabelType.misLb_end) // { // uiLabel.SetLabelPosByNPC(AdRMRepository.m_AdRandMisMap[missionID].m_iReplyNpc); // } // } //} } } }
void MinMapMissionLabelRealation(MissionLabel tmp, bool add) //小地图显示任务标示的优先级关系 { if (add) { int npcId = tmp.m_attachOnID; if (tmp.m_type == MissionLabelType.misLb_target) { AddMapLabel(tmp); AddArrowLabel(tmp); return; } if (tmp.m_type == MissionLabelType.misLb_unActive) { if (!npc_receiveSubmit.ContainsKey(npcId)) { npc_receiveSubmit.Add(npcId, new List <MissionLabel>()); npc_receiveSubmit[npcId].Add(tmp); AddMapLabel(tmp); AddArrowLabel(tmp); } else { npc_receiveSubmit[npcId].Add(tmp); if (CheckNpcMissionLabel(npc_receiveSubmit[npcId]) == ReceiveSubmit.receive) { AddMapLabel(tmp); AddArrowLabel(tmp); } } } else if (tmp.m_type == MissionLabelType.misLb_end) { if (!npc_receiveSubmit.ContainsKey(npcId)) { npc_receiveSubmit.Add(npcId, new List <MissionLabel>()); npc_receiveSubmit[npcId].Add(tmp); AddMapLabel(tmp); AddArrowLabel(tmp); } else { if (CheckNpcMissionLabel(npc_receiveSubmit[npcId]) == ReceiveSubmit.receive) { foreach (var item in npc_receiveSubmit[npcId]) { if (item.m_type == MissionLabelType.misLb_unActive) { RemvoeMapLabel(item); RemvoArrowLabel(item); } } } npc_receiveSubmit[npcId].Add(tmp); AddMapLabel(tmp); AddArrowLabel(tmp); } } } else { int npcId = tmp.m_attachOnID; if (tmp.m_type == MissionLabelType.misLb_target) { RemvoeMapLabel(tmp); RemvoArrowLabel(tmp); return; } if (tmp.m_type == MissionLabelType.misLb_unActive) { if (npc_receiveSubmit.ContainsKey(npcId)) { if (CheckNpcMissionLabel(npc_receiveSubmit[npcId]) == ReceiveSubmit.receive) { RemvoeMapLabel(tmp); RemvoArrowLabel(tmp); } npc_receiveSubmit[npcId].Remove(tmp); } else { RemvoeMapLabel(tmp); RemvoArrowLabel(tmp); } } else if (tmp.m_type == MissionLabelType.misLb_end) { RemvoeMapLabel(tmp); RemvoArrowLabel(tmp); if (npc_receiveSubmit.ContainsKey(npcId)) { npc_receiveSubmit[npcId].Remove(tmp); if (CheckNpcMissionLabel(npc_receiveSubmit[npcId]) == ReceiveSubmit.receive) { foreach (var item in npc_receiveSubmit[npcId]) { AddMapLabel(item); AddArrowLabel(item); } } } } } }
void UpdateMapLabel(UIMapLabel lb) { if (lb == null) { m_CurrentMapLabelList.Remove(lb); return; } if (lb.type == ELabelType.Npc) { Vector2 v1 = new Vector2(lb.worldPos.x, lb.worldPos.z); if (null != GameUI.Instance && null != GameUI.Instance.mMainPlayer) //lz-2017.07.31 错误 #11490 Crash { Vector2 v2 = new Vector2(GameUI.Instance.mMainPlayer.position.x, GameUI.Instance.mMainPlayer.position.z); if (PeGameMgr.IsMulti && lb._ILabel.GetIcon() == MapIcon.AllyPlayer) { RepositionMapLabel(lb); //lz-2018.01.03 队友更新朝向角度 MapCmpt mapCmpt = (lb._ILabel as MapCmpt); if (mapCmpt && mapCmpt.Entity && mapCmpt.Entity.peTrans) { lb.transform.rotation = Quaternion.Euler(0, 0, -mapCmpt.Entity.peTrans.rotation.eulerAngles.y); } lb.gameObject.SetActive(true); } else if (lb._ILabel.GetIcon() != PeMap.MapIcon.ServantDeadPlace) { if (Vector2.Distance(v1, v2) < ShowNpcRadiusPx && mCkNpcMask.isChecked) { RepositionMapLabel(lb); lb.gameObject.SetActive(true); } else { lb.gameObject.SetActive(false); } } } } else if (lb.type == ELabelType.User) { lb.gameObject.SetActive(mCkUserMask.isChecked); } else if (lb.type == ELabelType.Vehicle) { lb.gameObject.SetActive(mCkVehicleMask.isChecked); //lz-2016.08.01 �����ؾ�λ�� if (mCkVehicleMask.isChecked) { RepositionMapLabel(lb); } } //lz-2016.06.15 npc����������Ż����ʹӾͲ���ʾ���ͼ��ͼ�������ͼ�� if (lb.type == ELabelType.Mission) { //lz-2016.06.16 ������������͵�����ͼ�겻���أ�npc�����ΪUIMapLabel���ڵ�npc������������Ĺ���npc���� MissionLabel missionLabel = (MissionLabel)lb._ILabel; //lz-2016.07.16 ���ﲻ����ֱ��return�ų��������ᵼ�º����UIMapLabelû�б����������Ը�Ϊ!�ų� if (missionLabel.m_type != MissionLabelType.misLb_target && lb.NpcID != -1) { PeEntity entity = EntityMgr.Instance.Get(lb.NpcID); if (null != entity && null != entity.NpcCmpt && entity.NpcCmpt.IsFollower) { if (lb.gameObject.activeSelf) { lb.gameObject.SetActive(false); } } else { if (!lb.gameObject.activeSelf) { lb.gameObject.SetActive(true); } } } //lz-2016.10.27 多人那边有时候misLb_target需要先添加,后刷新位置 if (missionLabel.NeedOneRefreshPos) { RepositionMapLabel(lb); missionLabel.NeedOneRefreshPos = false; } } }
void AddMapLabel(ILabel label) { if (label.GetShow() == EShow.All || label.GetShow() == EShow.BigMap) { UIMapLabel uiLabel; if (this.m_MapLabelPool.Count > 0) { uiLabel = this.m_MapLabelPool.Dequeue(); uiLabel.gameObject.SetActive(true); } else { GameObject obj = GameObject.Instantiate(mMapLabelPrefab) as GameObject; obj.transform.parent = mMapWnd.transform; obj.transform.localPosition = Vector3.zero; obj.transform.localScale = Vector3.one; obj.transform.localRotation = Quaternion.identity; uiLabel = obj.GetComponent <UIMapLabel>(); } if (uiLabel != null) { uiLabel.transform.localScale = Vector3.one; uiLabel.SetLabel(label); uiLabel.e_OnMouseOver += UIMapLabel_OnMouseOver; uiLabel.e_OnClick += UIMapLabel_OnClick; RepositionMapLabel(uiLabel); uiLabel.gameObject.name = string.Format("MapLabel_{0}_{1}", uiLabel._ILabel.GetType().ToString(), uiLabel._ILabel.GetText()); this.m_CurrentMapLabelList.Add(uiLabel); UpdateMapLabel(uiLabel); } TryAddMonsterSiegeEffect(uiLabel); if (label.GetType() == ELabelType.Mission) { if (label.GetIcon() != 13) { return; } MissionLabel ml = label as MissionLabel; uiLabel.transform.localScale *= 0.5f; if (ml.m_attachOnID != 0) { uiLabel.SetLabelPosByNPC(ml.m_attachOnID); } } //if (missionID == 0 || label.GetIcon() != 13) // return; //uiLabel.transform.localScale *= 0.5f; //if (MissionRepository.m_TypeFollow.ContainsKey(targetID)) //{ // TypeFollowData fol = MissionManager.GetTypeFollowData(targetID); // if (fol.m_LookNameID != 0) // uiLabel.SetLabelPosByNPC(fol.m_LookNameID); //} //else if (MissionRepository.m_TypeSearch.ContainsKey(targetID)) //{ // TypeSearchData ser = MissionManager.GetTypeSearchData(targetID); // if (ser.m_NpcID != 0) // uiLabel.SetLabelPosByNPC(ser.m_NpcID); //} //else if (AdRMRepository.m_AdTypeFollow.ContainsKey(targetID)) //{ // TypeFollowData fol = MissionManager.GetTypeFollowData(targetID); // if (fol.m_LookNameID != 0) // uiLabel.SetLabelPosByNPC(fol.m_LookNameID); //} //else if (AdRMRepository.m_AdTypeSearch.ContainsKey(targetID)) //{ // TypeSearchData ser = MissionManager.GetTypeSearchData(targetID); // if (ser.m_NpcID != 0) // uiLabel.SetLabelPosByNPC(ser.m_NpcID); //} } }
public void SetLabel(PeMap.ILabel _label, bool _inMinMap = false) { this.Init(); m_Label = _label; inMinMap = _inMinMap; if (m_Label == null) { return; } UpdateIcon(); if (_label is TownLabel) { if (Pathea.PeGameMgr.IsAdventure) { TownLabel townLabel = _label as TownLabel; int colorIndex = townLabel.GetAllianceColor(); if (colorIndex >= 0 && colorIndex < AllyColor.AllianceCols.Length) { Color32 color32 = AllyColor.AllianceCols[colorIndex]; SetColor(color32); } SetFriendlyLevelIcon(townLabel.GetFriendlyLevel()); } } else if (_label is MissionLabel) { MissionLabel missionLabel = _label as MissionLabel; SetColor(missionLabel.GetMissionColor()); } //SetEnableClick(m_Label.GetType()!= PeMap.ELabelType.Mission); SetEnableClick(true); UpdateRadiusSize(); // label depth 处理 //从高到底:User,Mission,NPC,Revive,Vehicle,Mark,FastTravel switch (_label.GetType()) { case PeMap.ELabelType.FastTravel: mSpr.depth = 1; break; case PeMap.ELabelType.Mark: mSpr.depth = 2; break; case PeMap.ELabelType.Vehicle: mSpr.depth = 3; break; case PeMap.ELabelType.Revive: mSpr.depth = 4; break; case PeMap.ELabelType.Npc: mSpr.depth = 5; break; case PeMap.ELabelType.Mission: //lz-2016.10.11 如果有任务覆盖的情况,主线在支线上面 MissionLabel missionLabel = _label as MissionLabel; mSpr.depth = MissionManager.IsMainMission(missionLabel.m_missionID)?7:6; break; case PeMap.ELabelType.User: mSpr.depth = 8; break; default: mSpr.depth = 0; break; } }