Game.UI.InGame.CargoTransportVehicleSection
Assembly: Assembly-CSharp
Namespace: Game.UI.InGame
Type: class
Base: VehicleWithLineSection
Summary:
UI section used in the in-game vehicle inspector for cargo transport vehicles. This class controls visibility of the section based on entity components (Vehicle, CargoTransport and Owner), and populates UI state information by reading the CargoTransport component and computing a state key via VehicleUIUtils. It overrides OnUpdate and OnProcess to integrate with the UI lifecycle.
Fields
- None declared in this class.
This class does not declare private fields; it relies on inherited members from VehicleWithLineSection (such as selectedEntity, stateKey, visible and EntityManager) to perform its work.
Properties
protected override string group { get; }
Returns the UI grouping identifier for this section. This override yields the literal "CargoTransportVehicleSection", which is used by the UI system to identify or group this section.
Constructors
public CargoTransportVehicleSection()
Parameterless constructor. Marked with [Preserve] in source to prevent stripping by Unity's managed code stripping. No custom initialization logic is performed here.
Methods
-
private bool Visible()
Determines whether this UI section should be visible for the currently selected entity. Returns true only when the selected entity has the Vehicle and CargoTransport components and also has an Owner component. Otherwise returns false. -
protected override void OnUpdate()
Called during the UI update step. This override sets base.visible to the result of Visible(), controlling whether the section is rendered. -
protected override void OnProcess()
Called when the UI system processes the section's content. Retrieves the CargoTransport component data for selectedEntity, computes a state key by calling VehicleUIUtils.GetStateKey(selectedEntity, componentData, base.EntityManager), assigns it to base.stateKey, and then calls base.OnProcess() to continue standard processing.
Usage Example
[Preserve]
protected override void OnUpdate()
{
// Toggle visibility based on entity components
base.visible = Visible();
}
protected override void OnProcess()
{
// Read cargo transport component and set the UI state key before processing
CargoTransport componentData = base.EntityManager.GetComponentData<CargoTransport>(selectedEntity);
base.stateKey = VehicleUIUtils.GetStateKey(selectedEntity, componentData, base.EntityManager);
base.OnProcess();
}