All Classes Namespaces Functions Variables Enumerations Enumerator Properties
plyGame.LoadSaveProviderBase Class Reference

Base class for LoadSave Providers. The provider will be asked by plyGame to save or load keys with data associated to them. The provider will be instantiated under the Game Global GameObject parent. More...

Inherits MonoBehaviour.

Inherited by plyGame.LoadSave_PlayerPrefs.

Public Member Functions

virtual void Load ()
 This is called at the start of the game by the Game Global, just after the LoadSave Provider object was created. More...
 
virtual void Save ()
 Called when it is a good time to write all stored keys to disc. Normally when the user selects to save the game. Will also be called if the game application quits in a normal way. More...
 
virtual bool HasKey (string key)
 Is the key present? More...
 
virtual void DeleteKey (string key)
 Deletes the key and its value. More...
 
virtual void DeleteAll ()
 Deletes all keys and values. More...
 
virtual void SetString (string key, string value)
 Sets a key with string value. More...
 
virtual string GetString (string key, string defaultVal)
 Gets a string from stored key or return the defaultVal if key not set. More...
 
void SetInt (string key, int value)
 Set a key with int value. More...
 
void SetFloat (string key, float value)
 Sets a key with float value. More...
 
void SetBool (string key, bool value)
 Sets a key with bool value. More...
 
void SetVector2 (string key, Vector2 value)
 Sets a key with a vector2 value. More...
 
void SetVector3 (string key, Vector3 value)
 Sets a key with a vector3 value. More...
 
void SetVector4 (string key, Vector4 value)
 Sets a key with a vector4 value. More...
 
void SetRect (string key, Rect value)
 Sets a key with a rect value. More...
 
int GetInt (string key, int defaultVal)
 Gets an int from stored key or return the defaultVal if key not set More...
 
float GetFloat (string key, float defaultVal)
 Gets a float from stored key or return the defaultVal if key not set. More...
 
bool GetBool (string key, bool defaultVal)
 Gets a bool from stored key or return the defaultVal if key not set. More...
 
Vector2 GetVector2 (string key, Vector2 defaultVal)
 Gets vector2 from stored key or return the defaultVal if key not set. More...
 
Vector3 GetVector3 (string key, Vector3 defaultVal)
 Gets vector3 from stored key or return the defaultVal if key not set. More...
 
Vector4 GetVector4 (string key, Vector4 defaultVal)
 Gets vector4 from stored key or return the defaultVal if key not set. More...
 
Rect GetRect (string key, Rect defaultVal)
 Gets rect from stored key or return the defaultVal if key not set. More...
 

Protected Member Functions

void Awake ()
 The provider's GameObject is set inactive at runtime, in Awake() as it does not need to be active for the function calls to work, no Update(), etc needed. You can replace this function with new protected void Awake() if you need a different behaviour. More...
 

Detailed Description

Base class for LoadSave Providers. The provider will be asked by plyGame to save or load keys with data associated to them. The provider will be instantiated under the Game Global GameObject parent.

For a provider to be shown as option in plyGame you need to also add an editor script for it. See LoadSaveProviderEdBase for more information on this.

Member Function Documentation

void plyGame.LoadSaveProviderBase.Awake ( )
protected

The provider's GameObject is set inactive at runtime, in Awake() as it does not need to be active for the function calls to work, no Update(), etc needed. You can replace this function with new protected void Awake() if you need a different behaviour.

virtual void plyGame.LoadSaveProviderBase.DeleteAll ( )
virtual

Deletes all keys and values.

virtual void plyGame.LoadSaveProviderBase.DeleteKey ( string  key)
virtual

Deletes the key and its value.

bool plyGame.LoadSaveProviderBase.GetBool ( string  key,
bool  defaultVal 
)

Gets a bool from stored key or return the defaultVal if key not set.

float plyGame.LoadSaveProviderBase.GetFloat ( string  key,
float  defaultVal 
)

Gets a float from stored key or return the defaultVal if key not set.

int plyGame.LoadSaveProviderBase.GetInt ( string  key,
int  defaultVal 
)

Gets an int from stored key or return the defaultVal if key not set

Rect plyGame.LoadSaveProviderBase.GetRect ( string  key,
Rect  defaultVal 
)

Gets rect from stored key or return the defaultVal if key not set.

virtual string plyGame.LoadSaveProviderBase.GetString ( string  key,
string  defaultVal 
)
virtual

Gets a string from stored key or return the defaultVal if key not set.

Vector2 plyGame.LoadSaveProviderBase.GetVector2 ( string  key,
Vector2  defaultVal 
)

Gets vector2 from stored key or return the defaultVal if key not set.

Vector3 plyGame.LoadSaveProviderBase.GetVector3 ( string  key,
Vector3  defaultVal 
)

Gets vector3 from stored key or return the defaultVal if key not set.

Vector4 plyGame.LoadSaveProviderBase.GetVector4 ( string  key,
Vector4  defaultVal 
)

Gets vector4 from stored key or return the defaultVal if key not set.

virtual bool plyGame.LoadSaveProviderBase.HasKey ( string  key)
virtual

Is the key present?

virtual void plyGame.LoadSaveProviderBase.Load ( )
virtual

This is called at the start of the game by the Game Global, just after the LoadSave Provider object was created.

virtual void plyGame.LoadSaveProviderBase.Save ( )
virtual

Called when it is a good time to write all stored keys to disc. Normally when the user selects to save the game. Will also be called if the game application quits in a normal way.

void plyGame.LoadSaveProviderBase.SetBool ( string  key,
bool  value 
)

Sets a key with bool value.

void plyGame.LoadSaveProviderBase.SetFloat ( string  key,
float  value 
)

Sets a key with float value.

void plyGame.LoadSaveProviderBase.SetInt ( string  key,
int  value 
)

Set a key with int value.

void plyGame.LoadSaveProviderBase.SetRect ( string  key,
Rect  value 
)

Sets a key with a rect value.

virtual void plyGame.LoadSaveProviderBase.SetString ( string  key,
string  value 
)
virtual

Sets a key with string value.

void plyGame.LoadSaveProviderBase.SetVector2 ( string  key,
Vector2  value 
)

Sets a key with a vector2 value.

void plyGame.LoadSaveProviderBase.SetVector3 ( string  key,
Vector3  value 
)

Sets a key with a vector3 value.

void plyGame.LoadSaveProviderBase.SetVector4 ( string  key,
Vector4  value 
)

Sets a key with a vector4 value.