Game.UI.InGame.EntityGamePanel
Assembly: Assembly-CSharp
Namespace: Game.UI.InGame
Type: abstract class
Base: GamePanel, IEquatable
Summary:
EntityGamePanel is an abstract UI panel base used in-game that stores a reference to a Unity.Entities.Entity as the currently selected entity. It exposes that entity as a virtual property (defaulting to Entity.Null), binds the property into the JSON binding pipeline via BindProperties, and implements IEquatable
Fields
- This class declares no explicit fields. All state is exposed via properties.
Properties
public virtual Unity.Entities.Entity selectedEntity { get; set; } = Entity.Null
Holds the selected entity for this panel. Defaults to Entity.Null. The property is virtual so derived panels can override behavior. It is serialized into the binding output by BindProperties under the name "selectedEntity".
Constructors
public EntityGamePanel()
No explicit constructor is declared in source — the compiler-provided default constructor is used. Derived types should call the base constructor implicitly or explicitly as needed.
Methods
-
protected override void BindProperties(Colossal.UI.Binding.IJsonWriter writer) : System.Void
Binds the panel's properties into the provided IJsonWriter. Implementation calls base.BindProperties(writer), then writes the "selectedEntity" property name and the current selectedEntity value so UI binding/serialization systems can observe it. -
public bool Equals(EntityGamePanel other) : System.Boolean
Implements equality comparison for IEquatable. Returns false if other is null. If this and other are the same reference, returns true. Otherwise compares selectedEntity using Entity.Equals to determine equality.
Usage Example
// Example override in a derived panel to ensure the selected entity is bound.
protected override void BindProperties(IJsonWriter writer)
{
base.BindProperties(writer);
writer.PropertyName("selectedEntity");
writer.Write(selectedEntity);
}
// Example of setting the selected entity
var panel = myDerivedPanelInstance;
panel.selectedEntity = someEntity; // someEntity is a Unity.Entities.Entity