Esempio n. 1
0
MenuLayer* MenuLayer::getMenu(cocos2d::Color4B var)
{
	MenuLayer* layer = MenuLayer::create();
	layer->initWithColor(var);

	return layer;
}
Esempio n. 2
0
MenuLayer* MenuLayer::menuWithEntryID(int entryId)
{
	MenuLayer* pLayer = new MenuLayer();
	pLayer->initWithEntryID(entryId);
	pLayer->autorelease();

	return pLayer;
}
Esempio n. 3
0
MenuLayer* MenuLayer::create( GameplayView* view )
{
	MenuLayer* layer = new MenuLayer;
	if (layer && layer->init(view))
	{
		layer->autorelease();
		return layer;
	}
	return NULL;
}
Esempio n. 4
0
MenuLayer * MenuLayer::createScene(int Tag) {
    MenuLayer *pRet = new (std::nothrow) MenuLayer();
    if (pRet&&pRet->init(Tag)) {
        pRet->autorelease();
        return pRet;
    }
    else
    {
        delete pRet;
        pRet = NULL;
        return NULL;
    }

}
//TODO: this is one ugly function
MenuStoreLayer* PurchaseCallbackHelper::getMenuStoreLayer()
{
    cocos2d::Scene * scene = cocos2d::CCDirector::sharedDirector()->getRunningScene();
    auto children = scene->getChildren();
    MenuLayer * menuLayer = 0;
    for(auto it = children.begin(); it != children.end(); ++it)
    {
        menuLayer = dynamic_cast<MenuLayer *>(*it);
        if (menuLayer != 0)
        {
            break;
        }
    }
    
    MenuButtonLayer * menuButtonLayer = 0;
    if (menuLayer != 0)
    {
        auto menuLayerChildren = menuLayer->getChildren();
        for (auto it = menuLayerChildren.begin(); it != menuLayerChildren.end(); ++it)
        {
            menuButtonLayer = dynamic_cast<MenuButtonLayer *>(*it);
            if (menuButtonLayer != 0)
            {
                break;
            }
        }
    }
    
    MenuStoreLayer * menuStoreLayer = 0;
    if (menuButtonLayer != 0)
    {
        auto menuButtonLayerChildren = menuButtonLayer->getChildren();
        for (auto it = menuButtonLayerChildren.begin(); it != menuButtonLayerChildren.end(); ++it)
        {
            menuStoreLayer = dynamic_cast<MenuStoreLayer *>(*it);
            if (menuStoreLayer != 0)
            {
                break;
            }
        }
    }
    
    return menuStoreLayer;
}