123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- //
- // IAPCtlShop.hpp
- // TileManor
- //
- // Created by 徐炼新 on 2024/9/30.
- //
- #ifndef IAPCtlShop_hpp
- #define IAPCtlShop_hpp
- #include <stdio.h>
- #include "cocos2d.h"
- #include "IAPDefine.hpp"
- #include "IAPShopDelegate.hpp"
- class IAPConf;
- class IAPCtlShopUI;
- class PBConfigData;
- NS_IAPSHOP_BEGIN
- class IAPCtlShop : public cocos2d::Ref {
- public:
- // 创建一个商店控制器
- static IAPCtlShop* createWith();
-
- // 设置代理
- // delegate 代理的实现
- void setDelegate(IAPShopDelegate* delegate);
- // 初始化普通商店卡片配置
- // cfgFN 配置文件名
- void init(std::string& cfgFN);
-
- // 设置失败时内购卡片的配置
- // cfgFN 配置文件名
- void setCfg4Failure(std::string& cfgFN);
-
- // 设置当前设备的等级
- // level 等级: 1 表示初级, 2 表示中级, 3 表示高级 (中级目前没有设计)
- void setDeviceLevel(int level);
- // 添加一个商店版位
- // plInfo 版位信息
- bool addAPlacement(const IAPPlacement& plInfo);
- // 删除一个商店版位
- // id 添加版位时的id
- void removePlacement(const std::string& id);
-
- // 给某个商店版位添加卡片
- // id 商店版位id card 卡片信息
- bool addCardToPlacement(const std::string& id, IAPCard* card);
-
- // 给某个商店版位删除卡片
- // id 商店版位id cardIndex 卡片索引
- bool removeCardToPlacement(const std::string& id, int cardIndex = -1);
-
- // 清空活动
- void clearPlacement();
-
- // 获取活动版位总数
- size_t getPlacementCount();
-
- // 在某个节点中打开普通商店
- // pParent 父节点
- // requirement 对商店的要求,比如说最低金币数
- void showInNode(cocos2d::Node* pParent, ShopRequirement& requirement);
-
- // 显示失败时的内购卡片(失败时卡片,非普通商店卡片)
- // Node 父节点
- // cardsName 内购卡片名称
- void displayFailureCardIn(cocos2d::Node*, std::vector<std::string> cardsName);
-
- // 以滑动卡片的形式在某个节点中显示满足金币条件的所有 普通商店卡片(暂未使用)删除?
- // pParent 父节点
- // stillNeedCoins 距离所需要的金币数还差多少金币
- void showSlideCardsByCoinsIn(cocos2d::Node* pParent, int stillNeedCoins);
-
- // 添加用户购买信息 并 从delegate发送购买的道具信息
- // commodityID 购买的商店卡片ID
- void addUserBuyInfo(std::string commodityID);
-
- // 清除用户购买信息
- void clearUserBuyInfo();
-
- private:
-
-
- private:
- static IAPCtlShop* _instance;
-
- IAPShopDelegate* _delegate;
- IAPConf* _conf;
- PBConfigData* _pbConf;
- };
- NS_IAPSHOP_END
- #endif /* IAPCtlShop_hpp */
|