
const { ccclass, property } = cc._decorator;

@ccclass
export default class StartScreen extends cc.Component {
    @property(cc.Node)
    private selectBtnNode: cc.Node = null;
    @property(cc.AudioClip)
    private backgroundMusic: cc.AudioClip = null;

    protected onLoad(): void {
        this.selectBtnNode.on('click', this.onSelectBtnClick, this);
        cc.director.preloadScene('main');
        
        if (!cc.audioEngine.isMusicPlaying()) {
            cc.audioEngine.playMusic(this.backgroundMusic, true);
        }
    }

    private onSelectBtnClick() {
        cc.director.loadScene('main');
    }
}
