CloudOnce v2.7.5
Unified Game Services API
CloudOnce.Internal.SyncableCurrency Class Reference

Handles virtual currencies. Keeps a record of all the earnings and purchases for every device the user has. This way the balance should always be accurate. More...

Inheritance diagram for CloudOnce.Internal.SyncableCurrency:
[legend]
Collaboration diagram for CloudOnce.Internal.SyncableCurrency:
[legend]

Public Member Functions

 SyncableCurrency (string currencyID)
 Initializes a new instance of the SyncableCurrency class. More...
 
 SyncableCurrency (JSONObject jsonSerializedCurrency)
 Initializes a new instance of the SyncableCurrency class. Reconstructs the currency from a serialized string. More...
 
JSONObject ToJSONObject ()
 Serializes the currency into a JSONObject. More...
 
void FromJSONObject (JSONObject jsonObject)
 Recreates the currency from a JSONObject. More...
 
bool MergeWith (SyncableCurrency otherData)
 Merges the currency with another record of it, most likely gotten from the cloud More...
 
void ResetCurrency ()
 Use with caution! Completely resets currency. All additions and subtractions for every registered device are lost.
 
JSONObject ToJSONObject ()
 
void FromJSONObject (JSONObject jsonObject)
 

Properties

string CurrencyID [get]
 Unique identifier for this currency.
 
Dictionary< string, CurrencyValueDeviceCurrencyValues [get, set]
 Dictionary containing device IDs and currency values for each.
 

Detailed Description

Handles virtual currencies. Keeps a record of all the earnings and purchases for every device the user has. This way the balance should always be accurate.

Constructor & Destructor Documentation

◆ SyncableCurrency() [1/2]

CloudOnce.Internal.SyncableCurrency.SyncableCurrency ( string  currencyID)
inline

Initializes a new instance of the SyncableCurrency class.

Parameters
currencyIDA unique identifier for this currency.

◆ SyncableCurrency() [2/2]

CloudOnce.Internal.SyncableCurrency.SyncableCurrency ( JSONObject  jsonSerializedCurrency)
inline

Initializes a new instance of the SyncableCurrency class. Reconstructs the currency from a serialized string.

Parameters
jsonSerializedCurrencyA currency represented by a serialized string

Member Function Documentation

◆ FromJSONObject()

void CloudOnce.Internal.SyncableCurrency.FromJSONObject ( JSONObject  jsonObject)
inline

Recreates the currency from a JSONObject.

Parameters
jsonObjectJSONObject containing the currency data.

Implements CloudOnce.Internal.IJsonDeserializable.

◆ MergeWith()

bool CloudOnce.Internal.SyncableCurrency.MergeWith ( SyncableCurrency  otherData)
inline

Merges the currency with another record of it, most likely gotten from the cloud

Parameters
otherDataThe other record of the same currency
Returns
true if there was any change to this SyncableCurrency, false if there was no new data.

◆ ToJSONObject()

JSONObject CloudOnce.Internal.SyncableCurrency.ToJSONObject ( )
inline

Serializes the currency into a JSONObject.

Returns
JSONObject containing the currency.

Implements CloudOnce.Internal.IJsonSerializable.


The documentation for this class was generated from the following file: