const {ccclass, property} = cc._decorator;
import GameData from '../GameData'
import SelRole from './SelRole'
@ccclass
export default class LevelSel extends cc.Component {

    @property(cc.Node)
    btnStart:cc.Node = null;
    @property(SelRole)
    selRole:SelRole = null;
    @property(cc.PageView)
    mapView:cc.PageView = null;

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {}

    start () {
        this.btnStart.on('click', this.onBtnStart, this);
    }
    onBtnStart(){
        //存储选择的角色ID和关卡id
        GameData.getInstance().setData('LevelID', this.mapView.getCurrentPageIndex() + 4001)
        let arrRoleID = [this.selRole.arrRoleIndex[0] + 2001, this.selRole.arrRoleIndex[1] + 2001];
        GameData.getInstance().setData('RoleID', arrRoleID);
        //切换场景
        cc.director.loadScene('GameScene');
        //console.log('btnStart');
    }
    // update (dt) {}
}
