import { _decorator, Component, Node } from 'cc'; import { GUIManager } from '../../../engines/gui/GUIManager'; import { GUIMediator } from '../../../engines/gui/GUIMediator'; import { SceneManager } from '../../../engines/scenes/SceneManager'; import { LiangLiangSDK } from '../../../libs/liangliangSDK'; import { PlatformManager } from '../../../Platform/PlatformManager'; import { UIConst } from '../UIConst'; const { ccclass, property } = _decorator; @ccclass('FullOutputMediator') export class FullOutputMediator extends GUIMediator { continueShowBanner:boolean = true; @property({ type:Node }) ContinueButton:Node=null; @property({ type:Node }) ButtonDaochuBack:Node=null; start () { // Your initialization goes here. } OnShow(data?:any):void{ PlatformManager.hideBanner(); this.ContinueButton.active = false; this.ButtonDaochuBack.active = false; this.data=data; if(LiangLiangSDK.CanWuChu()){ this.randomCpa(); } this.scheduleOnce(this.showContinueButton.bind(this), 1); this.scheduleOnce(this.showDaochuButton.bind(this), 4); } OnHide():void{ this.ContinueButton.active = false; this.ButtonDaochuBack.active = false; this.continueShowBanner = true; PlatformManager.showBanner(); } randomCpa():void{ if(this.wx!=null) { let adList: any[] = LiangLiangSDK.GetList(); let data = adList[Math.floor(Math.random()*adList.length)] this.wx.navigateToMiniProgram({ appId: data.app_id, path: data.app_path, success: (res) => { LiangLiangSDK.CpaReport(self.data); }, fail: (res) => { // GUIManager.single.Show(UIConst.FULL_OUTPUT_UI); console.log("跳转失败!"); }, complete: (res) => {}, }); } } showContinueButton():void{ this.ContinueButton.active = true; } showDaochuButton():void{ this.ButtonDaochuBack.active = true; } /** * 返回主界面 */ BackToMain():void{ SceneManager.single.Swicth("PrepareScene"); this.HideSelf(); if(LiangLiangSDK.CanWuChu() == true){ this.randomCpa(); } } ContinueGame():void{ if(LiangLiangSDK.CanWuChu() == true){ if(this.continueShowBanner == true){ this.__bannerWuChu(); }else{ this.randomCpa(); } }else{ SceneManager.single.Swicth("PrepareScene"); this.HideSelf(); } } /** * 误触逻辑 */ private __bannerWuChu():void{ this.scheduleOnce(()=>{ PlatformManager.showBanner(); this.scheduleOnce(()=>{ PlatformManager.hideBanner(); this.continueShowBanner = false; }, 1) }, 1) } private get wx():any{ return window["wx"]; } // update (deltaTime: number) { // // Your update function goes here. // } }