Game.Tutorials.ITutorialSystem
Assembly: Assembly-CSharp
Namespace: Game.Tutorials
Type: interface
Base: (none)
Summary:
Interface that defines the contract for the game's tutorial management system. Implementations are responsible for tracking the current tutorial entity, the active phase, queued/next tutorials, and controlling tutorial flow (start, force, complete). This interface is used by systems or managers that drive in-game tutorials and UI reminders in Cities: Skylines 2.
Fields
- (This interface declares no private or public fields.)
Interfaces do not contain instance fields; they only declare properties and methods that implementing types must provide.
Properties
-
Entity activeTutorial { get; }
Current active tutorial entity. This should reference the Entity representing the tutorial that is currently running (or Entity.Null if none). -
Entity activeTutorialPhase { get; }
Current active tutorial phase entity. Tutorials are often split into phases/steps; this property points to the Entity for the currently executing phase. -
Entity activeTutorialList { get; }
If the active tutorial belongs to a tutorial list (sequence), this property references that list entity. Used to manage grouped/tutorial-series behavior and reminders. -
bool tutorialEnabled { get; set; }
Global on/off flag for tutorials. Setting this to false should disable automatic tutorial activation and reminders; setting true re-enables them. -
TutorialMode mode { get; set; }
Current tutorial mode (enum). This property indicates how tutorials are being presented or processed (e.g., Normal, Forced, TutorialOnly, etc.). The specific values are defined in the TutorialMode enum elsewhere in the codebase. -
Entity tutorialPending { get; }
A queued/pending tutorial entity waiting to be started. This can be used to indicate a tutorial scheduled to start after the current one completes. -
Entity nextListTutorial { get; }
The next tutorial from the active tutorial list that should run after the current one completes. Useful for progressing through a sequence automatically. -
bool showListReminder { get; }
Indicates whether a UI reminder (e.g., a "continue tutorial list" hint) should be shown for the active tutorial list.
Constructors
- (None)
Interfaces do not declare constructors. Implementing types provide constructors as needed.
Methods
-
void CompleteCurrentTutorialPhase()
Signals that the current tutorial phase has been completed. The implementation should advance to the next phase of the active tutorial (or complete the tutorial if there are no more phases), update state, and trigger any associated UI or game logic. -
void SetTutorial(Entity tutorial, Entity phase)
Set the specified tutorial and phase as the active ones. This is the normal/soft way to start or switch to a tutorial; implementations may respect user settings (tutorialEnabled) and avoid forcing advisor or other intrusive behavior. -
void ForceTutorial(Entity tutorial, Entity phase, bool advisorActivation)
Force-start the given tutorial and phase immediately, optionally activating the in-game advisor (advisorActivation = true). Use this to override normal restrictions (for example, in critical gameplay moments or scripted sequences). -
void CompleteTutorial(Entity tutorial)
Mark the specified tutorial entity as completed. This should clean up state, remove reminders, and progress tutorial list tracking if applicable.
Usage Example
using Unity.Entities;
using Game.Tutorials;
// Example usage: Helper that starts a tutorial if tutorials are enabled.
public static class TutorialHelpers
{
public static void StartTutorialIfEnabled(ITutorialSystem tutorialSystem, Entity tutorial, Entity phase)
{
if (tutorialSystem == null) return;
if (tutorialSystem.tutorialEnabled)
{
// Normal start
tutorialSystem.SetTutorial(tutorial, phase);
}
else
{
// Queue it as pending or force it depending on game logic
// Example: force it and also activate advisor
tutorialSystem.ForceTutorial(tutorial, phase, advisorActivation: true);
}
}
}
// Example implementation skeleton of the interface
public class TutorialSystemImpl : ITutorialSystem
{
public Entity activeTutorial { get; private set; } = Entity.Null;
public Entity activeTutorialPhase { get; private set; } = Entity.Null;
public Entity activeTutorialList { get; private set; } = Entity.Null;
public bool tutorialEnabled { get; set; } = true;
public TutorialMode mode { get; set; } = TutorialMode.Normal;
public Entity tutorialPending { get; private set; } = Entity.Null;
public Entity nextListTutorial { get; private set; } = Entity.Null;
public bool showListReminder { get; private set; } = false;
public void CompleteCurrentTutorialPhase()
{
// Advance phase or complete tutorial...
}
public void SetTutorial(Entity tutorial, Entity phase)
{
// Respect tutorialEnabled, set activeTutorial/phase...
}
public void ForceTutorial(Entity tutorial, Entity phase, bool advisorActivation)
{
// Immediately set and optionally trigger advisor UI...
}
public void CompleteTutorial(Entity tutorial)
{
// Mark tutorial done, clear state...
}
}
Notes: - Entity refers to Unity.Entities.Entity (an identifier for entity component system instances). - TutorialMode is an enum defined elsewhere; consult its definition for possible modes and meanings. - Implementations should handle persistence of completed tutorial state, UI updates, and interactions with advisor/reminder systems according to the game's design.