//********************* // create by 流云 // time: Wed Jul 29 2026 // desc: //********************* import { _decorator } from 'cc'; import { Auto_PopBattleSpeed } from './Auto_PopBattleSpeed'; import { BATTLE_SPEED_UNLOCK_VIDEO_COUNT, getBattleSpeedVideoUnlockCount, isBattleSpeedPermanentlyUnlocked, recordBattleSpeedVideoUnlock, } from '../../battle/BattleSpeedUnlock'; import { BattleRuntime } from '../../battle/runtime/BattleRuntime'; const { ccclass } = _decorator; @ccclass('UIPopBattleSpeed') export class UIPopBattleSpeed extends Auto_PopBattleSpeed { onInit(): void { this._refreshUnlockCountUi(); } private _refreshUnlockCountUi(): void { const count = getBattleSpeedVideoUnlockCount(); this.rt_Count.string = `已使用:(${count}/${BATTLE_SPEED_UNLOCK_VIDEO_COUNT})次 `; } click_btnClose(): void { this.close(2); } click_btnUse(): void { const match = gg.game.CurentBattle as BattleRuntime | null; if (!match || match.IsGameOver) return; gg.sdk.showVideoAd((res) => { if (!res) { gg.ui.showToast('观看视频失败'); return; } recordBattleSpeedVideoUnlock(); match.grantBattleSpeed2xForMatch(); gg.sdk.reportDY( 'inLevel', `${gg.game.getReportDYBattleLabel()}-AD-战斗加速${isBattleSpeedPermanentlyUnlocked() ? '-永久解锁' : ''}`, ); this.close(2); }); } }