bool BalloonRankDialog::init()
{
	bool bRet = false;
	do
	{
		CC_BREAK_IF(!DialogLayer::init());
		CCNodeLoaderLibrary* pLoaderLib = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();

		CCBReader* pCCBReader = new CCBReader(pLoaderLib);

		std::string strCCBFileName = "BalloonRankDialog.ccbi";

		const std::vector<std::string> vSearchOrder = CCFileUtils::sharedFileUtils()->getSearchResolutionsOrder();

		std::string strCCBRootPath = vSearchOrder[0];

		pCCBReader->setCCBRootPath(strCCBRootPath.c_str());

		CCNode* pNode = pCCBReader->readNodeGraphFromFile(strCCBFileName.c_str(), this);

		if (pNode != NULL)
		{
			this->addChild(pNode);
		}

		pCCBReader->release();
		
		setKeypadEnabled(true);

		initLabelTTF();
        
        initTableView();
        
        initMenu();
        
        // start fire
        CCArray* pArrayFire = CCArray::createWithCapacity(6);
        for (int idx = 1; idx <= 6; ++idx)
        {
            pArrayFire->addObject(CCSpriteFrameCache::sharedSpriteFrameCache()->spriteFrameByName(CCString::createWithFormat("energy_fire%d.png", idx)->getCString()));
        }
        CCAnimation* pAnimation = CCAnimation::createWithSpriteFrames(pArrayFire, 0.1f);
        CCAnimate* pAnimateFire = CCAnimate::create(pAnimation);
        m_pSpriteScoreFire->runAction(CCRepeatForever::create(pAnimateFire));
        
        // set animation onEnter and onExit
        m_pMainBoard = m_pSpriteBoard;
        m_pSpriteBoard->setScale(0.01f);
        setOnEnterAction(CCEaseBounceOut::create(CCScaleTo::create(0.5f, 1.0f)));
        setOnExitAction(CCEaseExponentialIn::create(CCScaleTo::create(0.5f, 0.01f)));
		
		bRet = true;
		
	} while(0);
	
	return bRet;
}
bool BalloonOptionsDialog::init()
{
    // TODO:
    bool bRet = false;
    do
    {
        CC_BREAK_IF(!DialogLayer::init());
        // 加载ccbi
        CCNodeLoaderLibrary* pLoaderLib = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();

        CCBReader* pCCBReader = new CCBReader(pLoaderLib);

        // 对应ccbi文件
        std::string strCCBFileName = "BalloonOptionsDialog.ccbi";

        // 得到第一个搜索路径
        const std::vector<std::string> vSearchOrder = CCFileUtils::sharedFileUtils()->getSearchResolutionsOrder();

        // 本程序中是对应的第一个元素即为对应的资源路径
        std::string strCCBRootPath = vSearchOrder[0];

        // 设置CCB的资源路径
        pCCBReader->setCCBRootPath(strCCBRootPath.c_str());

        CCNode* pNode = pCCBReader->readNodeGraphFromFile(strCCBFileName.c_str(), this);

        if (pNode != NULL)
        {
            this->addChild(pNode);
        }

        pCCBReader->release();

        initMenuItem();

        SetVisibleBoard(m_pSpriteBoard);

        bRet = true;

    } while(0);

    return bRet;
}
Exemple #3
0
void NBGCCBReader::readCCB(const char * ccbiName)
{
    releaseMembers();
    
    /* Create an autorelease NodeLoaderLibrary. */
    NodeLoaderLibrary* ccNodeLoaderLibrary = NodeLoaderLibrary::newDefaultNodeLoaderLibrary();
    
    /* Create an autorelease CCBReader. */
    CCBReader* ccbReader = new CCBReader(ccNodeLoaderLibrary);
    ccbReader->setCCBRootPath(CCBRESOURCES_BASE_PATH);
    ccbReader->autorelease();
    
    /* Read a ccbi file. */
    m_pCCBNode = ccbReader->readNodeGraphFromFile(ccbiName, this);
    if (m_pCCBNode != nullptr)
    {
        m_pAnimationManager = ccbReader->getAnimationManager();
        m_pAnimationManager->setDelegate(this);
    }
    CC_SAFE_RETAIN(m_pCCBNode);
    CC_SAFE_RETAIN(m_pAnimationManager);
}
bool BalloonResultDialog::init()
{
	bool bRet = false;
	do
	{
		CC_BREAK_IF(!DialogLayer::init());
		// 加载ccbi
		CCNodeLoaderLibrary* pLoaderLib = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();

		CCBReader* pCCBReader = new CCBReader(pLoaderLib);

		// 对应ccbi文件
		std::string strCCBFileName = "BalloonResultDialog.ccbi";

		// 得到第一个搜索路径
		const std::vector<std::string> vSearchOrder = CCFileUtils::sharedFileUtils()->getSearchResolutionsOrder();

		// 本程序中是对应的第一个元素即为对应的资源路径
		std::string strCCBRootPath = vSearchOrder[0];

		// 设置CCB的资源路径
		pCCBReader->setCCBRootPath(strCCBRootPath.c_str());

		CCNode* pNode = pCCBReader->readNodeGraphFromFile(strCCBFileName.c_str(), this);

		if (pNode != NULL)
		{
			this->addChild(pNode);
		}

		pCCBReader->release();
		
        initMenuTop();
        
        pushMenu(m_pMenuShare);
        
        // 设置按钮按下后变大的效果
        ControlUtil::sharedControlUtil()->SetMenuItemSelectedImageWithNormalImage(m_pMenuShare);
        
        /*
        // 初始化位置
        m_posOri = m_pSpriteResultBoard->getPosition();
        CCPoint posUp = ccp(m_pSpriteResultBoard->getPositionX(), getContentSize().height*2);
        
        // 进场动画
        m_pSpriteResultBoard->setPosition(posUp);
        
        addBoardChildWithAction(m_pSpriteResultBoard,
                                CCEaseBounceOut::create(CCMoveTo::create(0.5f, m_posOri)),
                                CCEaseExponentialIn::create(CCMoveTo::create(0.2f, posUp)));
        SetVisibleBoard(NULL);
        */
        m_pSpriteResultBoard->setScale(0.1f);
        setOnEnterAction(CCEaseBounceOut::create(CCScaleTo::create(0.5f, 1.0f)));
        setOnExitAction(CCEaseExponentialOut::create(CCScaleTo::create(0.3f, 0.1f)));
        m_pMainBoard = m_pSpriteResultBoard;
        
        // 更新分享按钮数据
        m_posShareItemOri = m_pMenuItemShare->getPosition();
        m_fShareItemAngleOri = m_pMenuItemShare->getRotation();
        // 默认隐藏新记录标志
        setNewFlagVisible(false);
        
        initLabelTTF();
        
		bRet = true;
		
	} while(0);
	
	return bRet;
}