Exemple #1
0
        public void Init(PlanetPanel panel, EditorArea[] areas, uint mapId)
        {
            m_Panel       = panel;
            m_GamingMapId = mapId;
            m_PlanetAreas.Clear();
            if (areas != null && areas.Length > 0)
            {
                EditorPlanet planet = m_Panel.m_Root.GetPreviewPlanet(mapId);
                if (planet != null)
                {
                    m_MiniMapSize    = planet.minimapSize;
                    m_FixedStarRes   = planet.bgmapRes;
                    m_FixedStarScale = planet.bgmapScale.ToVector2();
                    if (m_FixedStarContainer != null)
                    {
                        m_FixedStarContainer.rectTransform.sizeDelta = m_FixedStarScale;
                    }

                    m_FixedStarPos = planet.bgmapPos.ToVector2();
                    m_FixedStarObj = StarMapEditorRoot.FindResAsset(m_FixedStarRes);
                }
                for (int iArea = 0; iArea < areas.Length; iArea++)
                {
                    EditorArea editorArea = areas[iArea];
                    if (editorArea == null)
                    {
                        continue;
                    }
                    CreateElement(editorArea, planet);
                }
            }
            RefreshMap();
        }
 public EditorStarMapArea GetPreviewArea(EditorPlanet planet, ulong areaId)
 {
     if (planet == null)
     {
         return(null);
     }
     if (m_PreviewStarMap != null)
     {
         EditorStarMapArea[] areas = planet.arealist;
         if (areas != null && areas.Length > 0)
         {
             for (int iArea = 0; iArea < areas.Length; iArea++)
             {
                 EditorStarMapArea starMapArea = areas[iArea];
                 if (starMapArea == null)
                 {
                     continue;
                 }
                 if (starMapArea.areaId == areaId)
                 {
                     return(starMapArea);
                 }
             }
         }
     }
     return(null);
 }
Exemple #3
0
        private void CreateElement(EditorGamingMap editorData)
        {
            GameObject planetObj = Instantiate(m_FixedStarPanel.m_PlanetElementPrefab);

            planetObj.SetActive(true);
            planetObj.transform.SetParent(transform);

            PlanetElement planetElement = planetObj.GetComponent <PlanetElement>();

            if (planetElement != null)
            {
                EditorPlanet planet = m_FixedStarPanel.m_Root.GetPreviewPlanet(editorData.gamingmapId);
                if (planet != null)
                {
                    planetElement.Init(editorData, planet);
                    //planetObj.transform.localPosition = Vector3.zero;
                }
                else
                {
                    planetElement.Init(editorData, null);
                    //planetObj.transform.localPosition = Vector3.zero;
                    Debug.LogError("PlanetContainer " + m_StarMapId + "新增了:" + editorData.gamingmapId);
                }
                m_PlanetElements.Add(planetElement);
            }
        }
Exemple #4
0
    /// <summary>
    /// 设置行星数据
    /// </summary>
    /// <param name="data"></param>
    /// <param name="isCurrentPoint"></param>
    public void SetData(EditorPlanet data, bool isCurrentPoint, bool selected = false)
    {
        Initialize();
        m_Data = data;

        SetName($"gamingmap_name_{m_Data.gamingmapId}");
        SetLocationVisible(isCurrentPoint);
        SetSelectState(selected);
        SetModel(data.gamingmapRes);
    }
        /// <summary>
        /// 保存行星
        /// </summary>
        /// <param name="planets"></param>
        private void SavePlanet(List <EditorPlanet> planets, int fixedStarId, List <EditorStarMapArea> areaList, EditorFixedStar fixedStar)
        {
            List <EditorGamingMap> gamingDatas = null;

            if (m_GamingMapDatas.TryGetValue(fixedStarId, out gamingDatas))
            {
                PlanetContainer panelContainer = m_FixedStarPanel.GetElement(fixedStarId);
                if (gamingDatas != null)
                {
                    for (int iGaming = 0; iGaming < gamingDatas.Count; iGaming++)
                    {
                        EditorGamingMap gamingData = gamingDatas[iGaming];
                        PlanetElement   element    = null; //= GetElement(gamingData.gamingmap_id);
                        if (panelContainer != null)
                        {
                            element = panelContainer.GetElement(gamingData.gamingmapId);
                        }
                        EditorPlanet editorPlanet = new EditorPlanet();
                        planets.Add(editorPlanet);
                        editorPlanet.gamingmapId   = gamingData.gamingmapId;
                        editorPlanet.gamingmapName = gamingData.gamingmapName;
                        PlanetAreaContainer areaContainer = m_PlanetPanel.ExistElement(gamingData.gamingmapId);
                        if (areaContainer != null)
                        {
                            editorPlanet.minimapSize = areaContainer.m_MiniMapSize;
                            editorPlanet.bgmapRes    = areaContainer.GetStarRes();
                            editorPlanet.bgmapScale  = new EditorPosition2D(areaContainer.m_FixedStarScale);
                            editorPlanet.bgmapPos    = new EditorPosition2D(areaContainer.m_FixedStarPos);
                        }

                        if (element != null)
                        {
                            editorPlanet.gamingmapRes = element.m_Res;
                            editorPlanet.position     = new EditorPosition2D(element.GetPosition());
                            editorPlanet.scale        = new EditorPosition2D(element.GetScale());
                        }
                        areaList.Clear();
                        ulong areaId = 0;
                        SaveArea(gamingData, areaList, ref areaId);
                        if (areaId > 0)
                        {
                            fixedStar.ttGamingMapId  = gamingData.gamingmapId;
                            fixedStar.ttGamingAreaId = areaId;
                        }
                        editorPlanet.arealist = areaList.ToArray();
                    }
                }
            }
        }
Exemple #6
0
        private void CreateElement(EditorArea editorArea, EditorPlanet planet)
        {
            GameObject planetArea = GameObject.Instantiate(m_Panel.m_PlanetAreaElementPrefab);

            planetArea.SetActive(true);
            planetArea.transform.SetParent(transform);
            planetArea.transform.localPosition = Vector3.zero;
            PlanetAreaElement planetElement = planetArea.GetComponent <PlanetAreaElement>();

            if (planetElement != null)
            {
                EditorStarMapArea starMapArea = m_Panel.m_Root.GetPreviewArea(planet, editorArea.areaId);
                planetElement.Init(editorArea, starMapArea);
                m_PlanetAreas.Add(planetElement);
            }
        }
Exemple #7
0
 public void Init(EditorGamingMap gamingData, EditorPlanet planet)
 {
     if (gamingData == null)
     {
         return;
     }
     m_StarData      = gamingData;
     gameObject.name = gamingData.gamingmapName;
     if (m_RectTrans == null)
     {
         m_RectTrans = GetComponent <RectTransform>();
     }
     if (planet != null)
     {
         m_Res = planet.gamingmapRes;
         m_RectTrans.anchoredPosition = planet.position.ToVector2();
         m_ResScale            = planet.scale.ToVector2();
         m_RectTrans.sizeDelta = m_ResScale;
         m_ResObj = StarMapEditorRoot.FindResAsset(m_Res);
     }
 }
Exemple #8
0
    public override void OnShow(object msg)
    {
        base.OnShow(msg);
        m_CfgEternityProxy  = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy;
        m_CfgStarmapProxy   = GameFacade.Instance.RetrieveProxy(ProxyName.CfgStarmapProxy) as CfgStarmapProxy;
        m_TaskTrackingProxy = GameFacade.Instance.RetrieveProxy(ProxyName.TaskTrackingProxy) as TaskTrackingProxy;
        m_TeamProxy         = GameFacade.Instance.RetrieveProxy(ProxyName.TeamProxy) as TeamProxy;
        m_MissionProxy      = GameFacade.Instance.RetrieveProxy(ProxyName.MissionProxy) as MissionProxy;
        if (msg is MsgStarmapPanelState)
        {
            m_Data = (msg as MsgStarmapPanelState).Data as EditorPlanet;
        }
        else
        {
            Eternity.FlatBuffer.Map mapData = m_CfgEternityProxy.GetCurrentMapData();
            m_Data = m_CfgStarmapProxy.GetPlanet(mapData.BelongFixedStar, mapData.GamingmapId);
        }
        m_PointDic = new Dictionary <ulong, StarAreaElement>();
        m_Lines    = new List <GameObject>();

        LoadViewPart(ASSET_ADDRESS, OwnerView.OtherBox);
    }