Example #1
0
void MallMarkets::menuItemCall2(CCObject *pSender)
{
    
    CCTableViewCell *cell = (CCTableViewCell*)(((CCMenuItemImage*)pSender)->getParent()->getParent());
    CCLog("getIdx: %d",cell->getIdx());
    
    int amountNumber = this->coinNumber[cell->getIdx()];
    
    char amount2[11];
    sprintf(amount2, "%d",amountNumber);
    string amount3 = amount2;

    int price = this->coinListPrice[cell->getIdx()];
    char tempPrice[10];
    sprintf(tempPrice, "%d",price);
    string priceString = tempPrice;
    CCLog("price: %s",priceString.c_str());
    
    string postData ;
    string temp1 = "buy_method=2";
    string temp2 = "&buy_amount=";
    string temp3 = "&rmb=";
    postData = temp1 + temp2 + amount3 + temp3 + priceString ;
    CCLog("postData: %s",postData.c_str());
    
    

    CCLog("returnData1: %s",this->returnDataBusiness.c_str());
    

    
    /*PrizeMoneyChange acceptPrize;
    acceptPrize.prizeID = this->coinID[cell->getIdx()];
    acceptPrize.prizeName = this->coinName[cell->getIdx()];
    acceptPrize.prizePrice = this->coinListPrice[cell->getIdx()];
    
    CCDirector::sharedDirector()->pushScene(CCTransitionSlideInR::create(1, PrizeMoneyChange::scene()));*/
    
}
void MainLayerHerosBaseBody::menuItemClicked_heroImg(CCObject* pSender)
{
	CCTableViewCell *cell = (CCTableViewCell*)((CCMenuItemSprite*)pSender)->getParent()->getParent()->getParent();
	int idx = cell->getIdx();
	AddFriendUI *layer = AddFriendUI::create();
	layer->ignoreAnchorPointForPosition(false);
	layer->setAnchorPoint(CCPointZero);
	layer->setPosition(CCPointZero);
	layer->setProfessionId(mHerosVec[idx]->getActorType());
	layer->setMenuShow(true,false);
	CCDirector::sharedDirector()->getRunningScene()->addChild(layer,1024);
	

	
}
void MainLayerHerosBaseBody::menuItemClicked_choseHero(CCObject* pSender)
{
	BaseSprite* bg = (BaseSprite*)((CCMenuItemImage*)pSender)->getParent()->getParent();
	CCTableViewCell* cell = (CCTableViewCell*)bg->getParent();
	int idx = cell->getIdx();

	if(mChoseHeroState[idx]>=1 && mChoseHeroState[idx]<=4)
	{
		mChoseHeroState[idx] = 0;
		--mChoseNum;

//		mTableView->reloadData();
		for(int i=0; i!=mHerosVec.size(); ++i)
			mTableView->updateCellAtIndex(i);
	}
	else if(mChoseHeroState[idx] == 0 && mChoseNum<3)
	{
		int temp[4] = {false};
		int chessboard;
		for(int i=0; i!=mChoseHeroState.size(); ++i)
			if(mChoseHeroState[i]>=1 && mChoseHeroState[i]<=4)
				temp[mChoseHeroState[i]-1] = true;
		for(int i=0; i!=4; ++i)
			if(! temp[i])		
			{
				if(MyselfManager::getManager()->getMyZhuJueData()->getChessBoardPos() == i+1)
					continue;
				chessboard = i+1;
				break;
			}
			
		mChoseHeroState[idx] = chessboard;
		++mChoseNum;

//		mTableView->reloadData();

		for(int i=0; i!=mHerosVec.size(); ++i)
			mTableView->updateCellAtIndex(i);
	}
	
}
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;
	}
}
Example #5
0
void MainScene::tableViewSubBtnCallback(CCObject* pSender)
{
    CCTableViewCell *cell = (CCTableViewCell*)(((CCMenuItemImage*)pSender)->getParent()->getParent());
    CCLog("tableViewSubBtnCallback,%d",cell->getIdx());
//    ((CCMenuItemImage*)pSender)->setScaleX(2);
}