123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- //
- // TestScene.cpp
- // demo
- //
- // Created by Red_mini on 2024/10/11.
- //
- #include "TestScene.h"
- #include "RUPlatform.h"
- #include "IAPCtlShopUI.hpp"
- #include "IAPCtlShop.hpp"
- #include "IAPDefine.hpp"
- USING_NS_CC;
- Scene* TestScene::createScene(){
-
- // create the scene with physics enabled
- auto scene = Scene::create();
- auto layer = TestScene::create();
- scene->addChild(layer);
-
- return scene;
- }
- bool TestScene::init(){
- if (!Layer::init()) {
- return false;
- }
-
- std::string cfgFN = "shop_5.json";
-
- _iapShop = iap::IAPCtlShop::createWith();
- _iapShop->init(cfgFN);
-
- // 在此处添加场景初始化的代码,比如创建背景、角色、UI等
- createBoard();
- schedule(CC_SCHEDULE_SELECTOR(TestScene::update), 1.0f);
-
- return true;
- }
- void TestScene::createBoard(){
- // auto iapConf = IAPConf::getInstance();
- // iapConf->initWith();
- // auto iapCtlShopUi = IAPCtlShopUI::getInstance();
- // iapCtlShopUi->create(this, iapConf);
- //
- auto lyMap = redutils::RUReboltLayer::createReboltLayer("lyMap.redream");
- this->addChild(lyMap);
- // log(lyMap->getChildrenCount());
- lyMap->registerOnNotify([this](const redutils::ReboltNotifyData& data){
- onNotifyDevelopment(data);
- });
- lyMap->runBehaviacWhitFunName("初始化");
-
- // _igCoin->doOwnInit();
- }
- void TestScene::onNotifyDevelopment(const redutils::ReboltNotifyData& data){
- if(data.notify == "点击显示商店"){
- log("点击显示商店按钮");
-
- iap::ShopRequirement shopRequirement;
- shopRequirement.coinsMin = 0;
-
- _iapShop->showInNode(this, shopRequirement);
- }else if(data.notify == "点击设备1"){
- log("点击设备等级1按钮");
- }else if(data.notify == "点击设备2"){
- log("点击设备等级2按钮");
- }else if(data.notify == "点击设备3"){
- log("点击设备等级3按钮");
- }else if(data.notify == "点击失败"){
- log("点击失败时金币不够按钮");
-
- iap::ShopRequirement shopRequirement;
- shopRequirement.coinsMin = 10000;
-
- _iapShop->showInNode(this, shopRequirement);
- }else if(data.notify == "点击重置"){
- log("重置");
- }
- }
- void TestScene::update(float dt){
-
-
- }
|