|
@@ -55,6 +55,7 @@ void IAPCtlShopUI::clear() {
|
|
|
}
|
|
|
_goodsItems.clear();
|
|
|
_placementItems.clear();
|
|
|
+ _failItems.clear();
|
|
|
for(const auto& placement : _placements){
|
|
|
_indicators[placement.first].clear();
|
|
|
}
|
|
@@ -98,70 +99,37 @@ bool IAPCtlShopUI::create(Node* pNode, IAPConf* cfg, iap::ShopRequirement& requi
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-// (暂未完成)
|
|
|
-void IAPCtlShopUI::showPlacementsInNode(cocos2d::Node *pNode, const vector<std::string> &plIds){
|
|
|
+void IAPCtlShopUI::displayFailureCardIn(cocos2d::Node *pNode){
|
|
|
clear();
|
|
|
- redutils::Platform::getInstance()->reportLog("open iap");
|
|
|
|
|
|
- int index = 0;
|
|
|
- _tableData.setCascadeOpacity(true);
|
|
|
- _tableData.clear();
|
|
|
- cocos2d::Size size = _ndScrollArea->getContentSize();
|
|
|
- auto delayIdx = 0;
|
|
|
- cocos2d::Vec2 offset(size.width, 0);
|
|
|
- float dur = 0.4;
|
|
|
- int height = 0;
|
|
|
+ IAPCardView::sDotCfg cfg;
|
|
|
+ cfg.hightSp = "内购版位_通用_图标_滑动点_已选中.png";
|
|
|
+ cfg.normalSp = "内购版位_通用_图标_滑动点_未选中.png";
|
|
|
+ cfg.sepWidth = 30.0f;
|
|
|
+ cfg.yStart = 0;
|
|
|
|
|
|
- for(int i = 0; i < plIds.size(); i++){
|
|
|
- if(_placements.count(plIds[i]) == 0)continue;
|
|
|
- // 展示活动版位
|
|
|
- bool bNeedAnim = height <= size.height;
|
|
|
- Node* nd = Node::create();
|
|
|
- nd->setAnchorPoint(Vec2(0.5,0.5));
|
|
|
- nd->setContentSize(cocos2d::Size(584,250));
|
|
|
- nd->setCascadeOpacityEnabled(true);
|
|
|
- nd->setCascadeColorEnabled(true);
|
|
|
-
|
|
|
- auto si = createPlacementUI(_placements[plIds[i]]);
|
|
|
- auto sz = cocos2d::Size(584,280);
|
|
|
- cocos2d::Vec2 pos(size.width/2.0, sz.height/2.0);
|
|
|
- nd->addChild(si);
|
|
|
- si->setPosition(bNeedAnim ? pos+offset : pos);
|
|
|
- _placementItems.push_back(nd);
|
|
|
- _tableData.insertCell(index++, nd);
|
|
|
- _allSizes.push_back(sz);
|
|
|
- height += sz.height;
|
|
|
-
|
|
|
- if (bNeedAnim) {
|
|
|
- // 加入动画
|
|
|
- auto d = DelayTime::create(delayIdx*dur/8.0);
|
|
|
- auto m = EaseBackOut::create(MoveBy::create(dur, cocos2d::Vec2(-offset.x, offset.y)));
|
|
|
- si->runAction(Sequence::create(d, m, NULL));
|
|
|
- delayIdx ++;
|
|
|
- }
|
|
|
+ IAPConf::getInstance()->getAllGoods(_goodsInfo);
|
|
|
+ float h = 0.0;
|
|
|
+ for(const auto& goodInfo : _goodsInfo){
|
|
|
+ h = std::max(h, goodInfo.sz.height);
|
|
|
}
|
|
|
|
|
|
- _tableData._numberOfCellsInTableView = [=](cocos2d::extension::TableViewSmooth*)->ssize_t{
|
|
|
- return _allSizes.size();
|
|
|
- };
|
|
|
- _tableData._tableCellSizeForIndex = [=](cocos2d::extension::TableViewSmooth*, ssize_t idx)->Size{
|
|
|
- if (idx < _allSizes.size()) {
|
|
|
- return _allSizes[idx];
|
|
|
- } else {
|
|
|
- return Size(0,0);
|
|
|
- }
|
|
|
- };
|
|
|
+ auto visibleSize = Director::getInstance()->getVisibleSize();
|
|
|
+ float width = visibleSize.width;
|
|
|
+ cocos2d::Size sz = cocos2d::Size(width, h + 20);
|
|
|
|
|
|
+ IAPCardView* cardView = IAPCardView::create(sz, cfg);
|
|
|
|
|
|
- _tableView = redutils::RUTableView::create(&_tableData, cocos2d::Size(size.width, size.height));
|
|
|
- _tableView->setCascadeOpacityEnabled(true);
|
|
|
- _tableView->setCascadeColorEnabled(true);
|
|
|
- _tableView->setDirection(ScrollViewSmooth::Direction::VERTICAL);
|
|
|
- _tableView->setVerticalFillOrder(TableViewSmooth::VerticalFillOrder::TOP_DOWN, false);
|
|
|
- _tableView->setDelegate(&_tableData);
|
|
|
- _tableView->setBounceable(true);
|
|
|
-// _tableView->setOutSightClean(false);
|
|
|
- _ndScrollArea->addChild(_tableView);
|
|
|
+ IAPTestCardViewDelegate* cardViewDelegate = new IAPTestCardViewDelegate();
|
|
|
+ cardView->setDelegate(cardViewDelegate);
|
|
|
+
|
|
|
+ for (const auto& goodInfo : _goodsInfo) {
|
|
|
+ auto item = IAPCtlShopItem::create(goodInfo, 1);
|
|
|
+ _failItems.push_back(item);
|
|
|
+ cardView->addCard(item);
|
|
|
+ }
|
|
|
+
|
|
|
+ pNode->addChild(cardView);
|
|
|
}
|
|
|
|
|
|
bool IAPCtlShopUI::addAPlacement(const iap::IAPPlacement &plInfo){
|