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

Public Member Functions

void OnInitPersistentEngine ()
 
bool SwitchProfile (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...
 
int CreateProfile (string _label="")
 Creates a new profile (instance of OptionsData). More...
 
void RenameProfile (string newProfileLabel, int profileIndex=-2, bool includeActive=true)
 Renames a profile by referencing its entry in a MenuProfilesList element. More...
 
void RenameProfileID (string newProfileLabel, int profileID)
 Renames a profile ID. More...
 
string GetProfileName (int index=-1, bool includeActive=true)
 Gets the name of a specific profile. More...
 
string GetProfileIDName (int profileID)
 Gets the name of a specific profile ID. More...
 
int GetNumProfiles ()
 Gets the number of profiles associated with the game. More...
 
bool DoesProfileExist (int index, bool includeActive=true)
 Checks if a profile exists. More...
 
bool DoesProfileExist (string label)
 Checks if a profile with a specific name exists More...
 
void OnInitialiseScene ()
 
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 (bool updateVariables=true)
 Saves the current options to the active profile. More...
 
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 profileID, bool showLog=false, bool doSave=true)
 Gets the options values associated with a specific profile. More...
 
static void DrawStatus ()
 
static int GetActiveProfileID ()
 Gets the ID number of the active profile. More...
 
static void SetActiveProfileID (int profileID)
 Sets the ID number of the active profile. More...
 
static void DeleteProfilePrefs (int profileID)
 Deletes the PlayerPrefs key associated with a specfic profile More...
 
static bool DoesProfileIDExist (int profileID)
 Checks if a specific profile ID exists. More...
 
static bool SwitchProfileID (int profileID)
 Switches to a specific profile ID, provided that it exists. 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. If voice and text languages are synced (which is the default), then both will be updated More...
 
static void SetVoiceLanguage (int i)
 Changes the currently-selected voice language. If voice and text languages are synced, the text language will be set to this as well. More...
 
static void SetSubtitles (bool showSubtitles)
 Changes the subtitle display setting. More...
 
static void SetSFXVolume (float newVolume)
 Sets the value of the 'SFX volume'. More...
 
static void SetSpeechVolume (float newVolume)
 Sets the value of the 'Speech volume'. More...
 
static void SetMusicVolume (float newVolume)
 Sets the value of the 'Music volume'. More...
 
static string GetLanguageName ()
 Gets the name of the currently-selected language. More...
 
static string GetVoiceLanguageName ()
 Gets the name of the currently-selected voice language. More...
 
static int GetLanguage ()
 Gets the index number of the currently-selected language. More...
 
static int GetVoiceLanguage ()
 Gets the index number of the currently-selected voice language. More...
 
static bool AreSubtitlesOn ()
 Checks if subtitles are enabled More...
 
static float GetSFXVolume ()
 Gets the current value of the 'SFX volume'. More...
 
static float GetMusicVolume ()
 Gets the current value of the 'Music volume'. More...
 
static float GetSpeechVolume ()
 Gets the current value of the 'Speech volume'. More...
 
static GVar GetProfileVariable (int profileID, int variableID)
 Gets the variable associated with a specific profile More...
 

Static Public Attributes

static OptionsData optionsData
 
const int maxProfiles = 50
 

Protected Member Functions

int FindFirstEmptyProfileID ()
 
IEnumerator UpdateMixerVolumes ()
 

Static Protected Attributes

static iOptionsFileHandler optionsFileHandlerOverride
 

Properties

static iOptionsFileHandler OptionsFileHandler [get, set]
 

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

◆ AreSubtitlesOn()

static bool AC.Options.AreSubtitlesOn ( )
static

Checks if subtitles are enabled

Returns
True if subtitles are enabled

◆ CreateProfile()

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

Creates a new profile (instance of OptionsData).

Parameters
_labelThe name of the new profile.
Returns
The ID number of the new profile

◆ DeleteDefaultProfile()

static void AC.Options.DeleteDefaultProfile ( )
static

Deletes the default profile.

◆ DeleteProfilePrefs()

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

Deletes the PlayerPrefs key associated with a specfic profile

Parameters
profileIDThe unique identifier of the profile to delete

◆ DoesProfileExist() [1/2]

bool AC.Options.DoesProfileExist ( int  index,
bool  includeActive = true 
)

Checks if a profile exists.

Parameters
indexThe index in the MenuProfilesList element that represents the profile to search for.
includeActiveIf True, then the MenuProfilesList element that the profile was selected from also displays the active profile
Returns
True if the profile exists

◆ DoesProfileExist() [2/2]

bool AC.Options.DoesProfileExist ( string  label)

Checks if a profile with a specific name exists

Parameters
labelThe name of the profile to check for
Returns
True if a profile with the supplied name exists

◆ DoesProfileIDExist()

static bool AC.Options.DoesProfileIDExist ( int  profileID)
static

Checks if a specific profile ID exists.

Parameters
profileIDThe profile ID to check for
Returns
True if the given profile ID exists

◆ DrawStatus()

static void AC.Options.DrawStatus ( )
static

Displays Options-related information for the AC Status window

◆ GetActiveProfileID()

static int AC.Options.GetActiveProfileID ( )
static

Gets the ID number of the active profile.

Returns
The active profile's unique identifier

◆ GetLanguage()

static int AC.Options.GetLanguage ( )
static

Gets the index number of the currently-selected language.

Returns
The language's index number in SpeechManager.

◆ GetLanguageName()

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

◆ GetMusicVolume()

static float AC.Options.GetMusicVolume ( )
static

Gets the current value of the 'Music volume'.

Returns
The current value of the 'Music volume', as defined in the current instance of OptionsData

◆ GetNumProfiles()

int AC.Options.GetNumProfiles ( )

Gets the number of profiles associated with the game.

Returns
The number of profiles found

◆ GetProfileIDName()

string AC.Options.GetProfileIDName ( int  profileID)

Gets the name of a specific profile ID.

Parameters
profileIDThe profile ID to get the name of
Returns
The display name of the profile

◆ GetProfileName()

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 get the name of.
includeActiveIf True, then the MenuProfilesList element that the profile was selected from also displays the active profile
Returns
The display name of the profile

◆ GetProfileVariable()

static GVar AC.Options.GetProfileVariable ( int  profileID,
int  variableID 
)
static

Gets the variable associated with a specific profile

Parameters
profileIDThe ID of the profile
variableIDThe ID of the Global variable
Returns
The variable associated with the profile

◆ GetSFXVolume()

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

◆ GetSpeechVolume()

static float AC.Options.GetSpeechVolume ( )
static

Gets the current value of the 'Speech volume'.

Returns
The current value of the 'Speech volume', as defined in the current instance of OptionsData

◆ GetVoiceLanguage()

static int AC.Options.GetVoiceLanguage ( )
static

Gets the index number of the currently-selected voice language.

Returns
The voice language's index number in SpeechManager. If voice and text languages are synced, this will return the same as GetLanguage().

◆ GetVoiceLanguageName()

static string AC.Options.GetVoiceLanguageName ( )
static

Gets the name of the currently-selected voice language.

Returns
The name of the currently-selected language, as defined in SpeechManager. If voice and text languages are synced, this will return the same as GetLanguageName().

◆ LoadDefaultPrefs()

static OptionsData AC.Options.LoadDefaultPrefs ( )
static

Loads the OptionsData from the default profile.

Returns
An instance of OptionsData used by the default profile

◆ LoadPrefs()

static void AC.Options.LoadPrefs ( )
static

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

◆ LoadPrefsFromID()

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

Gets the options values associated with a specific profile.

Parameters
profileIDA 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

◆ ProfileIndexToID()

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

◆ RenameProfile()

void AC.Options.RenameProfile ( string  newProfileLabel,
int  profileIndex = -2,
bool  includeActive = true 
)

Renames a profile by referencing its entry in a MenuProfilesList element.

Parameters
newProfileLabelThe new label for the profile
profileIndexThe index in the MenuProfilesList element that represents the profile to rename. If it is set to its default, -2, the active profile will be renamed
includeActiveIf True, then the MenuProfilesList element that the profile was selected from also displays the active profile

◆ RenameProfileID()

void AC.Options.RenameProfileID ( string  newProfileLabel,
int  profileID 
)

Renames a profile ID.

Parameters
newProfileLabelThe new label for the profile
profileIDThe profile ID to rename

◆ SaveDefaultPrefs()

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

◆ SavePrefs()

static void AC.Options.SavePrefs ( bool  updateVariables = true)
static

Saves the current options to the active profile.

Parameters
updateVariablesIf True, then the values of variables linked to options data will be updated in the options data

◆ SavePrefsToID()

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

◆ SetActiveProfileID()

static void AC.Options.SetActiveProfileID ( int  profileID)
static

Sets the ID number of the active profile.

Parameters
profileIDA unique identifier for the profile

◆ SetLanguage()

static void AC.Options.SetLanguage ( int  i)
static

Changes the currently-selected language. If voice and text languages are synced (which is the default), then both will be updated

Parameters
iThe language's index number in SpeechManager

◆ SetMusicVolume()

static void AC.Options.SetMusicVolume ( float  newVolume)
static

Sets the value of the 'Music volume'.

Parameters
newVolumeThe new value of the 'Music volume'

◆ SetSFXVolume()

static void AC.Options.SetSFXVolume ( float  newVolume)
static

Sets the value of the 'SFX volume'.

Parameters
newVolumeThe new value of the 'SFX volume'

◆ SetSpeechVolume()

static void AC.Options.SetSpeechVolume ( float  newVolume)
static

Sets the value of the 'Speech volume'.

Parameters
newVolumeThe new value of the 'Speech volume'

◆ SetSubtitles()

static void AC.Options.SetSubtitles ( bool  showSubtitles)
static

Changes the subtitle display setting.

Parameters
showSubtitlesIf True, subtitles will be shown

◆ SetVoiceLanguage()

static void AC.Options.SetVoiceLanguage ( int  i)
static

Changes the currently-selected voice language. If voice and text languages are synced, the text language will be set to this as well.

Parameters
iThe language's index number in SpeechManager

◆ SetVolume()

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

◆ SwitchProfile()

bool AC.Options.SwitchProfile ( 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

◆ SwitchProfileID()

static bool AC.Options.SwitchProfileID ( int  profileID)
static

Switches to a specific profile ID, provided that it exists.

Parameters
profileIDThe unique identifier of the profile to switch to
Returns
True if the switch was successful

◆ UpdateSaveLabels()

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

◆ maxProfiles

const int AC.Options.maxProfiles = 50
static

The maximum number of profiles that can be created

◆ optionsData

OptionsData AC.Options.optionsData
static

A local copy of the currently-active profile

Property Documentation

◆ OptionsFileHandler

iOptionsFileHandler AC.Options.OptionsFileHandler
staticgetset

The iOptionsFileHandler class that handles the creation, loading, and deletion of save files