628 lines
21 KiB
C#
628 lines
21 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Runtime.CompilerServices;
|
||
using Logic.CrashSight;
|
||
using Logic.Multilingual;
|
||
using ParadoxNotion;
|
||
using UnityEngine;
|
||
using RuntimeData;
|
||
using Unity.VisualScripting;
|
||
|
||
|
||
public enum WonderLibrary
|
||
{
|
||
EgyptianRemiliaPEACE,
|
||
EgyptianRemiliaKNOWLEDGE,
|
||
EgyptianRemiliaTRADE,
|
||
EgyptianRemiliaWEALTH,
|
||
EgyptianRemiliaPOWER,
|
||
EgyptianRemiliaPARK,
|
||
EgyptianRemiliaEYE,
|
||
RrenchKaguyaPEACE,
|
||
RrenchKaguyaKNOWLEDGE,
|
||
RrenchKaguyaTRADE,
|
||
RrenchKaguyaWEALTH,
|
||
RrenchKaguyaPOWER,
|
||
RrenchKaguyaPARK,
|
||
RrenchKaguyaEYE,
|
||
GermanyKanakoPEACE,
|
||
GermanyKanakoKNOWLEDGE,
|
||
GermanyKanakoTRADE,
|
||
GermanyKanakoWEALTH,
|
||
GermanyKanakoPOWER,
|
||
GermanyKanakoPARK,
|
||
GermanyKanakoEYE,
|
||
IndianSatoriPEACE,
|
||
IndianSatoriKNOWLEDGE,
|
||
IndianSatoriTRADE,
|
||
IndianSatoriWEALTH,
|
||
IndianSatoriPOWER,
|
||
IndianSatoriPARK,
|
||
IndianSatoriEYE,
|
||
NorwayReimuPEACE,
|
||
NorwayReimuKNOWLEDGE,
|
||
NorwayReimuTRADE,
|
||
NorwayReimuWEALTH,
|
||
NorwayReimuPOWER,
|
||
NorwayReimuPARK,
|
||
NorwayReimuEYE,
|
||
BritishByakurenPEACE,
|
||
BritishByakurenKNOWLEDGE,
|
||
BritishByakurenTRADE,
|
||
BritishByakurenWEALTH,
|
||
BritishByakurenPOWER,
|
||
BritishByakurenPARK,
|
||
BritishByakurenEYE,
|
||
PersianMikoPEACE,
|
||
PersianMikoKNOWLEDGE,
|
||
PersianMikoTRADE,
|
||
PersianMikoWEALTH,
|
||
PersianMikoPOWER,
|
||
PersianMikoPARK,
|
||
PersianMikoEYE,
|
||
ByzantineZanmuPEACE,
|
||
ByzantineZanmuKNOWLEDGE,
|
||
ByzantineZanmuTRADE,
|
||
ByzantineZanmuWEALTH,
|
||
ByzantineZanmuPOWER,
|
||
ByzantineZanmuPARK,
|
||
ByzantineZanmuEYE
|
||
}
|
||
|
||
public enum ResourceSubType{Building,Resource}
|
||
|
||
[Serializable]
|
||
[CreateAssetMenu(fileName = "GridAndResourceDataAssets", menuName = "TH1 Game Data/GridAndResource Data Asset")]
|
||
public class GridAndResourceDataAssets : ScriptableObject
|
||
{
|
||
public List<TerrainInfo> TerrainInfoList;
|
||
public List<ResourceInfo> ResourceInfoList;
|
||
public List<WonderInfo> WonderInfoList;
|
||
public MountainInfo MountainInfo;
|
||
public VegetationInfo VegetationInfo;
|
||
|
||
private Dictionary<ResourceType, ResourceInfo> _resourceInfoDict = new Dictionary<ResourceType, ResourceInfo>();
|
||
|
||
[NonSerialized] private bool _initialized = false;
|
||
|
||
private static Sprite ResolveVisualSprite(Sprite sprite)
|
||
{
|
||
return VisualSpriteResolver.Resolve(sprite);
|
||
}
|
||
|
||
public void Init()
|
||
{
|
||
if (_initialized)
|
||
return;
|
||
foreach (var t in ResourceInfoList)
|
||
_resourceInfoDict[t.Resource] = t;
|
||
|
||
_initialized = true;
|
||
}
|
||
|
||
public bool GetVegetationInfo(out VegetationInfo vegetationInfo)
|
||
{
|
||
vegetationInfo = VegetationInfo;
|
||
return true;
|
||
}
|
||
|
||
public bool GetMountainInfo(out MountainInfo mountainInfo)
|
||
{
|
||
mountainInfo = MountainInfo;
|
||
return true;
|
||
}
|
||
|
||
public bool GetTerrainInfo(TerrainType terrainType, out TerrainInfo terrainInfo)
|
||
{
|
||
terrainInfo = null;
|
||
foreach (var info in TerrainInfoList)
|
||
if (info.TerrainType == terrainType)
|
||
{
|
||
terrainInfo = info;
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
//获得一个varientResource的name和desc
|
||
public void GetResourceVarientInfo(ResourceType resource, PlayerData playerData,GridData gridData,out string name,out string desc)
|
||
{
|
||
name = "";
|
||
desc = "";
|
||
if (!GetResourceInfo(resource, out var resourceInfo)) return;
|
||
uint cid = playerData?.PlayerCivId ?? 0;
|
||
uint forceid = playerData?.PlayerForceId ?? 0;
|
||
//如果是remilia 特别类,过一遍remilia的滤网,优先级更高
|
||
if (gridData.HasSpType(GridSpType.RemiliaGrid))
|
||
{
|
||
if(resource == ResourceType.Animal || resource == ResourceType.Fruit )
|
||
foreach(var t in resourceInfo.SpriteList)
|
||
if (t.IsGridSpType && t.GridSpType == GridSpType.RemiliaGrid)
|
||
{
|
||
name = t.Name;
|
||
desc = t.Desc;
|
||
return;
|
||
}
|
||
}
|
||
|
||
//如果是kaguya 特别类,过一遍kaguya的滤网
|
||
if (gridData.HasSpType(GridSpType.KaguyaGrid))
|
||
{
|
||
if(resource == ResourceType.Animal || resource == ResourceType.Fruit )
|
||
foreach(var t in resourceInfo.SpriteList)
|
||
if (t.IsGridSpType && t.GridSpType == GridSpType.KaguyaGrid)
|
||
{
|
||
name = t.Name;
|
||
desc = t.Desc;
|
||
return;
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
public bool GetResourceInfo(ResourceType resource, out ResourceInfo resourceInfo)
|
||
{
|
||
Init();
|
||
return _resourceInfoDict.TryGetValue(resource, out resourceInfo);
|
||
}
|
||
|
||
public bool GetWonderInfo(WonderLibrary wonder, out WonderInfo wonderInfo)
|
||
{
|
||
wonderInfo = null;
|
||
foreach (var t in WonderInfoList)
|
||
if (t.Wonder == wonder)
|
||
{
|
||
wonderInfo = t;
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
public bool GetWonderInfoByType(WonderTypeEnum wonder, PlayerData player, out WonderInfo wonderInfo)
|
||
{
|
||
wonderInfo = null;
|
||
foreach (var t in WonderInfoList)
|
||
if (t.WonderType == wonder && t.CivId == player.PlayerCivId && t.ForceId == player.PlayerForceId)
|
||
{
|
||
wonderInfo = t;
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
public bool GetWonderInfoByType(WonderTypeEnum wonder, Empire empire, out WonderInfo wonderInfo)
|
||
{
|
||
wonderInfo = null;
|
||
foreach (var t in WonderInfoList)
|
||
if (t.WonderType == wonder && t.Civ == empire.Civ && t.Force == empire.Force)
|
||
{
|
||
wonderInfo = t;
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
|
||
|
||
public Sprite GetWonderSprite(WonderLibrary wonder)
|
||
{
|
||
if (!GetWonderInfo(wonder, out var wonderInfo))
|
||
return null;
|
||
return wonderInfo.Sprite;
|
||
}
|
||
|
||
public Sprite GetWonderSprite(Empire empire,WonderTypeEnum wonderType)
|
||
{
|
||
if (!Table.Instance.GridAndResourceDataAssets.GetWonderInfoByType( wonderType,empire, out var wonderInfo)) return null;
|
||
return GetWonderSprite(wonderInfo.Wonder);
|
||
}
|
||
|
||
public Sprite GetMountainSprite(GridData grid)
|
||
{
|
||
if (grid.Feature != TerrainFeature.Mountain) return null;
|
||
if (!GetMountainInfo(out var info)) return null;
|
||
//如果是remilia 特别类,先过一遍remilia的滤网,优先级高于kaguya
|
||
if (grid.HasSpType(GridSpType.RemiliaGrid))
|
||
foreach (var t in info.SpriteList)
|
||
if (t.IsGridSpType && t.GridSpType == GridSpType.RemiliaGrid)
|
||
return t.Sprite;
|
||
//如果是kaguya 特别类,先过一遍kaguya的滤网
|
||
if (grid.HasSpType(GridSpType.KaguyaGrid))
|
||
foreach (var t in info.SpriteList)
|
||
if (t.IsGridSpType && t.GridSpType == GridSpType.KaguyaGrid)
|
||
return t.Sprite;
|
||
foreach (var t in info.SpriteList)
|
||
if (grid.CivId == t.CivId)
|
||
return t.Sprite;
|
||
return null;
|
||
}
|
||
|
||
public Sprite GetTerrainSprite(GridData grid)
|
||
{
|
||
if (!GetTerrainInfo(grid.Terrain,out var info)) return null;
|
||
if (!info.VarientSprite)
|
||
return ResolveVisualSprite(info.Sprite);
|
||
|
||
//如果是remilia 特别类,先过一遍remilia的滤网,优先级高于kaguya
|
||
if (grid.HasSpType(GridSpType.RemiliaGrid))
|
||
foreach (var t in info.SpriteList)
|
||
if (t.IsGridSpType && t.GridSpType == GridSpType.RemiliaGrid)
|
||
return ResolveVisualSprite(t.Sprite);
|
||
//如果是kaguya 特别类,先过一遍kaguya的滤网
|
||
if (grid.HasSpType(GridSpType.KaguyaGrid))
|
||
foreach (var t in info.SpriteList)
|
||
if (t.IsGridSpType && t.GridSpType == GridSpType.KaguyaGrid)
|
||
return ResolveVisualSprite(t.Sprite);
|
||
//如果是地脉格,使用地脉特殊外观(阵营限制由表格配置控制)
|
||
if (grid.HasSpType(GridSpType.LeyLine))
|
||
foreach (var t in info.SpriteList)
|
||
if (t.IsGridSpType && t.GridSpType == GridSpType.LeyLine)
|
||
return ResolveVisualSprite(t.Sprite);
|
||
|
||
|
||
|
||
foreach (var t in info.SpriteList)
|
||
if (grid.CivId == t.CivId)
|
||
return ResolveVisualSprite(t.Sprite);
|
||
return ResolveVisualSprite(info.Sprite);
|
||
}
|
||
|
||
/// <summary>
|
||
/// 获取默认地形精灵(不处理特殊类型如LayLine等)
|
||
/// </summary>
|
||
public Sprite GetDefaultTerrainSprite(GridData grid)
|
||
{
|
||
if (!GetTerrainInfo(grid.Terrain, out var info)) return null;
|
||
if (!info.VarientSprite)
|
||
return ResolveVisualSprite(info.Sprite);
|
||
|
||
// 只根据CivId返回基础精灵,不处理特殊类型的覆盖
|
||
foreach (var t in info.SpriteList)
|
||
if (grid.CivId == t.CivId && !t.IsGridSpType)
|
||
return ResolveVisualSprite(t.Sprite);
|
||
return ResolveVisualSprite(info.Sprite);
|
||
}
|
||
|
||
public Sprite GetGroundSprite(CivEnum civEnum, GridSpType gridSpType)
|
||
{
|
||
foreach (var t in TerrainInfoList)
|
||
{
|
||
if (t.TerrainType == TerrainType.Land)
|
||
{
|
||
foreach(var p in t.SpriteList)
|
||
if (Table.Instance.TransCivIdToCivEnum(p.CivId) == civEnum && p.GridSpType == gridSpType)
|
||
{
|
||
return ResolveVisualSprite(p.Sprite);
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
|
||
return null;
|
||
}
|
||
|
||
public Sprite GetVegetationSprite(GridData grid)
|
||
{
|
||
if (grid.Vegetation != Vegetation.Trees) return null;
|
||
if (!GetVegetationInfo(out var info)) return null;
|
||
//如果是remilia 特别类,先过一遍remilia的滤网,优先级高于kaguya
|
||
if (grid.HasSpType(GridSpType.RemiliaGrid))
|
||
foreach (var t in info.SpriteList)
|
||
if (t.IsGridSpType && t.GridSpType == GridSpType.RemiliaGrid)
|
||
return t.Sprite;
|
||
|
||
//如果是kaguya 特别类,先过一遍kaguya的滤网
|
||
if (grid.HasSpType(GridSpType.KaguyaGrid))
|
||
foreach (var t in info.SpriteList)
|
||
if (t.IsGridSpType && t.GridSpType == GridSpType.KaguyaGrid)
|
||
return t.Sprite;
|
||
foreach (var t in info.SpriteList)
|
||
if (grid.CivId == t.CivId)
|
||
return t.Sprite;
|
||
return null;
|
||
}
|
||
|
||
public Sprite GetResourceSprite(ResourceType resource, PlayerData playerData,GridData gridData,bool mirror = false)
|
||
{
|
||
if (!GetResourceInfo(resource, out var resourceInfo))
|
||
return null;
|
||
uint cid = playerData?.PlayerCivId ?? 0;
|
||
uint forceid = playerData?.PlayerForceId ?? 0;
|
||
//如果是remilia 特别类,先过一遍remilia的滤网,优先级高于kaguya
|
||
if (gridData.HasSpType(GridSpType.RemiliaGrid))
|
||
{
|
||
if(resource == ResourceType.Animal)
|
||
foreach(var t in resourceInfo.SpriteList)
|
||
if (t.IsGridSpType && t.GridSpType == GridSpType.RemiliaGrid)
|
||
return t.Sprite;
|
||
if(resource == ResourceType.Fruit)
|
||
foreach(var t in resourceInfo.SpriteList)
|
||
if (t.IsGridSpType && t.GridSpType == GridSpType.RemiliaGrid)
|
||
return t.Sprite;
|
||
}
|
||
|
||
//如果是kaguya 特别类,过一遍kaguya的滤网
|
||
if (gridData.HasSpType(GridSpType.KaguyaGrid))
|
||
{
|
||
if(resource == ResourceType.Animal)
|
||
foreach(var t in resourceInfo.SpriteList)
|
||
if (t.IsGridSpType && t.GridSpType == GridSpType.KaguyaGrid)
|
||
return t.Sprite;
|
||
if(resource == ResourceType.Fruit)
|
||
foreach(var t in resourceInfo.SpriteList)
|
||
if (t.IsGridSpType && t.GridSpType == GridSpType.KaguyaGrid)
|
||
return t.Sprite;
|
||
}
|
||
|
||
//如果是通用sprite且有mirror
|
||
if (!resourceInfo.VarientSprite && mirror)
|
||
{
|
||
if (resourceInfo.HasMirror) return resourceInfo.MirrorSprite;
|
||
return resourceInfo.Sprite;
|
||
}
|
||
//如果是根据等级或者种族变化的
|
||
if (resourceInfo.CivIdForceIdNotFromPlayer)
|
||
cid = gridData?.CivId ?? 0;
|
||
if (resourceInfo.VarientSprite)
|
||
{
|
||
foreach(var t in resourceInfo.SpriteList)
|
||
{
|
||
if ((t.IgnoreCivId || t.CivId == cid)
|
||
&& (t.IgnoreForceId || t.ForceId == forceid))
|
||
{
|
||
if (!t.HasLevel || gridData == null) return t.Sprite;
|
||
//如果是拥有level的建筑,还要根据level返回
|
||
if (t.LevelSprite.Count == 0)
|
||
{
|
||
LogSystem.LogError($"LevelSprite Count is 0 {gridData.Resource} : {gridData.buildingLevel}");
|
||
return null;
|
||
}
|
||
if (gridData.buildingLevel < 0)
|
||
{
|
||
LogSystem.LogError($"building Level < 0 {gridData.Resource} : {gridData.buildingLevel}");
|
||
return null;
|
||
}
|
||
if (gridData.buildingLevel >= t.LevelSprite.Count)
|
||
{
|
||
LogSystem.LogError($"gridData BuildingLevel Overflow {gridData.Resource} : {gridData.buildingLevel}");
|
||
return t.LevelSprite[0];
|
||
}
|
||
return t.LevelSprite[gridData.buildingLevel];
|
||
}
|
||
}
|
||
}
|
||
return resourceInfo.Sprite;
|
||
}
|
||
|
||
public string GetWonderName(WonderLibrary wonder,PlayerData playerData)
|
||
{
|
||
if (!GetWonderInfo(wonder, out var wonderInfo))
|
||
return "";
|
||
return wonderInfo.Name;
|
||
}
|
||
|
||
public string GetResourceName(ResourceType resource,Empire empire,GridSpType spType)
|
||
{
|
||
|
||
if (!_resourceInfoDict.TryGetValue(resource, out var resourceInfo))
|
||
{
|
||
Debug.Log("Error In GetResourceName , " + resource);
|
||
return "Error In GetResourceName";
|
||
}
|
||
|
||
|
||
return resourceInfo.GetResourceName(empire,spType);
|
||
}
|
||
|
||
public string GetResourceNameWithLevel_DECODE(GridData grid,Empire empire, GridSpType spType)
|
||
{
|
||
|
||
if (!_resourceInfoDict.TryGetValue(grid.Resource, out var resourceInfo))
|
||
{
|
||
Debug.Log("Error In GetResourceName , " + grid.Resource);
|
||
return "Error In GetResourceName";
|
||
}
|
||
|
||
//保护区特殊判断
|
||
if (grid.Resource == ResourceType.Preserve)
|
||
{
|
||
if (grid.buildingLevel == 2)
|
||
return MultilingualManager.Instance.GetMultilingualText(Table.Instance.TextDataAssets.NationParkName);
|
||
if(grid.Vegetation == Vegetation.Trees)
|
||
return MultilingualManager.Instance.GetMultilingualText(Table.Instance.TextDataAssets.ForestPreserveName);
|
||
if(grid.Terrain == TerrainType.ShallowSea)
|
||
return MultilingualManager.Instance.GetMultilingualText(Table.Instance.TextDataAssets.WaterPreserveName);
|
||
if(grid.Terrain == TerrainType.DeepSea)
|
||
return MultilingualManager.Instance.GetMultilingualText(Table.Instance.TextDataAssets.OceanPreserveName);
|
||
if(grid.Feature == TerrainFeature.Mountain)
|
||
return MultilingualManager.Instance.GetMultilingualText(Table.Instance.TextDataAssets.MountainPreserveName);
|
||
}
|
||
|
||
var name = MultilingualManager.Instance.GetMultilingualTextSafe(resourceInfo.GetResourceName(empire,spType));
|
||
if(resourceInfo.HasLevel)
|
||
return name + " Lv." + grid.buildingLevel;
|
||
if (resourceInfo.Resource == ResourceType.Wonder)
|
||
return name.Replace("{param}", "");
|
||
return name;
|
||
}
|
||
|
||
|
||
|
||
public ResourceType GetMillLikeRelative(ResourceType resource)
|
||
{
|
||
if (resource == ResourceType.Sawmill)
|
||
return ResourceType.LumberHut;
|
||
if (resource == ResourceType.Windmill)
|
||
return ResourceType.Farm;
|
||
if (resource == ResourceType.Forge)
|
||
return ResourceType.Mine;
|
||
if (resource == ResourceType.Mine)
|
||
return ResourceType.Forge;
|
||
if (resource == ResourceType.Farm)
|
||
return ResourceType.Windmill;
|
||
if (resource == ResourceType.LumberHut)
|
||
return ResourceType.Sawmill;
|
||
return ResourceType.None;
|
||
}
|
||
|
||
public bool CheckCanBeDestroy(ResourceType resourceType)
|
||
{
|
||
return resourceType is ResourceType.Temple or ResourceType.ForestTemple
|
||
or ResourceType.MountainTemple or ResourceType.WaterTemple or ResourceType.KingTemple
|
||
or ResourceType.Windmill or ResourceType.Sawmill or ResourceType.Forge
|
||
or ResourceType.LumberHut or ResourceType.Farm or ResourceType.Mine
|
||
or ResourceType.Port
|
||
or ResourceType.Market
|
||
or ResourceType.Wonder
|
||
or ResourceType.Academy or ResourceType.Preserve
|
||
or ResourceType.Military or ResourceType.NavalBase or ResourceType.RemiliaMilitary
|
||
or ResourceType.MoriyaMilitary
|
||
or ResourceType.KaguyaFrenchYard
|
||
or ResourceType.EgyptianIrrigation or ResourceType.MetalStation
|
||
or ResourceType.Bridge;
|
||
}
|
||
}
|
||
|
||
|
||
[Serializable]
|
||
public class TerrainInfo
|
||
{
|
||
public TerrainType TerrainType;
|
||
public Sprite Sprite;
|
||
public bool VarientSprite;
|
||
[MultilingualField]
|
||
public string ResourceName;
|
||
[MultilingualField]
|
||
public string ResourceDesc;
|
||
public List<EmpireGridSpInfoPack> SpriteList;
|
||
}
|
||
|
||
[Serializable]
|
||
public class MountainInfo
|
||
{
|
||
[MultilingualField]
|
||
public string ResourceName;
|
||
[MultilingualField]
|
||
public string ResourceDesc;
|
||
public List<EmpireGridSpInfoPack> SpriteList;
|
||
|
||
|
||
}
|
||
|
||
[Serializable]
|
||
public class VegetationInfo
|
||
{
|
||
[MultilingualField]
|
||
public string ResourceName;
|
||
[MultilingualField]
|
||
public string ResourceDesc;
|
||
public List<EmpireGridSpInfoPack> SpriteList;
|
||
|
||
public bool GetEmpireGridSpInfoPack(Empire empire,GridSpType spType, out EmpireGridSpInfoPack pack)
|
||
{
|
||
pack = null;
|
||
if (SpriteList.Count == 0) return false;
|
||
foreach (var tpack in SpriteList)
|
||
if(tpack.CheckEmpire(empire,spType))
|
||
{
|
||
pack = tpack;
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
}
|
||
public string GetResourceDesc(Empire empire, GridSpType spType)
|
||
{
|
||
if(SpriteList.Count == 0)return ResourceDesc;
|
||
if(GetEmpireGridSpInfoPack(empire,spType,out var pack) && pack.Desc != "")
|
||
return pack.Desc;
|
||
return ResourceDesc;
|
||
}
|
||
|
||
public string GetResourceName(Empire empire, GridSpType spType)
|
||
{
|
||
if(SpriteList.Count == 0)return ResourceName;
|
||
if(GetEmpireGridSpInfoPack(empire,spType,out var pack) && pack.Name != "")
|
||
return pack.Name;
|
||
return ResourceName;
|
||
}
|
||
}
|
||
|
||
[Serializable]
|
||
public class ResourceInfo
|
||
{
|
||
public ResourceType Resource;
|
||
public ResourceSubType ResourceSubType;
|
||
public Sprite Sprite;
|
||
[MultilingualField]
|
||
public string ResourceName;
|
||
[MultilingualField]
|
||
public string ResourceDesc;
|
||
public int Exp;
|
||
|
||
//如果是神像,确定是什么棋子类型
|
||
public ChessType ChessType;
|
||
//动物、植物、土地这些 不从player读取civid和forceid的情况
|
||
public bool CivIdForceIdNotFromPlayer;
|
||
//每个城市只能有一个
|
||
public bool HasLevel;
|
||
public int MaxLevel;
|
||
public int CityExpPerLevel;
|
||
public bool HasMirror;
|
||
public Sprite MirrorSprite;
|
||
public bool VarientSprite;
|
||
public List<EmpireGridSpInfoPack> SpriteList;
|
||
|
||
|
||
public bool GetEmpireGridSpInfoPack(Empire empire,GridSpType spType, out EmpireGridSpInfoPack pack)
|
||
{
|
||
pack = null;
|
||
if (SpriteList.Count == 0) return false;
|
||
foreach (var tpack in SpriteList)
|
||
if(tpack.CheckEmpire(empire,spType))
|
||
{
|
||
pack = tpack;
|
||
return true;
|
||
}
|
||
|
||
return false;
|
||
}
|
||
public string GetResourceDesc(Empire empire, GridSpType spType)
|
||
{
|
||
if(SpriteList.Count == 0)return ResourceDesc;
|
||
if(GetEmpireGridSpInfoPack(empire,spType,out var pack) && pack.Desc != "")
|
||
return pack.Desc;
|
||
return ResourceDesc;
|
||
}
|
||
|
||
public string GetResourceName(Empire empire, GridSpType spType)
|
||
{
|
||
if(SpriteList.Count == 0)return ResourceName;
|
||
if(GetEmpireGridSpInfoPack(empire,spType,out var pack) && pack.Name != "")
|
||
return pack.Name;
|
||
return ResourceName;
|
||
}
|
||
}
|
||
|
||
[Serializable]
|
||
public class WonderInfo
|
||
{
|
||
public WonderLibrary Wonder;
|
||
public WonderTypeEnum WonderType;
|
||
public uint CivId;
|
||
public CivEnum Civ => Table.Instance.TransCivIdToCivEnum(CivId);
|
||
public uint ForceId;
|
||
public ForceEnum Force => Table.Instance.TransForceIdToForceEnum(ForceId);
|
||
public Sprite Sprite;
|
||
[MultilingualField]
|
||
public string Name;
|
||
[MultilingualField]
|
||
public string Desc;
|
||
public int Exp;
|
||
|
||
}
|