C# 클래스 Soomla.Store.StoreInventory

This class will help you do your day to day virtual economy operations easily. You can give or take items from your users. You can buy items or upgrade them. You can also check their equipping status and change it.
파일 보기 프로젝트 열기: soomla/unity3d-store 1 사용 예제들

공개 메소드들

메소드 설명
BuyItem ( string itemId ) : void

Buys the item with the given itemId.

BuyItem ( string itemId, string payload ) : void

Buys the item with the given itemId.

CanAfford ( string itemId ) : bool

Checks if there is enough funds to afford itemId.

EquipVirtualGood ( string goodItemId ) : void

Equips the virtual good with the given goodItemId. Equipping means that the user decides to currently use a specific virtual good. For more details and examples com.soomla.store.domain.virtualGoods.EquippableVG.

GetEquippedVirtualGood ( Soomla.Store.VirtualCategory category ) : Soomla.Store.EquippableVG

Checks currently equipped good in given category

GetEquippedVirtualGood ( string categoryName ) : Soomla.Store.EquippableVG

Checks currently equipped good in given category

GetGoodCurrentUpgrade ( string goodItemId ) : string

Retrieves the current upgrade of the good with the given id.

GetGoodUpgradeLevel ( string goodItemId ) : int

Retrieves the upgrade level of the virtual good with the given goodItemId. For Example: Let's say there's a strength attribute to one of the characters in your game and you provide your users with the ability to upgrade that strength on a scale of 1-3. This is what you've created: 1. SingleUseVG for "strength". 2. UpgradeVG for strength 'level 1'. 3. UpgradeVG for strength 'level 2'. 4. UpgradeVG for strength 'level 3'. In the example, this function will retrieve the upgrade level for "strength" (1, 2, or 3).

GetItemBalance ( string itemId ) : int

Retrieves the balance of the virtual item with the given itemId.

GiveItem ( string itemId, int amount ) : void

Gives your user the given amount of the virtual item with the given itemId. For example, when your user plays your game for the first time you GIVE him/her 1000 gems. NOTE: This action is different than buy - You use give(int amount) to give your user something for free. You use buy() to give your user something and you get something in return.

IsVirtualGoodEquipped ( string goodItemId ) : bool

Checks if the virtual good with the given goodItemId is currently equipped.

RefreshLocalInventory ( ) : void

This function refreshes a local set of objects that will hold your user's balances in memory for quick and more efficient fetching for your game UI. This way, we save many JNI or static calls to native platforms. NOTE: You don't need to call this function as it's automatically called when the game initializes. NOTE: This is less useful when you work in editor.

RefreshOnCurrencyBalanceChanged ( Soomla.Store.VirtualCurrency virtualCurrency, int balance, int amountAdded ) : void
RefreshOnGoodBalanceChanged ( Soomla.Store.VirtualGood good, int balance, int amountAdded ) : void
RefreshOnGoodEquipped ( Soomla.Store.EquippableVG equippable ) : void
RefreshOnGoodUnEquipped ( Soomla.Store.EquippableVG equippable ) : void
RefreshOnGoodUpgrade ( Soomla.Store.VirtualGood vg, UpgradeVG uvg ) : void
RemoveGoodUpgrades ( string goodItemId ) : void

Removes all upgrades from the virtual good with the given goodItemId.

TakeItem ( string itemId, int amount ) : void

Takes from your user the given amount of the virtual item with the given itemId. For example, when your user requests a refund, you need to TAKE the item he/she is returning from him/her.

UnEquipVirtualGood ( string goodItemId ) : void

Unequips the virtual good with the given goodItemId. Unequipping means that the user decides to stop using the virtual good he/she is currently using. For more details and examples com.soomla.store.domain.virtualGoods.EquippableVG.

UpgradeGood ( string goodItemId ) : void

Upgrades the virtual good with the given goodItemId by doing the following: 1. Checks if the good is currently upgraded or if this is the first time being upgraded. 2. If the good is currently upgraded, upgrades to the next upgrade in the series. In case there are no more upgrades available(meaning the current upgrade is the last available), the function returns. 3. If the good has never been upgraded before, the function upgrades it to the first available upgrade with the first upgrade of the series.

비공개 메소드들

메소드 설명
UpdateLocalBalance ( string itemId, int balance ) : void

메소드 상세

BuyItem() 공개 정적인 메소드

Buys the item with the given itemId.
Thrown if the item to be bought is not found. Thrown if the user does not have enough funds.
public static BuyItem ( string itemId ) : void
itemId string id of item to be bought
리턴 void

BuyItem() 공개 정적인 메소드

Buys the item with the given itemId.
Thrown if the item to be bought is not found. Thrown if the user does not have enough funds.
public static BuyItem ( string itemId, string payload ) : void
itemId string id of item to be bought
payload string a string you want to be assigned to the purchase. This string /// is saved in a static variable and will be given bacl to you when the purchase is completed.
리턴 void

CanAfford() 공개 정적인 메소드

Checks if there is enough funds to afford itemId.
public static CanAfford ( string itemId ) : bool
itemId string id of item to be checked
리턴 bool

EquipVirtualGood() 공개 정적인 메소드

Equips the virtual good with the given goodItemId. Equipping means that the user decides to currently use a specific virtual good. For more details and examples com.soomla.store.domain.virtualGoods.EquippableVG.
Thrown if the item is not found.
public static EquipVirtualGood ( string goodItemId ) : void
goodItemId string Id of the good to be equipped.
리턴 void

GetEquippedVirtualGood() 공개 정적인 메소드

Checks currently equipped good in given category
public static GetEquippedVirtualGood ( Soomla.Store.VirtualCategory category ) : Soomla.Store.EquippableVG
category Soomla.Store.VirtualCategory Category we want to check
리턴 Soomla.Store.EquippableVG

GetEquippedVirtualGood() 공개 정적인 메소드

Checks currently equipped good in given category
public static GetEquippedVirtualGood ( string categoryName ) : Soomla.Store.EquippableVG
categoryName string
리턴 Soomla.Store.EquippableVG

GetGoodCurrentUpgrade() 공개 정적인 메소드

Retrieves the current upgrade of the good with the given id.
Thrown if the item is not found.
public static GetGoodCurrentUpgrade ( string goodItemId ) : string
goodItemId string Id of the good whose upgrade we want to fetch.
리턴 string

GetGoodUpgradeLevel() 공개 정적인 메소드

Retrieves the upgrade level of the virtual good with the given goodItemId. For Example: Let's say there's a strength attribute to one of the characters in your game and you provide your users with the ability to upgrade that strength on a scale of 1-3. This is what you've created: 1. SingleUseVG for "strength". 2. UpgradeVG for strength 'level 1'. 3. UpgradeVG for strength 'level 2'. 4. UpgradeVG for strength 'level 3'. In the example, this function will retrieve the upgrade level for "strength" (1, 2, or 3).
Thrown if the item is not found.
public static GetGoodUpgradeLevel ( string goodItemId ) : int
goodItemId string Good item identifier.
리턴 int

GetItemBalance() 공개 정적인 메소드

Retrieves the balance of the virtual item with the given itemId.
Thrown if the item is not found.
public static GetItemBalance ( string itemId ) : int
itemId string Id of the virtual item to be fetched.
리턴 int

GiveItem() 공개 정적인 메소드

Gives your user the given amount of the virtual item with the given itemId. For example, when your user plays your game for the first time you GIVE him/her 1000 gems. NOTE: This action is different than buy - You use give(int amount) to give your user something for free. You use buy() to give your user something and you get something in return.
Thrown if the item is not found.
public static GiveItem ( string itemId, int amount ) : void
itemId string Id of the item to be given.
amount int Amount of the item to be given.
리턴 void

IsVirtualGoodEquipped() 공개 정적인 메소드

Checks if the virtual good with the given goodItemId is currently equipped.
Thrown if the item is not found.
public static IsVirtualGoodEquipped ( string goodItemId ) : bool
goodItemId string Id of the virtual good who we want to know if is equipped.
리턴 bool

RefreshLocalInventory() 공개 정적인 메소드

This function refreshes a local set of objects that will hold your user's balances in memory for quick and more efficient fetching for your game UI. This way, we save many JNI or static calls to native platforms. NOTE: You don't need to call this function as it's automatically called when the game initializes. NOTE: This is less useful when you work in editor.
public static RefreshLocalInventory ( ) : void
리턴 void

RefreshOnCurrencyBalanceChanged() 공개 정적인 메소드

public static RefreshOnCurrencyBalanceChanged ( Soomla.Store.VirtualCurrency virtualCurrency, int balance, int amountAdded ) : void
virtualCurrency Soomla.Store.VirtualCurrency
balance int
amountAdded int
리턴 void

RefreshOnGoodBalanceChanged() 공개 정적인 메소드

public static RefreshOnGoodBalanceChanged ( Soomla.Store.VirtualGood good, int balance, int amountAdded ) : void
good Soomla.Store.VirtualGood
balance int
amountAdded int
리턴 void

RefreshOnGoodEquipped() 공개 정적인 메소드

public static RefreshOnGoodEquipped ( Soomla.Store.EquippableVG equippable ) : void
equippable Soomla.Store.EquippableVG
리턴 void

RefreshOnGoodUnEquipped() 공개 정적인 메소드

public static RefreshOnGoodUnEquipped ( Soomla.Store.EquippableVG equippable ) : void
equippable Soomla.Store.EquippableVG
리턴 void

RefreshOnGoodUpgrade() 공개 정적인 메소드

public static RefreshOnGoodUpgrade ( Soomla.Store.VirtualGood vg, UpgradeVG uvg ) : void
vg Soomla.Store.VirtualGood
uvg UpgradeVG
리턴 void

RemoveGoodUpgrades() 공개 정적인 메소드

Removes all upgrades from the virtual good with the given goodItemId.
Thrown if the item is not found.
public static RemoveGoodUpgrades ( string goodItemId ) : void
goodItemId string Id of the good whose upgrades are to be removed.
리턴 void

TakeItem() 공개 정적인 메소드

Takes from your user the given amount of the virtual item with the given itemId. For example, when your user requests a refund, you need to TAKE the item he/she is returning from him/her.
Thrown if the item is not found.
public static TakeItem ( string itemId, int amount ) : void
itemId string Item identifier.
amount int Amount.
리턴 void

UnEquipVirtualGood() 공개 정적인 메소드

Unequips the virtual good with the given goodItemId. Unequipping means that the user decides to stop using the virtual good he/she is currently using. For more details and examples com.soomla.store.domain.virtualGoods.EquippableVG.
Thrown if the item is not found.
public static UnEquipVirtualGood ( string goodItemId ) : void
goodItemId string Id of the good to be unequipped.
리턴 void

UpgradeGood() 공개 정적인 메소드

Upgrades the virtual good with the given goodItemId by doing the following: 1. Checks if the good is currently upgraded or if this is the first time being upgraded. 2. If the good is currently upgraded, upgrades to the next upgrade in the series. In case there are no more upgrades available(meaning the current upgrade is the last available), the function returns. 3. If the good has never been upgraded before, the function upgrades it to the first available upgrade with the first upgrade of the series.
Thrown if the item is not found.
public static UpgradeGood ( string goodItemId ) : void
goodItemId string Good item identifier.
리턴 void