当前位置: 首页>>代码示例>>C++>>正文


C++ CCTableView::setVerticalFillOrder方法代码示例

本文整理汇总了C++中CCTableView::setVerticalFillOrder方法的典型用法代码示例。如果您正苦于以下问题:C++ CCTableView::setVerticalFillOrder方法的具体用法?C++ CCTableView::setVerticalFillOrder怎么用?C++ CCTableView::setVerticalFillOrder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCTableView的用法示例。


在下文中一共展示了CCTableView::setVerticalFillOrder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: init

// on "init" you need to initialize your instance
bool TableViewTestLayer::init()
{
    if ( !CCLayer::init() )
    {
        return false;
    }

	CCSize winSize = CCDirector::sharedDirector()->getWinSize();

    CCTableView* tableView = CCTableView::create(this, CCSizeMake(250, 60));
    tableView->setDirection(kCCScrollViewDirectionHorizontal);
    tableView->setPosition(ccp(20,winSize.height/2-30));
    tableView->setDelegate(this);
    this->addChild(tableView);
    tableView->reloadData();

	tableView = CCTableView::create(this, CCSizeMake(60, 280));
	tableView->setDirection(kCCScrollViewDirectionVertical);
	tableView->setPosition(ccp(winSize.width-150,winSize.height/2-120));
	tableView->setDelegate(this);
	tableView->setVerticalFillOrder(kCCTableViewFillTopDown);
	this->addChild(tableView);
	tableView->reloadData();

	// Back Menu
	CCMenuItemFont *itemBack = CCMenuItemFont::create("Back", this, menu_selector(TableViewTestLayer::toExtensionsMainLayer));
	itemBack->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
	CCMenu *menuBack = CCMenu::create(itemBack, NULL);
	menuBack->setPosition(CCPointZero);
	addChild(menuBack);

    return true;
}
开发者ID:BradB132,项目名称:cocos2d-x,代码行数:34,代码来源:TableViewTestScene.cpp

示例2: creatMyTableView

void FightInfoLayer::creatMyTableView() {
    CCTableView *tableView = CCTableView::create(this, myTableView->getContentSize());
    tableView -> setDelegate(this);
    tableView->setDirection(kCCScrollViewDirectionVertical);
    tableView->setVerticalFillOrder(kCCTableViewFillTopDown);
    myTableView -> addCCNode(tableView);
}
开发者ID:anzhongliu,项目名称:SmallGame_Cocos2dx,代码行数:7,代码来源:FightInfoLayer.cpp

示例3: init

bool GameUI_MainTitle::init()
{
    gameLayer = NULL;

    CCSize winSize = CCDirector::sharedDirector()->getWinSize();
    
    CCSprite* title = CCSprite::create("HelloWorld.png");
    CCSize size = CCDirector::sharedDirector()->getWinSize();
    
    title->setPosition(ccp(size.width/2,size.height/2));
    this->addChild(title);
    
    CCSprite* test = CCSprite::create("Icon.png");
    test->setPosition(ccp(size.width/2,size.height/2));
    this->addChild(test);
    
    CCTableView* tableView = CCTableView::create(this, CCSizeMake(60, 280));
	tableView->setDirection(kCCScrollViewDirectionVertical);
	tableView->setPosition(ccp(50,winSize.height/2-120));
	tableView->setDelegate(this);
	tableView->setVerticalFillOrder(kCCTableViewFillTopDown);
	this->addChild(tableView);
	tableView->reloadData();
    
    CCMenuItemImage* start_Button = CCMenuItemImage::create("CloseNormal.png", "CloseSelected.png", this,menu_selector(GameUI_MainTitle::ButtonDelegate_Start));
    CCMenuItemImage* post_Button = CCMenuItemImage::create("CloseNormal.png", "CloseSelected.png", this,menu_selector(GameUI_MainTitle::ButtonDelegate_Post));
    post_Button->setPosition(ccp(0,100));
    CCMenu* menu = CCMenu::create(start_Button, post_Button, NULL);
    menu->setPosition(ccp(winSize.width * 0.8f, winSize.height * 0.2f));
    this->addChild(menu);
    
    return true;
}
开发者ID:bwjdrl2,项目名称:Infinity,代码行数:33,代码来源:GameUI_MainTitle.cpp

示例4: setAttribute

void CCTableViewCreator::setAttribute(CCNode* pNode, const char* strName, const char* strValue, bool bCache)
{
    CCTableView* pTableView = (CCTableView*)pNode;
    if(bCache)
        mAttrMap[strName] = strValue;

    else
    {
        if(strcmp(strName, "fill_order") == 0)
            pTableView->setVerticalFillOrder((CCTableViewVerticalFillOrder)ccXmlAttrParse::toInt(strValue));

        else
            CCScrollViewCreator::setAttribute(pNode, strName, strValue, bCache);
    }
}
开发者ID:zhaxun,项目名称:cocos2d,代码行数:15,代码来源:ccScrollViewCreator.cpp

示例5: init

bool RPGMapItemsMenuLayer::init(cocos2d::CCDictionary *stringList, CppSQLite3DB *db, float width, float height)
{
    if(CCLayerColor::initWithColor(ccc4(0, 0, 0, 200), width, height))
    {
        this->m_stringList = stringList;
        this->m_stringList->retain();
        
        this->m_db = db;
        
        this->m_itemsList = new CCArray();
        this->m_itemsList->init();
        
        CCTMXTiledMap *mainBg = CCTMXTiledMap::create(CCString::createWithFormat("map_menu3_%s.tmx", CCUserDefault::sharedUserDefault()->getStringForKey(GAME_STYLE).c_str())->getCString());
        mainBg->setPosition(CCPointZero);
        mainBg->setTag(kRPGMapItemsMenuLayerTagBg);
        this->addChild(mainBg);
        
        CCMenu *mainMenu = CCMenu::create();
        mainMenu->setTag(kRPGMapItemsMenuLayerTagMainMenu);
        mainMenu->setAnchorPoint(CCPointZero);
        mainMenu->setPosition(CCPointZero);
        this->addChild(mainMenu);
        
        CCMenuItemSprite *menuBack = (CCMenuItemSprite*)mainMenu->getChildByTag(kRPGMapItemsMenuLayerTagMainMenuBack);
        if(!menuBack)
        {
            menuBack = CCMenuItemSprite::create(CCSprite::createWithSpriteFrameName("commons_btn_back_04.png"), CCSprite::createWithSpriteFrameName("commons_btn_back_04.png"), this, menu_selector(RPGMapItemsMenuLayer::onMenu));
            menuBack->setPosition(ccp(40, 600));
            menuBack->setTag(kRPGMapItemsMenuLayerTagMainMenuBack);
            menuBack->setScale(0.5);
            mainMenu->addChild(menuBack);
        }
        
        CCTableView *tableView = CCTableView::create(this, CCSizeMake(900, 570));
        tableView->setDirection(kCCScrollViewDirectionVertical);
        tableView->setPosition(ccp(80, 30));
        tableView->setDelegate(this);
        tableView->setVerticalFillOrder(kCCTableViewFillTopDown);
        tableView->setTag(kRPGMapItemsMenuLayerTagItemListTable);
        this->addChild(tableView);
        
        this->loadItemsData();
        
        return true;
    }
    return false;
}
开发者ID:ChinaiOS,项目名称:OzgGameRPG,代码行数:47,代码来源:RPGMapItemsMenuLayer.cpp

示例6: init

bool DebugTestScene::init()
{
    if ( !CCLayer::init() )
    {
        return false;
    }

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

    //  タイトル名表示
    CCLabelTTF* pTitleLabel = NULL;
    {
        pTitleLabel = CCLabelTTF::create("DebugScene", "Arial", MultiResolution::shared()->getFontSize(24));

        pTitleLabel->setPosition(ccp(origin.x + visibleSize.width/2,
                                origin.y + visibleSize.height - pTitleLabel->getContentSize().height));
        
        addChild(pTitleLabel, 1);
    }
    
    //  テーブルビュー作成
    {
        CCTableView*    pTableView  =
            CCTableView::create(this, CCSizeMake(visibleSize.width, visibleSize.height));
        
        pTableView->setDirection(kCCScrollViewDirectionVertical);
        pTableView->setVerticalFillOrder(kCCTableViewFillTopDown);
        pTableView->setPosition(ccp(origin.x, origin.y - pTitleLabel->getContentSize().height * 2));
        pTableView->setDelegate(this);

        addChild(pTableView, 2);
        
        //  テーブルビューのデータを読み込み
        pTableView->reloadData();
    }
    
    return true;
}
开发者ID:kuronokurujp,项目名称:stg,代码行数:39,代码来源:DebugTestScene.cpp

示例7: initRoomTable

bool CCLobbyView::initRoomTable()
{
    const CCPoint center = this->getCenter();
    CCLOG("CCLobbyView::initRoomTable:1");
    this->removeRoomTable();
    this->_lobbyViewDataSource = new CCLobbyViewDataSource(this);
    CCLOG("CCLobbyView::initRoomTable:2");
    
    if (this->_lobbyViewDataSource) {
//        this->_lobbyViewDataSource->autorelease();
//        CC_SAFE_RETAIN(this->_lobbyViewDataSource);
        CCSize tableSize = this->_lobbyViewDataSource->cellSizeForTable( NULL );
        tableSize.height *= 10.0f;
        CCLOG("CCLobbyView::initRoomTable:3 tableSize.height[%f]", tableSize.height);
        CCTableView* table = CCTableView::create( this->_lobbyViewDataSource, tableSize );
        CCLOG("CCLobbyView::initRoomTable:4");
        if( table )
        {
            CCSize winSize = CCDirector::sharedDirector()->getWinSize();
            float posy = this->getEditName()->getContentSize().height;
            posy += this->getConsole()->getContentSize().height;
            table->setContentOffset( CCPointZero );
            table->setDirection(kCCScrollViewDirectionVertical);
            table->setPosition( ccp( center.x - ( tableSize.width * 0.5f ), winSize.height - posy - tableSize.height - FONT_SIZE(24) ) );
            table->setDelegate( this );
            table->setVerticalFillOrder(kCCTableViewFillTopDown);
            table->setTouchEnabled( true );
            this->addChild( table, 0, Child::CCTableView_roomTable );
            table->reloadData();
            
            this->setMinRoomsInView( 10 );
            return true;
        } else {
        	CCLOG("CCLobbyView::initRoomTable:5 table create failed");
        }
    }
    return false;
}
开发者ID:kaznog,项目名称:t09,代码行数:38,代码来源:CCLobbyView.cpp

示例8: init

bool HelloWorld::init()
{
    if ( !CCLayer::init() )
    {
        return false;
    }
    
    CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
    CCPoint origin = CCDirector::sharedDirector()->getVisibleOrigin();
    
    m_pRecipes = CCArray::createWithContentsOfFile("recipes.plist");
    m_pRecipes->retain();

    CCTableView* tableView = CCTableView::create(this, visibleSize);
    tableView->setDirection(kCCScrollViewDirectionVertical);
    tableView->setVerticalFillOrder(kCCTableViewFillTopDown);
    tableView->setPosition(origin);
    tableView->setDelegate(this);
    this->addChild(tableView);
    tableView->reloadData();
    
    return true;
}
开发者ID:duoku,项目名称:cocos2dx_recipe,代码行数:23,代码来源:HelloWorldScene.cpp

示例9: CCLog


//.........这里部分代码省略.........
            }
            
            //设置按钮
            {
                CCSprite * sprite1 = CCSprite::create("pSettingsIcon.png");
                CCSprite * sprite2 = CCSprite::create("pSettingsIconActive.png");
                CCMenuItemSprite *aItem = CCMenuItemSprite::create(
                                                                   sprite1,
                                                                   sprite2,
                                                                   this,
                                                                   menu_selector(S3PracticeScene::menuOnSettings));
                CC_BREAK_IF(! aItem);
                aItem->setPosition(s3Position7_macro(aItem));
                _menu ->addChild(aItem,1);
            }
            
        }
        
        
		//控件
	
        {
			CCSprite * sprite1 = CCSprite::create("pBackButton.png");
			CCSprite * sprite2 = CCSprite::create("pBackButton.png");
            
			CCMenuItemSprite *aItem = CCMenuItemSprite::create(
                sprite1,
                sprite2,
                this,
                menu_selector(S3PracticeScene::menuOnBackCallback));
			CC_BREAK_IF(! aItem);
			aItem->setPosition(s3Position3_macro(aItem));
			_menu ->addChild(aItem,1);
            
            
            CCLabelTTF *label_back = CCLabelTTF::create("GRE模考", "Arial", s3FontSize2_macro, sprite1->getContentSize(), kCCTextAlignmentCenter, kCCVerticalTextAlignmentCenter);
            label_back->setPosition(s3Position3_macro(aItem));
            this ->addChild(label_back,2);
		}
                
        
        CCSprite *spriteBackground = CCSprite::create("s3ElevenRowTable.png");
        spriteBackground->setPosition(s3Position4_macro(aSprite));
        CCLog("spriteBackground.width:%f spriteBackground.height:%f",spriteBackground->getContentSize().width,spriteBackground->getContentSize().height);
        CC_BREAK_IF(! spriteBackground);
        this->addChild(spriteBackground,1);
        
        
		CCTableView* pTableView = CCTableView::create(this, s3Size1_macro(aTableView));
        CC_BREAK_IF(! pTableView);
		pTableView->setDirection(kCCScrollViewDirectionVertical);
        pTableView->setAnchorPoint(CCPointZero);
        pTableView->setPosition(ccp(spriteBackground->getPosition().x-(spriteBackground->getContentSize().width / 2),spriteBackground->getPosition().y-(spriteBackground->getContentSize().height / 2) + s3Less1_macro / 2));
		pTableView->setDelegate(this);
        
        //   设置顺序是自上往下
		pTableView->setVerticalFillOrder(kCCTableViewFillTopDown);
        
		this->addChild(pTableView,1);
        
        {
            std::string str = "Practice 1";
            aVectorCellValue.push_back(str);
        }
        {
            std::string str = "Practice 2";
            aVectorCellValue.push_back(str);
        }
        {
            std::string str = "Practice 3";
            aVectorCellValue.push_back(str);
        }
        {
            std::string str = "Practice 4";
            aVectorCellValue.push_back(str);
        }
        {
            std::string str = "Practice 5";
            aVectorCellValue.push_back(str);
        }
        {
            std::string str = "Practice 6";
            aVectorCellValue.push_back(str);
        }
        {
            std::string str = "Practice 7";
            aVectorCellValue.push_back(str);
        }
        {
            std::string str = "Practice 8";
            aVectorCellValue.push_back(str);
        }
        
		pTableView->reloadData();
        
		bRet = true;
	} while (0);

	return bRet;
}
开发者ID:liuyuyefz,项目名称:GreTest,代码行数:101,代码来源:S3PracticeScene.cpp

示例10: init

bool MallMarkets::init()
{
    
    if (!CCLayer::init()) {
        return false;
    }
    writablePathLocal = CCFileUtils::sharedFileUtils()->getWritablePath();
    layerMarket = NULL;
    

    ColorLayer *modleLayer = ColorLayer::create();
    modleLayer->setOpacity(100);
    this->addChild(modleLayer);
    
    
    CCSize winSize = CCDirector::sharedDirector()->getWinSize();
    
    CCSprite *bg = CCSprite::create("ZF_Shoot_background_coinList.png");
    CCSize size = bg->getContentSize();
    bg->setContentSize(CCSize(winSize.width*0.58, winSize.height*0.98));
    bg->setPosition(ccp(winSize.width/2,winSize.height*0.5));
    this->addChild(bg);
    
    
    //1.加载服务器所有奖品
    
    //2.init tableView
    this->tableViewX = winSize.width*0.17;
    
    //获取奖品表格的高度
    CCSprite *pSprite = CCSprite::create("ZF_Shoot_Button_gridItem.png");
    
    CCSize tableCellSize = pSprite->getContentSize();
    this->tableViewCellHeight = tableCellSize.height;
    CCLog("tableViewCellHeight: %d",this->tableViewCellHeight);
    
    
    CCTableView *tableView = CCTableView::create(this, CCSizeMake(winSize.width*0.715,winSize.height*0.71));
    tableView->setDirection(kCCScrollViewDirectionVertical);
    tableView->setAnchorPoint(ccp(0, 0));
    tableView->setPosition( ccp(winSize.width*0.22,winSize.height*0.15));
    tableView->setDelegate(this);
    tableView->setVerticalFillOrder(kCCTableViewFillTopDown);
    tableView->setTag(1136);
    this->addChild(tableView);
    tableView->reloadData();
    
    
    
    //3.添加2个按钮
    //ZF_Shoot_button_serverPrizeList_mall2
    CCMenuItemImage *item1 = CCMenuItemImage::create("ZF_Shoot_button_coinList_fubi1.png", "ZF_Shoot_button_coinList_fubi1.png");
    CCMenuItemImage *item2 = CCMenuItemImage::create("ZF_Shoot_button_coinList_fubi2.png", "ZF_Shoot_button_coinList_fubi2.png");
    
    toggleServer = CCMenuItemToggle::createWithTarget(this, menu_selector(MallMarkets::menuItemCall), item1,item2,NULL);
    toggleServer->setPosition( CCPointMake(winSize.width*0.325, winSize.height*0.86));
    toggleServer->setAnchorPoint(ccp(1, 0));
    toggleServer->setEnabled(false);
    toggleServer->setTag(1122);
    
    
    //ZF_Shoot_button_coinList_prop2ZF_Shoot_button_coinList_prop2
    CCMenuItemImage *item3 = CCMenuItemImage::create("ZF_Shoot_button_coinList_prop2.png", "ZF_Shoot_button_coinList_prop2.png");
    CCMenuItemImage *item4 = CCMenuItemImage::create("ZF_Shoot_button_coinList_prop1.png", "ZF_Shoot_button_coinList_prop1.png");
    
    togglePlayer = CCMenuItemToggle::createWithTarget(this, menu_selector(MallMarkets::menuItemCall), item3,item4,NULL);
    togglePlayer->setTag(1133);
    togglePlayer->setPosition( CCPointMake(winSize.width*0.425, winSize.height*0.86));
    //togglePlayer->setAnchorPoint(CCPointZero);
    togglePlayer->setAnchorPoint(ccp(1, 0));
    
    
    CCMenu *menu = CCMenu::create(toggleServer,togglePlayer,NULL);
    menu->setPosition(CCPointZero);
    this->addChild(menu, 1);
    
    
    //4.返回按钮
    CCMenuItemImage *pCloseItem = CCMenuItemImage::create(
                                                          "ZF_Shoot_button_coinList_back1.png",
                                                          "ZF_Shoot_button_coinList_back2.png",
                                                          this,
                                                          menu_selector(MallMarkets::menuCloseCallBack) );
    pCloseItem->setPosition( CCPointMake(winSize.width*0.75 , winSize.height*0.92) );
    CCMenu* pMenu = CCMenu::create(pCloseItem, NULL);
    pMenu->setPosition( CCPointZero );
    this->addChild(pMenu);
    
    return  true;
    
    
}
开发者ID:valentman,项目名称:Shoot,代码行数:92,代码来源:MallMarkets.cpp

示例11: setDimensions

// on "init" you need to initialize your instance
bool S11PrepareRes::init()
{
    //////////////////////////////
    // 1. super init first
    if ( !CCLayer::init() )
    {
        return false;
    }
    //每个项目都要创建的东西
    
    _menu = CCMenu::create(NULL);
    _menu->setPosition(CCPointZero);
    this->addChild(_menu, 101);
    
    titleString = "";
    
	scriptMap=ScriptParser::paserScript("S11PrepareRes","leftTitle");//right_TableView_Map

    //背景图
    
    {
        CCSprite * aSprite = CCSprite::create("s11Background.png");
        aSprite->setPosition(ccp(visibleSize.width / 2, visibleSize.height / 2));
        //CC_BREAK_IF(! aSprite);
        this->addChild(aSprite,98);
        aSprite ->getTexture()->setAntiAliasTexParameters();//抗锯齿
    }
    //控件
    
    {
        CCSprite * aSprite = CCSprite::create("s11NavBar.png");
        aSprite->setAnchorPoint(ccp(0.0,1.0));
        aSprite->setPosition(ccp(0,visibleSize.height-40));
        this->addChild(aSprite,100);
    }
    
    
    {
        CCLabelTTF * leftTitleLabel = CCLabelTTF::create(s11Str2_macro,s11FontName_macro,s11TitleFontSize_macro);
        CCLabelTTF* pLabel = leftTitleLabel;
        pLabel->setColor(ccWHITE);
        
        pLabel->setPosition( s11Position3_macro(pLabel));
        this->addChild(pLabel, 100);
    }
    
    titleLabel = CCLabelTTF::create(s11Str2_macro,s11FontName_macro,s11TitleFontSize_macro);
    CCLabelTTF* pLabel = titleLabel;
    pLabel->setColor(ccWHITE);
    
    pLabel->setPosition( s11Position4_macro(pLabel));
    this->addChild(pLabel, 100);
    
    
    
    {
        CCSprite * aSprite = CCSprite::create("pRecButton.png");
        aSprite->setPosition(s11Position1_macro(aSprite));
        this->addChild(aSprite,100);
        
        
        CCSprite * aSprite1 = CCSprite::create("s11FullScreenIcon.png");
        aSprite1->setPosition(s11Position1_macro(aItem));
        this->addChild(aSprite1,100);
    
        CCSprite * sprite1 = CCSprite::create();
        CCSprite * sprite2 = CCSprite::create();
        
        CCMenuItemSprite *aItem = CCMenuItemSprite::create(
                                                           sprite1,
                                                           sprite2,
                                                           this,
                                                           menu_selector(S11PrepareRes::menuCloseCallback));
        aItem->setPosition(s11Position1_macro(aItem));
        aItem->setContentSize(aSprite->getContentSize());
        _menu ->addChild(aItem,100);
        
    }

    
    
    CCTableView * tableView = CCTableView::create(this, s11Size1_macro);
    tableView->setAnchorPoint(ccp(0.0,0.0));
    tableView->setDirection(kCCScrollViewDirectionVertical);
    tableView->setPosition(s11Position8_macro(tableView));
    tableView->setDelegate(this);
    tableView->setVerticalFillOrder(kCCTableViewFillTopDown);
    this->addChild(tableView,99);
    tableView->reloadData();
    

    std::string aStr = ScriptParser::readScript("s11TableCellTxt1.txt");
    S11PrepareRes::detailString = aStr;
    rightDetailTex = CCLabelTTF::create(aStr.c_str(), "Helvetica", 30.0);
    rightDetailTex->setColor(ccBLACK);
    rightDetailTex-> setDimensions(s11Size2_macro);
    rightDetailTex->setPosition(s11Position9_macro(label));
    this->addChild(rightDetailTex,100);
    //TabelBar
//.........这里部分代码省略.........
开发者ID:liuyuyefz,项目名称:GreTest,代码行数:101,代码来源:S11PrepareResScene.cpp

示例12: init

bool UIStrengthen::init()
{
	if (!CCLayer::init())
	{
		return false;
	}

	uiLayer = UILayer::create();

	UILayout* strengthenRoot = dynamic_cast<UILayout*>(GUIReader::shareReader()->widgetFromJsonFile("ui/UIStrengthen.ExportJson"));
	uiLayer->addWidget(strengthenRoot);

	UIButton* closeButton = dynamic_cast<UIButton*>(uiLayer->getWidgetByName("CloseButton"));
	closeButton->addTouchEventListener(this, toucheventselector(UIStrengthen::closeButtonClicked));

	UIButton* strengthenButton = dynamic_cast<UIButton*>(uiLayer->getWidgetByName("StrengthenButton"));
	strengthenButton->addTouchEventListener(this, toucheventselector(UIStrengthen::strengthenButtonClicked));

	UIButton* pageLeftButton = dynamic_cast<UIButton*>(uiLayer->getWidgetByName("PageLeftButton"));
	pageLeftButton->addTouchEventListener(this, toucheventselector(UIStrengthen::pageLeftButtonClicked));

	UIButton* pageRightButton = dynamic_cast<UIButton*>(uiLayer->getWidgetByName("PageRightButton"));
	pageRightButton->addTouchEventListener(this, toucheventselector(UIStrengthen::pageRightButtonClicked));

	for (int i = 0; i < 4; i++)
	{
		const char* s = CCString::createWithFormat("EquipmentButton_%d", i+1)->getCString();
		UIButton* equipmentButton = dynamic_cast<UIButton*>(uiLayer->getWidgetByName(s));
		equipmentButton->addTouchEventListener(this, toucheventselector(UIStrengthen::equipmentButtonClicked));
	}

	for (int i = 0; i < 2; i++)
	{
		const char* s = CCString::createWithFormat("GemButton_%d", i+1)->getCString();
		UIButton* gemButton = dynamic_cast<UIButton*>(uiLayer->getWidgetByName(s));
		gemButton->addTouchEventListener(this, toucheventselector(UIStrengthen::gemButtonClicked));
	}

	for (int i = 0; i < 4; i++)
	{
		const char* s = CCString::createWithFormat("EquipmentImageView_%d", i+1)->getCString();
		equipmentImageView[i] = dynamic_cast<UIImageView*>(uiLayer->getWidgetByName(s));
	}

	for (int i = 0; i < 3; i++)
	{
		const char* s = CCString::createWithFormat("GemImageView_%d", i+1)->getCString();
		gemImageView[i] = dynamic_cast<UIImageView*>(uiLayer->getWidgetByName(s));
	}

	for (int i = 0; i < 2; i++)
	{
		const char* s = CCString::createWithFormat("GemFrontImageView_%d", i+1)->getCString();
		gemFrontImageView[i] = dynamic_cast<UIImageView*>(uiLayer->getWidgetByName(s));
	}

	strengthenfeatureImageView = dynamic_cast<UIImageView*>(uiLayer->getWidgetByName("FeatureImageView"));

	strengthenTestButton = dynamic_cast<UIButton*>(uiLayer->getWidgetByName("StrengthenTestButton"));

	selectFrameImageView = dynamic_cast<UIImageView*>(uiLayer->getWidgetByName("SelectFrameImageView"));

	UIPanel* tableViewPanel = dynamic_cast<UIPanel*>(uiLayer->getWidgetByName("TableViewPanel"));

	CCTableView* strengthenTableView = CCTableView::create(this, CCSizeMake(strengthenTestButton->getContentSize().width, tableViewPanel->getContentSize().height));
	strengthenTableView->setDirection(kCCScrollViewDirectionVertical);
	strengthenTableView->setVerticalFillOrder(kCCTableViewFillTopDown);

	CCPoint strengthenTestPosition = strengthenTestButton->getPosition();
	strengthenTableView->setPosition(ccp(strengthenTestPosition.x, strengthenTestPosition.y - tableViewPanel->getContentSize().height));
	strengthenTableView->setDelegate(this);
	strengthenTableView->reloadData();

	addChild(uiLayer);
	addChild(strengthenTableView);

	setVisible(false);
	refresh();
	return true;
}
开发者ID:joyfish,项目名称:tianxiadiyi,代码行数:80,代码来源:UIStrengthen.cpp

示例13: onMenu

void RPGBattleMenu::onMenu(cocos2d::CCObject *pObject)
{
    CCMenuItem *menuItem = (CCMenuItem*)pObject;
    SimpleAudioEngine::sharedEngine()->playEffect("audio_effect_btn.wav");

    switch (menuItem->getTag())
    {
        case kRPGBattleMenuTagSkill:
        {
            CCLog("技能");
            
            this->hideMenu();
            
            this->m_selectedMenuTag = kRPGBattleMenuTagSkill;
            
            CCMenuItemSprite *menuCancel = CCMenuItemSprite::create(CCSprite::createWithSpriteFrameName("commons_btn_back_04.png"), CCSprite::createWithSpriteFrameName("commons_btn_back_04.png"), this, menu_selector(RPGBattleMenu::onMenu));
            menuCancel->setPosition(ccp(43, 596));
            menuCancel->setTag(kRPGBattleMenuTagCancel);
            menuCancel->setScale(0.75);
            this->addChild(menuCancel);
            
            CCTMXTiledMap *selectLayer = CCTMXTiledMap::create(CCString::createWithFormat("battle_select_%s.tmx", CCUserDefault::sharedUserDefault()->getStringForKey(GAME_STYLE).c_str())->getCString());
            selectLayer->setPosition(ccp((CCDirector::sharedDirector()->getWinSize().width - selectLayer->getContentSize().width) / 2, (CCDirector::sharedDirector()->getWinSize().height - selectLayer->getContentSize().height) / 2));
            selectLayer->setTag(kRPGBattleSceneLayerTagSkillSelectDialog);
            
            ((RPGBattleSceneLayer*)this->m_parentNode)->addChild(selectLayer);            
            ((RPGBattleSceneLayer*)this->m_parentNode)->enabledTouched(true);
            
            //显示title和分隔线
            addLab(selectLayer, 199, (CCString*)this->m_stringList->objectForKey("skill_title"), 25, ccp(310, 285));
            CCLabelTTF *titleLab = (CCLabelTTF*)selectLayer->getChildByTag(199);
            titleLab->setFontFillColor(ccc3(144, 144, 144));
            
            CCSprite *separate = CCSprite::createWithSpriteFrameName("separate.png");
            separate->setPosition(ccp(selectLayer->getContentSize().width / 2, 260));
            separate->setScaleX(0.65);
            separate->setTag(198);
            selectLayer->addChild(separate);
            
            //加载技能数据
            CCTableView *tableView = (CCTableView*)selectLayer->getChildByTag(197);
            if(!tableView)
            {
                tableView = CCTableView::create(this, ccp(selectLayer->getContentSize().width, selectLayer->getContentSize().height - 80));
                tableView->setDirection(kCCScrollViewDirectionVertical);
                tableView->setPosition(CCSizeZero);
                tableView->setDelegate(this);
                tableView->setVerticalFillOrder(kCCTableViewFillTopDown);
                tableView->setTag(197);
                selectLayer->addChild(tableView);
                
            }
            
            this->m_tableItems->removeAllObjects();

            string wq = "";
            JsonBox::Value json;
            json.loadFromString(this->m_playerData->m_skill.c_str());
            JsonBox::Array jsonArr = json.getArray();
            for (int i = 0; i < jsonArr.size(); i++)
            {
                char* str = (char*)malloc(10 * sizeof(char));
                OzgCCUtility::itoa(jsonArr[i].getInt(), str);
                wq.append(str);
                
                if(i + 1 < jsonArr.size())
                    wq.append(", ");
                
                free(str);
            }
            if((int)wq.length() > 0)
            {
                CppSQLite3Query query = this->m_db->execQuery(CCString::createWithFormat(SKILL_QUERY, wq.c_str())->getCString());
                while(!query.eof())
                {
                    RPGSkillBtnData *skill = RPGSkillBtnData::create();
                    skill->m_dataId = query.getIntField("id");
                    skill->m_name = query.getStringField("name_cns");
                    skill->m_MP = query.getIntField("mp");
                    skill->m_skillAttack = query.getIntField("skill_attack");
                    skill->m_type = query.getIntField("type");
                    skill->m_attr = query.getIntField("attr");
                    skill->m_enabled = true;
                    
                    //不能使用技能的情况
                    if(this->m_playerData->m_MP <= 0 || this->m_playerData->m_HP <= 0)
                        skill->m_enabled = false;
                    else if(this->m_playerData->m_MP < skill->m_MP)
                        skill->m_enabled = false;
                    
                    this->m_tableItems->addObject(skill);
                    
                    query.nextRow();
                }
                query.finalize();
            }
            
            tableView->reloadData();
            //加载技能数据 end
            
//.........这里部分代码省略.........
开发者ID:ChinaiOS,项目名称:OzgGameRPG,代码行数:101,代码来源:RPGBattleMenu.cpp

示例14: while

bool S2TestMain::init()
{
	bool bRet = false;
	do 
	{
		CC_BREAK_IF(! CCLayer::init());
        
        
		//每个项目都要创建的东西

		_menu = CCMenu::create(NULL);
		_menu->setPosition(CCPointZero);
		CC_BREAK_IF(! _menu);

		this->addChild(_menu, 2);

        
        
        //*****************背景图/ NavBar/ Title*****************//
		{
			CCSprite * aSprite = CCSprite::create("pBackground.png");
			aSprite->setPosition(ccp(visibleSize.width / 2, visibleSize.height / 2));
            //CC_BREAK_IF(! aSprite);
			this->addChild(aSprite,1);
            aSprite ->getTexture()->setAntiAliasTexParameters();//抗锯齿
		}
        
        {
			CCSprite * aSprite = CCSprite::create("pNavBar.png");
			aSprite->setPosition(s2Position2_macro(aSprite));
            //CC_BREAK_IF(! aSprite);
			this->addChild(aSprite,1);
		}
        
        {
            CCLabelTTF * titleLabel = CCLabelTTF::create("Test 1", "Arial", s2FontSize1_macro);
            titleLabel->setPosition(s2Position1_macro(aItem));
            //CC_BREAK_IF(! aSprite);
            this->addChild(titleLabel,1);
        }
        
        //*****************BackButton And BackLabel*****************//
        {
			CCSprite * sprite1 = CCSprite::create("pBackButton.png");
			CCSprite * sprite2 = CCSprite::create("pBackButton.png");
            
			CCMenuItemSprite *aItem = CCMenuItemSprite::create(
                sprite1,
                sprite2,
                this,
                menu_selector(S2TestMain::menuOnBackCallback));
			CC_BREAK_IF(! aItem);
			aItem->setPosition(s2Position3_macro(aItem));
			_menu ->addChild(aItem,1);
            
            {
                CCLabelTTF *label_back = CCLabelTTF::create("Test", "Arial", s2FontSize2_macro, sprite1->getContentSize(), kCCTextAlignmentCenter, kCCVerticalTextAlignmentCenter);
                label_back->setPosition(s2Position3_macro(aItem));
                this ->addChild(label_back,2);
            }
		}
        
        //*****************pRecButton*****************//
		{
			CCSprite * sprite1 = CCSprite::create("pRecButton.png");
			CCSprite * sprite2 = CCSprite::create("pRecButton.png");

			CCMenuItemSprite *aItem = CCMenuItemSprite::create(
				sprite1,
				sprite2,
				this,
                menu_selector(S2TestMain::menuShowPracticeList));
			CC_BREAK_IF(! aItem);
			aItem->setPosition(s2Position4_macro(aItem));
			_menu ->addChild(aItem,1);
		}
        
        //*****************Practice List 集,包括小TableView和背景*****************//
        {
            CCSprite *spritePracticeList = CCSprite::create("s2Popover.png");
            spritePracticeList->setPosition(s2Position5_macro(aSprite));
            CC_BREAK_IF(! spritePracticeList);
            spritePracticeList->setTag(s2Tag4);
            spritePracticeList->setVisible(false);
            this->addChild(spritePracticeList,10);
            
            CCTableView* pTableView = CCTableView::create(this, s2Size1_macro(aTableView));
            CC_BREAK_IF(! pTableView);
            pTableView->setDirection(kCCScrollViewDirectionVertical);
            pTableView->setPosition(ccp(129,160));//bug
            pTableView->setDelegate(this);
            pTableView->setTag(s2Tag2);
            
            //   设置顺序是自上往下
            pTableView->setVerticalFillOrder(kCCTableViewFillTopDown);
            
            spritePracticeList->addChild(pTableView);
            
            pTableView->reloadData();
            
//.........这里部分代码省略.........
开发者ID:liuyuyefz,项目名称:GreTest,代码行数:101,代码来源:S2TestScene.cpp

示例15: init

bool CCLobbyView::init( CCNetworkLogic* network, const CCSize& mySize )
{
    if( CCLayer::init() )
    {
        CCSize winSize = CCDirector::sharedDirector()->getWinSize();
        const CCPoint& center = ccpMult( ccpFromSize( mySize ), 0.5f );
        CCPoint position = CCPointZero;
        CCSize size = CCSizeZero;
        int length = 0;
        int fontSize = 0;
        
        this->setNetwork( network );
        
        CCSprite* s = CCSprite::create("Images/r1.png");
        s->retain();
        CCRect rect = CCRectZero;
        rect.size = s->getContentSize();
        s->release();
        
        fontSize = 12;
        CCLabelTTF* label = CCLabelTTF::create( "Connect", "fonts/American Typewriter.ttf", fontSize );
        label->setColor( ccc3( 0, 0, 0 ) );
        CCScale9Sprite* sprite = CCScale9Sprite::create("Images/r1.png", rect, rect );
        sprite->setScaleX( 1.4f );
        sprite->setScaleY( 0.8f );
        CCControlButton* button = CCControlButton::create( label, sprite );
        button->addTargetWithActionForControlEvents( this, cccontrol_selector( CCLobbyView::connectButtonCallback ), CCControlEventTouchUpInside);
        button->setPreferredSize( rect.size );
        position = center;
        position.y -= 136;
        position.x -= 100;
        button->setPosition( position );
        this->setConnectButton( button );
        
        label = CCLabelTTF::create( "Create Room", "fonts/American Typewriter.ttf", fontSize );
        label->setColor( ccc3( 0, 0, 0 ) );
        sprite = CCScale9Sprite::create("Images/r1.png", rect, rect );
        sprite->setScaleX( 1.4f );
        sprite->setScaleY( 0.8f );
        button = CCControlButton::create( label, sprite );
        button->addTargetWithActionForControlEvents( this, cccontrol_selector( CCLobbyView::createGameButtonCallback ), CCControlEventTouchUpInside);
        button->setPreferredSize( rect.size );
        position = center;
        position.y -= 136;
        //position.x += 0;
        button->setPosition( position );
        this->setCreateGameButton( button );
        
        label = CCLabelTTF::create( "Random Room", "fonts/American Typewriter.ttf", fontSize );
        label->setColor( ccc3( 0, 0, 0 ) );
        sprite = CCScale9Sprite::create("Images/r1.png", rect, rect );
        sprite->setScaleX( 1.6f );
        sprite->setScaleY( 0.8f );
        button = CCControlButton::create( label, sprite );
        button->addTargetWithActionForControlEvents( this, cccontrol_selector( CCLobbyView::joinGameButtonCallback ), CCControlEventTouchUpInside);
        button->setPreferredSize( rect.size );
        position = center;
        position.y -= 136;
        position.x += 100;
        button->setPosition( position );
        this->setRandomGameButton( button );
        
        this->_lobbyViewDataSource = new CCLobbyViewDataSource( this );

        fontSize = 16;
        length = mySize.width;
        size = this->_lobbyViewDataSource->cellSizeForTable( NULL );
        size.height *= 3;
        CCTableView* table = CCTableView::create( this->_lobbyViewDataSource, size );
        table->setContentOffset( CCPointZero );
        table->setDirection(kCCScrollViewDirectionVertical);
        position = center;
        position.x -= size.width * 0.5f;
        position.y -= fontSize + ( size.height * 0.17f );
        table->setPosition( position );
        table->setDelegate( this );
        table->setVerticalFillOrder(kCCTableViewFillTopDown);
        this->setRoomTable( table );
        table->reloadData();
        
        fontSize = 16;
        label = CCLabelTTF::create("Running games:", "fonts/American Typewriter.ttf", fontSize,
                                                 winSize, kCCTextAlignmentCenter, kCCVerticalTextAlignmentCenter);
        position = center;
        position.x -= size.width * 0.4f;
        position.y += size.height - ( fontSize * 0.5f );
        label->setPosition( position );
        //label->setAnchorPoint( CCPointZero );
        this->setRoomTableLabel( label );
        
        fontSize = 16;
        CCLabelTTF* console = CCLabelTTF::create("disconnected", "fonts/American Typewriter.ttf", fontSize,
                                             winSize, kCCTextAlignmentCenter, kCCVerticalTextAlignmentCenter);
        
            
        console->setColor( ccc3(255, 255, 255) );
        console->setContentSize(winSize);
        position = center;
        position.y += 100;
        console->setPosition( position );
//.........这里部分代码省略.........
开发者ID:darkcl,项目名称:Cocos2d-x_Photon_MultiPlatform_Test,代码行数:101,代码来源:CCLobbyView.cpp


注:本文中的CCTableView::setVerticalFillOrder方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。