iap_ios.monkey2 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. Namespace iap
  2. #Import "native/iap_ios.mm"
  3. #Import "native/iap_ios.h"
  4. Extern Internal
  5. Class BBProduct="BBProduct"
  6. Field identifier:String
  7. Field type:Int
  8. Field valid:Bool
  9. Field title:String
  10. Field description:String
  11. Field price:String
  12. Field owned:Bool
  13. End
  14. Class BBIAPStore="BBIAPStore"
  15. Method BBOpenStoreAsync:Bool( products:BBProduct[] )="OpenStoreAsync"
  16. Method BBBuyProductAsync:Bool( product:BBProduct )="BuyProductAsync"
  17. Method GetOwnedProductsAsync:Bool()
  18. Method IsRunning:Bool()
  19. Method GetResult:Int()
  20. End
  21. public
  22. Class Product Extends BBProduct
  23. Method New( identifier:String,type:Int )
  24. Self.identifier=identifier
  25. Self.type=type
  26. End
  27. Property Valid:Bool()
  28. Return valid
  29. End
  30. Property Title:String()
  31. Return title
  32. End
  33. Property Description:String()
  34. Return description
  35. End
  36. Property Price:String()
  37. Return price
  38. End
  39. Property Identifier:String()
  40. Return identifier
  41. End
  42. Property Type:Int()
  43. Return type
  44. End
  45. Internal
  46. Property Interrupted:Bool()
  47. Return False
  48. end
  49. Property Owned:Bool()
  50. Return owned
  51. End
  52. End
  53. Class IAPStoreRep Extends BBIAPStore
  54. Method OpenStoreAsync:Bool( products:Product[] )
  55. Local bbproducts:=New BBProduct[products.Length]
  56. For Local i:=0 Until bbproducts.Length
  57. bbproducts[i]=products[i]
  58. Next
  59. Return Super.BBOpenStoreAsync( bbproducts )
  60. End
  61. Method BuyProductAsync:Bool( product:Product )
  62. Return Super.BBBuyProductAsync( product )
  63. End
  64. End