Table of Contents

Class CountrySystem

Namespace
Core.Systems
Assembly
Core.dll

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
object
CountrySystem

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

allocator Allocator

Returns

NativeArray<ushort>

GetCountryColdData(ushort)

public CountryColdData GetCountryColdData(ushort countryId)

Parameters

countryId ushort

Returns

CountryColdData

GetCountryColor(ushort)

public Color32 GetCountryColor(ushort countryId)

Parameters

countryId ushort

Returns

Color32

GetCountryGraphicalCulture(ushort)

public byte GetCountryGraphicalCulture(ushort countryId)

Parameters

countryId ushort

Returns

byte

GetCountryHotData(ushort)

public CountryHotData GetCountryHotData(ushort countryId)

Parameters

countryId ushort

Returns

CountryHotData

GetCountryIdFromTag(string)

public ushort GetCountryIdFromTag(string tag)

Parameters

tag string

Returns

ushort

GetCountryTag(ushort)

public string GetCountryTag(ushort countryId)

Parameters

countryId ushort

Returns

string

HasCountry(ushort)

public bool HasCountry(ushort countryId)

Parameters

countryId ushort

Returns

bool

HasCountryFlag(ushort, byte)

public bool HasCountryFlag(ushort countryId, byte flag)

Parameters

countryId ushort
flag byte

Returns

bool

HasTag(string)

public bool HasTag(string tag)

Parameters

tag string

Returns

bool

Initialize(EventBus)

Initialize the country system with event bus

public void Initialize(EventBus eventBus)

Parameters

eventBus EventBus

InitializeEmpty()

Initialize empty country system for map-only mode No country data loaded

public void InitializeEmpty()

InitializeFromCountryData(CountryDataLoadResult)

public void InitializeFromCountryData(CountryDataLoadResult countryDataResult)

Parameters

countryDataResult CountryDataLoadResult

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

reader BinaryReader

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

writer BinaryWriter

SetCountryColor(ushort, Color32)

public void SetCountryColor(ushort countryId, Color32 newColor)

Parameters

countryId ushort
newColor Color32