Beispiel #1
0
// PvP Recovery
BattleScene* BattleScene::create(int seed,
                                 int round,
                                 const Player& first,
                                 const Player& second,
                                 const rapidjson::Value& battleState,
                                 float skillTimeout,
                                 float moveTimeout,
                                 float skillTimeLeft,
                                 float moveTimeLeft,
                                 const rapidjson::Value& events)
{
    BattleScene* scene = new BattleScene();
    
    if(scene && scene->initPvP(seed,
                               round,
                               first,
                               second,
                               battleState,
                               skillTimeout,
                               moveTimeout,
                               skillTimeLeft,
                               moveTimeLeft,
                               events))
    {
        scene->autorelease();
        return scene;
    }
    CC_SAFE_DELETE(scene);
    return NULL;
}
BattleScene *BattleScene::create(const std::string &stage){
    BattleScene *pRet = new (std::nothrow) BattleScene(stage);
    if (pRet && pRet->init()){
        pRet->autorelease();
        return pRet;
    }
    
    delete pRet;
    pRet = nullptr;
    return nullptr;
}
Beispiel #3
0
// PvP
BattleScene* BattleScene::create(const Player& p1, const Player& p2, const PvPConfig& config)
{
    BattleScene* scene = new BattleScene();

    if(scene && scene->initPvP(p1, p2, config))
    {
        scene->autorelease();
        return scene;
    }
    CC_SAFE_DELETE(scene);
    return NULL;
}
Beispiel #4
0
// PvE
BattleScene* BattleScene::create(HeroList& team, LevelInfo& level)
{
    BattleScene* scene = new BattleScene();
    
    if(scene && scene->initWithLevel(team, level))
    {
        scene->autorelease();
        return scene;
    }
    CC_SAFE_DELETE(scene);
    return NULL;
}
Beispiel #5
0
BattleScene* BattleScene::create(PreloadBattleScene* preloaderScene, std::vector<int> parameters)
{
	BattleScene* scene = new BattleScene();
	if (scene && scene->init(preloaderScene, parameters))
	{
		return (BattleScene*)scene->autorelease();
	}

	CC_SAFE_DELETE(scene);

	return scene;
}
BattleScene* BattleScene::create(int level)
{
	BattleScene* battleScene = new BattleScene();
	if (battleScene && battleScene->init(level))
	{
		battleScene->autorelease();
	}
	else
	{
		CC_SAFE_DELETE(battleScene);
	}
	return battleScene;
}