import { WeChat } from "./module/Share/share";

const {ccclass, property, requireComponent} = cc._decorator;

@ccclass
export default class NewClass extends cc.Component {
    start () {
        window.initMgr();
        // WeChat.setShare(location.href);
        cc.fx.GameConfig.init();
        // cc.fx.AudioManager._instance.init();
        var urlNow = window.location.href;
        if(this.containsTrain(urlNow)){
            console.log("无排行版本");
            this.node.getChildByName("Rank").active = false;
        }
        else{
            console.log("有排行版本");
        }
    }

    //判断来源
    containsTrain(str) {
        return /from=train/i.test(str);
    }

    //开始游戏，跳转至引导页面
    startGame(){
        cc.director.loadScene("GuideScene");
    }
    //备用，用来测试跳转 指定关卡
    clickBtn(event,data){
        cc.fx.GameConfig.GM_INFO.custom = parseInt(data);
        cc.director.loadScene("GameScene");
    }   
    //打开排行榜
    openRank(){
        cc.director.loadScene("RankScene");
    }
    
    protected update(dt: number): void {
    }
}
