Class TransactionsSample
Inherited Members
Namespace: UnityEngine.GameFoundation.Sample
Syntax
public class TransactionsSample : MonoBehaviour
Fields
appleIngredientButton
References to the specific buttons to enable/disable when either action is not possible.
Declaration
public Button appleIngredientButton
Field Value
Type | Description |
---|---|
Button |
bananaIngredientButton
Declaration
public Button bananaIngredientButton
Field Value
Type | Description |
---|---|
Button |
blendFruitButton
Declaration
public Button blendFruitButton
Field Value
Type | Description |
---|---|
Button |
blendVeggieButton
Declaration
public Button blendVeggieButton
Field Value
Type | Description |
---|---|
Button |
broccoliIngredientButton
Declaration
public Button broccoliIngredientButton
Field Value
Type | Description |
---|---|
Button |
carrotIngredientButton
Declaration
public Button carrotIngredientButton
Field Value
Type | Description |
---|---|
Button |
mainText
We will need a reference to the main text box in the scene so we can easily modify it.
Declaration
public Text mainText
Field Value
Type | Description |
---|---|
Text |
orangeIngredientButton
Declaration
public Button orangeIngredientButton
Field Value
Type | Description |
---|---|
Button |
Methods
BlendFruitSmoothie()
This will begin a transaction using the fruit smoothie Transaction. This transaction exchanges InventoryItems (fruits) for a different InventoryItem (smoothie). TransactionManager will find instances of each InventoryItem for the fruits that are consumed during the transaction.
Declaration
public void BlendFruitSmoothie()
BlendVeggieSmoothie()
This will begin a transaction using the veggies smoothie Transaction. This transaction exchanges InventoryItems (veggies) for a different InventoryItem (smoothie). TransactionManager will find instances of each InventoryItem for the veggies that are consumed during the transaction.
Declaration
public void BlendVeggieSmoothie()
OnGameFoundationException(Exception)
If GameFoundation throws exception, log the error to console.
Declaration
public void OnGameFoundationException(Exception exception)
Parameters
Type | Name | Description |
---|---|---|
Exception | exception | Exception thrown by GameFoundation. |
OnGameFoundationInitialized()
Once Game Foundation completes initialization, we enable buttons, setup callbacks, update GUI, etc.
Declaration
public void OnGameFoundationInitialized()
PurchaseAppleIngredient()
This will begin a transaction using the appleIngredient Transaction. This transaction uses coins from the wallet as the purchase price, and adds an apple Inventory Item to the Inventory Manager.
Declaration
public void PurchaseAppleIngredient()
PurchaseBananaIngredient()
This will begin a transaction using the bananaIngredient Transaction. This transaction uses coins from the wallet as the purchase price, and adds a banana Inventory Item to the Inventory Manager.
Declaration
public void PurchaseBananaIngredient()
PurchaseBroccoliIngredient()
This will begin a transaction using the broccoliIngredient Transaction. This transaction uses coins from the wallet as the purchase price, and adds a broccoli Inventory Item to the Inventory Manager.
Declaration
public void PurchaseBroccoliIngredient()
PurchaseCarrotIngredient()
This will begin a transaction using the carrotIngredient Transaction. This transaction uses coins from the wallet as the purchase price, and adds a carrot Inventory Item to the Inventory Manager.
Declaration
public void PurchaseCarrotIngredient()
PurchaseOrangeIngredient()
This will begin a transaction using the orangeIngredient Transaction. This transaction uses coins from the wallet as the purchase price, and adds an orange Inventory Item to the Inventory Manager.
Declaration
public void PurchaseOrangeIngredient()