Skip to content

Game.Prefabs.UITransportConfigurationPrefab

Assembly: Assembly-CSharp
Namespace: Game.Prefabs

Type: class

Base: PrefabBase

Summary:
UITransportConfigurationPrefab is a prefab holder used by the UI/transport system. It contains references to infoviews, infomodes, various transport policies, arrays of UI summary items and line type definitions (passenger and cargo). At prefab processing time it exposes dependencies required by these references and registers the UITransportConfigurationData ECS component so runtime systems can locate the configuration data.


Fields

  • public InfoviewPrefab m_TransportInfoview
    Reference to the transport infoview prefab used to display transport info in the UI.

  • public InfomodePrefab m_RoutesInfomode
    Reference to the infomode prefab for route visualization.

  • public PolicyPrefab m_TicketPricePolicy
    Policy prefab controlling ticket pricing settings exposed in the UI.

  • public PolicyPrefab m_OutOfServicePolicy
    Policy prefab controlling out-of-service behavior for transport lines/vehicles.

  • public PolicyPrefab m_VehicleCountPolicy
    Policy prefab that controls vehicle count settings.

  • public PolicyPrefab m_DayRoutePolicy
    Policy prefab for daytime route behavior/settings.

  • public PolicyPrefab m_NightRoutePolicy
    Policy prefab for nighttime route behavior/settings.

  • public UITransportSummaryItem[] m_PassengerSummaryItems
    Array of UI summary items shown for passenger transport (used to populate UI lists/summaries).

  • public UITransportSummaryItem[] m_CargoSummaryItems
    Array of UI summary items shown for cargo transport.

  • public UITransportItem[] m_PassengerLineTypes
    Array of passenger line type UI definitions. Each UITransportItem contains an .m_Unlockable reference that is added to dependencies.

  • public UITransportItem[] m_CargoLineTypes
    Array of cargo line type UI definitions. Each UITransportItem contains an .m_Unlockable reference that is added to dependencies.

Properties

  • This type does not declare any public properties. It relies on public fields to hold references and overrides methods from PrefabBase to report dependencies and component requirements.

Constructors

  • public UITransportConfigurationPrefab()
    Default (compiler-provided) constructor. No custom initialization is defined in the class.

Methods

  • public override void GetDependencies(System.Collections.Generic.List<PrefabBase> prefabs)
    Adds all referenced prefabs to the provided list so prefab-processing / loading systems know what this prefab depends on. Specifically:
  • Adds m_TransportInfoview, m_TicketPricePolicy, m_OutOfServicePolicy, m_VehicleCountPolicy, m_DayRoutePolicy, m_NightRoutePolicy.
  • Iterates m_PassengerLineTypes and m_CargoLineTypes and adds each item's m_Unlockable prefab to the dependency list.
  • Note: the implementation does not perform null checks on arrays or individual entries; ensure arrays and referenced fields are populated to avoid NullReferenceException.

  • public override void GetPrefabComponents(System.Collections.Generic.HashSet<Unity.Entities.ComponentType> components)
    Registers ECS component requirements for this prefab by adding ComponentType.ReadWrite() to the provided set. This tells the prefab-processing pipeline that entities created from this prefab will include the UITransportConfigurationData component and it should be available for read/write access.

Usage Example

// Example: during a custom prefab processing step you might query dependencies:
var prefab = new UITransportConfigurationPrefab();
// Normally prefabs are created/loaded by the game's prefab system; if you construct manually,
// make sure to populate referenced fields before calling GetDependencies.
var deps = new List<PrefabBase>();
prefab.GetDependencies(deps);

// Register required ECS components:
var comps = new HashSet<ComponentType>();
prefab.GetPrefabComponents(comps);

Notes: - This prefab class is intended to be used by the game's prefab pipeline; manual instantiation is not common in typical mod code. - Ensure that m_PassengerLineTypes and m_CargoLineTypes arrays and their .m_Unlockable members are initialized before calling GetDependencies to avoid runtime exceptions.