unsigned int GoodsHelper::getTangguoNum(){ const BagItem *item = getOneItem(unitID_TangGuo); if (!item) { return 0; } return item->value; }
unsigned int GoodsHelper::getGuodongNum(){ const BagItem *item = getOneItem(unitID_GuoDong);//甜筒 if (!item) { return 0; } return item->value; }
unsigned int GoodsHelper::getDaogaiNum(){ const BagItem *item = getOneItem(unitID_DanGao); if (!item) { return 0; } return item->value; }
unsigned int GoodsHelper::getJewelNum() { const BagItem *item = getOneItem(unitID_RedJewel); if (!item) { return 0; } return item->value; }
unsigned int GoodsHelper::getDiamondNum() { const BagItem *item = getOneItem(unitID_Diamond); if (!item) { return 0; } return item->value; }
unsigned int GoodsHelper::getActorFragmentNum(UnitID actorId) { UnitID fragmentId = (UnitID)ActorHelper::getHelper()->getActorUnlockNeedFragmentId(actorId); const BagItem *item = getOneItem(fragmentId); if (!item) { return 0; } return item->value; }
// Extracts items one by one from line, copies them into heap storage, // and stores references to them in the row array. // The function result is the number of items copied. static int extractItems(char *line, char *row[]) { char t[MAXINPUTLINELEN]; int col = 0; for( ; ; ) { line = getOneItem(line,t); if (line == NULL) break; char *s = mystrdup(t); row[col++] = s; } return col; }
//运输机内士兵 void UIConveyorLayer::showConveyorInfoLayer() { auto node = this->getContentInfoNode(); auto Nodesize = Size(node->getContentSize().width/2.5,node->getContentSize().height); if(m_ConveyorInfolist) { m_ConveyorInfolist->removeAllItems(); } else { ListView* listView = ListView::create(); // set list view ex direction listView->setDirection(SCROLLVIEW_DIR_VERTICAL); listView->setTouchEnabled(true); listView->setBounceEnabled(true); listView->setBackGroundImage("dian9/[email protected]"); //背景图 listView->setBackGroundImageScale9Enabled(true); //是否用的是点9图 listView->setSize(Nodesize*0.98f); listView->setPosition(Point(120,5)); node->addChild(listView); m_ConveyorInfolist = listView; } int i = 1; auto info = ConveyorConfig::getConveyorConfigFromId(m_iCurState); if(info) { auto iter = info->soldieritems.begin(); for (iter;iter != info->soldieritems.end(); iter++) { auto iteminfo = (*iter); while (iteminfo->number == 0) { iter++; if(iter == info->soldieritems.end())return; iteminfo = (*iter); } auto soldierInfo = SoldierConfig::getSoldierConfig(iteminfo->soldierid); if(!soldierInfo){ return ; } auto layer1 = UISoldierHeadLayer::create(soldierInfo,iteminfo->number,true); layer1->getCurDownLayer()->setVisible(false); layer1->setIsTopVisible(false); layer1->setRecruitCallBack(CC_CALLBACK_1( UIConveyorLayer::ReductionSoldier,this)); layer1->setTag(i); iter++; i++; if(iter != info->soldieritems.end()) { auto iteminfo = (*iter); while (iteminfo->number == 0) { iter++; if(iter == info->soldieritems.end()){ auto tmpnode = getOneItem(layer1,nullptr); Layout* custom_item = Layout::create(); custom_item->setSize(tmpnode->getContentSize()); tmpnode->setPosition(Point(custom_item->getSize().width / 2.0f-tmpnode->getContentSize().width/2, custom_item->getSize().height / 2.0f-tmpnode->getContentSize().height/2)); custom_item->addChild(tmpnode); m_ConveyorInfolist->pushBackCustomItem(custom_item); return; } iteminfo = (*iter); } soldierInfo = SoldierConfig::getSoldierConfig(iteminfo->soldierid); if(!soldierInfo){ return ; } auto layer2 = UISoldierHeadLayer::create(soldierInfo,iteminfo->number,true); layer2->getCurDownLayer()->setVisible(false); layer2->setIsTopVisible(false); layer2->setRecruitCallBack(CC_CALLBACK_1( UIConveyorLayer::ReductionSoldier,this)); layer2->setTag(i); auto tmpnode = getOneItem(layer1,layer2); Layout* custom_item = Layout::create(); custom_item->setSize(tmpnode->getContentSize()); tmpnode->setPosition(Point(custom_item->getSize().width / 2.0f-tmpnode->getContentSize().width/2, custom_item->getSize().height / 2.0f-tmpnode->getContentSize().height/2)); custom_item->addChild(tmpnode); m_ConveyorInfolist->pushBackCustomItem(custom_item); } else { auto tmpnode = getOneItem(layer1,nullptr); Layout* custom_item = Layout::create(); custom_item->setSize(tmpnode->getContentSize()); tmpnode->setPosition(Point(custom_item->getSize().width / 2.0f-tmpnode->getContentSize().width/2, custom_item->getSize().height / 2.0f-tmpnode->getContentSize().height/2)); custom_item->addChild(tmpnode); m_ConveyorInfolist->pushBackCustomItem(custom_item); return ; } } } }