using System;
using Framework.Services;
using Framework.Storage.Containers;
namespace Framework.Storage {
/// Stores the persistent data of the game
///
///
/// The recommended usage is to write a game-specific persistent settings accessor
/// that will initialize the container types so the game is guaranteed to always have
/// the correct container types throughout.
///
///
[
ServiceScope(Scope.Global),
DefaultBinding(typeof(PersistentSettingsManager))
]
public interface IPersistentSettingsStore {
/// Called when the persistent state store has been initialized
event Action Initialized;
/// Initializes the types that will be used by the store
///
/// Type that will be used to store user-specific settings such as key bindings,
/// mouse speed or language.
///
///
/// Type that will be used to store machine-specific settings such as resolution,
/// monitor and detail levels.
///
///
/// Type that will be used to store global unlocks and achievements
///
///
/// 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 if no saved settings exist.
///
void Initialize<
TMachineSettings,
TUserSettings,
TAchievements
>(
IPersistentStateSerializer machineSettingsSerializer = null,
IPersistentStateSerializer userSettingsSerializer = null,
IPersistentStateSerializer achievementSerializer = null
)
where TMachineSettings : class, IMachineSettings, new()
where TUserSettings : class, IUserSettings, new()
where TAchievements : class, IAchievements, new();
/// Whether the persistent data store has been initialized already
bool IsInitialized { get; }
/// Container for machine-specific settings such as display parameters
IPersistentContainer MachineSettings { get; }
/// Container for user-specific settings such as key bindings
IPersistentContainer UserSettings { get; }
/// Container for global unlocks and achievements
IVerifiedPersistentContainer Achievements { get; }
/// Loads all persistent settings from the current serialized state
void LoadAllSettings();
/// Saves all persistent settings into their respective files
void SaveAllSettings();
/*
/// Resets all persistent settings to their defaults
void ResetAllSettings();
/// Resets the achievements container to its defaults
void ResetAchievements();
*/
}
} // namespace Framework.Storage