Skip to content

Game.UI.InGame.TelecomInfoviewUISystem

Assembly:
Assembly-CSharp (Unity game assembly; actual assembly name may vary in your modding environment)

Namespace:
Game.UI.InGame

Type:
class

Base:
InfoviewUISystemBase

Summary:
TelecomInfoviewUISystem is an in-game UI system that drives the Telecom (network) infoview. It sets up EntityQueries to find telecom facilities and population density (households/employees), binds an indicator value for network availability to the UI, and holds NativeArray buffers for coverage and status data. OnCreate initializes required world systems, queries and bindings; OnDestroy releases native arrays. PerformUpdate is present but not implemented in this snippet — this is where the system would normally compute and push telecom coverage/status updates to the UI.


Fields

  • private const string kGroup = "telecomInfo"
    Identifier used for UI binding group names (used when creating ValueBinding entries).

  • private TerrainSystem m_TerrainSystem
    Reference to the TerrainSystem obtained from the ECS World. Likely used for mapping coverage to world coordinates or sampling terrain-related data.

  • private CitySystem m_CitySystem
    Reference to the CitySystem obtained from the ECS World. Used to query city-level data needed to compute telecom information.

  • private EntityQuery m_TelecomQuery
    EntityQuery matching telecom facility buildings (components: Building, Game.Buildings.TelecomFacility, PrefabRef) while excluding Deleted, Temp and ServiceUpgrade. Used to enumerate active telecom facilities.

  • private EntityQuery m_TelecomModifiedQuery
    EntityQuery similar to m_TelecomQuery but also filters for entities that have been Created, Deleted or Updated (and excludes Temp). Used to quickly determine whether telecom entities changed this frame.

  • private EntityQuery m_DensityQuery
    EntityQuery that matches population entities (HouseholdCitizen or Employee) and excludes Temp and Deleted. Used to gather density information that may affect network demand/coverage visualization.

  • private NativeArray<TelecomCoverage> m_Coverage
    Persistent NativeArray buffer intended to hold computed coverage data per cell/area. In OnCreate it is allocated with length 0 (Allocator.Persistent) and should be resized/filled when performing updates.

  • private NativeArray<TelecomStatus> m_Status
    Persistent NativeArray buffer for storing telecom status data. In OnCreate it is allocated with length 1 (Allocator.Persistent); likely resized or populated by PerformUpdate.

  • private ValueBinding<IndicatorValue> m_NetworkAvailability
    A UI ValueBinding for an IndicatorValue named "networkAvailability" in the "telecomInfo" group. This binding exposes whether network availability indicator is active and allows writing indicator values to the UI.

Properties

  • protected override bool Active
    Returns true if the base InfoviewUISystemBase reports active OR if the m_NetworkAvailability binding is active. Implementation detail: if base.Active is false, the property returns m_NetworkAvailability.active; otherwise it returns true. This makes the system active when the network availability indicator is active even if the base active flag is false.

  • protected override bool Modified => !m_TelecomModifiedQuery.IsEmptyIgnoreFilter
    Indicates whether the telecom-related entities were created/updated/deleted this frame by checking the m_TelecomModifiedQuery. IsEmptyIgnoreFilter returns false when there are matching entities, so Modified becomes true when changes occurred.

Constructors

  • public TelecomInfoviewUISystem()
    Default constructor; annotated with [Preserve] in the source. No custom initialization beyond what OnCreate performs.

Methods

  • protected virtual OnCreate() : System.Void
    [Preserve] Called when the system is created. Key actions:
  • Calls base.OnCreate().
  • Obtains references to world systems: TerrainSystem and CitySystem.
  • Builds EntityQuery objects:
    • m_TelecomQuery: matches Building + TelecomFacility + PrefabRef; excludes Deleted, Temp, ServiceUpgrade.
    • m_TelecomModifiedQuery: same components but filters Any = Created/Deleted/Updated and excludes Temp.
    • m_DensityQuery: matches HouseholdCitizen or Employee; excludes Temp and Deleted.
  • Adds ValueBinding for network availability: new ValueBinding("telecomInfo", "networkAvailability", default(...), new ValueWriter()) and stores it in m_NetworkAvailability.
  • Allocates NativeArray buffers: m_Coverage = new NativeArray(0, Allocator.Persistent); m_Status = new NativeArray(1, Allocator.Persistent).
  • Note: The arrays are persistent and must be disposed in OnDestroy.

  • protected virtual OnDestroy() : System.Void
    Disposes persistent NativeArray buffers (m_Coverage and m_Status) and then calls base.OnDestroy(). Ensures native memory is released to avoid leaks.

  • protected override void PerformUpdate()
    Empty in this snippet. This is the place to:

  • Query m_TelecomQuery and m_DensityQuery to compute telecom coverage and status.
  • Populate or resize m_Coverage and m_Status NativeArrays as needed.
  • Write results to m_NetworkAvailability binding (and other UI bindings if present).
  • Use m_TerrainSystem / m_CitySystem for any world-space or city-level calculations.

Usage Example

[Preserve]
protected override void OnCreate()
{
    base.OnCreate();

    // Get required world systems
    m_TerrainSystem = base.World.GetOrCreateSystemManaged<TerrainSystem>();
    m_CitySystem = base.World.GetOrCreateSystemManaged<CitySystem>();

    // Example: create the network availability binding used by the UI
    AddBinding(m_NetworkAvailability = new ValueBinding<IndicatorValue>(
        "telecomInfo",
        "networkAvailability",
        default(IndicatorValue),
        new ValueWriter<IndicatorValue>()));

    // Allocate persistent buffers (will be disposed in OnDestroy)
    m_Coverage = new NativeArray<TelecomCoverage>(0, Allocator.Persistent);
    m_Status = new NativeArray<TelecomStatus>(1, Allocator.Persistent);
}

Notes and modding tips: - Ensure PerformUpdate is implemented to compute coverage and status and to update the ValueBinding(s) so the UI reflects current data. - Always dispose persistent NativeArray allocations in OnDestroy to avoid memory leaks. - If you extend or use these EntityQueries, be aware of component filters (All, Any, None) to correctly match entities you intend to process. - The ValueBinding mechanism expects writer/reader implementations (ValueWriter/ValueReader) appropriate for the bound type (IndicatorValue). Use the same group/key strings ("telecomInfo", "networkAvailability") on the UI side to read the values.