Class CountrySystem
Single source of truth for all country/nation data Manages CountryHotData (8-byte) array for frequently accessed data Lazy-loads CountryColdData for detailed information Performance: Structure of Arrays, hot/cold separation, zero allocations
public class CountrySystem : MonoBehaviour
- Inheritance
-
objectCountrySystem
Properties
ActiveCountryIds
public NativeList<ushort> ActiveCountryIds { get; }
Property Value
- NativeList<ushort>
Capacity
public int Capacity { get; }
Property Value
- int
CountryCount
public int CountryCount { get; }
Property Value
- int
IsInitialized
public bool IsInitialized { get; }
Property Value
- bool
Methods
Dispose()
public void Dispose()
GetAllCountryIds(Allocator)
public NativeArray<ushort> GetAllCountryIds(Allocator allocator = Allocator.TempJob)
Parameters
allocatorAllocator
Returns
- NativeArray<ushort>
GetCountryColdData(ushort)
public CountryColdData GetCountryColdData(ushort countryId)
Parameters
countryIdushort
Returns
GetCountryColor(ushort)
public Color32 GetCountryColor(ushort countryId)
Parameters
countryIdushort
Returns
GetCountryGraphicalCulture(ushort)
public byte GetCountryGraphicalCulture(ushort countryId)
Parameters
countryIdushort
Returns
- byte
GetCountryHotData(ushort)
public CountryHotData GetCountryHotData(ushort countryId)
Parameters
countryIdushort
Returns
GetCountryIdFromTag(string)
public ushort GetCountryIdFromTag(string tag)
Parameters
tagstring
Returns
- ushort
GetCountryTag(ushort)
public string GetCountryTag(ushort countryId)
Parameters
countryIdushort
Returns
- string
HasCountry(ushort)
public bool HasCountry(ushort countryId)
Parameters
countryIdushort
Returns
- bool
HasCountryFlag(ushort, byte)
public bool HasCountryFlag(ushort countryId, byte flag)
Parameters
countryIdushortflagbyte
Returns
- bool
HasTag(string)
public bool HasTag(string tag)
Parameters
tagstring
Returns
- bool
Initialize(EventBus)
Initialize the country system with event bus
public void Initialize(EventBus eventBus)
Parameters
eventBusEventBus
InitializeEmpty()
Initialize empty country system for map-only mode No country data loaded
public void InitializeEmpty()
InitializeFromCountryData(CountryDataLoadResult)
public void InitializeFromCountryData(CountryDataLoadResult countryDataResult)
Parameters
countryDataResultCountryDataLoadResult
LoadState(BinaryReader)
Load CountrySystem state from binary reader Restores: capacity, hot data arrays, id mappings, tags, cold data cache Note: Must be called AFTER Initialize() but BEFORE any country operations
public void LoadState(BinaryReader reader)
Parameters
readerBinaryReader
SaveState(BinaryWriter)
Save CountrySystem state to binary writer Serializes: capacity, hot data arrays, id mappings, tags, cold data cache
public void SaveState(BinaryWriter writer)
Parameters
writerBinaryWriter
SetCountryColor(ushort, Color32)
public void SetCountryColor(ushort countryId, Color32 newColor)
Parameters
countryIdushortnewColorColor32