|
@@ -6,7 +6,6 @@ import { UI_BattleResult } from "../../../../scripts/UIDef";
|
|
|
import { Layout_BattleResult } from "./Layout_BattleResult";
|
|
|
import { GtagMgr, GtagType } from "db://assets/core_tgx/base/GtagMgr";
|
|
|
import { GameEvent } from "../../../Script/Enum/GameEvent";
|
|
|
-import { LevelManager } from "../../../Script/Manager/LevelMgr";
|
|
|
import { StormSunderAudioMgr } from "../../../Script/Manager/StormSunderAudioMgr";
|
|
|
|
|
|
export class UI_BattleResult_Impl extends UI_BattleResult {
|
|
@@ -22,7 +21,7 @@ export class UI_BattleResult_Impl extends UI_BattleResult {
|
|
|
}
|
|
|
|
|
|
protected onCreated(): void {
|
|
|
- this.win = LevelManager.instance.levelModel.isWin;
|
|
|
+ this.win = true
|
|
|
const soundId = this.win ? 7 : 8;
|
|
|
StormSunderAudioMgr.playOneShot(StormSunderAudioMgr.getMusicIdName(soundId), 1.0);
|
|
|
|
|
@@ -38,9 +37,8 @@ export class UI_BattleResult_Impl extends UI_BattleResult {
|
|
|
layout.loseNode.active = !this.win;
|
|
|
|
|
|
this.rotationLight();
|
|
|
- this.refreshProgressBar();
|
|
|
|
|
|
- const { level } = LevelManager.instance.levelModel;
|
|
|
+ const level = 1
|
|
|
GtagMgr.inst.doGameDot(GtagType.level_end, { level }); //上报关卡结束
|
|
|
}
|
|
|
|
|
@@ -62,13 +60,10 @@ export class UI_BattleResult_Impl extends UI_BattleResult {
|
|
|
private emitEvent(): void {
|
|
|
if (this.win) {
|
|
|
EventDispatcher.instance.emit(GameEvent.EVENT_BATTLE_SUCCESS_LEVEL_UP);
|
|
|
- } else {
|
|
|
- EventDispatcher.instance.emit(GameEvent.EVENT_BATTLE_FAIL_LEVEL_RESET);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
onClickRewardBase(): void {
|
|
|
- this.destoryMyself();
|
|
|
this.emitEvent();
|
|
|
}
|
|
|
|
|
@@ -76,37 +71,6 @@ export class UI_BattleResult_Impl extends UI_BattleResult {
|
|
|
this.timeoutIds.forEach((id) => clearTimeout(id));
|
|
|
this.timeoutIds = [];
|
|
|
}
|
|
|
-
|
|
|
- //刷新进度条
|
|
|
- private refreshProgressBar(): void {
|
|
|
- const { winLevProgress, loseLevProgress } = this.layout;
|
|
|
-
|
|
|
- if (this.win) {
|
|
|
- winLevProgress.progress = 1;
|
|
|
- winLevProgress.node.getChildByName('Label').getComponent(Label).string = '100%';
|
|
|
- } else {
|
|
|
- const wineglass = LevelManager.instance.levelModel.levelConfig.wineglass;
|
|
|
- const sum = wineglass.reduce((pre, cur) => pre + cur, 0);
|
|
|
- const remainCupCount = LevelManager.instance.levelModel.remainCupCount;
|
|
|
- // const progress = ~~((sum - remainCupCount) / sum * 100) / 100;
|
|
|
- // loseLevProgress.progress = Math.floor(progress * 100) / 100;
|
|
|
- // const progressStr = (progress * 100).toFixed(2);
|
|
|
-
|
|
|
- const progress = (sum - remainCupCount) / sum;
|
|
|
- loseLevProgress.progress = progress;
|
|
|
- const progressStr = (progress * 100).toFixed(2);
|
|
|
- loseLevProgress.node.getChildByName('Label').getComponent(Label).string = progressStr + '%';
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private destoryMyself(): void {
|
|
|
- Tween.stopAllByTarget(this.node)
|
|
|
- if (isValid(this.node)) {
|
|
|
- this.node.removeFromParent();
|
|
|
- this.hide();
|
|
|
- }
|
|
|
- this.clearAllTimeouts();
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
tgxModuleContext.attachImplClass(UI_BattleResult, UI_BattleResult_Impl);
|