123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- 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.
- this.ContinueButton.active = false;
- this.ButtonDaochuBack.active = false;
- }
-
- OnShow(data?:any):void{
- console.log("open FullOutputMediator")
- PlatformManager.hideBanner();
- this.data=data;
- this.randomCpa();
- this.scheduleOnce(this.showContinueButton.bind(this), 1);
- this.scheduleOnce(this.showDaochuButton.bind(this), 3);
- }
- 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.
- // }
- }
|