
var SplashScreen = cc.Layer.extend({
    _backgroundSprite:null,
    _state:0,

    ctor:function () {
        this._super();
        this.init();
        this._state = 0;
    },

    init:function () {
        //==========BACKGROUND=========
        this._backgroundSprite = new cc.Sprite(res.splash_screen_jpg);
        this._backgroundSprite.attr({
            anchorX: 0,
            anchorY: 0,
            x: 0,
            y: 0
        });
        this.addChild(this._backgroundSprite,0);

        this.schedule(this.onSelectLevel, 2);

        console.log("Main menu");
        return true;
    },

    onSelectLevel:function () {
        if(this._state == 0) {
            this._state = 1;
            var scene = MainMenu.scene();
            cc.director.runScene(new cc.TransitionFade(1, scene));
        }
    },
});


SplashScreen.scene = function () {
    var scene = new cc.Scene();
    var layer = new SplashScreen();
    scene.addChild(layer);
    return scene;
};
