guh (fix the uihelper stuff)

This commit is contained in:
Mister_Nebula 2022-06-26 19:59:58 +01:00
parent fb2f7b51a1
commit 9cb92f2812
2 changed files with 14 additions and 7 deletions

View File

@ -15,15 +15,11 @@ internal class ShipRecoveryPoint : MonoBehaviour
private int _refillIndex;
private int _respawnIndex;
private bool _wearingSuit;
private static UITextType _respawnPlayerText;
private UITextType _respawnPlayerText;
private void Awake()
{
if (_respawnPlayerText == UITextType.None)
{
_respawnPlayerText = UIHelper.AddToUITable(QSBLocalization.Current.RespawnPlayer);
}
_respawnPlayerText = UIHelper.AddToUITable(QSBLocalization.Current.RespawnPlayer);
_interactVolume = this.GetRequiredComponent<MultipleInteractionVolume>();
_interactVolume.OnPressInteract += OnPressInteract;
@ -48,7 +44,6 @@ internal class ShipRecoveryPoint : MonoBehaviour
_interactVolume.OnGainFocus -= OnGainFocus;
GlobalMessenger.RemoveListener(OWEvents.SuitUp, OnSuitUp);
GlobalMessenger.RemoveListener(OWEvents.RemoveSuit, OnRemoveSuit);
_respawnPlayerText = UITextType.None;
}
private void OnSuitUp()

View File

@ -15,6 +15,12 @@ internal static class UIHelper
public static UITextType AddToUITable(string text)
{
var hasValue = UITableHasValue(text);
if (hasValue != UITextType.None)
{
return hasValue;
}
var table = TextTranslation.Get().m_table;
var key = table.theUITable.Keys.Max() + 1;
table.theUITable[key] = text;
@ -22,6 +28,12 @@ internal static class UIHelper
return (UITextType)key;
}
public static UITextType UITableHasValue(string text)
{
var table = TextTranslation.Get().m_table;
return (UITextType)table.theUITable.FirstOrDefault(x => x.Value == text).Key;
}
public static CultureInfo GetCurrentCultureInfo()
=> QSBLocalization.Current.Language switch
{