import { _decorator, Component, director, Node, Sprite, tween, Vec3, Widget } from 'cc'; import { AudioMgr } from './AudioMgr'; import { Clips, DJ, DJ_TYPE } from './Enums'; import { Global } from './Global'; import { BasePage } from './BasePage'; import { AdManger } from './ad/AdManger'; import { DjManger } from './DjManger'; const { ccclass, property } = _decorator; @ccclass('GameOverAction') export class GameOverAction extends BasePage { @property({ type: Node }) fail_img: Node @property({ type: Node }) fail_dou: Node @property({ type: Node }) btn_continue: Node start() { super.start(); } update(deltaTime: number) { } //show menu panel open() { if(this.node.position.x == 0 && this.node.position.y == 0){ //console.log("打开中,跳过"); return; } super.open(); this.fail_img.scale = new Vec3(2, 2, 0); tween(this.fail_img) .to(0.3, { scale: new Vec3(1, 1, 0) },Global.our_easing) .call(() => { }) .start(); this.fail_dou.scale = new Vec3(0.1, 0.1, 0); tween(this.fail_dou) .to(0.3, { scale: new Vec3(1, 1, 0) },Global.our_easing) .call(() => { }).start(); AudioMgr.ins.playSound(Clips.fail); } btn_go_home() { this.close(); director.loadScene("home"); AdManger.show_interstial(); } btn_restart_game() { this.close(); Global.main_action.restart_game(); AdManger.show_interstial(); } clear_pins_videos(){ AudioMgr.ins.playSound(Clips.btn_1); let pin_arr = Global.layer_empty_action.get_pin_arr(); if (pin_arr.length == 0) { Global.tips_action.show("No Screws to Clear");//没有可清理的钉子 return; } if (!DjManger.use_dj(DJ.Btn_5,DJ_TYPE.Type_video)) { Global.tips_action.show("Current Level: Props Exhausted");//当前关卡次数已经用完 return; } // Global.log_dj(); // this.close(); // Global.log_dj(); AdManger.show_video((data) => { if (data == 1) { console.log("clear_pins_videos 获取奖励成功"); this.close(); //解锁 Global.bucket_action.put_pins(pin_arr); } else { Global.tips_action.show("Gain reward failure");//获取奖励失败 //退款 DjManger.return_used_dj(DJ.Btn_5,DJ_TYPE.Type_video); } }) } }