// Learn TypeScript: // - https://docs.cocos.com/creator/manual/en/scripting/typescript.html // Learn Attribute: // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html import GameData from "./GameData"; import AudioManager from "./tool/AudioManager"; import { GameTool } from "./tool/GameTool"; import { StorageMessage } from "./tool/Storage"; import { WeChat } from "./tool/share"; const {ccclass, property} = cc._decorator; @ccclass export default class NewClass extends cc.Component { @property(cc.Label) label: cc.Label = null; @property text: string = 'hello'; // onLoad () {} start () { GameTool.Authentication(); WeChat.setShare(location.href); var urlNow = window.location.href; // debugger; if(this.containsTrain(urlNow)){ console.log("无排行版本"); this.node.getChildByName("rank").active = false; } else{ console.log("有排行版本"); } } //判断来源 containsTrain(str) { return /from=train/i.test(str); } click(){ // AudioManager._instance.playMusicGame(); if(GameData._instance.GM_INFO.probation){ cc.director.loadScene("GuideScene"); } else{ cc.director.loadScene("GameScene"); } } openRank(){ // AudioManager._instance.playMusicGame(); cc.director.loadScene("RankScene"); } // update (dt) {} }