import { _decorator, Component, Node, sys } from 'cc';
import { WxPlatform } from './WxPlatform';
const { ccclass, property } = _decorator;

@ccclass('AdManger')
export class AdManger {

    /**
     * 
     * @param delay 
     */
    static show_interstial(delay = 0) {
        const system = sys.platform;
        switch (system) {
            case sys.Platform.WECHAT_GAME:
                WxPlatform.ins.show_interstitial(delay);
                break;
        }
    }
    /**
     * 视频激励广告
     * @param callback 
     */
    static show_video(callback: Function) {
        console.log('zh:random_pins_videos 666')
        const system = sys.platform;
        switch (system) {
            case sys.Platform.WECHAT_GAME:
                WxPlatform.ins.show_reward_video((data) => {
                    if (data == 1) {
                        callback(data);
                        // Global.Pause(false);
                        // director.emit(events.Toast, "获取奖励成功");
                        console.log("show_video 获取奖励成功");
                    } else {
                        callback(data);
                        // Global.Pause(false);
                        // director.emit(events.Toast, "获取奖励失败");
                        console.log("show_video 获取奖励失败7");
                    }

                })
                break;
            default:
                callback(0);
                break;
        }
    }
}

