From b492c39d6bd4d1ca20a63c85a1e3b1a95f40ca2b Mon Sep 17 00:00:00 2001 From: eble_lars Date: Sun, 25 Jul 2021 23:57:00 +0200 Subject: [PATCH] Fix pop ups displaying under inhibitor timers Fix red side inhibitor bot/top swap (Fix #49) Fix score display not displaying when reenabling (Fix #41) --- Overlays/ingame/src/scenes/IngameScene.ts | 6 ++++-- Overlays/ingame/src/util/Utils.ts | 11 +++++++++++ Overlays/ingame/src/visual/InfoPageVisual.ts | 13 ++----------- Overlays/ingame/src/visual/InhibitorVisual.ts | 4 ++-- Overlays/ingame/src/visual/ObjectivePopUpVisual.ts | 4 ++-- Overlays/ingame/src/visual/ScoreboardVisual.ts | 9 +++++++-- 6 files changed, 28 insertions(+), 19 deletions(-) diff --git a/Overlays/ingame/src/scenes/IngameScene.ts b/Overlays/ingame/src/scenes/IngameScene.ts index 1abbcd7..6d89c6f 100644 --- a/Overlays/ingame/src/scenes/IngameScene.ts +++ b/Overlays/ingame/src/scenes/IngameScene.ts @@ -344,12 +344,12 @@ export default class IngameScene extends Phaser.Scene { if (!this.overlayCfg?.ObjectiveKill.SoulPointScoreboardPopUp.Enabled) return; if (state.scoreboard.BlueTeam.Dragons.length === 3 && this.state?.scoreboard.BlueTeam.Dragons.length === 2) { - //Blue Soul Point + console.log('Blue Soul Point'); new ObjectivePopUpVisual(this, this.overlayCfg!.ObjectiveKill.SoulPointScoreboardPopUp, `${state.scoreboard.BlueTeam.Dragons[2]}Soul`); } if (state.scoreboard.RedTeam.Dragons.length === 3 && this.state?.scoreboard.RedTeam.Dragons.length === 2) { - //Red Soul Point + console.log('Red Soul Point'); new ObjectivePopUpVisual(this, this.overlayCfg!.ObjectiveKill.SoulPointScoreboardPopUp, `${state.scoreboard.RedTeam.Dragons[2]}Soul`); } } @@ -369,6 +369,7 @@ export default class IngameScene extends Phaser.Scene { break; } + console.log(`${objectiveName} spawned`); new ObjectivePopUpVisual(this, cfg, `${objectiveName.toLowerCase()}Spawn`); } @@ -389,6 +390,7 @@ export default class IngameScene extends Phaser.Scene { break; } + console.log(`${objectiveName} killed`); new ObjectivePopUpVisual(this, cfg, `${objectiveName.toLowerCase()}Kill`); } diff --git a/Overlays/ingame/src/util/Utils.ts b/Overlays/ingame/src/util/Utils.ts index e69de29..217f480 100644 --- a/Overlays/ingame/src/util/Utils.ts +++ b/Overlays/ingame/src/util/Utils.ts @@ -0,0 +1,11 @@ +export default class Utils { + static ConvertGold(gold: number): string { + let hundred = Math.round((gold % 1000) / 100); + let thousand = Math.floor(gold / 1000); + if (hundred === 10) { + thousand++; + hundred = 0; + } + return thousand + '.' + hundred + 'k'; + } +} \ No newline at end of file diff --git a/Overlays/ingame/src/visual/InfoPageVisual.ts b/Overlays/ingame/src/visual/InfoPageVisual.ts index 0b02fa6..46f33b1 100644 --- a/Overlays/ingame/src/visual/InfoPageVisual.ts +++ b/Overlays/ingame/src/visual/InfoPageVisual.ts @@ -3,6 +3,7 @@ import InfoSidePage from "~/data/infoSidePage"; import PlayerInfoTab from "~/data/playerInfoTab"; import PlaceholderConversion from "~/PlaceholderConversion"; import IngameScene from "~/scenes/IngameScene"; +import Utils from "~/util/Utils"; import Vector2 from "~/util/Vector2"; import variables from "~/variables"; import { VisualElement } from "./VisualElement"; @@ -485,16 +486,6 @@ export class PlayerTabIndicator { } - static ConvertGold(gold: number): string { - let hundred = Math.round((gold % 1000) / 100); - let thousand = Math.floor(gold / 1000); - if (hundred === 10) { - thousand++; - hundred = 0; - } - return Math.floor(gold / 1000) + '.' + Math.floor((gold % 1000) / 100) + 'k'; - } - UpdateValues(tabInfo: PlayerInfoTab): void { this.CurrentInfo = tabInfo; let width = InfoPageVisual.GetCurrentElementVector2(InfoPageVisual.GetConfig()!.TabConfig.ProgressBar.Size, InfoPageVisual.CurrentInfoType).X; @@ -543,7 +534,7 @@ export class PlayerTabIndicator { min = ''; max = Math.trunc(tabInfo.Values.CurrentValue) + ''; let val = Math.trunc(tabInfo.Values.CurrentValue); - cur = PlayerTabIndicator.ConvertGold(val); + cur = Utils.ConvertGold(val); if (cur.includes('NaN')) { console.log(`${val} -> ${cur}`); } diff --git a/Overlays/ingame/src/visual/InhibitorVisual.ts b/Overlays/ingame/src/visual/InhibitorVisual.ts index 9cf1e94..ad2d07a 100644 --- a/Overlays/ingame/src/visual/InhibitorVisual.ts +++ b/Overlays/ingame/src/visual/InhibitorVisual.ts @@ -202,9 +202,9 @@ export default class InhibitorVisual extends VisualElement { this.blueBotTime.text = this.ToTimeString(newValues.Inhibitors[0].timeLeft); this.blueMidTime.text = this.ToTimeString(newValues.Inhibitors[1].timeLeft); this.blueTopTime.text = this.ToTimeString(newValues.Inhibitors[2].timeLeft); - this.redBotTime.text = this.ToTimeString(newValues.Inhibitors[3].timeLeft); + this.redBotTime.text = this.ToTimeString(newValues.Inhibitors[5].timeLeft); this.redMidTime.text = this.ToTimeString(newValues.Inhibitors[4].timeLeft); - this.redTopTime.text = this.ToTimeString(newValues.Inhibitors[5].timeLeft); + this.redTopTime.text = this.ToTimeString(newValues.Inhibitors[3].timeLeft); if (!this.isActive) { this.Start(); diff --git a/Overlays/ingame/src/visual/ObjectivePopUpVisual.ts b/Overlays/ingame/src/visual/ObjectivePopUpVisual.ts index f8ac828..2ac5f6c 100644 --- a/Overlays/ingame/src/visual/ObjectivePopUpVisual.ts +++ b/Overlays/ingame/src/visual/ObjectivePopUpVisual.ts @@ -118,7 +118,7 @@ export default class ObjectivePopUpVisual extends VisualElement { this.scene.load.once(`filecomplete-image-${this.Type}PopUp`, () => { this.BackgroundImage = this.scene.make.sprite({ x: 960, y: 0, key: `${this.Type}PopUp`, add: true }); this.BackgroundImage.setOrigin(0.5,0); - this.BackgroundImage.setDepth(-1); + this.BackgroundImage.setDepth(3); this.BackgroundImage.setPosition(960, 1080 - this.BackgroundImage.displayHeight); this.AddVisualComponent(this.BackgroundImage); this.LoadMask(); @@ -133,7 +133,7 @@ export default class ObjectivePopUpVisual extends VisualElement { // @ts-ignore this.BackgroundVideo = this.scene.add.video(960, 0, `${this.Type}PopUpVideo`, false, true); this.BackgroundVideo.setOrigin(0.5,0); - this.BackgroundVideo.setDepth(-1); + this.BackgroundVideo.setDepth(3); this.AddVisualComponent(this.BackgroundVideo); this.LoadMask(); }); diff --git a/Overlays/ingame/src/visual/ScoreboardVisual.ts b/Overlays/ingame/src/visual/ScoreboardVisual.ts index 2f0a316..765bbe6 100644 --- a/Overlays/ingame/src/visual/ScoreboardVisual.ts +++ b/Overlays/ingame/src/visual/ScoreboardVisual.ts @@ -381,8 +381,12 @@ export default class ScoreboardVisual extends VisualElement { this.ShowScores = false; } if (scoreConfig.BlueTeam.Score !== undefined || scoreConfig.RedTeam.Score !== undefined) { - this.ShowScores = true; - this.UpdateScores(state, false); + if(this.ShowScores === false) { + this.ShowScores = true; + this.UpdateScores(state, true); + } else { + this.UpdateScores(state, false); + } } if (!this.isActive) { @@ -868,6 +872,7 @@ export default class ScoreboardVisual extends VisualElement { let conf = state.scoreboard; cfg = cfg === null ? ScoreboardVisual.GetConfig()! : cfg; if (forceUpdate || conf.RedTeam.Score !== this.RedWins || conf.BlueTeam.Score !== this.BlueWins) { + console.log('[LB] Updating Score display'); let redWins = conf.RedTeam.Score; let blueWins = conf.BlueTeam.Score;