Skip to content

Commit

Permalink
Fix pop ups displaying under inhibitor timers
Browse files Browse the repository at this point in the history
Fix red side inhibitor bot/top swap (Fix #49)
Fix score display not displaying when reenabling (Fix #41)
  • Loading branch information
floh22 committed Jul 25, 2021
1 parent 2bf0d96 commit b492c39
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 19 deletions.
6 changes: 4 additions & 2 deletions Overlays/ingame/src/scenes/IngameScene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`);
}
}
Expand All @@ -369,6 +369,7 @@ export default class IngameScene extends Phaser.Scene {
break;
}

console.log(`${objectiveName} spawned`);
new ObjectivePopUpVisual(this, cfg, `${objectiveName.toLowerCase()}Spawn`);
}

Expand All @@ -389,6 +390,7 @@ export default class IngameScene extends Phaser.Scene {
break;
}

console.log(`${objectiveName} killed`);
new ObjectivePopUpVisual(this, cfg, `${objectiveName.toLowerCase()}Kill`);
}

Expand Down
11 changes: 11 additions & 0 deletions Overlays/ingame/src/util/Utils.ts
Original file line number Diff line number Diff line change
@@ -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';
}
}
13 changes: 2 additions & 11 deletions Overlays/ingame/src/visual/InfoPageVisual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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}`);
}
Expand Down
4 changes: 2 additions & 2 deletions Overlays/ingame/src/visual/InhibitorVisual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions Overlays/ingame/src/visual/ObjectivePopUpVisual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
});
Expand Down
9 changes: 7 additions & 2 deletions Overlays/ingame/src/visual/ScoreboardVisual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit b492c39

Please sign in to comment.