improve UIHelper a bit

This commit is contained in:
JohnCorby 2022-01-31 12:47:00 -08:00
parent 806438b324
commit ea3bc72701
3 changed files with 15 additions and 11 deletions

View File

@ -69,12 +69,9 @@ namespace QSB
private static DebugSettings DebugSettings { get; set; } = new(); private static DebugSettings DebugSettings { get; set; } = new();
public void Awake() public void Awake() =>
{ UIHelper.ReplaceUI(UITextType.PleaseUseController,
var instance = TextTranslation.Get().m_table; "<color=orange>Quantum Space Buddies</color> is best experienced with friends...");
instance.theUITable[(int)UITextType.PleaseUseController] =
"<color=orange>Quantum Space Buddies</color> is best experienced with friends...";
}
public void Start() public void Start()
{ {

View File

@ -22,7 +22,7 @@ namespace QSB.RespawnSync
var respawnPlayerText = UIHelper.AddToUITable("Respawn Player"); var respawnPlayerText = UIHelper.AddToUITable("Respawn Player");
_refillIndex = _interactVolume.AddInteraction(InputLibrary.interact, InputMode.Character, UITextType.None, true, true); _refillIndex = _interactVolume.AddInteraction(InputLibrary.interact, InputMode.Character, UITextType.None, true, true);
_respawnIndex = _interactVolume.AddInteraction(InputLibrary.interactSecondary, InputMode.Character, (UITextType)respawnPlayerText, true, true); _respawnIndex = _interactVolume.AddInteraction(InputLibrary.interactSecondary, InputMode.Character, respawnPlayerText, true, true);
GlobalMessenger.AddListener("SuitUp", new Callback(OnSuitUp)); GlobalMessenger.AddListener("SuitUp", new Callback(OnSuitUp));
GlobalMessenger.AddListener("RemoveSuit", new Callback(OnRemoveSuit)); GlobalMessenger.AddListener("RemoveSuit", new Callback(OnRemoveSuit));

View File

@ -4,11 +4,18 @@ namespace QSB.Utility
{ {
internal static class UIHelper internal static class UIHelper
{ {
public static int AddToUITable(string text) public static void ReplaceUI(UITextType key, string text)
{ {
var instance = UnityEngine.Object.FindObjectOfType<TextTranslation>().m_table; var table = TextTranslation.Get().m_table;
instance.Insert_UI(instance.theUITable.Keys.Max() + 1, text); table.theUITable[(int)key] = text;
return instance.theUITable.Keys.Max(); }
public static UITextType AddToUITable(string text)
{
var table = TextTranslation.Get().m_table;
var key = table.theUITable.Keys.Max() + 1;
table.theUITable[key] = text;
return (UITextType)key;
} }
} }
} }