123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- import { _decorator, Component, Node } from 'cc';
- import { GUIMediator } from '../../../engines/gui/GUIMediator';
- import { SceneManager } from '../../../engines/scenes/SceneManager';
- import { LiangLiangSDK } from '../../../libs/liangliangSDK';
- import { PlatformManager } from '../../../Platform/PlatformManager';
- const { ccclass, property } = _decorator;
- @ccclass('AdvertisingMediator')
- export class AdvertisingMediator extends GUIMediator {
- @property({
- type: Node
- })
- BackButton: Node = null;
- start() {
- }
- OnShow(data?: any): void {
- this.BackButton.active = false;
- this.scheduleOnce(this.showBackButton.bind(this), 3);
- }
- OnHide(): void {
- this.BackButton.active = false;
- }
- get LayerIndex() {
- return 4;
- }
- showBackButton(): void {
- this.BackButton.active = true;
- }
- 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) => {},
- });
- }
- }
- onClickBack(): void {
- this.HideSelf();
- if (LiangLiangSDK.CanWuChu() == true) {
- this.randomCpa();
- PlatformManager.showRewardedVideo(()=>{
- PlatformManager.showBanner();
- }, ()=>{
- PlatformManager.showBanner();
- })
- }
- }
- private get wx(): any {
- return window["wx"];
- }
- }
|