/** * @author uu * @file 主控制器 */ const ADSdk = require("ADSdk"); cc.Class({ extends: cc.Component, properties: { musicMgr: require('musicMgr'), //音乐控制组件 game: require('game'), //主游戏控制器 pageMgr: require('pageMgr'), //页面控制器 // social: require('social'), //排行榜、广告控制器 config: cc.JsonAsset, gameData: cc.JsonAsset, scoreMgr: require('score'), //分数 特效控制 totalRank: cc.Node, groupRank: cc.Node, startPage: require('startPage'), navNode: cc.Node, pictorial: cc.Node, helpPage: cc.Node, redBag: require('redBag'), singnInPage:require('signIn'), }, onLoad() { // 远程config配置 // Utils.getConfig((data) => { // let obj = JSON.parse(data) // AppConst.probabilityConfig = obj // }); ADSdk.init(); }, start() { this.totalRank.active = false this.pictorial.active = false this.game.init(this) // if (this.social.node.active) { // this.social.init(this) // } this.musicMgr.init() this.lateStart() }, lateStart() { // if (this.social.node.active) { // this.social.closeBannerAdv() // } this.game._status = 0 this.pictorial.getComponent('pictorial').init(this) this.startPage.bannerNode.scale = 1 this.pageMgr.onOpenPage(0) }, onGameStartButton() { // TODO: 增加一个动画 // if (this.social.node.active) { // this.social.openBannerAdv() // } this.startPage.showAnimation().then(() => { this.gameStart() }) }, gameStart() { this.pageMgr.onOpenPage(1) this.game.gameStart() }, closeRank() { this.totalRank.active = false this.navNode.active = true // if (this.social.node.active) { // this.social.closeRank() // } }, openRank() { this.totalRank.active = true this.navNode.active = false // if (this.social.node.active) { // this.social.showRank() // } }, openGroupRank() { this.groupRank.active = true // if (this.social.node.active) { // this.social.showGroupRank() // this.pageMgr.addPage(6) // } }, closeGroupRank() { this.groupRank.active = false this.navNode.active = true // if (this.social.node.active) { // this.social.closeGroupRank() // this.pageMgr.removePage(6) // } }, openPictorial() { this.pageMgr.addPage(7) this.pictorial.active = true }, closePictorial() { this.pictorial.active = false }, openHelpPage() { this.pageMgr.addPage(2) this.helpPage.active = true let num = Utils.randomNum(0, 100); let nativeAD = AppConst.probabilityConfig.nativeAD; let time = 0; if (num < nativeAD.helpUI.probability) { if (AppConst.SHOWADUI) { // cc.log("信息流") if (AppConst.CHANNEL == AppConst.channel.ANDROID) { time = nativeAD.helpUI.delayTime; this.scheduleOnce(() => { ADSdk.pay(6, this); }, time); } else { ADSdk.showInsertAd(); } } } }, closeHelpPage() { this.pageMgr.removePage(2) this.helpPage.active = false }, showRedBag() { if (Utils.hadRedPacket()) { // 开红包界面 this.redBag.init(0,this); } else { // 余额界面 this.redBag.init(2,this); } }, showSignIn() { this.singnInPage.init(this); }, });