CCTableViewCell* MainLayerZhuangBeiBody::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
	CCString *string = CCString::createWithFormat("%d", idx);
	CCTableViewCell *cell = NULL;  //table->dequeueCell();
	if (cell == NULL) 
	{
		cell = new CCTableViewCell();
		cell->autorelease();
	}
	else
	{
		cell->removeAllChildren();
	}
	//
	CCMenuItemImage *itemImage = CCMenuItemImage::create(
		itemFiles[idx].c_str()
		,itemFiles_select[idx].c_str()
		, this, SEL_MenuHandler(&MainLayerZhuangBeiBody::menuItemClicked));
	CCMenu* menu = CCMenu::create();
	cell->addChild(menu, 0, TAG_MENU);
	menu->setPosition(CCPointZero);
	menu->addChild(itemImage, 0, idx);
	itemImage->setPosition(ccp(itemImage->getContentSize().width/2, itemImage->getContentSize().height/2));


	return cell;
}
CCTableViewCell* MainLayerHerosBaseBody::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
	CCString *string = CCString::createWithFormat("%d", idx);
	CCTableViewCell *cell = table->dequeueCell();
	if (cell == NULL) 
	{
		cell = new CCTableViewCell();
		cell->autorelease();
	}
	else 
	{
		cell->removeAllChildren();
	}

	cell->addChild(getItemContentByIndex(idx),0,TAG_BaseBody_TABLE_ITEM);
		//CCLog("CCTableViewCell one");
// 	}
// 	else
// 	{
// 		//CCLog("refreshItem one");
// 		CCNode* temp = cell->getChildByTag(TAG_BaseBody_TABLE_ITEM);
// 		refreshItem(temp,idx);
// 	}

	return cell;
}
Пример #3
0
CCTableViewCell* TanSuoLayer::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
	CCTableViewCell *cell = table->dequeueCell();
	if (cell != NULL)
	{
		cell->removeAllChildren();
	}
	else 
	{
		cell = new CCTableViewCell();
		cell->autorelease();
	}

	if (table->getParent() != NULL)
	{
		CCSize cellSize = tableCellSizeForIndex(table, idx);
		Profession profId = mHeros.at(idx)->getCurrentProperty().profession;

		//head  Profession 1-10
		BaseSprite *headImg = BaseSprite::create(ImageManager::getManager()->getImageData_ProfessionHead(profId).getCurrentImageFile());
		cell->addChild(headImg);
		headImg->setPosition(ccp(cellSize.width/2, 92));

		//menu
		FXScrollMenu *menu = FXScrollMenu::create(
			table->getParent()->convertToWorldSpace(table->getPosition()), table->getViewSize());
		cell->addChild(menu, 1);
		menu->setPosition(ccp(0,0));
		CCMenuItemImage *item = CCMenuItemImage::create(
			"renxing_renwu_touxiang.png",
			"renxing_renwu_touxiang_select.png", 
			"renxing_renwu_touxiang_select.png", 
			this, menu_selector(TanSuoLayer::menuItemClicked_JieFenHeroSelect));
		menu->addChild(item, 0, profId);

		m_lMenuItemList.push_back(item);

		item->setPosition(headImg->getPosition());
		//name
		CCLabelTTF *nameLabel = CCLabelTTF::create(BaseActorPropertyParser::getParser()->getExtraProerty(profId).nameInChinese.c_str()
			, fontStr_kaiti, m_nFontSize);
		cell->addChild(nameLabel);
		nameLabel->setPosition(ccp(headImg->getPositionX()
			, headImg->getPositionY()-headImg->getContentSize().height/2-nameLabel->getContentSize().height/2));
		nameLabel->setColor(ccc3(195, 145, 96));
	}

	return cell;
}
Пример #4
0
CCTableViewCell* IOSStoreLayer::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
	CCTableViewCell *cell = table->dequeueCell();
	if (cell)
	{
		cell->removeAllChildren();
	}
	else
	{
		cell = new CCTableViewCell;
		cell->autorelease();
	}

	//根据标签来初创建不同的cell
	CCSprite* pDaoju = NULL;
	if (table->getTag() == kaibaoxiang_node_tableview_tag)
	{
		if (idx >= 0 && (int)idx < m_iBaoxiangCellCount)
		{
			pDaoju = this->createCellSpr(idx, &m_baoxiangInfoVector.at(idx));
		}
	}
	else
	{
		if (idx >= 0 && (int)idx < m_iBuyStarCellCount)
		{
			pDaoju = this->createCellSpr(idx, &m_buystarInfoVector.at(idx));
		}
	}

	if (pDaoju)
	{
		pDaoju->setPosition(CCPointZero);
		if (idx == 0)
		{
			pDaoju->setPosition(ccp(10, 0));
		}
		pDaoju->setAnchorPoint(ccp(0,0));
		cell->addChild(pDaoju);
	}

	return cell;
}
CCTableViewCell* MainLayerZhuangBeiBaseBody::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
    CCString *string = CCString::createWithFormat("%d", idx);
    CCTableViewCell *cell = table->dequeueCell();
    if (cell == NULL)
    {
        cell = new CCTableViewCell();
        cell->autorelease();
    }
    else
    {
        cell->removeAllChildren();
    }

    if (table != mTableView) return cell;

    cell->addChild(getItemContentByIndex(idx),0,TAG_EquipBaseBody_TABLE_ITEM);

    return cell;

}