Advertisement
ayoung

ExampleAssets.cs - 2015

Feb 6th, 2015
1,582
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. //ExampleAssets.cs
  2. //Alexander Young
  3. //February 5, 2015
  4. //Description - Creates the IAP assets so that their can be bought and used
  5.  
  6. using UnityEngine;
  7. using System.Collections;
  8.  
  9. namespace Soomla.Store.Example //Allows for access to Soomla API
  10. {
  11. public class ExampleAssets : IStoreAssets //Extend from IStoreAssets (required to define assets)
  12. {
  13. public int GetVersion() { // Get Current Version
  14. return 0;
  15. }
  16.  
  17. public VirtualCurrency[] GetCurrencies() { // Get/Setup Virtual Currencies
  18. return new VirtualCurrency[]{};
  19. }
  20.  
  21. public VirtualGood[] GetGoods() { // Add "TURN_GREEN" IAP to GetGoods
  22. return new VirtualGood[]{TURN_GREEN};
  23. }
  24.  
  25. public VirtualCurrencyPack[] GetCurrencyPacks() { // Get/Setup Currency Packs
  26. return new VirtualCurrencyPack[]{};
  27. }
  28.  
  29. public VirtualCategory[] GetCategories() { // Get/ Setup Categories (for In App Purchases)
  30. return new VirtualCategory[]{};
  31. }
  32.  
  33. //****************************BOILERPLATE ABOVE(modify as you see fit/ if nessisary)***********************
  34. public const string TURN_GREEN_PRODUCT_ID = "com.alexanderyounggames.soomlaiaptutorial.turngreen"; //create a string to store the "turn green" in app purchase
  35.  
  36.  
  37. /** Lifetime Virtual Goods (aka - lasts forever **/
  38.  
  39. // Create the 'TURN_GREEN' LifetimeVG In-App Purchase
  40. public static VirtualGood TURN_GREEN = new LifetimeVG(
  41. "turn_green", // Name of IAP
  42. "This will turn the cube green.", // Description of IAP
  43. "turn_green_item_id", // Item ID (different from 'product id" used by itunes, this is used by soomla)
  44.  
  45. // 1. assign the purchase type of the IAP (purchaseWithMarket == item cost real money),
  46. // 2. assign the IAP as a market item (using its ID)
  47. // 3. set the item to be a non-consumable purchase type
  48.  
  49. // 1. 2. 3.
  50. new PurchaseWithMarket(TURN_GREEN_PRODUCT_ID, 0.99)
  51. );
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement