Advertisement
ayoung

ExampleAssets.cs

Jul 28th, 2014
1,033
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.14 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. namespace Soomla.Store.Example                                                          //Allows for access to Soomla API
  5. {
  6.     public class ExampleAssets : IStoreAssets                                           //Extend from IStoreAssets (required to define assets)
  7.     {
  8.         public int GetVersion() {                                                       // Get Current Version
  9.             return 0;
  10.         }
  11.        
  12.         public VirtualCurrency[] GetCurrencies() {                                      // Get/Setup Virtual Currencies
  13.             return new VirtualCurrency[]{};
  14.         }
  15.  
  16.  
  17.         public VirtualGood[] GetGoods() {                                               // Get/Setup Virtual Goods
  18.             return new VirtualGood[]{};
  19.  
  20.         }
  21.        
  22.         public VirtualCurrencyPack[] GetCurrencyPacks() {                               // Get/Setup Currency Packs
  23.             return new VirtualCurrencyPack[]{};
  24.         }
  25.        
  26.         public VirtualCategory[] GetCategories() {                                      // Get/ Setup Categories (for In App Purchases)
  27.             return new VirtualCategory[]{};
  28.         }
  29.  
  30.    
  31.         //****************************BOILERPLATE ABOVE(modify as you see fit/ if nessisary)***********************
  32.  
  33.         //SETUP AND CREATE AN IN APP PURCHASE ASSET
  34.  
  35.         public NonConsumableItem[] GetNonConsumableItems() {                            // Add "turn green" IAP to non-consumable items
  36.             return new NonConsumableItem[]{TURN_GREEN_NONCOINS};
  37.         }
  38.  
  39.  
  40.         public const string TURN_GREEN_NONCOINS_PRODUCT_ID = "turn_green";              //create a string to store the "turn green" in app purchase
  41.  
  42.  
  43.         /** Non-Consumables **/
  44.  
  45.         public static NonConsumableItem TURN_GREEN_NONCOINS = new NonConsumableItem(        // Create the 'turn green' In-App Purchase
  46.             "turn_green",                                                               // Name of IAP
  47.             "This will turn the cube green.",                                           // Description of IAP
  48.             "turn_green_item_id",                                                       // Item ID (different from 'product id" used by itunes, this is used by soomla)
  49.            
  50.  
  51.             // 1. assign the purchase type of the IAP (purchaseWithMarket == item cost real money),
  52.             // 2. assign the IAP as a market item (using its ID)
  53.             // 3. set the item to be a non-consumable purchase type
  54.             // 4. set the item to cost .99 cents
  55.  
  56.             //          1.                          2.                                          3.                     4.
  57.             new PurchaseWithMarket(new MarketItem(TURN_GREEN_NONCOINS_PRODUCT_ID,MarketItem.Consumable.NONCONSUMABLE, 0.99))
  58.             );
  59.     }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement