Game.Net.BuildOrder
Assembly: Game (Assembly-CSharp.dll / exact assembly depends on build)
Namespace: Game.Net
Type: struct
Base: System.ValueType
Implements: IComponentData, IQueryTypeParameter, ISerializable
Summary:
Represents a compact build-order range with a start and end index (both unsigned integers). Intended for use as an ECS component (IComponentData) and for network/serialization (ISerializable). Typically used to convey a range or span of build items/IDs between systems or across the network.
Fields
-
public uint m_Start
{{ The inclusive start index of the build order range. As an unsigned 32-bit integer, its default value is 0. Used directly by code and during serialization. }} -
public uint m_End
{{ The inclusive (or conventionally upper) end index of the build order range. Also a uint with default value 0. Together with m_Start defines the range handled by this BuildOrder. }}
Properties
- None
{{ This struct exposes no C# properties; it only has public fields. It implements IComponentData so instances are intended to be stored on ECS entities. }}
Constructors
public BuildOrder()
(implicit default)
{{ The struct has the implicit parameterless constructor that initializes both m_Start and m_End to 0. No custom constructors are defined in the source. You can instantiate with an object initializer: new BuildOrder { m_Start = 1, m_End = 10 }. }}
Methods
-
public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
{{ Writes the m_Start and m_End fields to the provided writer in order. The method copies each field to local variables and calls writer.Write on them. This is used for network or persistent serialization via the Colossal.Serialization API. The order of writing is: start, then end. }} -
public void Deserialize<TReader>(TReader reader) where TReader : IReader
{{ Reads two uint values from the provided reader and stores them into m_Start and m_End (in that order). Uses reader.Read(out ref) to populate the fields. This restores the BuildOrder state previously written by Serialize. }}
Usage Example
// Creating and using a BuildOrder manually
var order = new Game.Net.BuildOrder
{
m_Start = 100u,
m_End = 200u
};
// Example: adding to an entity (EntityManager usage within a system)
EntityManager em = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity e = em.CreateEntity();
em.AddComponentData(e, order);
// Example: serializing to a writer (pseudo-code, depending on available writer)
SomeWriter writer = new SomeWriter();
order.Serialize(writer);
// Example: deserializing from a reader
Game.Net.BuildOrder loaded = default;
SomeReader reader = /* obtain reader */;
loaded.Deserialize(reader);
{{ NOTES: - As a value type and IComponentData, BuildOrder is cheap to copy but be mindful to update the component via ECS APIs rather than mutating stored copies. - The semantic interpretation of m_Start/m_End (inclusive/exclusive) is determined by the consuming systems—check those systems if available. - The serialization methods assume the writer/reader implement Colossal.Serialization.Entities.IWriter/IReader contracts. }}