Skip to content

Game.Events.EventJournalPending

Assembly: Assembly-CSharp
Namespace: Game.Events

Type: struct

Base: IComponentData, IQueryTypeParameter, ISerializable

Summary:
Component used by the game's ECS to mark an event journal entry as pending, storing the frame at which the pending event should start. Implements ISerializable so the start-frame value can be persisted/loaded, and IQueryTypeParameter so it can be used conveniently in entity queries.


Fields

  • public uint m_StartFrame
    Holds the start frame for the pending event journal entry. This value is serialized/deserialized by the struct's ISerializable implementation and is used at runtime to determine when the pending event should begin.

Properties

  • None.
    This struct exposes its data directly as a public field and does not define any C# properties.

Constructors

  • Default (implicit) parameterless constructor
    As a value type (struct) there is an implicit parameterless constructor that initializes m_StartFrame to 0. No explicit constructors are defined in source.

Methods

  • public void Deserialize<TReader>(TReader reader) where TReader : IReader
    Reads the m_StartFrame value from the provided reader. The method simply calls reader.Read(out m_StartFrame).

  • public void Serialize<TWriter>(TWriter writer) where TWriter : IWriter
    Writes the m_StartFrame value to the provided writer. The method simply calls writer.Write(m_StartFrame).

Remarks: These generic serialize/deserialize methods follow the ColossalSerialization pattern used throughout Cities: Skylines 2 to persist component data.

Usage Example

// Creating and assigning the component to an entity (inside an ECS system)
var entity = entityManager.CreateEntity();
var pending = new Game.Events.EventJournalPending { m_StartFrame = (uint)currentFrame + 120u }; // start in 120 frames
entityManager.AddComponentData(entity, pending);

// Example usage during serialization (writer provided by game's save system):
var pendingToSave = new Game.Events.EventJournalPending { m_StartFrame = 12345u };
writer.Write(pendingToSave.m_StartFrame); // or pendingToSave.Serialize(writer);

// Example usage during deserialization (reader provided by game's load system):
var loaded = new Game.Events.EventJournalPending();
reader.Read(out loaded.m_StartFrame); // or loaded.Deserialize(reader);
// now use loaded.m_StartFrame to restore state or re-add component to an entity

{{ This struct is small and POD-like: it's safe to copy and pass by value. Use it as a lightweight marker in ECS queries to find event journal entries that are scheduled to start at a specific frame. }}