示例#1
0
    /// <summary>
    /// 绘制星系
    /// </summary>
    /// <param name="currentStarTid"></param>
    private void DrawMap(int currentStarTid)
    {
        int count = m_CfgStarmapProxy.GetFixedStarCount();

        for (int i = 0; i < count; i++)
        {
            EditorFixedStar   data = m_CfgStarmapProxy.GetFixedStarByIndex(i);
            StarGalaxyElement cell =
                (OwnerView as StarGalaxyPanel).CellPrefab.Spawn(m_AreaPointContainer, data.position.ToVector2())
                .GetOrAddComponent <StarGalaxyElement>();

            cell.GetComponent <Toggle>().group = m_AreaPointContainer.GetOrAddComponent <ToggleGroup>();
            cell.transform.localScale          = Vector3.one;
            cell.transform.eulerAngles         = Vector3.zero;
            cell.SetData(data, data.fixedStarId == currentStarTid, data.fixedStarId == m_BeforeID);
            CheckMissionTeamInStar(cell);
            m_PointDic.Add(data.fixedStarId, cell);
            cell.OnSelected = StarPointOnSelected;
            cell.OnClick    = StarPointOnClick;
            if (data.fixedStarId == m_BeforeID)
            {
                m_CurrentCell = cell;
            }
        }
    }
 public void ExportStarMap()
 {
     if (m_StarMapVoList != null && m_StarMapVoList.Count > 0)
     {
         EditorStarMap            starMapData = new EditorStarMap();
         List <EditorFixedStar>   fixedStars  = new List <EditorFixedStar>();
         List <EditorPlanet>      planets     = new List <EditorPlanet>();
         List <EditorStarMapArea> planetAreas = new List <EditorStarMapArea>();
         FixedStarElement         element     = null;
         for (int iStar = 0; iStar < m_StarMapVoList.Count; iStar++)
         {
             StarMapVO       starMapVo = m_StarMapVoList[iStar];
             EditorFixedStar fixedStar = new EditorFixedStar();
             fixedStars.Add(fixedStar);
             fixedStar.fixedStarId   = starMapVo.FixedStarid;
             fixedStar.fixedStarName = starMapVo.Name;
             fixedStar.fixedStarRes  = starMapVo.AssetName;
             fixedStar.relations     = starMapVo.Relation_Id;
             element = m_StarMapMainPanel.GetElement(starMapVo.FixedStarid);
             if (element != null)
             {
                 fixedStar.position = new EditorPosition2D(element.GetPosition());
             }
             planets.Clear();
             SavePlanet(planets, starMapVo.FixedStarid, planetAreas, fixedStar);
             fixedStar.planetList = planets.ToArray();
         }
         starMapData.fixedStars = fixedStars.ToArray();
         EditorGamingMapData.SaveStarMapToJson(starMapData);
     }
 }
示例#3
0
    /// <summary>
    /// 获取一个星域数据
    /// </summary>
    /// <param name="starTid"></param>
    /// <param name="PlanetTid"></param>
    /// <returns></returns>
    public EditorPlanet GetPlanet(int starTid, uint PlanetTid)
    {
        EditorFixedStar star = GetFixedStarByTid(starTid);

        if (star != null && star.PlanetDic.TryGetValue(PlanetTid, out EditorPlanet value))
        {
            return(value);
        }
        return(null);
    }
示例#4
0
    /// <summary>
    /// 设置星系数据
    /// </summary>
    /// <param name="data"></param>
    /// <param name="isCurrentPoint"></param>
    public void SetData(EditorFixedStar data, bool isCurrentPoint, bool selected = false)
    {
        Initialize();
        m_Data = data;

        SetName($"starmap_name_{data.fixedStarId}");
        SetLocationVisible(isCurrentPoint);
        SetSelectState(selected);
        SetModel(data.fixedStarRes);
    }
示例#5
0
 public override void OnShow(object msg)
 {
     base.OnShow(msg);
     m_CfgEternityProxy  = GameFacade.Instance.RetrieveProxy(ProxyName.CfgEternityProxy) as CfgEternityProxy;
     m_TaskTrackingProxy = GameFacade.Instance.RetrieveProxy(ProxyName.TaskTrackingProxy) as TaskTrackingProxy;
     m_TeamProxy         = GameFacade.Instance.RetrieveProxy(ProxyName.TeamProxy) as TeamProxy;
     if (msg is MsgStarmapPanelState)
     {
         m_Data     = (msg as MsgStarmapPanelState).Data as EditorFixedStar;
         m_BeforeID = (uint)(msg as MsgStarmapPanelState).BeforeID;
     }
     LoadViewPart(ASSET_ADDRESS, OwnerView.OtherBox);
 }
        /// <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();
                    }
                }
            }
        }