//定制每个cell的内容 TableViewCell* MyCardListLayer::tableCellAtIndex(cocos2d::extension::TableView *table, ssize_t idx) { //'poreturn TableView::create() auto cell = table->dequeueCell(); if (!cell) { cell = new TableViewCell(); cell->autorelease(); Node* item_node = getItemNode(idx); item_node->setPosition(Point::ZERO); item_node->setAnchorPoint(Point::ZERO); item_node->setTag(100); cell->addChild(item_node); } return cell; }
//定制每个cell的内容 TableViewCell* TaskListLayer::tableCellAtIndex(cocos2d::extension::TableView *table, ssize_t idx) { //'poreturn TableView::create() log("%d_tableCellAtIndex", idx); String* str = String::createWithFormat("yjk_%d", idx); auto cell = table->dequeueCell(); if (!cell) { cell = new TableViewCell(); cell->autorelease(); Node* item_node = getItemNode(idx); item_node->setPosition(Point::ZERO); item_node->setAnchorPoint(Point::ZERO); item_node->setTag(777); cell->addChild(item_node); } return cell; }
cocos2d::extension::TableViewCell* StageSelect::tableCellAtIndex(cocos2d::extension::TableView *table, ssize_t idx) { auto cell = table->dequeueCell(); if (!cell) { cell = TableViewCell::create(); /*auto icon = Sprite::createWithSpriteFrameName(iconFileName); icon->setPosition(Point(50,_cellSize.height /2)); cell->addChild(icon,0,10);*/ auto cell_node = getItemNode(idx); cell->addChild(cell_node,0,10); if(_noTouch && idx==_selectItem) {selected_cell = cell;} log("!cell.....%d",idx); } else { log("cell.....%d",idx); auto item_bk = (Sprite*)cell->getChildByTag(10)->getChildByTag(20); if(idx <= fake_overstage) item_bk->setSpriteFrame("bt_mission_0.png"); else item_bk->setSpriteFrame("bt_mission_1.png"); // auto item_hl = (Sprite*)cell->getChildByTag(10)->getChildByTag(30); // item_hl->setSpriteFrame("bt_mission_3.png"); // item_hl->setVisible(false); std::string stage_text_str = s_gameStrings.mainMenu->stagetext + " - " + Value((int)idx+1).asString(); auto stage_text = (TextSprite*)cell->getChildByTag(10)->getChildByTag(40); stage_text->setText(stage_text_str); if(idx<=fake_overstage) stage_text->setColor(Color3B(230,230,230)); else stage_text->setColor(Color3B(80,80,80)); if(_selectItem == idx) cell->getChildByTag(10)->getChildByTag(40)->setColor(DIY_COLOR_BLUE5); if(_selectItem == idx) cell->getChildByTag(10)->getChildByTag(30)->setVisible(true); else cell->getChildByTag(10)->getChildByTag(30)->setVisible(false); if(_noTouch && idx==_selectItem) { selected_cell = cell; cell->getChildByTag(10)->getChildByTag(30)->setVisible(true); } if (fake_overstage == idx && s_playerConfig.overstage<50) { cell->getChildByTag(10)->getChildByTag(50)->setVisible(true); } else{ cell->getChildByTag(10)->getChildByTag(50)->setVisible(false); } ((RotateBall*)cell->getChildByTag(10)->getChildByTag(60))->resetIdx(idx); if(idx<=fake_overstage) cell->getChildByTag(10)->getChildByTag(70)->setVisible(false); else cell->getChildByTag(10)->getChildByTag(70)->setVisible(true); } return cell; }