IStartup
The entry point of the IdleKit framework resides in the IStartup. It is responsible for starting the game, switching to a different IContent (timed event), switching to a different IStage (ascension), and resetting the game. In this article, we will go over the start, switch content, reset, and switch stage game-flow and their various components.
Overview
Below are the primary functions of IStartup:
StartGame- called once on startup to initialize the IdleKit and is called again in the process ofResetGame(System.Boolean).SwitchContent(System.String) - called when the user switches betweencontents.SwitchStage- called when the user switches betweenstages.ResetGame(System.Boolean) - called when the user resets the game with the option of resetting all theISavedData. Once everything is cleaned up,StartGameis called.
Start Game and Switch Content Flow

Start Game
The game is first started by the StartGame that performs various steps such as binding the dependencies, initializing the game, and loading the entities. Once the steps are completed, the user then enters the core game loop of the IdleKit and starts playing the game.
Switch Content
At some point, the user would want to move to a different IContent either to play a limited-time event or return to the main game from the limited-time event. When this happens, SwitchContent(System.String) would be invoked, which clears the current IContent and load into the new IContent.
Reset Game Flow

Reset Game
Resetting the game is carried out by first clearing the current IContent, then cleaning up other non-content specific entities and services, and unbinding the dependencies. After these steps are performed, it invokes the Start Game Flow to restart the game.
Switch Stage Flow

Switch Stage
The switch stage flow contains only a single load phase which advances the IStage the user is on. More ILoadPhase for loading IStage specific data or assets can be added to the step.
Steps and Load Phases
As the flow diagrams indicate, each IStartup function can be broken down into various steps that further divide into reusable load phases.
In the next section, we will discuss all the default IdleKit steps and the load phases that make them up.
ILoadPhase
LoadPhases are the lowest-level building blocks used in the startup flow that can contain multiple load sequences. An example of an ILoadPhase would be the LoadContentLoadPhase, which is utilized in StartGame and SwitchContent(System.String), to set the IContent the user will be playing and load the entities associated with the IContent.
Step - Bind Dependencies
Bind Context
The step calls Bind and initializes a number of system-wide load phases, services, and actions, which includes fire-and-forget signals such as regular IActions and ISavedData altering IStateActions.
Initialize Services
This ILoadPhase initializes the services that were binded to the container in the previous step.
Step - Initialize Game
Initialize User
This ILoadPhase initializes and loads the IUserSavedData, which stores relevant user-related ISavedData.
Load Global Data
The AddDataPhase loads the IData and IEntity that it is initialized with. During this step of start up, it is initialized with data that are not related to any IContent (system-wide).
Step - Process Event
Set Content Id
This ILoadPhase determines which IContent to load based on the IUserSavedData and the active IEventSettings.
Process Event Saved Data
This ILoadPhase deletes all the content specific ISavedData for IEventContent that have been completed.
Step - Load Content
Load Content Data
In this step, the AddDataPhase is used again to load the IData that are related to the IContent that was determined in the previous step.
Load Content
This ILoadPhase loads the entities associated with the current IContent, including the IContent itself.
Step - Clear Content
Clear Content
This ILoadPhase is the opposite of the LoadContentLoadPhase. It removes all entities related to the previous IContent.
Clear Content Data
The RemoveDataPhase is the opposite of the AddDataPhase. In this step, it unloads all serialized data related to the IContent that was unloaded in the previous LoadContentDataLoadPhase.
Step - Cleanup Game
Clear Global Data
In this step, the RemoveDataPhase is used again to unload all IData and IEntity that are not related to any IContent.
Cleanup Services
This step is the opposite of the InitializeServicesPhase. It cleans up all the services.
Step - Unbind Dependencies
This step is the opposite of the Step - Bind Dependency. It unbinds all the system-wide load phases, services, and actions. After this, the game can then be restarted.
Step - Switch Stage
Advance Stage
This ILoadPhase advance the user from the current IStage to the next.