Ejemplo n.º 1
0
CCTableViewCell* S131More::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
    
    CCTableViewCell *pCell = table->dequeueCell();
    if (!pCell)
    {
        
        pCell = new CCTableViewCell();
        pCell->autorelease();
        
        CCSprite *pSprite1 = CCSprite::create("S13PRightPoint.png");
        pSprite1->setPosition(ccp(0,90));
        pSprite1->setTag(1010);
        pCell->addChild(pSprite1);
        
        string aStr = rightBigTitle[PersonalApi::convertIntToString(idx+1)]+"        "+rightTime[PersonalApi::convertIntToString(idx+1)];
        const char * labelStr = aStr.c_str();//rightBigTitle[PersonalApi::convertIntToString(idx+1)].c_str();
        float titleFontSize = 20;
        CCSize titleDetailSize = CCSizeMake(500, 30);
        CCLabelTTF *pLabel = CCLabelTTF::create(labelStr, s1FontName_macro, titleFontSize, titleDetailSize, kCCTextAlignmentLeft, kCCVerticalTextAlignmentTop);
        pLabel->setTag(234);
        pLabel->setPosition(ccp(280,180));
        pLabel->setColor(ccBLACK);
        pCell->addChild(pLabel);
        
        const char * labelStr2 = rightDetailTitle[PersonalApi::convertIntToString(idx+1)].c_str();
        float titleFontSize2 =  20;
        CCSize titleDetailSize2 = CCSizeMake(500, 30);
        CCLabelTTF *pLabel2 = CCLabelTTF::create(labelStr2, s1FontName_macro, titleFontSize2, titleDetailSize2, kCCTextAlignmentLeft, kCCVerticalTextAlignmentTop);
        pSprite1->setAnchorPoint(ccp(0.0,1.0));
        pLabel2->setTag(567);
        pLabel2->setPosition(ccp(280,130));
        pLabel2->setColor(ccBLACK);
        pCell->addChild(pLabel2);
        
 
        CCSprite *pSprite2 = CCSprite::create("s131RightWordBottom.png");
        pSprite2->setAnchorPoint(CCPointZero);
        pSprite2->setTag(999);
        pSprite2->setPosition(ccp(0,0));
        pCell->addChild(pSprite2);
    }
    else
    {
      
        
        CCLabelTTF *pLabel = (CCLabelTTF*)pCell->getChildByTag(234);
        pLabel->setString((rightBigTitle[PersonalApi::convertIntToString(idx)]+"        "+rightTime[PersonalApi::convertIntToString(idx)]).c_str());
        
        CCLabelTTF *pLabel2 = (CCLabelTTF*)pCell->getChildByTag(567);
        pLabel2->setString(rightDetailTitle[PersonalApi::convertIntToString(idx)].c_str());
        
    }

    return pCell;
}
Ejemplo n.º 2
0
CCTableViewCell* ItemListScene::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
    CCTableViewCell *cell = table->dequeueCell();

    CCLabelTTF *itemNumberLabel = NULL;
    CCLabelTTF *itemNameLabel = NULL;

    if (!cell) {
        cell = new CCTableViewCell();
        cell->autorelease();

        itemNumberLabel = CCLabelTTF::create("", DefaultFontName, FontSizeNormal);
        itemNumberLabel->setAnchorPoint(ccp(0.0, 0.5));
        itemNumberLabel->setPosition(ccp(kItemNumberLabelMarginLeft, kItemCellHeight / 2));
        itemNumberLabel->setTag(kItemCellTagNumberLabel);
        cell->addChild(itemNumberLabel);

        itemNameLabel = CCLabelTTF::create("", DefaultFontName, FontSizeNormal);
        itemNameLabel->setAnchorPoint(ccp(0.0, 0.5));
        itemNameLabel->setPosition(ccp(kItemNameLabelMarginLeft, kItemCellHeight / 2));
        itemNameLabel->setTag(kItemCellTagNameLabel);
        cell->addChild(itemNameLabel);
    }

    Item item = selectedItem(idx);

    cell->removeChildByTag(kItemCellTagImage);

    itemNumberLabel = (CCLabelTTF *)cell->getChildByTag(kItemCellTagNumberLabel);
    itemNumberLabel->setString(CCString::createWithFormat("%02lld", item.get_id())->getCString());

    CCSprite *itemImage = NULL;
    itemNameLabel = (CCLabelTTF *)cell->getChildByTag(kItemCellTagNameLabel);

    if (item->count > 0) {
        itemImage = CCSprite::createWithSpriteFrameName(item->image.c_str());
        itemNameLabel->setString(item->name.c_str());
    }
    else {
        itemImage = CCSprite::createWithSpriteFrameName(NotFoundItemImage);
        itemNameLabel->setString(MessageNotFoundItemNameText);
    }

    itemImage->setAnchorPoint(ccp(0.0, 0.5));
    itemImage->setPosition(ccp(kItemImageMarginLeft, kItemCellHeight / 2));
    itemImage->setTag(kItemCellTagImage);
    cell->addChild(itemImage);

    return cell;
}
Ejemplo n.º 3
0
CCTableViewCell* S22PicDetail::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
    CCTableViewCell *pCell = table->dequeueCell();
    if (!pCell)
    {
        
        pCell = new CCTableViewCell();
        pCell->autorelease();
        
        string picName = "S2"+ PersonalApi::convertIntToString(AppDelegate::S2SelectedScene)+ PersonalApi::convertIntToString(AppDelegate::S2LeftSelected)+"Display"+PersonalApi::convertIntToString(idx+1)+".png";
        
        
        string picNameStr=PersonalApi::getRealImageName(picName.c_str(),"S2BigPic.png").c_str();
        CCSprite *pSprite = CCSprite::create(picNameStr.c_str());
        pSprite->setAnchorPoint(CCPointZero);
        pSprite->setTag(123);
        
        float pSpriteScale = tableViewBackGroundSp->getContentSize().height/pSprite->getContentSize().height;
        pSprite->setScale(pSpriteScale);
        pSprite->setPosition(ccp(0,pSprite->getPosition().y-pSprite->getContentSize().height*pSpriteScale/2));
        
        pCell->addChild(pSprite);
   
    }
    else
    {
        CCSprite *pSprite = (CCSprite*)pCell->getChildByTag(123);
        string picName = "S2"+ PersonalApi::convertIntToString(AppDelegate::S2SelectedScene)+ PersonalApi::convertIntToString(AppDelegate::S2LeftSelected)+"Display"+PersonalApi::convertIntToString(idx+1)+".png";
        
        string picNameStr=PersonalApi::getRealImageName(picName.c_str(),"S2BigPic.png").c_str();
        pSprite->setTexture(CCTextureCache::sharedTextureCache()->addImage(picNameStr.c_str()));
    }
    return pCell;
}
void MainLayerZhuangBeiBaseBody::disableAllTouchEnd()
{
    mTableView->setTouchEnabled(true);

    int cellNum = numberOfCellsInTableView(mTableView);
    for (int i=0; i<cellNum; i++)
    {
        CCTableViewCell* cell = mTableView->cellAtIndex(i);
        if (cell)
        {
            CCNode* bg = cell->getChildByTag(TAG_EquipBaseBody_TABLE_ITEM);
            if (bg)
            {
                CCMenu* menu = (CCMenu*)bg->getChildByTag(TAG_BaseBody_MENU);
                if (menu)
                {
                    menu->setEnabled(true);
                }
            }
        }
    }

    CCPoint beg = mTableView->getContentOffset();
    if (mOffset.y < beg.y) mOffset.y = beg.y;
    if (mOffset.y > tableCellSizeForIndex(mTableView,0).height*3) mOffset.y = tableCellSizeForIndex(mTableView,0).height*3;
    mTableView->setContentOffset(mOffset);
}
Ejemplo n.º 5
0
CCTableViewCell* GameUI_MainTitle::tableCellAtIndex(cocos2d::extension::CCTableView *table, unsigned int idx)
{
    CCString *string = CCString::createWithFormat("%d", idx);
    CCTableViewCell *cell = table->dequeueCell();
    if (!cell)
    {
        cell = new CCTableViewCell();
        cell->autorelease();
        CCSprite *sprite = CCSprite::create("Icon.png");
        sprite->setAnchorPoint(CCPointZero);
        sprite->setPosition(ccp(0, 0));
        cell->addChild(sprite);
        
        CCLabelTTF *label = CCLabelTTF::create(string->getCString(), "Helvetica", 20.0);
        label->setPosition(CCPointZero);
		label->setAnchorPoint(CCPointZero);
        label->setTag(123);
        cell->addChild(label);
    }
    else
    {
        CCLabelTTF *label = (CCLabelTTF*)cell->getChildByTag(123);
        label->setString(string->getCString());
    }
    
    return cell;
}
void MainLayerHerosBaseBody::disableAllTouchBegin()
{
	mTableView->setTouchEnabled(false);
	int cellNum = numberOfCellsInTableView(mTableView);
	for (int i=0;i<cellNum;i++)
	{
		CCTableViewCell* cell = mTableView->cellAtIndex(i);
		if (cell)
		{
			CCNode* bg = cell->getChildByTag(TAG_BaseBody_TABLE_ITEM);
			if (bg)
			{
				CCMenu* menu = (CCMenu*)bg->getChildByTag(TAG_BaseBody_TABLE_HERO_IMG);
				if (menu)
				{
					menu->setEnabled(false);
				}
				menu = (CCMenu*)bg->getChildByTag(TAG_Menu);
				if(menu)
				{
					menu->setEnabled(false);
				}
			}
		}
	}

}
Ejemplo n.º 7
0
CCTableViewCell* DebugTestScene::tableCellAtIndex( CCTableView* in_pTable, unsigned int in_idx )
{
    CELL_DATA*  pCellData     = &s_aSelectSceneList[in_idx];
    CCString*   pText         = CCString::create(pCellData->pText);
    CCTableViewCell*    pCell = in_pTable->dequeueCell();
    if( pCell == NULL )
    {
        pCell   = new CCTableViewCell();
        pCell->autorelease();

        CCPoint origin     = CCDirector::sharedDirector()->getVisibleOrigin();

        //  ラベル追加
        {
            CCLabelTTF* pLabel  =
            CCLabelTTF::create( pText->getCString(), "Helvetica", MultiResolution::shared()->getFontSize(s_fontSize_.width) );
            
            pLabel->setPosition(ccp(origin.x, 0));
            pLabel->setAnchorPoint(CCPointZero);
            pLabel->setTag(100);
            pCell->addChild(pLabel);
        }
    }
    else
    {
        CCLabelTTF* pLabel  = (CCLabelTTF*)pCell->getChildByTag(100);
        pLabel->setString(pText->getCString());
    }
    
    return  pCell;
}
Ejemplo n.º 8
0
//reload가 호출 되거나, 스크롤이 움직여 안보이는 셀이 보여질 때 호출된다. 
CCTableViewCell* MenuScene::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
	//테이블이 사용 중인 셀이 있다면 재활용한다. 테이블 뷰는 똑같은 모양에 데이터만 다른 경우가 많다. 그래서 하나의 셀을 재사용하고 데이터만 바꿔준다.
	CCTableViewCell *cell = table->dequeueCell();

	//datalist에서 데이터를 가져온다. 여기서는 CCString을 했지만, CCObject를 상속받은 커스텀 클래스를 만들어서 여러 정보를 담을 수 있을 것이다.
	CCString* string = (CCString*) datalist->objectAtIndex(idx);

	if (!cell) {
		//커스텀 셀을 이용했는데, 이는 커스텀 셀 부분의 draw 함수를 오버로딩하여 여러가지 효과를 줄 수 있기 때문이다. 이 예제에서는 아무런 추가 내용이 없지만, 이부분을 이용하여 3D리스트 뷰나, 크기가 바뀌는 리스트 뷰 같은 조금 더 다이나믹한 리스트뷰를 만들 수 있을 것 같다. 
		cell = new TableViewCell();
		cell->autorelease();

		CCLabelTTF *label = CCLabelTTF::create(string->getCString(), "Helvetica", 20.0);
		label->setPosition(CCPointZero);
		label->setAnchorPoint(CCPointZero);
		label->setTag(123);
		cell->addChild(label);
	}
	else
	{
		CCLabelTTF *label = (CCLabelTTF*)cell->getChildByTag(123);
		label->setString(string->getCString());
	}

	return cell;
}
Ejemplo n.º 9
0
CCTableViewCell* ListViewLayer::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
    //CCString *pString = (CCString *)aArray->objectAtIndex(idx);
    const char * str = aVect[idx].c_str();
    CCLOG("%s\n/////////",str);
    CCTableViewCell *pCell = table->dequeueCell();
    if (!pCell) {
        pCell = new CCTableViewCell();
        pCell->autorelease();
       /* CCSprite *pSprite = CCSprite::create("pBackground.png");
        //pSprite->setColor(ccBLUE);
        pSprite->setAnchorPoint(CCPointZero);
		pSprite->setPosition(CCPointZero);
        pCell->addChild(pSprite);
*/
        CCLabelTTF *pLabel = CCLabelTTF::create(str, "Arial", 20.0,CCSizeMake(table->getContentSize().width, 0), kCCTextAlignmentLeft);
        pLabel->setPosition(CCPointZero);
		pLabel->setAnchorPoint(CCPointZero);
        pLabel->setTag(123);
        pLabel->setColor(ccBLACK);
        //pLabel->setContentSize(CCSizeMake(table->getContentSize().width-60, 120));
        pCell->addChild(pLabel);
    }
    else
    {
        CCLabelTTF *pLabel = (CCLabelTTF*)pCell->getChildByTag(123);
        pLabel->setString(str);
    }


    return pCell;
}
Ejemplo n.º 10
0
void GongJiang_EquipSelect::select()
{
	CCTableViewCell* lastCell = mTableView->cellAtIndex(0);
	if (lastCell)
	{
		BaseSprite* bg = (BaseSprite*)lastCell->getChildByTag(TAG_EquipBaseBody_TABLE_ITEM);

		bool isFirstIn = false;
		// 先不管是否点击了图片
		if(GameGuideManager::getManager()->isGuideNow(GameGuideManager::GID_GongJiang_QiangHua))
		{
			//GameGuideManager::getManager()->setOneGuideStart(GameGuideManager::GID_GongJiang_SelectZhuangBei);
			//GameGuideManager::getManager()->setOneGuideEnd(GameGuideManager::GID_GongJiang_SelectZhuangBei);
			if (bg)
			{
				CCPoint pos = bg->getParent()->convertToWorldSpace(bg->getPosition());
				GuideLayerBase *guideLayer1 = new GuideLayer_SimpleLayer;
				guideLayer1->init(bg->getContentSize(), ccp(pos.x,pos.y + bg->getContentSize().height / 2)
					, LFStrings::getValue("qiangxuanzezhuangbei"), NULL, false);
				//((GuideLayer_SimpleLayer*)guideLayer1)->setCallBack(this,SEL_CallFunc(&JiuGongGeLayer::GuiDeLayerCallBack));
				CCDirector::sharedDirector()->getRunningScene()->addChild(guideLayer1, 128);
			}
		}
	}

}
Ejemplo n.º 11
0
CCTableViewCell* DataSourceOfHour::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
    CCString *string;
    if (idx >= 2 && idx <= 25)
        string = CCString::createWithFormat("%0.2d", idx-2);
    else
        string = CCString::createWithFormat("");

    CCTableViewCell *cell = table->dequeueCell();
    if (!cell) {
        cell = new CustomTableViewCell();
        cell->autorelease();
        
        CCLabelTTF *label = CCLabelTTF::create(string->getCString(), "Helvetica", 25.0);
        label->setColor(ccBLACK);
        label->setPosition(ccp(WIDTH/2, HIGHT/2));
		label->setAnchorPoint(ccp(0.5,0.5));
        label->setTag(123);
        cell->addChild(label);
    }
    else
    {
        CCLabelTTF *label = (CCLabelTTF*)cell->getChildByTag(123);
        label->setString(string->getCString());
    }
    
    
    return cell;
}
Ejemplo n.º 12
0
CCTableViewCell* S11PrepareRes::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
    CCTableViewCell *cell = table->dequeueCell();
    if (!cell)
    {
        cell = new CustomTableViewCell();
        cell->autorelease();
        if (idx==0)
        {
            selectIndex=0;
        
        }
   
        CCLabelTTF *label = CCLabelTTF::create("点击输入", "Helvetica", 30.0);
        label->setColor(ccBLACK);
        label->setPosition(s11Position8_1_macro(label));
        label->setAnchorPoint(CCPointZero);
        label->setTag(123);
        cell->addChild(label,101);
        
        CCSprite *pSprite = CCSprite::create("s11CellDivideLine.png");
        pSprite->setAnchorPoint(CCPointZero);
		pSprite->setPosition(CCPointZero);
        cell->addChild(pSprite,101);
  
    }
    else
    {
        if (selectIndex ==idx)
        {
            if (activeSprite)
            {
                activeSprite->removeFromParentAndCleanup(false);
            }

            
            activeSprite = CCSprite::create("s11Active Bar.png");
            activeSprite->setAnchorPoint(CCPointZero);
            activeSprite->setPosition(CCPointZero);
            cell->addChild(activeSprite,99);
        }
        
         CCLabelTTF *label = (CCLabelTTF*)cell->getChildByTag(123);
        CCString *aString = CCString::createWithFormat("%u",idx+1);
        std::string aStr = aString->m_sString;
        std::map<std::string,std::string>::iterator aIterator = scriptMap.find(aStr);
        std::string aStr2;
        if (aIterator !=scriptMap.end())
        {
            aStr2 = aIterator->second;
        }
        
        label->setString(aStr2.c_str());
  
    }
    
    return cell;
}
void MainLayerZhuangBeiBody::selectAtIndex(unsigned int index)
{
	// 0 是第一个  所有装备
	CCTableViewCell* currentCell = tableView->cellAtIndex(index);
	CCTableViewCell* lastCell = tableView->cellAtIndex(selectedIndex);

	//if (selectedIndex != index)
	{
		if (lastCell!=NULL)
		{
			CCMenuItemImage* itemImage = (CCMenuItemImage*)lastCell->getChildByTag(TAG_MENU)->getChildByTag(lastCell->getIdx());
			int idx = itemImage->getTag();
			itemImage->initWithNormalImage(
				itemFiles[idx].c_str()
				,itemFiles_select[idx].c_str()
				,NULL, this, menu_selector(MainLayerZhuangBeiBody::menuItemClicked));
		}

		if (currentCell!=NULL)
		{
			CCMenuItemImage* itemImage = (CCMenuItemImage*)currentCell->getChildByTag(TAG_MENU)->getChildByTag(currentCell->getIdx());
			int idx = itemImage->getTag();
			itemImage->initWithNormalImage(
				itemFiles_select[idx].c_str()
				,itemFiles[idx].c_str()
				,NULL, this, menu_selector(MainLayerZhuangBeiBody::menuItemClicked));
		}

		selectedIndex = index;

		BaseLayer* content = createContentAtIndex(index);

		if (selectedContaint)
		{
			selectedContaint->removeFromParent();
		}
		if (content)
		{
			container->addChild(content);
			content->setPosition(ccp(0,0));
		}
		selectedContaint = content;
	}
}
Ejemplo n.º 14
0
CCNode* ListViewLayer::getListItemByIndex(int index)
{
	CCTableViewCell* lastCell = mTableView->cellAtIndex(index);
	if (lastCell)
	{
		CCNode* wrap = lastCell->getChildByTag(TAG_LIST_CELL_ITEM_WRAP);
		return (CCNode*)wrap->getChildren()->objectAtIndex(0);
	}
	// 已经释放了
	return NULL;
}
Ejemplo n.º 15
0
void GongJiang_EquipSelect::tableCellTouched(CCTableView* table, CCTableViewCell* cell)
{
	BaseSprite* bg = (BaseSprite*)cell->getChildByTag(TAG_EquipBaseBody_TABLE_ITEM);
	// 先不管是否点击了图片

	// 先移除上一个点击的
	if (selectedIndex >= 0)
	{
		CCTableViewCell* lastCell = table->cellAtIndex(selectedIndex);
		if (lastCell)
		{
			lastCell->getChildByTag(TAG_EquipBaseBody_TABLE_ITEM)->removeChildByTag(TAG_BG_MASK_PIC);
		}
	}
	// 再次选自己,代表取消
	if (selectedIndex == cell->getIdx())
	{
		selectedIndex = -1;
	}
	else
	{
		selectedIndex = cell->getIdx();
		BaseSprite* addEff = BaseSprite::create("mianban_zhuangbei_xiangxi_select.png");
		bg->addChild(addEff,10,TAG_BG_MASK_PIC);
		addEff->setPosition(ccp(bg->getContentSize().width/2,bg->getContentSize().height/2));
	}

	if(selectedIndex < 0)
	{
		mMenuItemMakeSure->setEnabled(false);
	}
	else
	{
		mMenuItemMakeSure->setEnabled(true);
	}
	bool isFirstIn = false;
	// 先不管是否点击了图片
	if(GameGuideManager::getManager()->isGuideNow(GameGuideManager::GID_GongJiang_QiangHua))
	{
		//GameGuideManager::getManager()->setOneGuideStart(GameGuideManager::GID_GongJiang_QhHt);
		GameGuideManager::getManager()->setOneGuideEnd(GameGuideManager::GID_GongJiang_QiangHua);

		if (mMenuItemMakeSure)
		{
			CCPoint pos =  mMenuItemMakeSure->getParent()->convertToWorldSpace(mMenuItemMakeSure->getPosition());
			GuideLayerBase *guideLayer1 = new GuideLayer_SimpleLayer;
			guideLayer1->init(mMenuItemMakeSure->getContentSize(),pos
				, LFStrings::getValue("DingjiQueding"), NULL, false);
			//((GuideLayer_SimpleLayer*)guideLayer1)->setCallBack(this,SEL_CallFunc(&JiuGongGeLayer::GuiDeLayerCallBack));
			CCDirector::sharedDirector()->getRunningScene()->addChild(guideLayer1, 128);
		}
	}
}
Ejemplo n.º 16
0
CCTableViewCell* MainInnerLayer::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
	//CCString *string = (CCString *)mCardList->objectAtIndex(idx);
	CCDictionary *dict = (CCDictionary *)mCardList->objectAtIndex(idx);
	//std::string strCardHeadName(((CCString *)dict->objectForKey("cardHeadImg"))->getCString());
	//strCardHeadName.append(".png");

	std::string strCardHeadImg("art/art_head1/");
	strCardHeadImg.append(((CCString *)dict->objectForKey("cardHeadImg"))->getCString());
	strCardHeadImg.append(".png");

	bool selected = (idx==selectedindex);
    CCSprite *sCard = NULL;
    CCSprite *sSelected = NULL;
	CCTableViewCell *cell = table->dequeueCell();
	if (!cell) {
		cell = new CCTableViewCell();
		cell->autorelease();

//		CCSize size = this->tableCellSizeForIndex(table, idx);

		sSelected = CCSprite::createWithSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("card_selected.png"));
		sSelected->setVisible(false);
		sSelected->setTag(121);
		sSelected->setPosition(ccp(2,0));
		sSelected->setAnchorPoint(CCPointZero);
		cell->addChild(sSelected);

		/*sCard = CCSprite::createWithSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(strCardHeadName.c_str()));*/
		sCard = CCSprite::create(strCardHeadImg.c_str());
		sCard->setScale(CCDirector::sharedDirector()->getContentScaleFactor()/2);
		sCard->setTag(122);
		sCard->setPosition(ccp(2,0));
		sCard->setAnchorPoint(CCPointZero);
		cell->addChild(sCard);
	}
	else
	{
		sCard = (CCSprite*)cell->getChildByTag(122);
        
        CCTexture2D* tex = CCTextureCache::sharedTextureCache()->addImage(strCardHeadImg.c_str());
        sCard->setTexture(tex);
        sCard->setScale(CCDirector::sharedDirector()->getContentScaleFactor()/2);
        
		sCard->setScale(CCDirector::sharedDirector()->getContentScaleFactor()/2);
        //sCard->setDisplayFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(strCardHeadName.c_str()));
	}

	return cell;
}
Ejemplo n.º 17
0
void DebugTestScene::tableCellTouched( CCTableView* in_pTable, CCTableViewCell* in_pCell )
{
    //  タッチしたシーンに遷移する。
    unsigned int    idx = in_pCell->getIdx();
    CCTableViewCell*    pCell = in_pTable->dequeueCell();
    if( pCell )
    {
        CCLabelTTF* pLabel  = (CCLabelTTF*)pCell->getChildByTag(100);
        pLabel->setFontFillColor(ccc3(255, 0, 0));
    }
    
    CCDirector* pDirector   = CCDirector::sharedDirector();
    pDirector->replaceScene((*s_aSelectSceneList[idx].pScene)());
}
Ejemplo n.º 18
0
CCTableViewCell* ListViewLayer::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
	CCTableViewCell *cell = table->dequeueCell();
	if (cell == NULL) {
		cell = new CCTableViewCell();
		cell->autorelease();

		if (mSource.creator)
		{
			CCNode* item = mSource.creator->getItemContentByIndex(idx);

			// 包裹
			CCNode* wraped = CCNode::create();
			wraped->setContentSize(item->getContentSize());
			wraped->addChild(item,0);

			// 有个0.5,0.5的偏移
			wraped->setPosition(ccp(wraped->getContentSize().width/2,wraped->getContentSize().height/2));

			cell->addChild(wraped,0,TAG_LIST_CELL_ITEM_WRAP);
		}else
		{
			CCAssert(false,"");
		}

		CCLog("ListViewLayer::tableCellAtIndex ---> create!");
	}
	else
	{
		CCLog("ListViewLayer::tableCellAtIndex ---> refesh!");

		CCNode* warped = cell->getChildByTag(TAG_LIST_CELL_ITEM_WRAP);
		CCNode* item = (CCNode*)warped->getChildren()->objectAtIndex(0);

		if (mSource.creator)
		{
			mSource.creator->refreshItem(item,idx);
		}else
		{
			CCAssert(false,"");
		}
	}

	return cell;
}
CCTableViewCell * HelloWorld::tableCellAtIndex(cocos2d::extension::CCTableView *table, unsigned int idx){
    
    CCTableViewCell *cell = table->dequeueCell();
    CCLabelTTF *label;
    if (cell==NULL) {
        cell = new CCTableViewCell();
        label = CCLabelTTF::create("Label", "Courier", 48);
        cell->addChild(label);
        label->setTag(TABLE_CELL_LABEL_TAG);
        label->setAnchorPoint(ccp(0, 0));
        cell->setAnchorPoint(ccp(0, 0));
    }else{
        label = (CCLabelTTF*)cell->getChildByTag(TABLE_CELL_LABEL_TAG);
    }
    
    label->setString(((CCString*)dataArr->objectAtIndex(idx))->getCString());
    
    return cell;
}
Ejemplo n.º 20
0
CCTableViewCell* TestList::tableCellAtIndex ( CCTableView* pTable, KDuint uIndex )
{
	CCTableViewCell*  pCell = pTable->dequeueCell ( );

	if ( !pCell )
	{
		pCell = CCTableViewCell::create ( );
		
		CCMenuItemFont*   pItem = CCMenuItemFont::create ( l_pTestNames [ uIndex ] );	
		pCell->addChild ( pItem, 0, 1 );
		pItem->setPosition ( ccpMid ( cellSizeForTable ( pTable ) ) );
	}
	else
	{
		CCMenuItemFont*   pItem = (CCMenuItemFont*) pCell->getChildByTag ( 1 );
		pItem->setString ( l_pTestNames [ uIndex ] );	
	}

	return pCell;
}
CCTableViewCell* EXMainMenuScene::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
    CCString *string = (CCString*)m_listData->objectAtIndex(idx);
    CCTableViewCell *cell = table->dequeueCell();
    if (!cell) {
        cell = new CCTableViewCell();
        cell->autorelease();
        CCLabelTTF *label = CCLabelTTF::create(string->getCString(), "Helvetica", 20.0);
        label->setPosition(ccp(m_winSize.width * .5, 30));
        label->setTag(123);
        cell->addChild(label);
    }
    else
    {
        CCLabelTTF *label = (CCLabelTTF*)cell->getChildByTag(123);
        label->setString(string->getCString());
    }
    
    
    return cell;
}
Ejemplo n.º 22
0
CCTableViewCell* MainScene::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
    CCString *string = CCString::createWithFormat("%d", idx);
    CCTableViewCell *cell = table->dequeueCell();
    if (!cell) {
        cell = new CCTableViewCell();
        cell->autorelease();
        CCSprite *sprite = CCSprite::create("Icon-144.png");
        sprite->setAnchorPoint(CCPointZero);
        sprite->setPosition(ccp(0, 0));
        sprite->setScaleX(2);
        cell->addChild(sprite);
        
        CCLabelTTF *label = CCLabelTTF::create(string->getCString(), "Helvetica", 20.0);
        label->setPosition(CCPointZero);
        label->setAnchorPoint(CCPointZero);
        label->setTag(123);
        cell->addChild(label);
        
        CCMenuItemImage *pBtn = CCMenuItemImage::create(
                                                        "CloseNormal.png",
                                                        "CloseSelected.png",
                                                        this,
                                                        menu_selector(MainScene::tableViewSubBtnCallback));
        CCMenu* pMenu = CCMenu::create(pBtn, NULL);
        pBtn->setPosition(ccp(pBtn->getContentSize().width/2,pBtn->getContentSize().height/2));
        pMenu->setPosition(CCPointZero);
        cell->addChild(pMenu, 1);
        cell->setTag(idx);
    }
    else
    {
        CCLabelTTF *label = (CCLabelTTF*)cell->getChildByTag(123);
        label->setString(string->getCString());
    }

    
    return cell;
}
Ejemplo n.º 23
0
CCTableViewCell* S3PracticeScene::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
//    CCString *strCell = CCString::createWithFormat("Practice %d",idx);
    CCString *strCell = CCString::create(aVectorCellValue[idx].c_str());
    CCTableViewCell *pCell = table->dequeueCell();
    if (!pCell) {
        pCell = new CCTableViewCell();
        pCell->autorelease();
        CCSprite *pSprite = CCSprite::create();//("cellLine.png");
        pSprite->setAnchorPoint(CCPointZero);
		pSprite->setPosition(CCPointZero);
        pCell->addChild(pSprite);
        
        {
            CCLabelTTF *pLabel = CCLabelTTF::create(strCell->getCString(), "Arial", s3FontSize3_macro, s3Size2_macro(aCell), kCCTextAlignmentLeft, kCCVerticalTextAlignmentCenter);
            pLabel->setPosition(ccp(s3Less2_macro,0));
            pLabel->setAnchorPoint(CCPointZero);
            pLabel->setColor(ccc3(0,0,0));
            pLabel->setTag(10);
            pCell->addChild(pLabel,1);
        }
        
        {
            CCLabelTTF *pLabel = CCLabelTTF::create("Locked", "Arial",s3FontSize3_macro, s3SizeCellLaterLabel_macro, kCCTextAlignmentRight, kCCVerticalTextAlignmentCenter);
            pLabel->setPosition(s3Position8_macro(aItem));
            pLabel->setAnchorPoint(CCPointZero);
            pLabel->setColor(ccc3(0,0,255));
            pLabel->setTag(10);
            pCell->addChild(pLabel,1);
        }
        
    }
    
    CCLabelTTF *pLabel = (CCLabelTTF*)pCell->getChildByTag(10);
    pLabel->setString(strCell->getCString());
    
    return pCell;
}
Ejemplo n.º 24
0
CCTableViewCell* HelloWorld::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
    CCDictionary* pRecipe = (CCDictionary*)m_pRecipes->objectAtIndex(idx);
    CCString* pName = (CCString*)pRecipe->objectForKey("name");
    CCString* pNo   = (CCString*)pRecipe->objectForKey("recipe");
    CCString* pStep = (CCString*)pRecipe->objectForKey("step");
    
    CCString* string;
    if (pStep!=NULL) {
        string = CCString::createWithFormat("レシピ %s (ステップ%s): %s", pNo->getCString(), pStep->getCString(), pName->getCString());
    } else if (pNo->isEqual(CCString::create("0"))) {
        string = pName;
    } else {
        string = CCString::createWithFormat("レシピ %s : %s", pNo->getCString(), pName->getCString());
    }
    CCTableViewCell *cell = table->dequeueCell();
    if (!cell) {
        cell = new CCTableViewCell();
        cell->autorelease();
        
        CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
        
        int fontSize = CCEGLView::sharedOpenGLView()->getDesignResolutionSize().height/320.0f * 20;
        CCLabelTTF *label = CCLabelTTF::create(string->getCString(), "Helvetica", fontSize, CCSizeMake(visibleSize.width, visibleSize.height/5), kCCTextAlignmentCenter);
        label->setPosition(CCPointZero);
		label->setAnchorPoint(CCPointZero);
        label->setTag(123);
        cell->addChild(label);
    }
    else
    {
        CCLabelTTF *label = (CCLabelTTF*)cell->getChildByTag(123);
        label->setString(string->getCString());
    }
    
    
    return cell;
}
void MainLayerZhuangBeiBaseBody::disableAllTouchBegin()
{
    mTableView->setTouchEnabled(false);
    int cellNum = numberOfCellsInTableView(mTableView);
    for (int i=0; i<cellNum; i++)
    {
        CCTableViewCell* cell = mTableView->cellAtIndex(i);
        if (cell)
        {
            CCNode* bg = cell->getChildByTag(TAG_EquipBaseBody_TABLE_ITEM);
            if (bg)
            {
                CCMenu* menu = (CCMenu*)bg->getChildByTag(TAG_BaseBody_MENU);
                if (menu)
                {
                    menu->setEnabled(false);
                }
            }
        }
    }

    mOffset = mTableView->getContentOffset();
}
Ejemplo n.º 26
0
CCTableViewCell* TableViewTestLayer::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
    CCString *string = CCString::createWithFormat("%d", idx);
    CCTableViewCell *cell = table->dequeueCell();
    if (!cell) {
        cell = new CCTableViewCell();
        cell->autorelease();
        CCSprite *sprite = CCSprite::create("HelloWorld.png");
		sprite->setScale(0.2f);
        sprite->setPosition(ccp(60, 60));
		sprite->setTag(123);
        cell->addChild(sprite);
        CCLabelTTF *label = CCLabelTTF::create(string->getCString(), "Arial", 20.0);
        label->setPosition(ccp(60,10));
        label->setTag(456);
        cell->addChild(label);
    }
    else
    {
        CCLabelTTF *label = (CCLabelTTF*)cell->getChildByTag(456);
        label->setString(string->getCString());
    }
    return cell;
}
Ejemplo n.º 27
0
CCTableViewCell* MallMarkets::tableCellAtIndex(cocos2d::extension::CCTableView *table, unsigned int idx)
{
    
    //CCSize winSize = CCDirector::sharedDirector()->getWinSize();
    CCSize tableCellSize = CCSizeMake(1136, 100);
    CCTableViewCell *pCell = table->dequeueCell();
    
    string temp = this->coinImageName[idx];
    string imagePath = writablePathLocal+temp;
    
    
    CCSprite *prizePicture = CCSprite::create(imagePath.c_str());
    prizePicture->setAnchorPoint(CCPointZero);
    prizePicture->setPosition(ccp(20, 60));
    prizePicture->setScale(1);
    prizePicture->setTag(122);
    //pCell->addChild(prizePicture);
    
    if (!pCell) {
        
        pCell = new CCTableViewCell();
        pCell->autorelease();
        
        
        //1.表格背景ZF_Shoot_Button_gridItem
        CCSprite *pSprite = CCSprite::create("ZF_Shoot_Button_gridItem.png");
        pSprite->setAnchorPoint(CCPointZero);
        pSprite->setPosition(CCPointZero);
        pSprite->setScale(1);
        pCell->addChild(pSprite);
        
        
        //2.prizePicture
        
        pCell->removeChildByTag(122);
        pCell->addChild(prizePicture);
        
        
        //3.coinName
        CCLabelTTF *pLabeName = CCLabelTTF::create(this->coinName[idx].c_str(), "Arial", 28);
        pLabeName->setPosition(ccp(20, 10));
        pLabeName->setColor(ccc3(88, 88, 88));
        pLabeName->setAnchorPoint(CCPointZero);
        pLabeName->setTag(123);
        pCell->addChild(pLabeName);
        
        
        
        //4.prizePrice
        char priceChar[11];
        sprintf(priceChar, "%d",this->coinListPrice[idx]);
        string t1 = "¥";
        t1 = t1 + priceChar;
        CCLabelTTF *pLabelPrice = CCLabelTTF::create(t1.c_str(), "Arial", 28);
        pLabelPrice->setPosition(ccp(tableCellSize.width*0.37, tableCellSize.height*0.8));
        pLabelPrice->setAnchorPoint(CCPointZero);
        pLabelPrice->setTag(124);
        pLabelPrice->setColor(ccc3(250, 131, 26));
        pCell->addChild(pLabelPrice);
        
        
        //5.购买
        CCMenuItemImage *itemImage = CCMenuItemImage::create("ZF_Shoot_button_coinList_buy1.png", "ZF_Shoot_button_coinList_buy2.png", this, menu_selector(MallMarkets::menuItemCall2));
        if (itemImage->getTag() == -1) {
            itemImage->setTag(idx);
        }
        itemImage->setPosition(ccp(tableCellSize.width*0.4, tableCellSize.height*0.42));
        CCMenu *menu = CCMenu::create(itemImage,NULL);
        menu->setPosition(CCPointZero);
        pCell->addChild(menu, 1);
        
        
    }else{
        
        
        pCell->removeChildByTag(122);
        pCell->addChild(prizePicture);
        
        
        CCLabelTTF *pLabeName = (CCLabelTTF*)pCell->getChildByTag(123);
        pLabeName->setString(this->coinName[idx].c_str());
        
        
        char priceChar[11];
        sprintf(priceChar, "%d",this->coinListPrice[idx]);
        string t1 = "¥";
        //string t2 = "元人民币";
        //t1 = t1 + priceChar + t2;
        t1 = t1 + priceChar;
        CCLabelTTF *pLabelPrice = (CCLabelTTF*)pCell->getChildByTag(124);
        pLabelPrice->setString(t1.c_str());
        
        
    }
    return pCell;
}
Ejemplo n.º 28
0
CCTableViewCell* RequestList::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
    int index = idx;    
    EziFBIncomingRequest* fbRequest = (EziFBIncomingRequest*)_fbIncomingRequestList->objectAtIndex(index);
    EziFacebookFriend* sender       = fbRequest->getSender();
    
    const char* senderName = sender->getName();
    
    // Create the fancy test.
    EziSocialWrapperNS::FB_REQUEST::TYPE requestType = fbRequest->getRequestType();
    std::string messageToDisplay = "";
    
    switch (requestType)
    {
        case EziSocialWrapperNS::FB_REQUEST::REQUEST_INVITE:
            messageToDisplay.append(senderName).append(" has sent invitation to you.");
            break;

        case EziSocialWrapperNS::FB_REQUEST::REQUEST_GIFT:
            messageToDisplay.append(senderName).append(" has sent gift to you.");
            break;

        case EziSocialWrapperNS::FB_REQUEST::REQUEST_CHALLENGE:
            messageToDisplay.append(senderName).append(" has challenged to you.");
            break;
            
        default:
            messageToDisplay.append("Unknown message");
            break;
    }
    
    // Means users have already used this request.
    bool requestConsumed = fbRequest->isConsumed();
    
    CCSprite* profilePic            = NULL;
    ccColor4B bgColor = ccc4(20, 0, 40, 255);
    
    if (requestConsumed == false)
    {
        bgColor = ccc4(50, 50, 20, 255);
    }

    
    // Build the table cell.
    CCTableViewCell *cell = table->dequeueCell();
    
    if (cell == NULL)
    {
        cell = new CCTableViewCell();
        cell->autorelease();

                
        // Create the back layer of the cell.
        CCLayerColor* colorLayer = CCLayerColor::create(bgColor, SCREEN_WIDTH, CELL_HEIGHT);
        colorLayer->setTag(BACKGROUND_TAG);
        
        cell->addChild(colorLayer);
        
        // Get the sender profile picture path. Create it if path is available.
        if (sender != NULL && strcmp(sender->getPhotoPath(), "") != 0)
        {
            const char*  picPath = sender->getPhotoPath();
            profilePic = CCSprite::create(picPath);
        }
        else
        {
            profilePic = CCSprite::create(FB_DEFAULT_PHOTO);
        }

        // Add the profile pic to the cell row.
        profilePic->setAnchorPoint(ccp(0, 0.5));
        profilePic->setPosition(ccp(20, CELL_HEIGHT/2));
        cell->addChild(profilePic);
        profilePic->setTag(FRIEND_PHOTO_TAG);
        
        // Set the message.
        CCLabelTTF *messageLabel = CCLabelTTF::create(messageToDisplay.c_str(), "Helvetica", 20.0 * MENU_FONT_SCALE);
        messageLabel->setAnchorPoint(ccp(0, 0.5));
        messageLabel->setPosition(ccp(20 + 20 + profilePic->getContentSize().width, CELL_HEIGHT/2));
        messageLabel->setTag(REQUEST_MESSAGE_LABEL_TAG);
        messageLabel->setDimensions(CCSizeMake(SCREEN_WIDTH - (profilePic->getContentSize().width * 2) - 60, CELL_HEIGHT-5));
        messageLabel->setHorizontalAlignment(kCCTextAlignmentLeft);
        cell->addChild(messageLabel);

        CCMenuItemImage* constumeItemButton = NULL;
        constumeItemButton = CCMenuItemImage::create("use.png", "use_pressed.png");
        

        constumeItemButton->setTag(idx);
        constumeItemButton->setTarget(this, menu_selector(RequestList::useItem));
        constumeItemButton->setScale(SCALE_FACTOR * 0.8);
        constumeItemButton->setTag(FRIEND_CONSUME_BUTTON_TAG);
        
        CCMenu* consumeMenu = CCMenu::create(constumeItemButton, NULL);
        consumeMenu->setTag(FRIEND_CONSUME_MENU_TAG);
        consumeMenu->setPosition(ccp(SCREEN_WIDTH - (constumeItemButton->getContentSize().width*SCALE_FACTOR*0.4),
                                       (CELL_HEIGHT - (constumeItemButton->getContentSize().height)*SCALE_FACTOR*0.4)));
        
        
        cell->addChild(consumeMenu);
        
        
    }
    else
    {
        // Refresh the cell data based upon idx.
        
        // 1. Refresh the profile picture.
        CCSprite* cellProfilePic = (CCSprite*)cell->getChildByTag(FRIEND_PHOTO_TAG);
        
        if (strcmp("", sender->getPhotoPath()) != 0 )
        {
            const char*  picPath = sender->getPhotoPath();
            profilePic = CCSprite::create(picPath);
            
        }
        else
        {
            profilePic = CCSprite::create(FB_DEFAULT_PHOTO);
        }
        
        cellProfilePic->setTexture(profilePic->getTexture());
        
        // Update the message Label.
        CCLabelTTF *messageLabel = (CCLabelTTF*)cell->getChildByTag(REQUEST_MESSAGE_LABEL_TAG);
        messageLabel->setString(messageToDisplay.c_str());
        
        CCMenu* consumeMenu = (CCMenu*)cell->getChildByTag(FRIEND_CONSUME_MENU_TAG);
        
        CCArray* children = consumeMenu->getChildren();
        
        if (children)
        {
            CCMenuItemImage* consumenButton = (CCMenuItemImage*)children->objectAtIndex(0);
            
            if (consumenButton)
            {
                consumenButton->setTag(index);
            }
            else
            {
                CCLOG("No Consume Button");
            }
            
        }
        
        CCLayerColor* bgLayer = (CCLayerColor*)cell->getChildByTag(BACKGROUND_TAG);
        bgLayer->setColor(ccc3(bgColor.r, bgColor.g, bgColor.b));
    }
    
    return cell;
    
}
Ejemplo n.º 29
0
CCTableViewCell* MailListScene::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
	CCString *string = (CCString *)mArrayList->objectAtIndex(idx);
    CCSize size = this->tableCellSizeForIndex(table, idx);
	CCTableViewCell *cell = table->dequeueCell();
	if (!cell) {
		cell = new CCTableViewCell();
		cell->autorelease();

		CCSprite *sState = CCSprite::createWithSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("mail_state_read.png"));
		sState->setAnchorPoint(CCPointMake(0, 0.5));
		sState->setPosition(ccp(10,size.height * 0.5));
		sState->setTag(120);
		cell->addChild(sState);

		CCLabelTTF *lblName = CCLabelTTF::create(string->getCString(), "Arial", 14.0);
		lblName->setPosition(ccp(65,size.height * 0.5));
        lblName->setColor(ccc3(255, 255, 204));
        //lblName->enableStroke(ccc3(51, 0, 0), 0.6);
		lblName->setTag(121);
		lblName->setHorizontalAlignment(kCCTextAlignmentLeft);
        lblName->setString(string->getCString());
		cell->addChild(lblName);

		CCLabelTTF *lblSubject = CCLabelTTF::create("100", "Arial", 14.0);
		lblSubject->setPosition(ccp(130,size.height * 0.5));
        lblSubject->setColor(ccc3(255, 255, 204));
        //lblSubject->enableStroke(ccc3(51, 0, 0), 0.6);
        lblSubject->setTag(122);
        lblSubject->setString(string->getCString());
		cell->addChild(lblSubject);
        
        CCScale9Sprite *sline = CCScale9Sprite::createWithSpriteFrame(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName("mail_line.png"));
        sline->setPreferredSize(CCSizeMake(310, 1));
        sline->setPosition(ccp(0,size.height-2));
        sline->setAnchorPoint(CCPointZero);
        cell->addChild(sline);
        
        CCMenu *menuCheck = this->generateCheckBox();
        cell->addChild(menuCheck);
        CCMenuItemToggle *toggle= (CCMenuItemToggle *)menuCheck->getChildByTag(1);
        toggle->setUserData(&vUserData[idx]);
		if (vUserData[idx] == 1) {
			toggle->setSelectedIndex(1);
		} else {
			toggle->setSelectedIndex(0);
		}

        menuCheck->setTag(123);
        menuCheck->setAnchorPoint(CCPointMake(0, 0.5));
        menuCheck->setPosition(CCPointMake(280, size.height * 0.5));
	}
	else
	{
		CCLabelTTF *lblName = (CCLabelTTF*)cell->getChildByTag(121);
		lblName->setString(string->getCString());
        
        CCLabelTTF *lblSubject = (CCLabelTTF*)cell->getChildByTag(122);
		lblSubject->setString(string->getCString());
        
        CCMenu *menuCheck = (CCMenu *)cell->getChildByTag(123);
        CCMenuItemToggle *toggle= (CCMenuItemToggle *)menuCheck->getChildByTag(1);
		toggle->setUserData(&vUserData[idx]);

        if (vUserData[idx] == 1) {
			toggle->setSelectedIndex(1);
        } else {
            toggle->setSelectedIndex(0);
        }
	}

	return cell;
}
Ejemplo n.º 30
0
CCTableViewCell* FriendList::tableCellAtIndex(CCTableView *table, unsigned int idx)
{
    EziFacebookFriend* friendDetails = (EziFacebookFriend*)mFriendList->objectAtIndex(idx);
    std::string friendID            = friendDetails->getFBID();
    std::string friendName          = friendDetails->getName();
    std::string installed           = "";
    std::string score               = "";
    CCSprite* profilePic            = NULL;
    
    // Set the score.
    long mylong = friendDetails->getScore();
    std::stringstream mystream;
    mystream << mylong;
    score = mystream.str();
    
    // Set the install status
    if (friendDetails->isInstalled())
    {
        installed = "Installed";
    }
    else
    {
        installed = "Not Installed";
    }
    
    
    CCTableViewCell *cell = table->dequeueCell();
    
    
    if (!cell) // Creation of Cell.
    {
        cell = new CCTableViewCell();
        cell->autorelease();
        
        CCLayerColor* colorLayer = CCLayerColor::create(ccc4(20, 0, 40, 255), SCREEN_WIDTH, CELL_HEIGHT);
        cell->addChild(colorLayer);
        
        CCSprite *sprite = NULL;
        
        if (strcmp(friendDetails->getPhotoPath(), "") != 0)
        {
            const char*  picPath = friendDetails->getPhotoPath();
            sprite = CCSprite::create(picPath);
        }
        else
        {
            sprite = CCSprite::create(FB_DEFAULT_PHOTO);
        }
        
        if (sprite == NULL)
        {
            CCLOG("Sprite is NULL");
        }
        
        sprite->setAnchorPoint(ccp(0, 0.5));
        sprite->setPosition(ccp(20, CELL_HEIGHT/2));
        cell->addChild(sprite);
        //sprite->setScale(0.9);
        sprite->setTag(FRIEND_PHOTO_TAG);
        
        // Friend Facebook ID
        CCLabelTTF *friendIDLabel = CCLabelTTF::create(friendID.c_str(), "Helvetica", 20.0 * MENU_FONT_SCALE);
        
        float gapY =  (CELL_HEIGHT - (friendIDLabel->getContentSize().height * 2)) / 3;
        
        if (sprite)
        {
            friendIDLabel->setPosition(ccp(sprite->getPositionX() + sprite->getContentSize().width + 20, CELL_HEIGHT - gapY));
        }
        
		friendIDLabel->setAnchorPoint(ccp(0, 1));
        friendIDLabel->setTag(FRIEND_ID_LABEL_TAG);
        cell->addChild(friendIDLabel);
        
        // Friend Facebook Name
        CCLabelTTF *friendNameLabel = CCLabelTTF::create(friendName.c_str(), "Helvetica", 20.0 * MENU_FONT_SCALE);
        friendNameLabel->setPosition(ccp(friendIDLabel->getPositionX(),
                                         friendIDLabel->getPositionY() - friendIDLabel->getContentSize().height - gapY));
        
		friendNameLabel->setAnchorPoint(ccp(0, 1));
        friendNameLabel->setTag(FRIEND_NAME_LABEL_TAG);
        cell->addChild(friendNameLabel);
        
        
        // High Score
        CCLabelTTF *scoreLabel = CCLabelTTF::create(score.c_str(), "Helvetica", 20.0 * MENU_FONT_SCALE);
        scoreLabel->setPosition(ccp(SCREEN_WIDTH - 20, friendIDLabel->getPositionY()));
        
        scoreLabel->setAnchorPoint(ccp(1, 1));
        scoreLabel->setTag(FRIEND_SCORE_LABEL_TAG);
        cell->addChild(scoreLabel);
        
        // Installed String
        CCLabelTTF *installedLabel = CCLabelTTF::create(installed.c_str(), "Helvetica", 20.0 * MENU_FONT_SCALE);
        installedLabel->setPosition(ccp(SCREEN_WIDTH - 20, friendNameLabel->getPositionY()));
        
        installedLabel->setAnchorPoint(ccp(1, 1));
        installedLabel->setTag(FRIEND_INSTALLED_LABEL_TAG);
        cell->addChild(installedLabel);
        
    }
    else
    {
        
        // Set the Friend ID
        CCLabelTTF *friendIDLabel = (CCLabelTTF*)cell->getChildByTag(FRIEND_ID_LABEL_TAG);
        friendIDLabel->setString(friendID.c_str());
        
        // Set the Friend Name
        CCLabelTTF *friendNameLabel = (CCLabelTTF*)cell->getChildByTag(FRIEND_NAME_LABEL_TAG);
        friendNameLabel->setString(friendName.c_str());
        
        
        CCLabelTTF *highScoreLabel = (CCLabelTTF*)cell->getChildByTag(FRIEND_SCORE_LABEL_TAG);
        if (highScoreLabel != NULL)
        {
            highScoreLabel->setString(score.c_str());
        }
        
        highScoreLabel->setVisible(mEnableHighScoreDisplay);
        
        
        CCLabelTTF *installedLabel = (CCLabelTTF*)cell->getChildByTag(FRIEND_INSTALLED_LABEL_TAG);
        if (installedLabel != NULL)
        {
            installedLabel->setString(installed.c_str());
        }
        installedLabel->setVisible(mEnableInstalledDisplay);
        
        
        CCSprite* cellProfilePic = (CCSprite*)cell->getChildByTag(FRIEND_PHOTO_TAG);
        
        if (strcmp("", friendDetails->getPhotoPath()) != 0 )
        {
            const char*  picPath = friendDetails->getPhotoPath();
            profilePic = CCSprite::create(picPath);
            
        }
        else
        {
            profilePic = CCSprite::create(FB_DEFAULT_PHOTO);
        }
        
        
        cellProfilePic->setTexture(profilePic->getTexture());
    }
    
    
    return cell;
}