![]() |
Platformer Pro
2.3.2
A platform game kit for Unity.
|
Base class for objects that can be saved. More...
Public Member Functions | |
virtual System.Type[] | GetExtraTypes () |
Support complex object serialisation by passing additional types to seralizer. More... | |
abstract void | ApplySaveData (object t) |
Applies the save data to the object. More... | |
abstract System.Type | SavedObjectType () |
Get the type of object this Persistable saves. More... | |
abstract void | ResetSaveData () |
Resets the save data back to default. More... | |
![]() | |
virtual void | Validate (PlatformerProMonoBehaviour myTarget) |
Override this method if you want to provide custom validation. The actual code should be surrounded by the if UNITY_EDITOR / endif directive. More... | |
Static Public Member Functions | |
static void | Save (Persistable p) |
Save the given persistable. More... | |
static void | SaveXml (Persistable p) |
Save the given persistable in XML format. More... | |
static void | SaveBinary (Persistable p) |
Save the given persistable in XML format. More... | |
static void | Load (Persistable p) |
Load the given persistable. More... | |
static void | Reset (Persistable p) |
Resets the given persistable. More... | |
Public Attributes | |
bool | usePersistenceDefaults = true |
Should we use the persistence defaults or override with our own values. More... | |
bool | enablePersistence = true |
Should we enable persistence. More... | |
bool | saveOnAnyChange |
Save whenever this value changes (Note: not supported by all objects). More... | |
PersistenceResetType | persistenceType |
When do we reset persistence? More... | |
Static Public Attributes | |
const string | BasePlayerPrefId = "PP.Persistent." |
The base player preference identifier. More... | |
Protected Member Functions | |
virtual void | OnLoaded () |
Raises the loaded event. More... | |
virtual void | ConfigureEventListeners () |
Init this instance. More... | |
virtual void | DoPendingSaves (object sender, PersistenceEventArgs e) |
Trigger any pending saves. More... | |
virtual void | PhaseChange (object sender, GamePhaseEventArgs e) |
Handle a change of game phase, look for persistence event and apply. More... | |
virtual void | HandleRespawn (object sender, CharacterEventArgs e) |
Handle a change of game phase, look for persistence event and apply. More... | |
virtual void | HandleWillExitScene (object sender, SceneEventArgs e) |
Handles the will exit scene event More... | |
virtual void | HandleGameOver (object sender, CharacterEventArgs e) |
Handles the game over event More... | |
virtual void | HandleDied (object sender, DamageInfoEventArgs e) |
Handles the died event. More... | |
Static Protected Member Functions | |
static object | LoadSavedDataXml (Persistable p) |
Does the actual load and returns raw object. More... | |
static object | LoadSavedDataBinary (Persistable p) |
Does the actual load and returns raw object. More... | |
Protected Attributes | |
bool | loaded |
Have we loaded the data yet? More... | |
bool | readyToSave |
Are we ready to save on the next save tick? More... | |
Persistable | latestSaveData |
Data to save when we trigger the next save tick. More... | |
Properties | |
virtual string | PlayerPrefsIdentifier [get] |
The player preference identifier. More... | |
virtual bool | EnablePersistence [get] |
Gets the value for persistence type taking in to account defaults. More... | |
virtual PersistenceResetType | PersistenceType [get] |
Gets the value for persistence type taking in to account defaults. More... | |
virtual bool | SaveOnChange [get] |
Gets the value for save on change type taking in to account defaults. More... | |
abstract Character | Character [get, set] |
Gets the character. More... | |
abstract object | SaveData [get] |
Gets the data to save. More... | |
abstract string | Identifier [get] |
Get a unique identifier to use when saving the data (for example this could be used for part of the file name or player prefs name). More... | |
![]() | |
virtual string | Header [get] |
Gets the header string used to describe the component. More... | |
virtual string | DocLink [get] |
Gets a link to documentation site. More... | |
virtual string | VideoLink [get] |
Gets a link to a youtube video. More... | |
virtual string | Deprecated [get] |
If non-null this component is deprecated. The string shows a message indicating how it should be replaced. More... | |
![]() | |
Character | Character [get, set] |
Get the character. More... | |
Events | |
System.EventHandler< EmptyEventArgs > | Loaded |
Sent when this persistable is loaded. More... | |
Base class for objects that can be saved.
|
pure virtual |
Applies the save data to the object.
Implemented in PlatformerPro.Shop, PlatformerPro.ItemManager, PlatformerPro.EquipmentManager, PlatformerPro.ActivationGroup, PlatformerPro.CharacterHealth, and PlatformerPro.LevelManager.
|
protectedvirtual |
Init this instance.
Reimplemented in PlatformerPro.EquipmentManager, and PlatformerPro.CharacterHealth.
|
protectedvirtual |
Trigger any pending saves.
|
virtual |
Support complex object serialisation by passing additional types to seralizer.
Reimplemented in PlatformerPro.Shop, PlatformerPro.ItemManager, and PlatformerPro.EquipmentManager.
|
protectedvirtual |
Handles the died event.
sender | Sender. |
e | E. |
|
protectedvirtual |
Handles the game over event
sender | Sender. |
e | Event. |
|
protectedvirtual |
Handle a change of game phase, look for persistence event and apply.
sender | Sender. |
e | E. |
|
protectedvirtual |
Handles the will exit scene event
sender | Sender. |
e | Event. |
|
static |
Load the given persistable.
p | Persistable to laod. |
|
staticprotected |
Does the actual load and returns raw object.
p | P. |
|
staticprotected |
Does the actual load and returns raw object.
p | P. |
|
protectedvirtual |
Raises the loaded event.
type | Type. |
amount | Number collected. |
character | Character. |
|
protectedvirtual |
Handle a change of game phase, look for persistence event and apply.
sender | Sender. |
e | E. |
Reimplemented in PlatformerPro.CharacterHealth.
|
static |
Resets the given persistable.
p | Persistable to reset. |
|
pure virtual |
Resets the save data back to default.
Implemented in PlatformerPro.Shop, PlatformerPro.ItemManager, PlatformerPro.EquipmentManager, PlatformerPro.ActivationGroup, PlatformerPro.CharacterHealth, and PlatformerPro.LevelManager.
|
static |
Save the given persistable.
p | Persistable to save. |
|
static |
Save the given persistable in XML format.
p | Persistable to save. |
|
pure virtual |
Get the type of object this Persistable saves.
Implemented in PlatformerPro.Shop, PlatformerPro.ItemManager, PlatformerPro.EquipmentManager, PlatformerPro.ActivationGroup, PlatformerPro.CharacterHealth, and PlatformerPro.LevelManager.
|
static |
Save the given persistable in XML format.
p | Persistable to save. |
|
static |
The base player preference identifier.
bool PlatformerPro.Persistable.enablePersistence = true |
Should we enable persistence.
|
protected |
Data to save when we trigger the next save tick.
|
protected |
Have we loaded the data yet?
PersistenceResetType PlatformerPro.Persistable.persistenceType |
When do we reset persistence?
|
protected |
Are we ready to save on the next save tick?
bool PlatformerPro.Persistable.saveOnAnyChange |
Save whenever this value changes (Note: not supported by all objects).
bool PlatformerPro.Persistable.usePersistenceDefaults = true |
Should we use the persistence defaults or override with our own values.
|
getset |
Gets the character.
|
get |
Gets the value for persistence type taking in to account defaults.
|
get |
Get a unique identifier to use when saving the data (for example this could be used for part of the file name or player prefs name).
|
getprotected |
Gets the value for persistence type taking in to account defaults.
|
get |
The player preference identifier.
|
get |
Gets the data to save.
|
getprotected |
Gets the value for save on change type taking in to account defaults.
System.EventHandler<EmptyEventArgs> PlatformerPro.Persistable.Loaded |
Sent when this persistable is loaded.