Exemple #1
0
    //single
    void DeactiveObjNotUse()
    {
        List <int>             followers    = RandomDungenMgrData.GetAllFollowers();
        int                    mainPlayerId = PeCreature.Instance.mainPlayerId;
        IEnumerable <PeEntity> allEntities  = EntityMgr.Instance.All;

        foreach (PeEntity pe in allEntities)
        {
            if (pe.Id != mainPlayerId && !followers.Contains(pe.Id))
            {
                if (pe.gameObject != null)
                {
                    pe.gameObject.SetActive(false);
                    MapCmpt mc = pe.GetCmpt <MapCmpt>();
                    pe.Remove(mc);
                }
            }
        }
        List <PeMap.ILabel> RemoveList = PeMap.LabelMgr.Instance.FindAll(itr => itr.GetType() == PeMap.ELabelType.Mission);

        foreach (PeMap.ILabel _ilabel in RemoveList)
        {
            PeMap.LabelMgr.Instance.Remove(_ilabel);
        }
    }
    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);
                    }
                }
            }
        }
    }
Exemple #3
0
        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;
                }
            }
        }