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.
132 lines
5.0 KiB
132 lines
5.0 KiB
|
|
//*********************
|
|
// create by 流云
|
|
// time: Thu Sep 25 2025
|
|
// desc:
|
|
//*********************
|
|
import { _decorator, Component, Node, find, Label, sp } from 'cc';
|
|
import { Auto_BattleRevive } from './Auto_BattleRevive';
|
|
|
|
import { UIID } from '../../game/ConfigRes';
|
|
import { GEvent } from 'db://assets/mx/module/event/GEvent';
|
|
import BeginnerGuideManager, { BeginnerGuideType } from '../BattleGame/BeginnerGuideManager';
|
|
import { MonsterType } from '../../manager/MonsterDataManager';
|
|
import { BattleType, ChapterDifficulty } from '../../manager/ChapterDataManager';
|
|
import { ConstNumType } from '../../game/ConfigProjectData';
|
|
const { ccclass, property } = _decorator;
|
|
|
|
@ccclass('UIBattleRevive')
|
|
export class UIBattleRevive extends Auto_BattleRevive {
|
|
|
|
onLoad(): void {
|
|
super.onLoad();
|
|
}
|
|
|
|
onEnable(): void {
|
|
super.onEnable();
|
|
}
|
|
|
|
onDisable(): void {
|
|
super.onDisable();
|
|
}
|
|
|
|
constReviveAddCoin = 200;
|
|
|
|
onInit(): void {
|
|
gg.audio.playEffect({ name: "复活失败音效" });
|
|
this.constReviveAddCoin = gg.data.table.getConst(ConstNumType.ReviveAddCoin);
|
|
this.showOpenMaskEff(2);
|
|
this.refreshFailReviveLeftNum()
|
|
this.refreshGameProgress()
|
|
this.scheduleOnce(() => {
|
|
this.showNewGuide()
|
|
}, 0.6)
|
|
}
|
|
refreshGameProgress() {
|
|
let curDeadMonsterNum = gg.game.CurentBattle.MonsterDeadNum;
|
|
let totalMonsterNum = gg.game.CurentBattle.TotalMonsterNum;
|
|
this.lb_progress.string = `${Math.floor((totalMonsterNum - curDeadMonsterNum) / totalMonsterNum * 100)}%`
|
|
}
|
|
refreshFailReviveLeftNum() {
|
|
let curFailReviveLeftNum = gg.game.CurentBattle.curFailReviveLeftNum;
|
|
this.btnAdRevive.getChildByName('leftTimes').getComponent(Label).string = gg.lang.get('剩余次数x{1}', [curFailReviveLeftNum]) //`剩余次数x${curFailReviveLeftNum}`
|
|
this.btnFreeRevive.getChildByName('leftTimes').getComponent(Label).string = gg.lang.get('剩余次数x{1}', [curFailReviveLeftNum]) //`剩余次数x${curFailReviveLeftNum}`
|
|
this.btnFreeRevive.active = gg.game.CurentSelectChapterId == 1 && curFailReviveLeftNum >= 2
|
|
if(this.btnFreeRevive.active ){
|
|
this.btnFreeRevive.getChildByName('dianji').active = true
|
|
}
|
|
|
|
this.btnAdRevive.active = !this.btnFreeRevive.active
|
|
this.lb_reward.string = this.constReviveAddCoin.toString();
|
|
}
|
|
click_btnBack() {
|
|
gg.audio.playEffect({ name: "点击音效" });
|
|
let curWaveNum = gg.game.CurentBattle.CurentWaveNum;
|
|
gg.sdk.reportDY("inLevel", `章节${gg.game.CurentBattle.getReportDYChapterId()}_${curWaveNum}-放弃复活`)
|
|
this.close(2)
|
|
//失败权重 失败领取会加这里不需要加
|
|
gg.game.CurentBattle.reportBigBossFailRemainingHpPercentIfNeeded();
|
|
gg.ui.openPanel(UIID.BattleFail)
|
|
// GEvent.Ins.emit(GEvent.GameRestart);
|
|
}
|
|
click_btnAdRevive() {
|
|
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-广告复活`)
|
|
if(gg.game.CurentBattle.jiujiuwoyaSoltFullFail ){
|
|
|
|
}else{
|
|
gg.game.CurentBattle.curFailReviveLeftNum--;
|
|
}
|
|
|
|
if(gg.game.CurentBattle.BattleType == BattleType.OrangeWeaponMode_Dian){
|
|
|
|
}else{
|
|
gg.game.CurentBattle.addCoinNum(this.constReviveAddCoin);
|
|
}
|
|
|
|
this.refreshFailReviveLeftNum()
|
|
gg.game.CurentBattle.IsWatchAd = true
|
|
this.close(2)
|
|
this.gameReborn();
|
|
gg.game.CurentBattle.IsGameOver = false
|
|
GEvent.Ins.emit(GEvent.GameReborn)
|
|
gg.game.CurentBattle.addFailWeight(true);
|
|
gg.PRR.AdClickNum.push(6)
|
|
} else {
|
|
gg.ui.showToast('观看视频失败');
|
|
}
|
|
})
|
|
}
|
|
click_btnFreeRevive() {
|
|
let curWaveNum = gg.game.CurentBattle.CurentWaveNum;
|
|
gg.sdk.reportDY("inLevel", `章节${gg.game.CurentBattle.getReportDYChapterId()}_${curWaveNum}-复活`)
|
|
if(gg.game.CurentBattle.jiujiuwoyaSoltFullFail ){
|
|
|
|
}else{
|
|
gg.game.CurentBattle.curFailReviveLeftNum--;
|
|
}
|
|
|
|
gg.game.CurentBattle.addCoinNum(this.constReviveAddCoin);
|
|
this.refreshFailReviveLeftNum()
|
|
this.close(2)
|
|
this.gameReborn();
|
|
gg.game.CurentBattle.IsGameOver = false
|
|
gg.game.CurentBattle.addFailWeight(true);
|
|
GEvent.Ins.emit(GEvent.GameReborn)
|
|
}
|
|
showNewGuide() {
|
|
|
|
}
|
|
|
|
gameReborn() {
|
|
//恢复城墙血量
|
|
gg.game.CurentBattle.CurentWallHp = gg.game.CurentBattle.WallMaxHp;
|
|
GEvent.Ins.emit(GEvent.playerHit);
|
|
//所有怪物回到起点
|
|
gg.game.CurentBattle.MonsterSpawner.setAllMonsterToBornPos()
|
|
|
|
}
|
|
}
|
|
|