IAPDefine.hpp 907 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //
  2. // IAPDefine.hpp
  3. // TileManor
  4. //
  5. // Created by 徐炼新 on 2024/9/30.
  6. //
  7. #ifndef IAPDefine_h
  8. #define IAPDefine_h
  9. #include <string>
  10. #include <vector>
  11. #include "cocos2d.h"
  12. #define NS_IAPSHOP_BEGIN namespace iapshop {
  13. #define NS_IAPSHOP_END }
  14. NS_IAPSHOP_BEGIN
  15. // 卡片的实例
  16. class IAPCard {
  17. public:
  18. // 创建一个实例节点
  19. virtual Node* create() = 0;
  20. // 设置点击回调
  21. virtual void setCbWhileClicked(std::function<void()> cb) = 0;
  22. // 释放
  23. virtual void release() = 0;
  24. // 获取卡片大小
  25. virtual cocos2d::Size getSize() = 0;
  26. };
  27. // 在商店中的一个活动版位
  28. typedef struct {
  29. std::string id;
  30. std::vector<IAPCard*> cards;
  31. std::string priority; // 活动优先级
  32. } IAPPlacement;
  33. // 显示商店时的一些要求
  34. typedef struct {
  35. int coinsMin;
  36. } ShopRequirement;
  37. NS_IAPSHOP_END
  38. #endif /* IAPDefine_h */