using System; using Framework.Services; using Framework.Storage.Containers; namespace Framework.Storage { /// Stores the persistent state of the game /// /// /// The recommended usage is to write a game-specific persistent settings accessor /// that will /// /// [ ServiceScope(Scope.Session), DefaultBinding(typeof(PersistentGameStateManager)) ] public interface IPersistentGameStateStore { /// Called when the persistent state store has been initialized event Action Initialized; /// Initializes the types that will be used by the store /// /// Type that holds the current state of the game as it is stored in a save slot /// /// /// The default implementation of the persistent store requires this method to be called /// before any of the other properties and methods of the persistent store will work. /// It will load the game's current settings from their default locations if available /// and create new default instances of no saved settings exist. /// void Initialize(IPersistentStateSerializer gameStateSerializer = null) where TGameState : class, IGameState, new(); /// Whether the persistent data store has been initialized already bool IsInitialized { get; } /// Container for the current state of the game IVerifiedPersistentContainer GameState { get; } /// Save slot that is currently being played, -1 if none int ActiveSaveSlot { get; } /// Starts a new game state in the specified slot /// Index of the slot a new game will be started in void StartNewGame(int slotIndex); /// Loads the game state from the specified slot /// Index of hte slot from which the game will be loaded void LoadGame(int slotIndex); /// Saves the game in the active slot void SaveGame(); /// Whether a saved game exists in the specified slot /// Index of the slot that will be checked /// True if a saved game exists in the specified slot bool HasSavedGame(int slotIndex); /// Deletes the game state in the specified slot /// Index of the slot in which the game will be deleted /// /// True if a saved state existed in the specified slot and was deleted, false otherwise /// bool DeleteGame(int slotIndex); } } // namespace Framework.Storage