Esempio n. 1
0
    /// <summary>
    /// 绘制星域
    /// </summary>
    /// <param name="currentAreaUid"></param>
    private void DrawMap(ulong currentAreaUid)
    {
        for (int i = 0; i < m_Data.arealist.Length; i++)
        {
            StarAreaElement cell =
                (OwnerView as StarAreaPanel).PointPrefab.Spawn(m_AreaPointContainer, m_Data.arealist[i].position.ToVector2())
                .AddComponent <StarAreaElement>();

            cell.transform.localScale          = Vector3.one;
            cell.GetComponent <Toggle>().group = m_AreaPointContainer.GetOrAddComponent <ToggleGroup>();
            cell.OnSelected = AreaPointOnSelected;
            UIEventListener.UIEventListener.AttachListener(cell.gameObject).onEnter = OnCellEnter;
            cell.SetData(m_Data.gamingmapId, m_Data.arealist[i], m_Data.arealist[i].areaId == currentAreaUid);
            SetMainIcon(cell);
            CheckMissionTeamInArea(cell);
            m_PointDic.Add(m_Data.arealist[i].areaId, cell);
            if (m_Data.arealist[i].areaId == currentAreaUid)
            {
                m_CurrentCell = cell;
            }
            if (Math.Abs(m_Data.arealist[i].position.ToVector2().x) > m_MapW)
            {
                m_MapW = Math.Abs(m_Data.arealist[i].position.ToVector2().x);
            }
            if (Math.Abs(m_Data.arealist[i].position.ToVector2().y) > m_MapH)
            {
                m_MapH = Math.Abs(m_Data.arealist[i].position.ToVector2().y);
            }
        }
    }
Esempio n. 2
0
 public void OnRefresh()
 {
     if (m_Data != null)
     {
         m_Title.text = TableUtil.GetLanguageString($"gamingmap_name_{m_Data.gamingmapId}");
         m_Starmap3DViewer.SetModel(m_Data.bgmapRes, Vector3.zero, Vector3.zero, Vector3.one);
         m_Starmap3DViewer.GetComponent <RectTransform>().sizeDelta = m_Data.bgmapScale.ToVector2();
         m_Starmap3DViewer.transform.localPosition = m_Data.bgmapPos.ToVector2();
         m_MissionTrackings = m_TaskTrackingProxy.GetAllTrackings();
         m_TeamMembers      = m_TeamProxy.GetMembersList();
         DrawMap(MapManager.GetInstance().GetCurrentAreaUid());
         DrawLine();
         m_AreaPointContainer.sizeDelta = new Vector2(m_Data.minimapSize, m_Data.minimapSize);
         if (!m_CurrentCell)
         {
             foreach (var item in m_PointDic)
             {
                 m_CurrentCell = item.Value as StarAreaElement;
                 break;
             }
         }
         if (m_CurrentCell)
         {
             OwnerView.FocusTo(m_CurrentCell.gameObject);
             m_StarAreaPanelLeftTips.SetData(m_Data.gamingmapId, m_CurrentCell.GetData(), m_MissionTrackings, m_TeamMembers);
             m_StarAreaPanelLeftTips.gameObject.SetActive(true);
         }
         else
         {
             m_StarAreaPanelLeftTips.gameObject.SetActive(false);
         }
         State.GetAction(UIAction.StarArea_TipsToggle).Enabled = m_StarAreaPanelLeftTips.HasToggle();
         m_AreaPointContainer.DOLocalMove(-m_CurrentCell.transform.localPosition, 0.5F).SetEase(Ease.OutExpo);
     }
 }
Esempio n. 3
0
    public override void OnHide()
    {
        State.GetAction(UIAction.StarArea_Leap).Callback         -= OnLeap;
        State.GetAction(UIAction.StarArea_TrackMission).Callback -= OnTrackMission;
        State.GetAction(UIAction.StarArea_TipsToggle).Callback   -= OnToggleTips;
        State.GetAction(UIAction.StarArea_ToPlant).Callback      -= OnEsc;
        State.GetAction(UIAction.StarArea_Legend).Callback       -= OnTab;
        OwnerView.DeleteHotKey(HotKeyID.StarmapOpen);

        m_Scroller.onValueChanged.RemoveAllListeners();
        InputManager.Instance.OnInputDeviceChanged -= OnInputDeviceChanged;
        m_Starmap3DViewer.SetModel(null);
        m_StarAreaPanelLeftTips.OnHide();
        GameObject.Destroy(m_StarAreaPanelLeftTips);
        m_CurrentCell = null;
        foreach (KeyValuePair <ulong, StarAreaElement> item in m_PointDic)
        {
            UIEventListener.UIEventListener.AttachListener(item.Value.gameObject).onEnter = null;
            item.Value.Destroy();
            item.Value.Recycle();
            item.Value.gameObject.Recycle();
        }
        m_PointDic.Clear();
        while (m_Lines.Count > 0)
        {
            m_Lines[0].gameObject.Recycle();
            m_Lines.RemoveAt(0);
        }
        m_Lines.Clear();
        base.OnHide();
    }
Esempio n. 4
0
    private void SetCurrentToNull()
    {
        if (m_CurrentCell)
        {
            m_CurrentCell.SetToggleIsOn(false);
            State.GetAction(UIAction.StarArea_TipsToggle).Enabled = false;
            State.GetAction(UIAction.StarArea_Leap).Enabled       = false;

            m_CurrentCell = null;
        }
    }
Esempio n. 5
0
    private void SetCurrentCell(StarAreaElement cell, float duration = 0.5f)
    {
        if (m_CurrentCell)
        {
            m_CurrentCell.SetToggleIsOn(false);
        }
        m_CurrentCell = cell;
        m_CurrentCell.SetToggleIsOn(true);
        m_AutoMoveing = true;
        m_AreaPointContainer.DOLocalMove(-m_CurrentCell.transform.localPosition, 0.5f).SetEase(Ease.OutExpo).OnComplete(() => { m_AutoMoveing = false; });

        m_StarAreaPanelLeftTips.SetData(m_Data.gamingmapId, m_CurrentCell.GetData(), m_MissionTrackings, m_TeamMembers);

        State.GetAction(UIAction.StarArea_TipsToggle).Enabled = m_StarAreaPanelLeftTips.HasToggle();
        State.GetAction(UIAction.StarArea_Leap).Enabled       = m_Data.gamingmapId == m_CfgEternityProxy.GetCurrentGamingMapId() && m_CurrentCell.GetData().areaId != MapManager.GetInstance().GetCurrentAreaUid();
    }
Esempio n. 6
0
    private void CheckMissionTeamInArea(StarAreaElement cell)
    {
        if (m_MissionTrackings?.Count > 0 || m_TeamMembers.Count > 0)
        {
            bool        hasMain   = false;
            bool        hasBranch = false;
            List <uint> s         = new List <uint>();

            for (int i = 0; i < m_MissionTrackings?.Count; i++)
            {
                if (m_MissionTrackings[i].EndingLeapPointID == cell.GetData().areaId)
                {
                    if (m_MissionTrackings[i].MissionType == MissionType.Main)
                    {
                        hasMain = true;
                    }
                    else if (m_MissionTrackings[i].MissionType == MissionType.Branch)
                    {
                        hasBranch = true;
                    }
                }
            }
            if (hasMain)
            {
                s.Add(31311);
            }
            if (hasBranch)
            {
                s.Add(31312);
            }
            for (int i = 0; i < m_TeamMembers.Count; i++)
            {
                if ((ulong)m_TeamMembers[i].AreaId == cell.GetData().areaId)
                {
                    s.Add(31316);
                }
                break;
            }
            if (s.Count > 0)
            {
                cell.SetBottomIcon(s.ToArray());
                return;
            }
        }
        cell.SetBottomIcon(null);
    }
Esempio n. 7
0
 private void SetMainIcon(StarAreaElement cell)
 {
     cell.SetTopIcon(m_CfgEternityProxy.GetIconIDByEnum((StarmapLeapIcon)cell.GetData().areaType), cell.GetData().area_leap_type == 2);
 }