Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

Commit

Permalink
Fixed using GetString in progress bar before strings were inited
Browse files Browse the repository at this point in the history
  • Loading branch information
amadare42 committed Nov 28, 2022
1 parent d89e1af commit 6acf214
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions TeammateRevive/ProgressBar/ProgressBarController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ public class ProgressBarController
{
private static string DefaultName => Language.GetString(LanguageConsts.TEAMMATE_REVIVAL_UI_PLAYER);
private static string Reviving => Language.GetString(LanguageConsts.TEAMMATE_REVIVAL_UI_PROGRESS_BAR_REVIVING);
public static float WidthModifier = 1;
public static ProgressBarController Instance;

private TextMeshProUGUI textComponent;
private string currentName = DefaultName;
private readonly CharArrayBuilder charArrayBuilder;
public bool showing = false;
public bool inited = false;
Slider progressBar;
public float progress;
RoR2.UI.HUD hudRef;
Expand All @@ -39,7 +37,7 @@ public ProgressBarController()
On.RoR2.UI.HUD.Awake += HUDOnAwake;
Instance = this;
// NOTE: this string splitting is required so class can internally keep track of individual parts and update them efficiently
charArrayBuilder = new CharArrayBuilder(Reviving, DefaultName, " - ", "000.0", "%");
charArrayBuilder = new CharArrayBuilder("Reviving ", DefaultName, " - ", "000.0", "%");
}

public void UpdateText(string name, float progress = 0)
Expand Down Expand Up @@ -146,6 +144,7 @@ public void Show()
UpdatePositionAndSize();
showing = true;
progressBar.GetComponent<CanvasGroup>().alpha = 1;
charArrayBuilder.UpdatePart(0, Reviving);
}

public void AttachProgressBar(RoR2.UI.HUD hud)
Expand Down

0 comments on commit 6acf214

Please sign in to comment.