/// <summary> /// Standard starting point for Unity scripts. /// </summary> void Start() { // The database has been properly setup. m_WrongDatabase = !SamplesHelper.VerifyDatabase(); if (m_WrongDatabase) { wrongDatabasePanel.SetActive(true); return; } // Initialize must always be called before working with any game foundation code. GameFoundation.Initialize(new MemoryDataLayer()); // Grab references to the transactions. m_AppleIngredientTransaction = GameFoundation.catalogs.transactionCatalog.FindTransaction <VirtualTransaction>("appleIngredient"); m_OrangeIngredientTransaction = GameFoundation.catalogs.transactionCatalog.FindTransaction <VirtualTransaction>("orangeIngredient"); m_BananaIngredientTransaction = GameFoundation.catalogs.transactionCatalog.FindTransaction <VirtualTransaction>("bananaIngredient"); m_BroccoliIngredientTransaction = GameFoundation.catalogs.transactionCatalog.FindTransaction <VirtualTransaction>("broccoliIngredient"); m_CarrotIngredientTransaction = GameFoundation.catalogs.transactionCatalog.FindTransaction <VirtualTransaction>("carrotIngredient"); m_FruitSmoothieTransaction = GameFoundation.catalogs.transactionCatalog.FindTransaction <VirtualTransaction>("fruitSmoothie"); m_VeggieSmoothieTransaction = GameFoundation.catalogs.transactionCatalog.FindTransaction <VirtualTransaction>("veggieSmoothie"); // Here we bind listeners that will set an inventoryChanged flag to callbacks on the Inventory Manager. // These callbacks will automatically be invoked anytime an inventory item is added or removed. // This prevents us from having to manually invoke RefreshUI every time we perform one of these actions. InventoryManager.itemAdded += OnInventoryItemChanged; InventoryManager.itemRemoved += OnInventoryItemChanged; // Here we bind listeners to callbacks on the Transaction Manager. // These callbacks will automatically be invoked during the processing of a transaction. TransactionManager.transactionInitiated += OnTransactionInitiated; TransactionManager.transactionProgressed += OnTransactionProgress; TransactionManager.transactionSucceeded += OnTransactionSucceeded; TransactionManager.transactionFailed += OnTransactionFailed; // We'll initialize our WalletManager with some coin for smoothie ingredient purchases. WalletManager.AddBalance("coin", 100); RefreshUI(); }
/// <summary> /// This method adds 50 coins to the wallet. /// </summary> public void FindBagOfCoins() { WalletManager.AddBalance(m_CoinDefinition, 50); }
/// <summary> /// 添加钱 /// </summary> /// <param name="c"></param> /// <param name="num"></param> public static void AddMoney(Currency c, long num) { WalletManager.AddBalance(c, num); }
public void FindBagOfCoins() { WalletManager.AddBalance(m_softCurrencyDefinition, 50); }