Class BaseMemoryDataLayer
Base for the memory data layers.
Namespace: UnityEngine.GameFoundation.DefaultLayers
Syntax
public abstract class BaseMemoryDataLayer : IDataAccessLayer, ICatalogConfigurator, IInventoryDataLayer, IWalletDataLayer, ITransactionDataLayer, IRewardDataLayer
Constructors
BaseMemoryDataLayer(CatalogAsset)
Create a data layer using the given catalogAsset
for static data.
Declaration
protected BaseMemoryDataLayer(CatalogAsset catalogAsset = null)
Parameters
Type | Name | Description |
---|---|---|
CatalogAsset | catalogAsset | The static data provider. |
Fields
m_CatalogAsset
The static data of the data layer.
Declaration
protected readonly CatalogAsset m_CatalogAsset
Field Value
Type | Description |
---|---|
CatalogAsset |
m_Version
Stores the version of the data structure.
Declaration
protected int m_Version
Field Value
Type | Description |
---|---|
Int32 |
Methods
GetData()
Gets all the data from Game Foundation (for persistence)
Declaration
protected GameFoundationData GetData()
Returns
Type | Description |
---|---|
GameFoundationData | The player's data. |
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(InventoryManagerData)
Initializes the data layer for IInventoryManager.
Declaration
protected void InitializeInventoryDataLayer(InventoryManagerData data)
Parameters
Type | Name | Description |
---|---|---|
InventoryManagerData | data | InventoryManager's serializable data. |
InitializeRewardDataLayer(RewardManagerData)
Initializes the data layer for the IRewardManager.
Declaration
protected void InitializeRewardDataLayer(RewardManagerData data)
Parameters
Type | Name | Description |
---|---|---|
RewardManagerData | data | RewardManager's serializable data. |
InitializeWalletDataLayer(WalletData)
Initializes the data layer for IWalletManager.
Declaration
protected void InitializeWalletDataLayer(WalletData data)
Parameters
Type | Name | Description |
---|---|---|
WalletData | data | Wallet's serializable data. |
Explicit Interface Implementations
ITransactionDataLayer.MakeVirtualTransaction(String, ICollection<String>, Completer<VirtualTransactionExchangeData>)
Performs a purchase defined by a VirtualTransaction
specified by its key
.
Declaration
void ITransactionDataLayer.MakeVirtualTransaction(string key, ICollection<string> counterparts, Completer<VirtualTransactionExchangeData> completer)
Parameters
Type | Name | Description |
---|---|---|
String | key | Identifier 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 payouts to the players account.
Declaration
void ITransactionDataLayer.RedeemAppleIap(string key, string receipt, Completer<TransactionExchangeData> completer)
Parameters
Type | Name | Description |
---|---|---|
String | key | Identifier 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 payouts to the players account.
Declaration
void ITransactionDataLayer.RedeemGoogleIap(string key, string purchaseData, string purchaseDataSignature, Completer<TransactionExchangeData> completer)
Parameters
Type | Name | Description |
---|---|---|
String | key | Identifier 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, Int64, Completer)
Request to create a new item with the given key
and id
.
Declaration
void IInventoryDataLayer.CreateItem(string key, string itemId, long quantity, Completer completer)
Parameters
Type | Name | Description |
---|---|---|
String | key | Identifier of the definition used to create the item. |
String | itemId | |
Int64 | quantity | Quantity of items if stackable, else 1 for non-stackable. |
Completer | completer | The handle to settle the promise with. |
Implements
IInventoryDataLayer.CreateItemList(String, Completer)
Request to create a new item list with the given id
.
Declaration
void IInventoryDataLayer.CreateItemList(string id, Completer completer)
Parameters
Type | Name | Description |
---|---|---|
String | id | Identifier to give to the created item. |
Completer | completer | The handle to settle the promise with. |
Implements
IInventoryDataLayer.CreateItemMap(String, Completer)
Request to create a new item map with the given id
.
Declaration
void IInventoryDataLayer.CreateItemMap(string id, Completer completer)
Parameters
Type | Name | Description |
---|---|---|
String | id | Identifier to give to the created item. |
Completer | completer | The handle to settle the promise with. |
Implements
IInventoryDataLayer.DeleteItem(String, Completer)
Request to delete the item matching the given id
.
Declaration
void IInventoryDataLayer.DeleteItem(string itemId, Completer completer)
Parameters
Type | Name | Description |
---|---|---|
String | itemId | |
Completer | completer | The handle to settle the promise with. |
Implements
IInventoryDataLayer.DeleteItemList(String, Completer)
Request to delete the item list matching the given id
.
Declaration
void IInventoryDataLayer.DeleteItemList(string id, Completer completer)
Parameters
Type | Name | Description |
---|---|---|
String | id | The identifier of the item list we want to delete. |
Completer | completer | The handle to settle the promise with. |
Implements
IInventoryDataLayer.DeleteItemMap(String, Completer)
Request to delete the item map matching the given id
.
Declaration
void IInventoryDataLayer.DeleteItemMap(string id, Completer completer)
Parameters
Type | Name | Description |
---|---|---|
String | id | The identifier of the item map we want to delete. |
Completer | completer | The handle to settle the promise with. |
Implements
IInventoryDataLayer.GetData()
Get InventoryManager's serializable data.
Declaration
InventoryManagerData IInventoryDataLayer.GetData()
Returns
Type | Description |
---|---|
InventoryManagerData | The player's data for the IInventoryManager. |
Implements
IInventoryDataLayer.GetMutablePropertyValue(String, String)
Get the mutable property with the given propertyKey
of the item with the given itemId
.
Declaration
Property IInventoryDataLayer.GetMutablePropertyValue(string itemId, string propertyKey)
Parameters
Type | Name | Description |
---|---|---|
String | itemId | The item's identifier. |
String | propertyKey | The mutable property's identifier. |
Returns
Type | Description |
---|---|
Property | The mutable property's value. |
Implements
Exceptions
Type | Condition |
---|---|
ArgumentException | If either |
InventoryItemNotFoundException | If there is no item with the given |
PropertyNotFoundException | If there is no mutable property with the given |
IInventoryDataLayer.ItemListAddItem(String, String, Completer)
Request to add item to ItemList.
Declaration
void IInventoryDataLayer.ItemListAddItem(string listId, string itemId, Completer completer)
Parameters
Type | Name | Description |
---|---|---|
String | listId | id to add item to. |
String | itemId | id to add to list. |
Completer | completer | Completer for action. |
Implements
IInventoryDataLayer.ItemListClear(String, Completer)
Request to clear all items in ItemList.
Declaration
void IInventoryDataLayer.ItemListClear(string listId, Completer completer)
Parameters
Type | Name | Description |
---|---|---|
String | listId | id to target. |
Completer | completer | Completer for action. |
Implements
IInventoryDataLayer.ItemListRemoveItem(String, String, Completer)
Request to remove item from ItemList.
Declaration
void IInventoryDataLayer.ItemListRemoveItem(string listId, string itemId, Completer completer)
Parameters
Type | Name | Description |
---|---|---|
String | listId | id to remove item from. |
String | itemId | id to remove from list. |
Completer | completer | Completer for action. |
Implements
IInventoryDataLayer.ItemListSwapIndexes(String, Int32, Int32, Completer)
Request to swap items in ItemList.
Declaration
void IInventoryDataLayer.ItemListSwapIndexes(string listId, int index0, int index1, Completer completer)
Parameters
Type | Name | Description |
---|---|---|
String | listId | id to target. |
Int32 | index0 | index of first item to swap. |
Int32 | index1 | index of item to swap with. |
Completer | completer | Completer for action. |
Implements
IInventoryDataLayer.ItemMapAddItem(String, String, String, Completer)
Request to add item to ItemMap.
Declaration
void IInventoryDataLayer.ItemMapAddItem(string mapId, string slot, string itemId, Completer completer)
Parameters
Type | Name | Description |
---|---|---|
String | mapId | id to add item to. |
String | slot | slot to use for this item in the map. |
String | itemId | id to add to map. |
Completer | completer | Completer for action. |
Implements
IInventoryDataLayer.ItemMapChangeSlot(String, String, String, Completer)
Request to change item slots in ItemMap.
Declaration
void IInventoryDataLayer.ItemMapChangeSlot(string mapId, string oldSlot, string newSlot, Completer completer)
Parameters
Type | Name | Description |
---|---|---|
String | mapId | id to target. |
String | oldSlot | Old slot id of the item to swap. |
String | newSlot | New slot id of the item. |
Completer | completer | Completer for action. |
Implements
IInventoryDataLayer.ItemMapClear(String, Completer)
Request to clear all items in ItemMap.
Declaration
void IInventoryDataLayer.ItemMapClear(string mapId, Completer completer)
Parameters
Type | Name | Description |
---|---|---|
String | mapId | id to target. |
Completer | completer | Completer for action. |
Implements
IInventoryDataLayer.ItemMapRemoveItem(String, String, Completer)
Request to remove item from ItemMap.
Declaration
void IInventoryDataLayer.ItemMapRemoveItem(string mapId, string slot, Completer completer)
Parameters
Type | Name | Description |
---|---|---|
String | mapId | id to remove item from. |
String | slot | slot to remove from map. |
Completer | completer | Completer for action. |
Implements
IInventoryDataLayer.ItemMapSwapSlots(String, String, String, Completer)
Request to swap items in ItemMap.
Declaration
void IInventoryDataLayer.ItemMapSwapSlots(string mapId, string slot0, string slot1, Completer completer)
Parameters
Type | Name | Description |
---|---|---|
String | mapId | id to target. |
String | slot0 | slot of first item to swap. |
String | slot1 | slot of item to swap with. |
Completer | completer | Completer for action. |
Implements
IInventoryDataLayer.SetMutablePropertyValue(String, String, Property, Completer)
Request to update the mutable property with the given propertyKey
of the item with the given itemId
.
Declaration
void IInventoryDataLayer.SetMutablePropertyValue(string itemId, string propertyKey, Property value, Completer completer)
Parameters
Type | Name | Description |
---|---|---|
String | itemId | Item's id to update the mutable property of. |
String | propertyKey | Mutable property's key to update. |
Property | value | Value to set to the mutable property. |
Completer | completer | The handle to settle the promise with. |
Implements
IInventoryDataLayer.SetQuantity(String, Int64, Completer)
Request to set quantity of item matching the given id
.
Declaration
void IInventoryDataLayer.SetQuantity(string id, long quantity, Completer completer)
Parameters
Type | Name | Description |
---|---|---|
String | id | The identifier of the item we want to delete. |
Int64 | quantity | New quantity of item specified. |
Completer | completer | The handle to settle the promise with. |
Implements
IInventoryDataLayer.TryGetMutablePropertyValue(String, String, out Property)
Get the mutable property with the given propertyKey
of the item with the given itemId
.
Declaration
bool IInventoryDataLayer.TryGetMutablePropertyValue(string itemId, string propertyKey, out Property propertyValue)
Parameters
Type | Name | Description |
---|---|---|
String | itemId | The item's identifier. |
String | propertyKey | The mutable property's identifier. |
Property | propertyValue | The mutable property's value found for the given identifiers. |
Returns
Type | Description |
---|---|
Boolean | True if a mutable property with the given |
Implements
IRewardDataLayer.Claim(String, String, Completer<TransactionExchangeData>)
Grants the Payout to the player if the reward item key is currently valid.
Declaration
void IRewardDataLayer.Claim(string rewardKey, string rewardItemKey, Completer<TransactionExchangeData> completer)
Parameters
Type | Name | Description |
---|---|---|
String | rewardKey | The key of the reward that contains the reward item to claim. |
String | rewardItemKey | The key of the reward item to claim. |
Completer<TransactionExchangeData> | completer | Maintains a reference to the original asynchronous promise. |
Implements
IRewardDataLayer.GetData()
Get the serializable data which is managed by IRewardManager.
Declaration
RewardManagerData IRewardDataLayer.GetData()
Returns
Type | Description |
---|---|
RewardManagerData | The player's data for the IRewardManager. |
Implements
IWalletDataLayer.AddBalance(String, Int64, Completer<Int64>)
Increase the balance for the given key
Declaration
void IWalletDataLayer.AddBalance(string currencyKey, long balance, Completer<long> completer)
Parameters
Type | Name | Description |
---|---|---|
String | currencyKey | |
Int64 | balance | |
Completer<Int64> | completer | The operation result. |
Implements
IWalletDataLayer.GetData()
Get Wallet's serializable data.
Declaration
WalletData IWalletDataLayer.GetData()
Returns
Type | Description |
---|---|
WalletData | The player's data for the IWalletManager. |
Implements
IWalletDataLayer.RemoveBalance(String, Int64, Completer<Int64>)
Decrease the balance for the given key
Declaration
void IWalletDataLayer.RemoveBalance(string currencyKey, long balance, Completer<long> completer)
Parameters
Type | Name | Description |
---|---|---|
String | currencyKey | |
Int64 | balance | |
Completer<Int64> | completer | The operation result. |
Implements
IWalletDataLayer.SetBalance(String, Int64, Completer)
Defines a new balance for the given key
Declaration
void IWalletDataLayer.SetBalance(string currencyKey, long balance, Completer completer)
Parameters
Type | Name | Description |
---|---|---|
String | currencyKey | |
Int64 | balance | |
Completer | completer | The operation result. |