import { _decorator, Component, Node, tween, v3 } from 'cc'; import BasePanel from '../../../core/component/BasePanel'; import WindowManager from '../../../core/manager/WindowManager'; import GameConst from '../../../core/common/GameConst'; import { Main } from '../Main'; import platformSystem from 'db://assets/platform/platformSystem'; import { constants } from 'db://assets/data/constants'; import audioManager from 'db://assets/manager/audioManager'; const { ccclass, property } = _decorator; @ccclass('OutOfBoxLayer') export class OutOfBoxLayer extends BasePanel { start() { let btn_clear = this.GetGameObject("btn_clear"); tween(btn_clear).sequence(tween(btn_clear).to(1, { scale: v3(0.8, 0.8, 0.8) }), tween(btn_clear).to(1, { scale: v3(1, 1, 1) })).repeatForever().start() this.SetText("lbl_coll_star", Main.Instance()._GameUI.star + ""); this.GetGameObject("one-more-chance-bg").active = false; Main.Instance()._GameUI.pasue = true; audioManager.playOneShot(constants.audios.softFail); } onDestroy() { super.onDestroy(); Main.Instance()._GameUI.pasue = false; } onBtnClicked(event: any, customEventData: any) { audioManager.playOneShot(constants.audios.btnclick); var btnName = event.target.name; switch (btnName) { case "btn_close": if (this.GetGameObject("one-more-chance-bg").active == false && Main.Instance()._GameUI.star > 0) { this.GetGameObject("one-more-chance-bg").active = true; tween(this.GetGameObject("one-more-chance-bg")).to(1, { position: v3(0, 372, 0) }).start(); return } this.close(); WindowManager.ins.open("FailLayer"); break; case "btn_clear": platformSystem.platform.showRewardVideo((b) => { if (b == 0) { this.dispatch(GameConst.CLEAR_ALL_BOX); this.close(); } else if (b == -2) { platformSystem.platform.shareAppMessage((bol) => { if (bol) { this.dispatch(GameConst.CLEAR_ALL_BOX); this.close(); } }) } }) break; } } }