void CCTableViewCellCreator::setAttribute(CCNode* pNode, const char* strName, const char* strValue, bool bCache) { CCTableViewCell* pTableViewCell = (CCTableViewCell*)pNode; if(bCache) mAttrMap[strName] = strValue; else { if(strcmp(strName, "index") == 0) pTableViewCell->setObjectID(ccXmlAttrParse::toInt(strValue)); else CCNodeCreator::setAttribute(pNode, strName, strValue, bCache); } }
CCTableViewCell * equipmentRoom:: tableCellAtIndex (CCTableView * table, unsigned int idx) { CCString* string; char tc_label[30]; int contentID = 0; sprintf(tc_label,"%s", equipmentList[idx]->m_name.c_str()); //string = CCString::create(m_buttons[idx].label); string = CCString::create(tc_label); //cout << idx << "script name = " << string->getCString() << endl; //cout << "author1 = " << scriptVector[idx]->authorNames[0] << endl; CCTableViewCell *cell;// = table->dequeueCell(); //if (!cell) { cell = new CustomTableViewCell(); cell->autorelease(); CCSprite *sprite = CCSprite::create("grey_cell.png"); sprite->setAnchorPoint(CCPointZero); sprite->setPosition(ccp(0, 0)); sprite->setScaleX(sfx); sprite->setScaleY(sfy); sprite->setTag(4); cell->addChild(sprite); cell->setObjectID(idx); CCLabelTTF *label = CCLabelTTF::create(string->getCString(), "Helvetica", 12.0); label->setPosition(ccp(sprite->boundingBox().size.width/2, sprite->boundingBox().size.height/2)); label->setAnchorPoint(ccp(0.5, 0.5)); //label->setPosition(CCPointZero); //label->setAnchorPoint(CCPointZero); label->setTag(123); cell->addChild(label); //} /*else { CCLabelTTF *label = (CCLabelTTF*)cell->getChildByTag(123); label->setString(string->getCString()); }*/ cout << "cell # " << idx << "title = " << string->getCString() << endl; return cell; }