Class BaseMemoryDataLayer
Base for the memory data layers.
Namespace: UnityEngine.GameFoundation.DataAccessLayers
Syntax
public abstract class BaseMemoryDataLayer : IDataAccessLayer, ICatalogConfigurator, IInventoryDataLayer, IStatDataLayer, IWalletDataLayer, ITransactionDataLayer
Constructors
BaseMemoryDataLayer(GameFoundationDatabase)
Create a data layer using the given database
for
static data.
Declaration
protected BaseMemoryDataLayer(GameFoundationDatabase database = null)
Parameters
Type | Name | Description |
---|---|---|
GameFoundationDatabase | database | The static data provider. |
Fields
m_Version
Declaration
protected int m_Version
Field Value
Type | Description |
---|---|
Int32 |
Methods
GetData()
Gets all the data from Game Foundation (for persistence)
Declaration
protected GameFoundationSerializableData GetData()
Returns
Type | Description |
---|---|
GameFoundationSerializableData |
Initialize(Completer)
Initialize this data layer.
Declaration
public abstract void Initialize(Completer completer)
Parameters
Type | Name | Description |
---|---|---|
Completer | completer | When done, this completer is resolved or rejected |
Implements
InitializeInventoryDataLayer(InventoryManagerSerializableData)
Initializes the data layer for InventoryManager.
Declaration
protected void InitializeInventoryDataLayer(InventoryManagerSerializableData data)
Parameters
Type | Name | Description |
---|---|---|
InventoryManagerSerializableData | data | InventoryManager's serializable data. |
InitializeStatDataLayer(StatManagerSerializableData)
Initializes the data layer for StatManager.
Declaration
protected void InitializeStatDataLayer(StatManagerSerializableData data)
Parameters
Type | Name | Description |
---|---|---|
StatManagerSerializableData | data | StatManager's serializable data. |
InitializeWalletDataLayer(WalletSerializableData, CurrencyCatalogAsset)
Initializes the data layer for WalletManager.
Declaration
protected void InitializeWalletDataLayer(WalletSerializableData data, CurrencyCatalogAsset catalog)
Parameters
Type | Name | Description |
---|---|---|
WalletSerializableData | data | Wallet's serializable data. |
CurrencyCatalogAsset | catalog | The currency catalog used as source of truth. |
Explicit Interface Implementations
ITransactionDataLayer.MakeVirtualTransaction(String, ICollection<String>, Completer<VirtualTransactionExchangeData>)
Performs a purchase defined by a VirtualTransaction
specified by its id
.
Declaration
void ITransactionDataLayer.MakeVirtualTransaction(string id, ICollection<string> counterparts, Completer<VirtualTransactionExchangeData> completer)
Parameters
Type | Name | Description |
---|---|---|
String | id | Id of a VirtualTransaction |
ICollection<String> | counterparts | |
Completer<VirtualTransactionExchangeData> | completer | The transaction result |
Implements
ITransactionDataLayer.RedeemAppleIap(String, String, Completer<TransactionExchangeData>)
Validates a Receipt from a successful purchase on an Apple device and applies the rewards to the players account.
Declaration
void ITransactionDataLayer.RedeemAppleIap(string id, string receipt, Completer<TransactionExchangeData> completer)
Parameters
Type | Name | Description |
---|---|---|
String | id | Id of a IAPTransaction |
String | receipt | Receipt data returned from the App Store as a result of a successful purchase. This should be base64 encoded |
Completer<TransactionExchangeData> | completer | The redeem result |
Implements
ITransactionDataLayer.RedeemGoogleIap(String, String, String, Completer<TransactionExchangeData>)
Validates a Receipt from a successful purchase on a Google device and applies the rewards to the players account.
Declaration
void ITransactionDataLayer.RedeemGoogleIap(string id, string purchaseData, string purchaseDataSignature, Completer<TransactionExchangeData> completer)
Parameters
Type | Name | Description |
---|---|---|
String | id | Id of a IAPTransaction |
String | purchaseData | A JSON encoded string returned from a successful in app billing purchase. |
String | purchaseDataSignature | A signature of the PurchaseData returned from a successful in app billing purchase |
Completer<TransactionExchangeData> | completer | The redeem result |
Implements
ICatalogConfigurator.Configure(CatalogBuilder)
Configures the specified builder
with the content
of this provider.
Declaration
void ICatalogConfigurator.Configure(CatalogBuilder builder)
Parameters
Type | Name | Description |
---|---|---|
CatalogBuilder | builder | The target builder. |
Implements
IInventoryDataLayer.CreateItem(String, String, Completer)
Declaration
void IInventoryDataLayer.CreateItem(string definitionId, string itemId, Completer completer)
Parameters
Type | Name | Description |
---|---|---|
String | definitionId | |
String | itemId | |
Completer | completer |
Implements
IInventoryDataLayer.DeleteItem(String, Completer)
Request to delete the item matching the given definition from the given inventory.
Declaration
void IInventoryDataLayer.DeleteItem(string itemId, Completer completer)
Parameters
Type | Name | Description |
---|---|---|
String | itemId | The id of the item we want to delete. |
Completer | completer | The handle to settle the promise with. |
Implements
IInventoryDataLayer.GetData()
Get InventoryManager's serializable data.
Declaration
InventoryManagerSerializableData IInventoryDataLayer.GetData()
Returns
Type | Description |
---|---|
InventoryManagerSerializableData |
Implements
IStatDataLayer.DeleteStatValue(String, String, Completer)
Request to delete the stat item defined by the given ids.
Declaration
void IStatDataLayer.DeleteStatValue(string gameItemId, string statDefinitionId, Completer completer)
Parameters
Type | Name | Description |
---|---|---|
String | gameItemId | Game item's id the stat item is connected to. |
String | statDefinitionId | Definition's Id the stat item is based on. |
Completer | completer | The handle to settle the promise with. |
Implements
IStatDataLayer.GetData()
Get StatManager's serializable data.
Declaration
StatManagerSerializableData IStatDataLayer.GetData()
Returns
Type | Description |
---|---|
StatManagerSerializableData |
Implements
IStatDataLayer.GetStatValue(String, String)
Gets the stat of an item by the gameItemId
and
the statDefinitionId
.
Declaration
StatValue IStatDataLayer.GetStatValue(string gameItemId, string statDefinitionId)
Parameters
Type | Name | Description |
---|---|---|
String | gameItemId | The id of the game item |
String | statDefinitionId | The id of the stat definition |
Returns
Type | Description |
---|---|
StatValue | The value of the stat |
Implements
IStatDataLayer.SetStatValue(String, String, StatValue, Completer)
Request to create or update the stat item defined by the given ids.
Declaration
void IStatDataLayer.SetStatValue(string gameItemId, string statDefinitionId, StatValue value, Completer completer)
Parameters
Type | Name | Description |
---|---|---|
String | gameItemId | Game item's id the stat item is connected to. |
String | statDefinitionId | Definition's Id the stat item is based on. |
StatValue | value | Value to set to the stat item. |
Completer | completer | The handle to settle the promise with. |
Implements
IWalletDataLayer.AddBalance(String, Int64, Completer<Int64>)
Increase the balance for the given currencyId
Declaration
void IWalletDataLayer.AddBalance(string currencyId, long value, Completer<long> completer)
Parameters
Type | Name | Description |
---|---|---|
String | currencyId | The identifier of the currency to update. |
Int64 | value | The amount to add. |
Completer<Int64> | completer | The operation result. |
Implements
IWalletDataLayer.GetData()
Get Wallet's serializable data.
Declaration
WalletSerializableData IWalletDataLayer.GetData()
Returns
Type | Description |
---|---|
WalletSerializableData |
Implements
IWalletDataLayer.RemoveBalance(String, Int64, Completer<Int64>)
Decrease the balance for the given currencyId
Declaration
void IWalletDataLayer.RemoveBalance(string currencyId, long value, Completer<long> completer)
Parameters
Type | Name | Description |
---|---|---|
String | currencyId | The identifier of the currency to update. |
Int64 | value | The amount to remove. |
Completer<Int64> | completer | The operation result. |
Implements
IWalletDataLayer.SetBalance(String, Int64, Completer)
Defines a new balance for the given currencyId
Declaration
void IWalletDataLayer.SetBalance(string currencyId, long value, Completer completer)
Parameters
Type | Name | Description |
---|---|---|
String | currencyId | The identifier of the currency to update. |
Int64 | value | The new balance. |
Completer | completer | The operation result |