There is no DidLoadFromCCB method in cocos2d-x

There is no DidLoadFromCCB method in cocos2d-x
0.0 0


Hi !
Does Cocos2d-x have similar function to DidLoadFromCCB from Cocos2d ? How to handle the state when loading from CCB file has been done ?


You should over ride following four methods:

  1. For Menu Selector (if using)
    virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuItemSelector(cocos2d::CCObject * pTarget, const char * pSelectorName);

  2. For Control (if using)
    virtual cocos2d::extension::SEL_CCControlHandler onResolveCCBCCControlSelector(cocos2d::CCObject * pTarget, const char * pSelectorName);

  3. If you have defined any variables in CCB
    virtual bool onAssignCCBMemberVariable(cocos2d::CCObject * pTarget, const char * pMemberVariableName, cocos2d::CCNode * pNode);

  4. This is the one you are looking for. It is called once CCB file is loaded and Scene is created from it.
    virtual void onNodeLoaded(cocos2d::CCNode * pNode, cocos2d::extension::CCNodeLoader * pNodeLoader);


Thanks ! :slight_smile: