Adventure Creator  1.55b
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2016
AC.Options Class Reference
Inheritance diagram for AC.Options:

Public Member Functions

void OnStart ()
 
bool SwitchProfileIfExists (int index, bool includeActive)
 Switches to a specific profile, provided that it exists. More...
 
int ProfileIndexToID (int index, bool includeActive=true)
 Converts a profile's index in a MenuProfilesList element to an ID number. More...
 
void CreateProfile (string _label="")
 Creates a new profile (instance of OptionsData). More...
 
void RenameProfile (string newProfileLabel, int profileIndex=-2, bool includeActive=true)
 Renames a profile. More...
 
string GetProfileName (int index=-1, bool includeActive=true)
 Gets the name of a specific profile. More...
 
int GetNumProfiles ()
 Gets the number of profiles associated with the game. More...
 
void AfterLoad ()
 
void SetVolume (SoundType _soundType, float newVolume=-1f)
 Updates the volume of all Sound object of a specific SoundType to their correct values. More...
 

Static Public Member Functions

static void SaveDefaultPrefs (OptionsData defaultOptionsData)
 Saves the default options data (i.e. the values chosen in SettingsManager) to the default profile. More...
 
static OptionsData LoadDefaultPrefs ()
 Loads the OptionsData from the default profile. More...
 
static void DeleteDefaultProfile ()
 
static void SavePrefs ()
 
static void SavePrefsToID (int ID, OptionsData _optionsData=null, bool showLog=false)
 Saves specific options to a specific profile. More...
 
static void LoadPrefs ()
 
static OptionsData LoadPrefsFromID (int ID, bool showLog=false, bool doSave=true)
 Gets the options values associated with a specific profile. More...
 
static int GetActiveProfileID ()
 Gets the ID number of the active profile. More...
 
static void SetActiveProfileID (int ID)
 Sets the ID number of the active profile. More...
 
static void DeleteProfilePrefs (int ID)
 Deletes the PlayerPrefs key associated with a specfic profile More...
 
static void SwitchProfile (int ID)
 Switches to a specific profile. More...
 
static string GetPrefKeyName (int ID)
 Gets the name of the PlayerPrefs key associated with a specific profile. More...
 
static void UpdateSaveLabels (SaveFile[] foundSaveFiles)
 Updates the labels of all save files by storing them in the profile's OptionsData. More...
 
static void SetLanguage (int i)
 Changes the currently-selected language. More...
 
static void SetSubtitles (bool showSubtitles)
 Changes the subtitle display setting. More...
 
static string GetLanguageName ()
 Gets the name of the currently-selected language. More...
 
static int GetLanguage ()
 Gets the index number of the currently-selected language. More...
 
static float GetSFXVolume ()
 Gets the current value of the 'SFX volume'. More...
 

Static Public Attributes

static OptionsData optionsData
 
static int maxProfiles = 50
 

Detailed Description

Stores the local instances of OptionsData, and provides functions for saving and loading options and profiles to and from the PlayerPrefs.

Member Function Documentation

void AC.Options.AfterLoad ( )

Called after a scene change.

void AC.Options.CreateProfile ( string  _label = "")

Creates a new profile (instance of OptionsData).

Parameters
_labelThe name of the new profile.
static void AC.Options.DeleteDefaultProfile ( )
static

Deletes the default profile.

static void AC.Options.DeleteProfilePrefs ( int  ID)
static

Deletes the PlayerPrefs key associated with a specfic profile

Parameters
IDThe unique identifier of the profile to delete
static int AC.Options.GetActiveProfileID ( )
static

Gets the ID number of the active profile.

Returns
The active profile's unique identifier
static int AC.Options.GetLanguage ( )
static

Gets the index number of the currently-selected language.

Returns
The language's index number in SpeechManager
static string AC.Options.GetLanguageName ( )
static

Gets the name of the currently-selected language.

Returns
The name of the currently-selected language, as defined in SpeechManager
int AC.Options.GetNumProfiles ( )

Gets the number of profiles associated with the game.

Returns
The number of profiles found
static string AC.Options.GetPrefKeyName ( int  ID)
static

Gets the name of the PlayerPrefs key associated with a specific profile.

Parameters
IDThe unique identifier of the profile to find
Returns
The name of the PlayerPrefs key associated with the profile
string AC.Options.GetProfileName ( int  index = -1,
bool  includeActive = true 
)

Gets the name of a specific profile.

Parameters
indexThe index in the MenuProfilesList element that represents the profile to delete.
includeActiveIf True, then the MenuProfilesList element that the profile was selected from also displays the active profile
Returns
The display name of the profile
static float AC.Options.GetSFXVolume ( )
static

Gets the current value of the 'SFX volume'.

Returns
The current value of the 'SFX volume', as defined in the current instance of OptionsData
static OptionsData AC.Options.LoadDefaultPrefs ( )
static

Loads the OptionsData from the default profile.

Returns
An instance of OptionsData used by the default profile
static void AC.Options.LoadPrefs ( )
static

Sets the options values to those stored within the active profile.

static OptionsData AC.Options.LoadPrefsFromID ( int  ID,
bool  showLog = false,
bool  doSave = true 
)
static

Gets the options values associated with a specific profile.

Parameters
IDA unique identifier for the profile to save to
showLogIf True, the details of this save will be printed in the Console window
doSaveIf True, and if the profile had no OptionsData to read, then new values will be saved to it
Returns
An instance of OptionsData containing the profile's options
int AC.Options.ProfileIndexToID ( int  index,
bool  includeActive = true 
)

Converts a profile's index in a MenuProfilesList element to an ID number.

Parameters
indexThe index of profiles in a MenuProfilesList element that represents the profile to switch to
includeActiveIf True, then the MenuProfilesList element that contains the profile to switch to also lists the active profile
Returns
The profile's unique identifier
void AC.Options.RenameProfile ( string  newProfileLabel,
int  profileIndex = -2,
bool  includeActive = true 
)

Renames a profile.

Parameters
newProfileLabelThe new label for the profile
profileIndexThe index in the MenuProfilesList element that represents the profile to delete. If it is set to its default, -2, the active profile will be deleted
includeActiveIf True, then the MenuProfilesList element that the profile was selected from also displays the active profile
static void AC.Options.SaveDefaultPrefs ( OptionsData  defaultOptionsData)
static

Saves the default options data (i.e. the values chosen in SettingsManager) to the default profile.

Parameters
defaultOptionsDataAn instance of OptionsData that represents default values
static void AC.Options.SavePrefs ( )
static

Saves the current options to the active profile.

static void AC.Options.SavePrefsToID ( int  ID,
OptionsData  _optionsData = null,
bool  showLog = false 
)
static

Saves specific options to a specific profile.

Parameters
IDA unique identifier for the profile to save to
_optionsDataAn instance of OptionsData containing the options to save
showLogIf True, the details of this save will be printed in the Console window
static void AC.Options.SetActiveProfileID ( int  ID)
static

Sets the ID number of the active profile.

Parameters
IDA unique identifier for the profile
static void AC.Options.SetLanguage ( int  i)
static

Changes the currently-selected language.

Parameters
iThe language's index number in SpeechManager
static void AC.Options.SetSubtitles ( bool  showSubtitles)
static

Changes the subtitle display setting.

Parameters
showSubtitlesIf True, subtitles will be shown
void AC.Options.SetVolume ( SoundType  _soundType,
float  newVolume = -1f 
)

Updates the volume of all Sound object of a specific SoundType to their correct values.

Parameters
_soundTypeThe SoundType that matches the Sound objects to update (Music, SFX, Other)
newVolumeIf >= 0, the OptionsData will be updated as well
static void AC.Options.SwitchProfile ( int  ID)
static

Switches to a specific profile.

Parameters
IDThe unique identifier of the profile to switch to
bool AC.Options.SwitchProfileIfExists ( int  index,
bool  includeActive 
)

Switches to a specific profile, provided that it exists.

Parameters
indexThe index of profiles in a MenuProfilesList element that represents the profile to switch to
includeActiveIf True, then the MenuProfilesList element that contains the profile to switch to also lists the active profile
Returns
True if the switch was successful
static void AC.Options.UpdateSaveLabels ( SaveFile[]  foundSaveFiles)
static

Updates the labels of all save files by storing them in the profile's OptionsData.

Parameters
foundSaveFilesAn array of SaveFile instances, that represent the found save game files found on disk

Member Data Documentation

int AC.Options.maxProfiles = 50
static

The maximum number of profiles that can be created

OptionsData AC.Options.optionsData
static

A local copy of the currently-active profile