예제 #1
0
        public void onStoreControllerInitialized()
        {
            ExampleLocalStoreInfo.Init();

            // some usage examples for add/remove currency
            // some examples
            if (ExampleLocalStoreInfo.VirtualCurrencies.Count > 0)
            {
                try {
                    StoreInventory.GiveItem(ExampleLocalStoreInfo.VirtualCurrencies[0].ItemId, 4000);
                    StoreUtils.LogDebug("SOOMLA ExampleEventHandler", "Currency balance:" + StoreInventory.GetItemBalance(ExampleLocalStoreInfo.VirtualCurrencies[0].ItemId));
                } catch (VirtualItemNotFoundException ex) {
                    StoreUtils.LogError("SOOMLA ExampleEventHandler", ex.Message);
                }
            }
        }
        // Use this for initialization
        void Start()
        {
            StoreController.Initialize(new MuffinRushAssets());
            handler = new ExampleEventHandler();
            ExampleLocalStoreInfo.Init();

            // some examples
            try {
                Debug.Log("start currency: " + StoreInventory.GetItemBalance("currency_muffin"));
                StoreInventory.TakeItem("currency_muffin", 50);
                Debug.Log("middle currency: " + StoreInventory.GetItemBalance("currency_muffin"));
                StoreInventory.GiveItem("currency_muffin", 4000);
                Debug.Log("end currency:" + StoreInventory.GetItemBalance("currency_muffin"));
            } catch (VirtualItemNotFoundException ex) {
                Debug.Log(ex.Message);
            }
        }
 public void onGoodBalanceChanged(VirtualGood good, int balance, int amountAdded)
 {
     ExampleLocalStoreInfo.UpdateBalances();
 }
 public void onCurrencyBalanceChanged(VirtualCurrency virtualCurrency, int balance, int amountAdded)
 {
     ExampleLocalStoreInfo.UpdateBalances();
 }