Skip to content

Game.Prefabs.TutorialCardPrefab

Assembly: Assembly-CSharp.dll
Namespace: Game.Prefabs

Type: Class

Base: TutorialPhasePrefab

Summary:
Prefab component used to configure a tutorial "card" phase for the game's tutorial system. When the prefab is instantiated/initialized it writes a TutorialPhaseData component onto the supplied ECS entity. The written data chooses between TutorialPhaseType.Card and TutorialPhaseType.CenterCard based on the m_CenterCard flag and forwards the inherited m_OverrideCompletionDelay value. This class is part of the Unity.Entities (ECS) based tutorial pipeline used by Cities: Skylines 2 modding.


Fields

  • public System.Boolean m_CenterCard
    Indicates whether this tutorial phase should be treated as a center card (true) or a regular card (false). Controls the TutorialPhaseData.m_Type value that gets written to the entity during Initialize.

  • protected System.Single m_OverrideCompletionDelay (inherited)
    Defined on the base TutorialPhasePrefab. When set, this value is copied into TutorialPhaseData.m_OverrideCompletionDelay so the phase can override the default completion delay.

Properties

  • None declared on this class.
    (Uses members/properties inherited from TutorialPhasePrefab if needed.)

Constructors

  • public TutorialCardPrefab()
    Default public constructor (compiler-generated). No custom construction logic in this class.

Methods

  • public override void Initialize(Unity.Entities.EntityManager entityManager, Unity.Entities.Entity entity) : System.Void
    Called to initialize the prefab instance for an ECS entity. Implementation details:
  • Calls base.Initialize(entityManager, entity) to perform any base-class initialization.
  • Writes/sets a TutorialPhaseData component on the provided entity with:
    • m_Type = TutorialPhaseType.CenterCard if m_CenterCard is true; otherwise TutorialPhaseType.Card.
    • m_OverrideCompletionDelay = m_OverrideCompletionDelay (value taken from the prefab/base).

This method requires the TutorialPhaseData and TutorialPhaseType definitions from Game.Tutorials and uses EntityManager.SetComponentData to update the entity's component data.

Usage Example

public override void Initialize(EntityManager entityManager, Entity entity)
{
    base.Initialize(entityManager, entity);
    entityManager.SetComponentData(entity, new TutorialPhaseData
    {
        m_Type = m_CenterCard ? TutorialPhaseType.CenterCard : TutorialPhaseType.Card,
        m_OverrideCompletionDelay = m_OverrideCompletionDelay
    });
}

Additional notes: - The m_CenterCard field is typically configured in the prefab inspector (not in code) to select whether the tutorial should appear centered. - Ensure Game.Tutorials namespace types (TutorialPhaseData, TutorialPhaseType) are available to the mod project.