123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- //电子邮件puhalskijsemen@gmail.com
- //源码网站 开vpn全局模式打开 http://web3incubators.com/
- //电报https://t.me/gamecode999
- //网页客服 http://web3incubators.com/kefu.html
- /**
- * @author heyuchang
- * @file 主控制器
- */
- // import ATSDK from "./AnyThinkAds/ATJSSDK";
- // import ATRewardedVideoSDK from "./AnyThinkAds/ATRewardedVideoJSSDK";
- // import AAJS2 from "./ATAndroidJS2";
- // import AESUtil from "./AESUtil"
- cc.Class({
- extends: cc.Component,
- properties: {
- musicManager: require('musicManager'), //音乐控制组件
- game: require('game'), //主游戏控制器
- pageManager: require('pageManager'), //页面控制器
- social: require('social'), //排行榜、广告控制器
- config: cc.JsonAsset,
- gameData: cc.JsonAsset,
- scoreMgr: require('score'), //分数 特效控制
- totalRank: cc.Node,
- groupRank: cc.Node,
- startPage: require('startPage'),
- navNode: cc.Node,
- illustrative: cc.Node,
- helpPage: cc.Node,
- },
- start() {
- console.log('zh:controller 00000000000000')
- this.totalRank.active = false
- this.illustrative.active = false
- this.game.init(this)
- if (this.social.node.active) {
- this.social.init(this)
- }
- this.musicManager.init()
- this.lateStart()
- //this.initAdForPage()//这是里测试的时候用
- },
- initAdForPage() {
- console.log('zh:controller.js initAdForPage start')
- let deviceId = AAJS2.getDeviceUserId();
- //console.log("zh:checkstatus:", ATRewardedVideoSDK.checkAdStatus(AAJS2.getPlacementID()));
- var setting = {};
- setting[ATRewardedVideoSDK.userIdKey] = deviceId;
- ATRewardedVideoSDK.loadRewardedVideo(AAJS2.getPlacementID(), setting);
- console.log('zh:controller.js initAdForPage END')
- },
- lateStart() {
- if (this.social.node.active) {
- this.social.closeBannerAdv()
- }
- this.illustrative.getComponent('illustrative').init(this)
- this.startPage.bannerNode.scale = 1
- this.pageManager.onOpenPage(0)
- },
- onGameStartButton() {
- // TODO: 增加一个动画
- if (this.social.node.active) {
- this.social.openBannerAdv()
- }
- this.startPage.showAnimation().then(() => {
- this.gameStart()
- })
- },
- gameStart() {
- this.pageManager.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.pageManager.addPage(6)
- }
- },
- closeGroupRank() {
- this.groupRank.active = false
- this.navNode.active = true
- if (this.social.node.active) {
- this.social.closeGroupRank()
- this.pageManager.removePage(6)
- }
- },
- openPictorial() {
- //ZH测试专用显示AD
- if (2 > 3) {
- setTimeout(() => {
- if (cc.sys.os === cc.sys.OS_ANDROID) {
- if (ATRewardedVideoSDK.hasAdReady(AAJS2.getPlacementID())) {
- console.log('zh:AD ready for controller.js')
- ATRewardedVideoSDK.showAd(AAJS2.getPlacementID());
- } else {
- console.log('zh:AD not ready for controller.js')
- }
- }
- }, 300)
- }
- this.illustrative.active = true
- },
- closePictorial() {
- this.illustrative.active = false
- },
- openHelpPage() {
- this.helpPage.active = true
- },
- closeHelpPage() {
- this.helpPage.active = false
- }
- });
|