/// <summary>�����������ģ����MapLabel,�����DZ���û�е���¼���MapLabel�ڸ�ס�˿��Ե����MapLabel</summary> void TryClickNextLable(UIMapLabel sender, bool leftClick) { Ray ray = new Ray(); ray.origin = sender.transform.position; ray.direction = ray.origin; RaycastHit[] hitArray = Physics.RaycastAll(ray); if (null != hitArray && hitArray.Length > 0) { for (int i = 0; i < hitArray.Length; i++) { UIMapLabel hitLable = hitArray[i].collider.GetComponent <UIMapLabel>(); if (null == hitLable || hitLable == sender) { continue; } if (leftClick) { if (hitLable.type == ELabelType.User) { OpenMaskWnd(hitLable); } else if (hitLable.fastTrval) { OpenWarpWnd(hitLable); } else { continue; } } else { if (hitLable.type == ELabelType.User) { if (PeGameMgr.IsMulti) { UserLabel userLb = hitLable._ILabel as UserLabel; if (userLb != null && userLb.playerID == PlayerNetwork.mainPlayerId) { PlayerNetwork.mainPlayer.RequestRemoveMask(userLb.index); } } else { UserLabel.Mgr.Instance.Remove(hitLable._ILabel as UserLabel); } } else { continue; } } break; } } }
void RemvoeMapLabel(ILabel label) { UIMapLabel uiLabel = m_CurrentMapLabelList.Find(itr => (itr._ILabel.CompareTo(label))); if (uiLabel != null) { TryRemoveMonsterSiegeEffect(uiLabel); uiLabel.gameObject.SetActive(false); this.m_CurrentMapLabelList.Remove(uiLabel); this.m_MapLabelPool.Enqueue(uiLabel); } }
//lz-2016.09.01 如果是Sotry模式,开始使用肉,只有过了314任务才会使用货币 protected override void OpenWarpWnd(UIMapLabel label) { if (Pathea.Money.Digital) { mMeatSprite.gameObject.SetActive(false); mMoneySprite.gameObject.SetActive(true); } else { mMeatSprite.gameObject.SetActive(true); mMoneySprite.gameObject.SetActive(false); } base.OpenWarpWnd(label); }
protected virtual void UIMapLabel_OnMouseOver(UIMapLabel sender, bool isOver) { if (isOver) { if (sender.descText == "") { mPosLabal.text = ((int)sender.worldPos.x).ToString() + "," + ((int)sender.worldPos.z).ToString(); } else { mPosLabal.text = sender.descText + "\n" + ((int)sender.worldPos.x).ToString() + "," + ((int)sender.worldPos.z).ToString(); } } mShowDes = isOver; }
protected virtual void UIMapLabel_OnClick(UIMapLabel sender) { if (Input.GetMouseButtonUp(0)) { if (sender.type == ELabelType.User) { OpenMaskWnd(sender); } else if (sender.fastTrval) { OpenWarpWnd(sender); } else { TryClickNextLable(sender, true); } } else if (Input.GetMouseButtonUp(1)) { if (sender.type == ELabelType.User) { if (PeGameMgr.IsMulti) { UserLabel userLb = sender._ILabel as UserLabel; if (userLb != null && userLb.playerID == PlayerNetwork.mainPlayerId) { PlayerNetwork.mainPlayer.RequestRemoveMask(userLb.index); } } else { UserLabel.Mgr.Instance.Remove(sender._ILabel as UserLabel); } //lz-2016.10.24 删除标记,鼠标提示变回位置 mShowDes = false; } else { TryClickNextLable(sender, false); } } }
/// <summary> lz-2016.10.09 尝试添加怪物攻城特效</summary> void TryAddMonsterSiegeEffect(UIMapLabel uiLabel) { ILabel label = uiLabel._ILabel; //lz-2016.09.06 如果是怪物攻城,就添加一个攻城效果 if (null != label && label is MonsterBeaconMark) { MonsterBeaconMark mark = label as MonsterBeaconMark; if (mark.IsMonsterSiege) { TryRemoveMonsterSiegeEffect(uiLabel); GameObject go = (GameObject)Instantiate(m_SiegeEffectPrefab.gameObject); go.transform.parent = uiLabel.transform; go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; go.transform.localRotation = Quaternion.identity; go.GetComponent <MaplabelMonsterSiegeEffect>().Run = true; } } }
protected virtual void OpenMaskWnd(UIMapLabel label) { if (null != label && label.type != ELabelType.User) { return; } mMaskOpWndParent.SetActive(true); mWarpWnd.SetActive(false); mIconSelWnd.SetActive(false); Vector3 arrayAtPos = Vector3.zero; if (label == null) { if (mUserIconList.Count > 0) { mMaskSpr.spriteName = mUserIconList[maskIcoIndex].iconName; mMaskSpr_2.spriteName = mUserIconList[maskIcoIndex].iconName; mMaskSpr_2.enabled = true; } mMaskDes.text = PELocalization.GetString(8000702); newUserLabelPos.x = Input.mousePosition.x; newUserLabelPos.y = Input.mousePosition.y; mMaskSpr_2.transform.localPosition = new Vector3(Input.mousePosition.x - Screen.width / 2 , Input.mousePosition.y - Screen.height / 2, -78); arrayAtPos = mMaskSpr_2.transform.position; } else { mMaskSpr.spriteName = label.iconStr; mMaskSpr_2.enabled = false; mMaskDes.text = label.descText; arrayAtPos = label.transform.position; } //lz-2016.07.18 WarpWnd���ݵ����λ����ʾ�ڵ�ĸ��� mMaskOpWnd.transform.SetTransInScreenByMousePos(UIToolFuncs.InScreenOffsetMode.OffsetBounds); //lz-2016.07.18 ������ʾ��λ����ʾ��Ӧ�ļ�ͷָ������ RotateArrayByWnd(mMaskOpWndCenter.position, arrayAtPos, mMaskOpArray, 266, 54); selectMapLabel = label; }
/// <summary> lz-2016.10.09 尝试移除怪物攻城特效</summary> void TryRemoveMonsterSiegeEffect(UIMapLabel uiLabel) { ILabel label = uiLabel._ILabel; //lz-2016.09.06 如果是怪物攻城,就移除掉效果 if (null != label && label is MonsterBeaconMark) { MonsterBeaconMark mark = label as MonsterBeaconMark; if (mark.IsMonsterSiege) { MaplabelMonsterSiegeEffect[] effects = uiLabel.GetComponentsInChildren <MaplabelMonsterSiegeEffect>(true); if (null != effects && effects.Length > 0) { for (int i = 0; i < effects.Length; i++) { effects[i].Run = false; Destroy(effects[i].gameObject); } } } } }
protected virtual void OpenWarpWnd(UIMapLabel label) { if (label == null) { return; } if (RandomDungenMgrData.InDungeon) { return; //lz-2018.01.10 副本中不可以传送 } mWarpWnd.SetActive(true); mMaskOpWndParent.SetActive(false); float dis = (label.worldPos - GameUI.Instance.mMainPlayer.position).magnitude; mMoneyCost = 2 + (int)(dis * 0.02f); mItemCost.text = mMoneyCost.ToString(); mWarpDes.text = label.descText; //lz-2016.07.18 WarpWnd���ݵ����λ����ʾ�ڵ�ĸ��� mWarpWnd.transform.SetTransInScreenByMousePos(UIToolFuncs.InScreenOffsetMode.OffsetBounds); //lz-2016.07.18 ���ݴ�����ʾ��λ����ʾ��ͷָ����λ�� RotateArrayByWnd(mWarpWndCenter.position, label.transform.position, mWarpArray, 264, 70); travelPos = label.worldPos; iconId = -1; if (!Equals(label._ILabel, null)) { iconId = label._ILabel.GetIcon(); } if (label._ILabel is StaticPoint) { //StaticPoint sp = (StaticPoint)label._ILabel; //campId = sp.campId; } }
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 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 RepositionMapLabel(UIMapLabel uiLabel) { uiLabel.transform.localPosition = GetUIPos(uiLabel.worldPos); }
//lz-2016.09.01 只能用货币 protected override void OpenWarpWnd(UIMapLabel label) { mMeatSprite.gameObject.SetActive(false); mMoneySprite.gameObject.SetActive(true); base.OpenWarpWnd(label); }