IAPCtlShop.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //
  2. // IAPCtlShop.hpp
  3. // TileManor
  4. //
  5. // Created by 徐炼新 on 2024/9/30.
  6. //
  7. #ifndef IAPCtlShop_hpp
  8. #define IAPCtlShop_hpp
  9. #include <stdio.h>
  10. #include "cocos2d.h"
  11. #include "IAPDefine.hpp"
  12. #include "IAPDelegate.hpp"
  13. NS_IAP_BEGIN
  14. class IAPCtlShop : public cocos2d::Ref {
  15. public:
  16. // 创建一个商店控制器
  17. static IAPCtlShop* createWith();
  18. // 初始化
  19. // cfgFN 配置文件名
  20. void init(std::string& cfgFN);
  21. // 设置代理
  22. // delegate 代理的实现
  23. void setDelegate(IAPDelegate* delegate);
  24. // 设置当前设备的等级
  25. // level 等级: 1 表示初级, 2 表示中级, 3 表示高级
  26. void setDeviceLevel(int level);
  27. // 添加一个商店版位
  28. // plInfo 版位信息
  29. bool addAPlacement(const IAPPlacement& plInfo);
  30. // 删除一个商店版位
  31. // id 卡片id(添加版位时的id)
  32. void removePlacement(const std::string& id);
  33. // 在某个节点中显示
  34. // pParent 父节点
  35. // requirement 对商店的要求,比如说最低金币数
  36. void showInNode(cocos2d::Node* pParent, ShopRequirement& requirement);
  37. // 以滑动卡片的形式在某个节点中显示某些版位(适用于失败时的场景)
  38. // pParent 父节点
  39. // plIds 需要的版位id
  40. void showPlacementsInNode(cocos2d::Node* pParent, const vector<std::string>& plIds);
  41. };
  42. NS_IAP_END
  43. #endif /* IAPCtlShop_hpp */