iap_ios.monkey2 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  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 CloseStore()
  19. Method IsRunning:Bool()
  20. Method GetResult:Int()
  21. Function CanMakePayments:Bool()
  22. End
  23. public
  24. Class Product Extends BBProduct
  25. Method New( identifier:String,type:Int )
  26. Self.identifier=identifier
  27. Self.type=type
  28. End
  29. Property Valid:Bool()
  30. Return valid
  31. End
  32. Property Title:String()
  33. Return title
  34. End
  35. Property Description:String()
  36. Return description
  37. End
  38. Property Price:String()
  39. Return price
  40. End
  41. Property Identifier:String()
  42. Return identifier
  43. End
  44. Property Type:Int()
  45. Return type
  46. End
  47. Internal
  48. Property Interrupted:Bool()
  49. Return False
  50. end
  51. Property Owned:Bool()
  52. Return owned
  53. End
  54. End
  55. Class IAPStoreRep Extends BBIAPStore
  56. Method OpenStoreAsync:Bool( products:Product[] )
  57. Local bbproducts:=New BBProduct[products.Length]
  58. For Local i:=0 Until bbproducts.Length
  59. bbproducts[i]=products[i]
  60. Next
  61. Return Super.BBOpenStoreAsync( bbproducts )
  62. End
  63. Method BuyProductAsync:Bool( product:Product )
  64. Return Super.BBBuyProductAsync( product )
  65. End
  66. End