备份CatanBuilding瘦身独立工程
This commit is contained in:
111
Assets/Scripts/TravelMap/TraveMapDataManager.cs
Normal file
111
Assets/Scripts/TravelMap/TraveMapDataManager.cs
Normal file
@@ -0,0 +1,111 @@
|
||||
using asap.core;
|
||||
using cfg;
|
||||
using GameCore;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class TraveMapDataManager
|
||||
{
|
||||
public List<TraveMapItemData> mapItemList = new List<TraveMapItemData>();
|
||||
public List<TraveMapItemData> mapShowItemData = new List<TraveMapItemData>();
|
||||
public int index = -1;
|
||||
public bool IsVisit { private set; get; } = false; //是否访问地图
|
||||
|
||||
public void Init(bool isVisit)
|
||||
{
|
||||
IsVisit = isVisit;
|
||||
Tables tables = GContext.container.Resolve<Tables>();
|
||||
int mapId = GContext.container.Resolve<CampDataMM>().Id;
|
||||
int maxID = mapId + 5;
|
||||
List<Construction> consDatas = tables.TbConstruction.DataList;
|
||||
List<MapData> mapDatas = tables.TbMapData.DataList;
|
||||
mapItemList.Clear();
|
||||
mapShowItemData.Clear();
|
||||
Construction cons = consDatas[0];
|
||||
MapData mapData= mapDatas[0];
|
||||
int count = 0;
|
||||
for (int i = 0; i < consDatas.Count; i++)
|
||||
{
|
||||
cons = consDatas[i];
|
||||
mapData = mapDatas[i];
|
||||
TraveMapItemData item = new TraveMapItemData();
|
||||
item.index = i;
|
||||
item.id = cons.ID;
|
||||
item.isVisit = IsVisit;
|
||||
item.icon = mapData.TravelMapIcon;
|
||||
item.name = $"{i + 1}.{LocalizationMgr.GetText(mapData.Name_l10n_key)}";
|
||||
if (mapId > cons.ID)
|
||||
{
|
||||
item.type = TraveMapType.unlocked;
|
||||
mapShowItemData.Add(item);
|
||||
}
|
||||
else if (mapId == cons.ID)
|
||||
{
|
||||
//CampData campData = GContext.container.Resolve<CampData>();
|
||||
//if (campData.IsCanSkyscraper)
|
||||
//{
|
||||
// item.type = TraveMapType.unlocked;
|
||||
// mapShowItemData.Add(item);
|
||||
//}
|
||||
//else
|
||||
{
|
||||
item.type = TraveMapType.current;
|
||||
}
|
||||
index = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
item.type = TraveMapType.locked;
|
||||
}
|
||||
mapItemList.Add(item);
|
||||
count = i;
|
||||
if (maxID == cons.ID)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index == -1)
|
||||
{
|
||||
index = mapItemList.Count - 1;
|
||||
}
|
||||
bool isShowTips = true;
|
||||
if (cons.NextID == -1)
|
||||
{
|
||||
isShowTips = false;
|
||||
count++;
|
||||
TraveMapItemData item = new TraveMapItemData();
|
||||
item.index = count;
|
||||
item.icon = "";
|
||||
item.name = $"{count + 1}.{LocalizationMgr.GetText("UI_ToastPanel_24")}";
|
||||
item.type = TraveMapType.comingSoon;
|
||||
mapItemList.Add(item);
|
||||
}
|
||||
|
||||
//滑动框支持从下往上排列???
|
||||
mapItemList.Reverse();
|
||||
mapItemList[0].showTips = isShowTips;
|
||||
index = mapItemList.Count - 1 - index - 1;
|
||||
}
|
||||
|
||||
}
|
||||
public enum TraveMapType
|
||||
{
|
||||
//已解锁
|
||||
//当前
|
||||
//未解锁
|
||||
//敬请期待
|
||||
unlocked,
|
||||
current,
|
||||
locked,
|
||||
comingSoon,
|
||||
}
|
||||
public class TraveMapItemData
|
||||
{
|
||||
public int index;
|
||||
public int id;
|
||||
public string icon;
|
||||
public string name;
|
||||
public string description;
|
||||
public TraveMapType type;
|
||||
public bool showTips;
|
||||
public bool isVisit;
|
||||
}
|
||||
Reference in New Issue
Block a user