Game.UI.InGame.DeveloperInfoUISystem
Assembly: Assembly-CSharp (game)
Namespace: Game.UI.InGame
Type: class DeveloperInfoUISystem
Base: UISystemBase
Summary:
DeveloperInfoUISystem is the in-game developer/debug information provider for Cities: Skylines 2. It integrates with the SelectedInfoUISystem to register and supply a very large set of "developer info" providers (HasX / UpdateX pairs) used by the debug UI to show detailed runtime information about entities (buildings, vehicles, citizens, companies, areas, etc.). The system queries game systems and prefab/component data to compute and format diagnostic values (capacities, statuses, counts, production, pollution, happiness factors, routes, and much more). It acts as glue between the ECS world, other game systems (CitySystem, PrefabSystem, ResourceSystem, etc.), and the debug UI.
Fields
-
protected CitySystem m_CitySystem
Reference to the CitySystem used to access city-wide state (city entity, city modifiers, etc.). -
protected NameSystem m_NameSystem
Used to resolve debug names for entities shown in the UI. -
protected PrefabSystem m_PrefabSystem
Used to get prefab data and prefab names. -
protected ResourceSystem m_ResourceSystem
Used to get resource prefabs and resource-related lookups. -
protected SimulationSystem m_SimulationSystem
Used for frame/time information and other simulation state. -
protected SelectedInfoUISystem m_InfoUISystem
The UI system where this system registers all developer info entries. -
protected GroundPollutionSystem m_GroundPollutionSystem
Read access to ground pollution data. -
protected AirPollutionSystem m_AirPollutionSystem
Read access to air pollution data. -
protected NoisePollutionSystem m_NoisePollutionSystem
Read access to noise pollution data. -
protected TelecomCoverageSystem m_TelecomCoverageSystem
Read access to telecom coverage cell map data. -
protected TaxSystem m_TaxSystem
Used to retrieve tax rate arrays and tax-related info. -
protected BatchManagerSystem m_BatchManagerSystem
Access to rendering batch and instance data for mesh/batch debug info. -
protected EntityQuery m_CitizenHappinessParameterQuery
Query used to get CitizenHappinessParameterData singleton. -
protected EntityQuery m_HealthcareParameterQuery
Query used to get HealthcareParameterData singleton. -
protected EntityQuery m_ParkParameterQuery
Query used to get ParkParameterData singleton. -
protected EntityQuery m_EducationParameterQuery
Query used to get EducationParameterData singleton. -
protected EntityQuery m_TelecomParameterQuery
Query used to get TelecomParameterData singleton. -
protected EntityQuery m_HappinessFactorParameterQuery
Query used to access happiness factor parameter buffer. -
protected EntityQuery m_EconomyParameterQuery
Query used to read economy parameters. -
protected EntityQuery m_ProcessQuery
Query used to list industrial processes (used as supporting data). -
protected EntityQuery m_TimeDataQuery
Query used to access TimeData singleton. -
protected EntityQuery m_GarbageParameterQuery
Query used to access garbage parameters. -
private TypeHandle __TypeHandle
Internal structure holding ComponentLookup/BufferLookup handles used by many helper functions (assigned at OnCreateForCompiler). -
private EntityQuery __query_746694604_0
Internal EntityQuery used by compiled methods (ServiceFeeParameterData). -
private EntityQuery __query_746694604_1
Internal EntityQuery used by compiled methods (PollutionParameterData). -
private EntityQuery __query_746694604_2
Internal EntityQuery used by compiled methods (CityModifier buffer). -
private EntityQuery __query_746694604_3
Internal EntityQuery used by compiled methods (GarbageParameterData). -
private EntityQuery __query_746694604_4
Internal EntityQuery used by compiled methods (EconomyParameterData). -
private EntityQuery __query_746694604_5
Internal EntityQuery used by compiled methods (ExtractorParameterData). -
private EntityQuery __query_746694604_6
Internal EntityQuery used by compiled methods (CitizenHappinessParameterData).
Properties
- (No public properties are exposed by this system; it uses protected fields and methods.)
Constructors
public DeveloperInfoUISystem()
Default constructor. The system initializes in OnCreate / OnCreateForCompiler where it sets up queries, component lookups and registers many info providers with SelectedInfoUISystem.
Methods
-
protected override void OnCreate()
: System.Void
Initializes EntityQueries and obtains references to required managed systems (CitySystem, PrefabSystem, ResourceSystem, SimulationSystem, SelectedInfoUISystem, pollution systems, TaxSystem, BatchManagerSystem, etc.). Registers a very large list of developer info providers with SelectedInfoUISystem using GenericInfo, InfoList and CapacityInfo delegates (HasX/UpdateX pairs). This is the primary registration point that makes all debug entries appear in the UI. -
protected override void OnUpdate()
: System.Void
The system doesn't implement periodic update logic here beyond what's required by registered info callbacks; OnUpdate is present but empty in the provided implementation. -
protected override void OnCreateForCompiler()
: System.Void
Compiler helper used by ECS/Hybrid to assign internal queries and component lookup handles (calls __AssignQueries and __TypeHandle.__AssignHandles). Called before runtime to prepare the lookups used by many functions. -
private void __AssignQueries(ref SystemState state)
Internal method that constructs the internal EntityQuery objects used in various Update* methods to fetch singleton parameter data buffers and to include system read-only buffers. -
protected void AddUpgradeData<T>(Entity entity, ref T data) where T : unmanaged, IComponentData, ICombineData<T>
Utility to combine installed upgrade data for a building into prefab data. If the entity has an InstalledUpgrade buffer this method calls UpgradeUtils.CombineStats to merge upgrade stats into the provided data instance (used by many capacity/production checks to produce effective values). -
private bool HasContentPrerequisite(Entity entity, Entity prefab)
A "Has" predicate used by an InfoList provider. Returns true if the prefab has content prerequisites (ContentPrerequisiteData). -
private void UpdateContentPrerequisite(Entity entity, Entity prefab, InfoList info)
Corresponding update method. Adds entries describing content prerequisites (content prefabs or component debug strings) to the info list. -
private bool HasEntityInfo(Entity entity, Entity prefab)
Returns true if the selected entity is valid (not null). Used to show the entity name. -
private void UpdateEntityInfo(Entity entity, Entity prefab, GenericInfo info)
Sets info.label to "Entity" and info.value to the debug name of the entity using NameSystem. -
Generic pattern: many pairs of methods named HasX/UpdateX (for example HasMeshGroupInfo/UpdateMeshGroupInfo, HasBatchInfo/UpdateBatchInfo, HasTelecomRangeInfo/UpdateTelecomRangeInfo, HasGarbageInfo/UpdateGarbageInfo, HasHouseholdInfo/UpdateHouseholdInfo, HasCitizenInfo/UpdateCitizenInfo, HasVehicleInfo/UpdateVehicleInfo, HasCompanyProfitInfo/UpdateCompanyProfitInfo, HasParkingInfo/UpdateParkingInfo, HasPublicTransportInfo/UpdatePublicTransportInfo, etc.).
These are the core providers used by the SelectedInfoUISystem. Typical responsibilities: - HasX: determine whether the selected entity/prefab supports a given piece of info (based on components on entity and/or prefab).
- UpdateX: gather relevant data (buffers/components/singletons/other systems) and populate GenericInfo, InfoList, or CapacityInfo instances with values and sub-items to present in the developer UI.
The system includes dozens of such pairs covering: - Building-related info: homelessness, parking, zoning, land value, garbage, pollution, electricity/water consumption & production, storage, mail, landfill/processing, police/prison capacity, shelter/deathcare, resource production, company economy/profit, trade costs/partners, extractor/processing/storage companies. - Citizen & household info: residents, household details, income/wealth, students, patients, employees, pets, travel purpose, wellbeing/health textual conversions, education, sleep/work times. - Vehicle & transport info: passenger/cargo capacity, route positions, public transport boarding/departure, maintenance, deliveries, post vans, garbage trucks, ambulances/hearse/fire/police cars. - Creature & group info: creature state, queueing, group leader/member lists. - Area, tree, mailbox, notifications, events, accidents, floods, destroyed/damaged/on-fire states. - Rendering/debug info: mesh prefabs, mesh groups, batches (uses BatchManagerSystem to read native batch groups/instances and ManagedBatches to format readable strings). - Misc helpers to compute strings (WellbeingToString, HealthToString, ConsumptionToString, GetLevelupTime, GetAgeString, GetEducationString, GetTimeString, ServicesToString, WorthToString, GetGarbageStatus, etc.)
-
private void UpdateZoneHappinessInfo(Entity entity, Entity prefab, GenericInfo info)
Example of a heavy-weight update method: collects many singleton parameters, environmental buffers (pollution, telecom coverage), taxes, processes, and calls CitizenHappinessSystem.GetBuildingHappinessFactors to compute per-factor integer contributions, sorts and presents the top contributors. -
private void UpdatePollutionInfo(Entity entity, Entity prefab, GenericInfo info)
Computes effective pollution produced by a building, taking into account destroyed/abandoned/park flags, efficiency, installed upgrades, city modifiers and returns a formatted "Ground/Air/Noise" line. -
Many more specific UpdateX methods exist in the class; each method uses EntityManager data and component lookups to produce friendly debug output.
Usage Example
[Preserve]
protected override void OnCreate()
{
base.OnCreate();
// Typical usage: get other systems and register developer info providers
m_CitySystem = base.World.GetOrCreateSystemManaged<CitySystem>();
m_NameSystem = base.World.GetOrCreateSystemManaged<NameSystem>();
m_PrefabSystem = base.World.GetOrCreateSystemManaged<PrefabSystem>();
m_InfoUISystem = base.World.GetOrCreateSystemManaged<SelectedInfoUISystem>();
// register an example debug provider (the real system registers many)
m_InfoUISystem.AddDeveloperInfo(new GenericInfo(HasEntityInfo, UpdateEntityInfo));
}
Notes: - DeveloperInfoUISystem heavily relies on ECS ComponentLookup/BufferLookup handles that are assigned in OnCreateForCompiler / __AssignQueries; the class is designed to be used inside the game's ECS environment and depends on many game-specific components and systems. - Most of the useful functionality is split across many small HasX/UpdateX pairs. When adding or modifying debug entries, add a Has predicate and Update function and register them in OnCreate via SelectedInfoUISystem.AddDeveloperInfo.