//********************* // create by 流云 // time: Fri Nov 28 2025 // desc: //********************* import { _decorator, Component, Node , find} from 'cc'; import { Auto_BattleGetCoin } from './Auto_BattleGetCoin'; import { GEvent } from 'db://assets/mx/module/event/GEvent'; const { ccclass, property } = _decorator; @ccclass('UIBattleGetCoin') export class UIBattleGetCoin extends Auto_BattleGetCoin { onLoad(): void { super.onLoad(); } onEnable(): void { super.onEnable(); gg.game.CurentBattle.pause(); } onDisable(): void { super.onDisable(); gg.game.CurentBattle.resume(); } onInit(): void { //显示lable //银币不足,观看广告可免费获取200银币 this.showOpenCenterEff(); this.showOpenMaskEff(2); this.guideStr.string = gg.lang.get('银币不足,观看广告可免费获取',[gg.game.CurentBattle.VideoAddCoin]) } click_ui_bgMask() { gg.audio.playEffect({ name: "点击音效"}); this.close(2) } click_btnUnlock() { gg.audio.playEffect({ name: "点击音效"}); gg.sdk.showVideoAd((res) => { if (res) { let curWaveNum = gg.game.CurentBattle.CurentWaveNum gg.sdk.reportDY("inLevel", `章节${gg.game.CurentBattle.getReportDYChapterId()}_${curWaveNum}-AD-弹框获取银币`) // BattleManager.Instance.addCoin() gg.game.CurentBattle.IsWatchAd = true gg.game.CurentBattle.CurentVideoAddCoinTimes-- gg.game.CurentBattle.CurentCoinNum += gg.game.CurentBattle.VideoAddCoin; //发消息刷新主界面金币 GEvent.Ins.emit(GEvent.UpdateGameCoinNum) this.close(2) } else { gg.ui.showToast('观看视频失败'); } }) } }