You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
2.0 KiB
60 lines
2.0 KiB
|
|
//*********************
|
|
// 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
|
|
//<i><b><size=24><outline color=#000000 width=3><color=#ffffff>银币不足,观看广告可免费获取</color><color=#6BFBA9>200银币</color><color=#ffffff>!</color></outline></size></b></i>
|
|
|
|
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('观看视频失败');
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|