Exemple #1
0
void UserLoginScene::buttonCallback(Ref* sender)
{
    MenuItemImage *pSender = (MenuItemImage*)sender;
    
    UserDefault::getInstance()->setIntegerForKey("Player_ID", pSender->getTag());

    log("User key for login:%d",UserLoginKey);
    Scene *startScene  =  CGameScene::createScene();
    Director::getInstance()->replaceScene(startScene);
}
void CognitoWorld::menuCallback(Ref* pSender)
{
    MenuItemImage* pMenuItem = (MenuItemImage *)pSender;
    int tag = (int)pMenuItem->getTag();
    
    switch (tag)
    {
        case 0:
        {
            Scene* menuScene = CognitoMenu::createScene();
            Director::getInstance()->replaceScene(menuScene);
            Director::getInstance()->resume();
            break;
        }
        case 1:
            restartGame();
            break;
            
        default:
            
            break;
    }
}