// method to buy item of the game public IEnumerator buyItem() { // find buyButton gameObject to change the scale Transform _button = transform.FindChild("BlackSquare").FindChild("BuyButton"); StoreAudioButton.shared().playAudio(); _button.localScale = new Vector3(1.05f, 1.05f, 1.0f); // wait some seconds to change back the scale yield return(new WaitForSeconds(0.1f)); _button.localScale = new Vector3(1.0f, 1.0f, 1.0f); // removes the price from money manager if the money is enough if (MoneyTeeth.removeTeeth(storeItem.Price)) { // load new teeth amount LoadStore.shareLoadStore().loadTeethAmount(); // to receive the items bought ArrayList _cloakRoomList = new ArrayList(); // check if there are if (SaveSystem.hasObject("CloakRoom_List")) { _cloakRoomList = (ArrayList)SaveSystem.load("CloakRoom_List", typeof(ArrayList)); } // add the new item bought _cloakRoomList.Add(storeItem); // save the new list SaveSystem.save("CloakRoom_List", _cloakRoomList); // remove all objects in the scene LoadStore.shareLoadStore().clearStoreItems(); // and load again LoadStore.shareLoadStore().loadStoreItems(); } else // if the money isn't enough, show message { Message.sharedMessage().setText("Dente insuficiente").show(); } }
void iOS_purchaseSucceededEvent(StoreKitTransaction transaction) { if (transaction.productIdentifier == BillingItemsIDs.teeth_01) { MoneyTeeth.addTeeth(1000f); } else if (transaction.productIdentifier == BillingItemsIDs.teeth_02) { MoneyTeeth.addTeeth(10000f); } else if (transaction.productIdentifier == BillingItemsIDs.teeth_03) { MoneyTeeth.addTeeth(100000f); } else if (transaction.productIdentifier == BillingItemsIDs.teeth_04) { MoneyTeeth.addTeeth(1000000f); } LoadStore.shareLoadStore().loadTeethAmount(); }
void android_purchaseSucceededEvent(GooglePurchase purchase) { if (purchase.productId == BillingItemsIDs.teeth_01) { MoneyTeeth.addTeeth(1000f); } else if (purchase.productId == BillingItemsIDs.teeth_02) { MoneyTeeth.addTeeth(10000f); } else if (purchase.productId == BillingItemsIDs.teeth_03) { MoneyTeeth.addTeeth(100000f); } else if (purchase.productId == BillingItemsIDs.teeth_04) { MoneyTeeth.addTeeth(1000000f); } BillingManager.consumeItem(purchase.productId); LoadStore.shareLoadStore().loadTeethAmount(); }