Game.Prefabs.UIStatisticsGroupData
Assembly: Assembly-CSharp (game assembly)
Namespace: Game.Prefabs
Type: struct
Base: System.ValueType, Unity.Entities.IComponentData, Unity.Entities.IQueryTypeParameter
Summary:
UIStatisticsGroupData is a lightweight ECS component that describes a statistics group displayed in the UI. It stores a reference to a category entity, the display color, the unit type used for values, and whether the group's values should be stacked in charts or visualizations. This component is intended to be attached to entities that represent UI statistic groups so systems can read rendering and aggregation metadata.
Fields
-
public Entity m_Category
Holds an Entity reference that identifies the category for this statistics group (for example a category entity used to group related statistics or to look up category metadata). -
public Color m_Color
The color used to render this statistics group's visuals in the UI (charts, legends, labels). -
public StatisticUnitType m_UnitType
Specifies the unit type used for the group's values (e.g., absolute, percentage, currency). The actual enumeration is defined elsewhere (Game.City) and determines formatting/scale. -
public bool m_Stacked
If true, this group's values should be stacked on top of others when rendering stacked charts; otherwise they are treated as separate series.
Properties
- This type exposes no managed properties; it is a plain struct component with public fields.
Constructors
public UIStatisticsGroupData()
This struct uses the default parameterless constructor generated by the C# compiler. Initialize fields explicitly when creating instances (see Usage Example).
Methods
- This component defines no methods. It is a plain data container used by ECS systems.
Usage Example
using Unity.Entities;
using UnityEngine;
using Game.Prefabs;
using Game.City;
// Example: create and assign a UIStatisticsGroupData component to an entity
var statsEntity = entityManager.CreateEntity();
// Assume categoryEntity is an existing Entity representing the category
Entity categoryEntity = /* obtain category entity */ Entity.Null;
var groupData = new UIStatisticsGroupData
{
m_Category = categoryEntity,
m_Color = Color.cyan,
m_UnitType = StatisticUnitType.Percentage,
m_Stacked = true
};
entityManager.AddComponentData(statsEntity, groupData);
{{ Notes: Ensure you have the appropriate using directives (Unity.Entities, UnityEngine, Game.City) and that StatisticUnitType and the category entity are available in your mod's context. }}