//********************* // create by 流云 // time: Thu Mar 19 2026 // desc: //********************* import { _decorator, Component, Node, find, Label, Sprite } from 'cc'; import { Auto_xiufuBox } from './Auto_xiufuBox'; import { BattleDataManager } from '../BattleGame/BattleDataManager'; import { GEvent } from 'db://assets/mx/module/event/GEvent'; import { SpriteLoad } from 'db://assets/mx/components/SpriteLoad'; import { GBundle, GPath } from '../../game/ConfigRes'; import { MapObstacle } from '../BattleGame/MapObstacle'; const { ccclass, property } = _decorator; @ccclass('UIxiufuBox') export class UIxiufuBox extends Auto_xiufuBox { onLoad(): void { super.onLoad(); } onEnable(): void { super.onEnable(); gg.game.CurentBattle.pause(); } onDisable(): void { super.onDisable(); gg.game.CurentBattle.resume(); } config: ITablePlaymode = null; zawConfig: ITableObstacle = null; mapObstacle: MapObstacle = null; onInit(): void { this.showOpenCenterEff(); this.showOpenMaskEff(2); let obj = this.prema this.config = obj.config; this.zawConfig = obj.zawConfig; this.mapObstacle = obj.mapObstacle; let lab = find('center/btnNo/lay/lab', this.node).getComponent(Label) lab.string = gg.lang.get('{1}修复', [obj.priceNum]) let desc = this.zawConfig?.desc; if (!desc) desc = this.config?.desc; if (!desc) desc = '确定修复吗?'; this.lb_content.string = gg.lang.get(desc); this.lb_name.string = gg.lang.get(this.zawConfig.name); if (this.zawConfig) { this.ui_icon.getOrAddComponent(SpriteLoad).setSprite(GPath.ObstacleIcon3(`${this.zawConfig.res}`), GBundle.Items); } else { this.ui_icon.getComponent(Sprite).spriteFrame = null; } } click_btnOk() { //广告修复 gg.sdk.showVideoAd((res) => { if (res) { let obj = this.prema gg.sdk.reportDY("inLevel", `章节${gg.game.CurentBattle.getReportDYChapterId()}-AD-${this.zawConfig.name}修复`) gg.data.project.setGridIsRepair(gg.game.CurentBattle.MapId, this.mapObstacle.Grid.Index, 1); GEvent.Ins.emit(GEvent.XiufuFinish, obj.xiufuNode) this.close(1) } else { gg.ui.showToast('观看视频失败'); } }) } click_btnNo() { //花钱修复 let obj = this.prema let price = Number(obj.priceNum) let coinNum = gg.game.CurentBattle.CurentCoinNum if (coinNum < price) { gg.ui.showToast('银币不足') return } gg.game.CurentBattle.CurentCoinNum -= price GEvent.Ins.emit(GEvent.XiufuFinish, obj.xiufuNode) this.close(1) } click_btnClose() { this.close(1) } }