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


C++ CCBReader类代码示例

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


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

示例1: init

bool HeroSkillLayer::init(){
    if ( !CCLayer::init() )
    {
        return false;
    }
    this->setTouchEnabled(true);
    this->setTouchPriority(-128);
    this->setTouchMode(kCCTouchesAllAtOnce);
    //加载cocosbuilder
    CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary()->registerCCNodeLoader("HeroSkillccbi",HeroSkillccbiLoder::loader());
    /* Create an autorelease CCBReader. */
    CCBReader * ccbReader = new cocos2d::extension::CCBReader(CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary());
    ccbReader->autorelease();
    /* Read a ccbi file. */
    node2 = ccbReader->readNodeGraphFromFile("ccbi/HeroSkillccbi.ccbi", this);
    if(node2 != NULL) {
        this->addChild(node2);
    }
    this->setVisible(false);
    isSkillLayer = true;
    layervisable = false;
    curPage = 0;//当前页
    addsprite();
    changeData();
    scheduleUpdate();
    return true;
}
开发者ID:IMfeather,项目名称:xingmeng,代码行数:27,代码来源:HeroSkillLayer.cpp

示例2: CCLog

void HelloWorld::menuCloseCallback(CCObject* pSender)
{
    //CCDirector::sharedDirector()->end();

//#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
    //exit(0);
//    CCNodeLoaderLibrary* ccNodeLoaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();
//    CCBReader* reader = new CCBReader(ccNodeLoaderLibrary);
//    CCScene* scene = reader->createSceneWithNodeGraphFromFile("TeLabels.ccbi");
//    CCDirector::sharedDirector()->replaceScene(CCTransitionFade::transitionWithDuration(2.0f, scene));
CCLog("1");
    
    CCNodeLoaderLibrary* ccNodeLoaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();
    CCLog("2");
    CCBReader* reader = new CCBReader(ccNodeLoaderLibrary);
    CCLog("3");
    CCNode* scene = reader->readNodeGraphFromFile("TestLabels.ccbi");
    CCLog("4");
    
    CCSize size = CCDirector::sharedDirector()->getWinSize();
    scene->setPosition(ccp(size.width/2, size.height/2));
                                                  if(scene != NULL)
                                                  {
                                                      this->addChild(scene, 2);
                                                      scene->release();
                                                  }
    CCLog("5");
//#endif
}
开发者ID:louis2001,项目名称:FMTeamTest,代码行数:29,代码来源:HelloWorldScene.cpp

示例3: js_CocosBuilder_create

JSBool js_CocosBuilder_create(JSContext *cx, uint32_t argc, jsval *vp)
{
    
	NodeLoaderLibrary * ccNodeLoaderLibrary = NodeLoaderLibrary::getInstance();
    
    ccNodeLoaderLibrary->registerNodeLoader("", JSLayerLoader::loader());
    
    CCBReader * ret = new CCBReader(ccNodeLoaderLibrary);
    ret->autorelease();
    
    jsval jsret;
    if (ret) {
        js_proxy_t *proxy = jsb_get_native_proxy(ret);
        if (proxy) {
            jsret = OBJECT_TO_JSVAL(proxy->obj);
        } else {
            // create a new js obj of that class
            proxy = js_get_or_create_proxy<CCBReader>(cx, ret);
            jsret = OBJECT_TO_JSVAL(proxy->obj);
        }
    } else {
        jsret = JSVAL_NULL;
    }
    JS_SET_RVAL(cx, vp, jsret);
    return JS_TRUE;
    
}
开发者ID:CryQ,项目名称:coclua,代码行数:27,代码来源:js_bindings_ccbreader.cpp

示例4: CCBReader

bool Unit::Init(enUnitType eType, enUnitIndex eIndex)
{
    do
    {
        unitDataMap unitData = GlobalData::sharedDirector()->getUnitDefaultData();
        m_unitData = unitData[eType];
        
        m_nFireCd = m_unitData.nFireCD;
        m_eUnitType = m_unitData.eType;
        m_eUnitStatus = enUnitStatusPre;
        m_nHp = m_unitData.nHp;
        m_eUnitIndex = eIndex;
        
        CCNodeLoaderLibrary * ccNodeLoaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();
        CCBReader * ccbReader = new CCBReader(ccNodeLoaderLibrary);
        CCNode * ccbNode = ccbReader->readNodeGraphFromFile(m_unitData.strCCBI.c_str(), this);
        m_animationManager = ccbReader->getAnimationManager();
        m_animationManager->runAnimationsForSequenceNamed("run");
        m_animationManager->setAnimationCompletedCallback(this, callfunc_selector(Unit::AnimationCallBack));
        ccbReader->release();
        
        addChild(ccbNode);
        return true;
    } while (false);
    CCLog("Function Unit::Init Error!");
    return false;
}
开发者ID:cjlaaa,项目名称:WarDemo,代码行数:27,代码来源:Units.cpp

示例5: CCBReader

void XFightView::SetBoard(const char* pszBoardName, const char* pszStartName)
{
	CCBReader* pCCBReader = new CCBReader(NodeLoaderLibrary::getInstance());
	CCNode*    pNode      = NULL;

	XYLOG_FAILED_JUMP(pCCBReader);

	pCCBReader->autorelease();

	if(m_pBoard)
	{
		removeChild(m_pBoard);
	}

	if(m_pFangKuaiParent)
	{
		removeChild(m_pFangKuaiParent);
	}

	m_pBoard = g_UIManager->GetInstanceByRootName(pszBoardName);//(BasicPanel*)pCCBReader->readNodeGraphFromFile(pszCCBFile);
	XYLOG_FAILED_JUMP(m_pBoard);


	m_pFangKuaiParent = m_pBoard->m_mapMemberVariable[pszStartName];
Exit0:
	return;
}
开发者ID:StevenFm,项目名称:bbt,代码行数:27,代码来源:FightView.cpp

示例6: CCLOG

bool TitleScene::init()
{
    CCLOG("TitleScene::init()");
    if ( !Layer::init() )
    {
        return false;
    }
    // BGM・SEのプリロード
    SimpleAudioEngine::getInstance()->preloadBackgroundMusic(BGM_TITLE);
    SimpleAudioEngine::getInstance()->preloadEffect(SE_TOUCH_NORMAL);
    
    // タイトルのccbiファイルを読み込む
    auto nodeLoaderLibrary = NodeLoaderLibrary::getInstance();
    CCBReader* reader = new CCBReader(nodeLoaderLibrary);
    auto TitleNode = reader->readNodeGraphFromFile("ccbi/TitleScene.ccbi");
    
    // 追加
    this->addChild(TitleNode, 0);
    
    // 開放
    reader->release();
    
    // シングルタップのみ受付
    setTouchEnabled(true);
    setTouchMode(Touch::DispatchMode::ONE_BY_ONE);

    return true;
}
开发者ID:yasuhiro-matsuda,项目名称:ichi_okuman_yen,代码行数:28,代码来源:TitleScene.cpp

示例7: if

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    CCDirector* pDirector = CCDirector::sharedDirector();
    CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();

    pDirector->setOpenGLView(pEGLView);
	
    // デザインサイズの設定
    pEGLView->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, kResolutionNoBorder);

    CCSize frameSize = pEGLView->getFrameSize();

    std::vector<std::string> searchPath;

    if (frameSize.height > largeResource.size.height)
    {
        // iPad Retina用リソースを使用
        searchPath.push_back(xlargeResource.directory);
        pDirector->setContentScaleFactor(MIN(xlargeResource.size.height / designResolutionSize.height, xlargeResource.size.width / designResolutionSize.width));
    }
    else if (frameSize.height > smallResource.size.height)
    {
        // iPad用リソースを使用
        searchPath.push_back(largeResource.directory);
        pDirector->setContentScaleFactor(MIN(largeResource.size.height / designResolutionSize.height, largeResource.size.width / designResolutionSize.width));
    }
    else
    {
        // iPhone用リソースを使用
        searchPath.push_back(smallResource.directory);
        pDirector->setContentScaleFactor(MIN(smallResource.size.height / designResolutionSize.height, smallResource.size.width / designResolutionSize.width));
    }

    // リソースディレクトリを指定
    CCFileUtils::sharedFileUtils()->setSearchPaths(searchPath);

    // turn on display FPS
    pDirector->setDisplayStats(true);

    // set FPS. the default value is 1.0/60 if you don't call this
    pDirector->setAnimationInterval(1.0 / 60);

    // CocosBuilderのファイルを読み込みゲーム画面を生成する
    CCNodeLoaderLibrary* ccNodeLoaderLibrary = CCNodeLoaderLibrary::newDefaultCCNodeLoaderLibrary();
    ccNodeLoaderLibrary->registerCCNodeLoader("GameLayer", GameLayerLoader::loader());
    CCBReader* ccbReader = new CCBReader(ccNodeLoaderLibrary);
    CCNode* node = ccbReader->readNodeGraphFromFile("GameLayer.ccbi");
    ((GameLayer*)node)->setAnimationManager(ccbReader->getAnimationManager());

    // シーンを用意し、ゲーム画面を設置する
    CCScene* pScene = CCScene::create();
    if (node != NULL)
        pScene->addChild(node);
    ccbReader->release();

    // run
    pDirector->runWithScene(pScene);

    return true;
}
开发者ID:shun-tak,项目名称:cocos2d-x-programming-guide,代码行数:60,代码来源:AppDelegate.cpp

示例8: CCBReader

bool AppDelegate::applicationDidFinishLaunching()
{
    LoadFunc::registerLoader();
    
    // initialize director
    CCDirector *pDirector = CCDirector::sharedDirector();
    pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());

    // turn on display FPS
    pDirector->setDisplayStats(true);

    // set FPS. the default value is 1.0/60 if you don't call this
    pDirector->setAnimationInterval(1.0 / 60);
    
    // set game window siz(1024x577)
    CCEGLView::sharedOpenGLView()->setDesignResolutionSize(1024, 577, kResolutionShowAll);

    // create a scene. it's an autorelease object
    CCNodeLoaderLibrary* ccNodeLoaderLibrary = CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary();
    CCBReader * ccbReader = new CCBReader(ccNodeLoaderLibrary);
    CCNode* node = ccbReader->readNodeGraphFromFile("CollisionTestLayer.ccbi");
    
    CCScene *scene = CCScene::create();
    scene->addChild(node);
    
    CC_SAFE_DELETE(ccbReader);

    // run
    pDirector->runWithScene(scene);

    return true;
}
开发者ID:Tingtingyu,项目名称:CollisionDetectionTest,代码行数:32,代码来源:AppDelegate.cpp

示例9: CCBReader

bool AppDelegate::applicationDidFinishLaunching() {
    // initialize director
    auto director = Director::getInstance();
    auto eglView = EGLView::getInstance();

    director->setOpenGLView(eglView);
    
    // turn on display FPS
    director->setDisplayStats(true);

    // set FPS. the default value is 1.0/60 if you don't call this
    director->setAnimationInterval(1.0 / 60);
    
    // create a scene. it's an autorelease object
    auto scene = Scene::create();
#if 0
    NodeLoaderLibrary *pLoaderLibrary = NodeLoaderLibrary::newDefaultNodeLoaderLibrary();
    CCBReader *ccbReader = new CCBReader(pLoaderLibrary);
    pLoaderLibrary->registerNodeLoader("plane_figtht_main", XCMainMenuLoader::loader());
    Node *pMainMenu = ccbReader->readNodeGraphFromFile("ccb/ccbi/plane_fight_main.ccbi");
    dynamic_cast<XCMainMenu*>(pMainMenu)->setAnimationManager(ccbReader->getAnimationManager());
    dynamic_cast<XCMainMenu*>(pMainMenu)->initPlaneMain();
    ccbReader->release();
    scene->addChild(pMainMenu); 
#else
    
#endif
    
    // run
    director->runWithScene(scene);

    return true;
}
开发者ID:jiatuhao,项目名称:coco2dx3.0,代码行数:33,代码来源:AppDelegate.cpp

示例10: CCLOG

void LayerChonBanChoi::onButtonCreate(CCObject* pSender)
{
    CCLOG("onButtonUpdate ");
    //Check
    boost::shared_ptr<double> am, amf;
    boost::shared_ptr<User> myself = GameServer::getSingleton().getSmartFox()->MySelf();
    if( myself==NULL || myself->GetVariable("am")==NULL || myself->GetVariable("amf")==NULL ){
        return;
    }
    amf = myself->GetVariable("amf")->GetDoubleValue();
    if((*amf/4)<1000){
		CCLOG("Không đủ tiền tạo phòng!");
		Chat *toast = new Chat("Bạn không đủ tiền tạo phòng!!", -1);
		this->addChild(toast);
        return;
    }
    
	CCNodeLoaderLibrary* ccNodeLoaderLibrary = SceneManager::getSingleton().getNodeLoaderLibrary();
	CCBReader* ccbReader = new cocos2d::extension::CCBReader(ccNodeLoaderLibrary);
    LayerCreateRoom* mLayer;
    if (ccbReader)
    {
        mLayer = (LayerCreateRoom *)ccbReader->readNodeGraphFromFile( "LayerCreateRoom.ccbi" );
        this->addChild(mLayer, 1, 1);
        ccbReader->release();
    }
    mLayer->setGameID(m_gID);
}
开发者ID:mrktj,项目名称:iCasino_v2,代码行数:28,代码来源:LayerChonBanChoi.cpp

示例11: new

CCBReader* CCBProxy::createCCBReader()
{
    NodeLoaderLibrary *ccNodeLoaderLibrary = NodeLoaderLibrary::getInstance();
    CCBReader * pCCBReader = new (std::nothrow) CCBReader(ccNodeLoaderLibrary);
    pCCBReader->autorelease();
    
    return pCCBReader;
}
开发者ID:Funemployment-Games,项目名称:rpgproject,代码行数:8,代码来源:CCBProxy.cpp

示例12: Model

// Constructor for the enemy. The layer is initialized in Model's constructor.
Enemy::Enemy(int x, int y) : Model(x,y)
{
    // Create a default NodeLoaderLibrary.
    NodeLoaderLibrary* nodeLoaderLibrary;
    nodeLoaderLibrary = NodeLoaderLibrary::newDefaultNodeLoaderLibrary();
    
    // Create a new CCBReader with a default NodeLoaderLibrary
    // This can take a lot of parameters to use code connections and more
    CCBReader* ccbReader = new CCBReader(nodeLoaderLibrary);
    
    // Load the main node from the CocosBuilder file
    modelNodes = ccbReader->readNodeGraphFromFile("Orc.ccbi");
    
    // Get the animationmanager so we can animate the thing afterwards
    animationManager = ccbReader->getAnimationManager();
    modelNodes->setPosition( Point(x, y));
    //modelNodes->setScale(0.5f);
    
    Node* rShoulder = modelNodes->getChildByTag(1)->getChildByTag(4)->getChildByTag(1);
    rShoulder->setZOrder(0);
    Node* lHip = modelNodes->getChildByTag(1)->getChildByTag(1);
    lHip->setZOrder(0);
    Node* rHip = modelNodes->getChildByTag(1)->getChildByTag(2);
    rHip->setZOrder(0);
    Node* rUpperArm = rShoulder->getChildByTag(2);
    rUpperArm->setZOrder(-1);
    Node* chest = modelNodes->getChildByTag(1)->getChildByTag(4)->getChildByTag(2);
    chest->setZOrder(0);
    Node* hips = modelNodes->getChildByTag(1)->getChildByTag(3);
    hips->setZOrder(0);
    modelNodes->getChildByTag(1)->getChildByTag(4)->setZOrder(0);
    
    Node* lShoulder = modelNodes->getChildByTag(1)->getChildByTag(4)->getChildByTag(4);
    lShoulder->setZOrder(3);
    Node* rElbow = rShoulder->getChildByTag(1);
    rElbow->setZOrder(1);
    Node* rLowerArm = rShoulder->getChildByTag(1)->getChildByTag(1);
    rLowerArm->setZOrder(2);
    Node* rHand = rShoulder->getChildByTag(1)->getChildByTag(2);
    rHand->getChildByTag(1)->setVisible(true);
    rHand->setZOrder(2);
    
    Node* neck = modelNodes->getChildByTag(1)->getChildByTag(4)->getChildByTag(3);
    neck->setZOrder(2);
    
    
    this->addChild(modelNodes); // Add the loaded node to the scene (this)
    
    healthStatus->setPosition(Point(x-500, y+100));
    this->addChild(healthStatus);
    
    initAttacks();
    
    // As nobody called ccbReader->autoRelease(), returning now would cause
    // a memory leak. We can call autoRelease or delete it ourselves.
    delete ccbReader;
    
}
开发者ID:Enniwhere,项目名称:BookBattleMultiplatform,代码行数:59,代码来源:Enemy.cpp

示例13: CCBReader

CCScene* MainScene::getMainScene() {
    NodeLoaderLibrary * ccNodeLoaderLibrary = NodeLoaderLibrary::sharedNodeLoaderLibrary();

    ccNodeLoaderLibrary->registerCCNodeLoader("MainScene", MainSceneLoader::loader());

    CCBReader *ccbReader = new CCBReader(ccNodeLoaderLibrary);

    return ccbReader->createSceneWithNodeGraphFromFile("ccb/MainScreen.ccbi");
}
开发者ID:ElliotMebane,项目名称:cocos2dx-store-example,代码行数:9,代码来源:MainScene.cpp

示例14: CC_BREAK_IF

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;
}
开发者ID:sosoayaen,项目名称:PokeBalloon,代码行数:57,代码来源:BalloonRankDialog.cpp

示例15: CCBReader

bool CResultDlg::init()
{
    CCLayer::init() ;
    CCNodeLoaderLibrary* plib = CCNodeLoaderLibrary::sharedCCNodeLoaderLibrary() ;
    CCBReader* pread = new CCBReader(plib);
    CCNode* pnode = pread->readNodeGraphFromFile("ResultDlg.ccbi", this) ;
    addChild(pnode) ;
    return true ;
}
开发者ID:BillXu,项目名称:Project,代码行数:9,代码来源:ResultDlg.cpp


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