diff --git a/Fika.Core/UI/Custom/MainMenuUIScript.cs b/Fika.Core/UI/Custom/MainMenuUIScript.cs index 9a14917e..1bc13a77 100644 --- a/Fika.Core/UI/Custom/MainMenuUIScript.cs +++ b/Fika.Core/UI/Custom/MainMenuUIScript.cs @@ -96,13 +96,9 @@ private void SetupPlayers(ref FikaPlayerPresence[] responses) { RaidInformation information = presence.RaidInformation.Value; string side = information.Side == EFT.ESideType.Pmc ? "PMC" : "Scav"; - TooltipTextGetter tooltipTextGetter = new() - { - TooltipText = $"Playing as a {side} on {ColorUtils.ColorizeText(Colors.BLUE, information.Location.Localized())}" - }; HoverTooltipArea tooltip = newPlayer.AddComponent(); tooltip.enabled = true; - tooltip.SetMessageText(tooltipTextGetter.GetText); + tooltip.SetMessageText($"Playing as a {side} on {ColorUtils.ColorizeText(Colors.BLUE, information.Location.Localized())}"); } newPlayer.SetActive(true); players.Add(newPlayer); diff --git a/Fika.Core/UI/Custom/MatchMakerUIScript.cs b/Fika.Core/UI/Custom/MatchMakerUIScript.cs index 9b7e6e9c..a11b8e50 100644 --- a/Fika.Core/UI/Custom/MatchMakerUIScript.cs +++ b/Fika.Core/UI/Custom/MatchMakerUIScript.cs @@ -184,14 +184,9 @@ private void CreateMatchMakerUI() dedicatedText.color = new(1f, 1f, 1f, 0.5f); } - TooltipTextGetter dediTooltipTextGetter = new() - { - TooltipText = LocaleUtils.UI_NO_DEDICATED_CLIENTS.Localized() - }; - HoverTooltipArea dediTooltipArea = fikaMatchMakerUi.DedicatedToggle.GetOrAddComponent(); dediTooltipArea.enabled = true; - dediTooltipArea.SetMessageText(dediTooltipTextGetter.GetText); + dediTooltipArea.SetMessageText(LocaleUtils.UI_NO_DEDICATED_CLIENTS.Localized()); } TMP_Text matchmakerUiHostRaidText = fikaMatchMakerUi.RaidGroupHostButton.GetComponentInChildren(); @@ -324,14 +319,9 @@ private void CreateMatchMakerUI() fikaMatchMakerUi.RefreshButton.onClick.AddListener(ManualRefresh); - TooltipTextGetter tooltipTextGetter = new() - { - TooltipText = LocaleUtils.UI_REFRESH_RAIDS.Localized() - }; - HoverTooltipArea tooltipArea = fikaMatchMakerUi.RefreshButton.GetOrAddComponent(); tooltipArea.enabled = true; - tooltipArea.SetMessageText(tooltipTextGetter.GetText); + tooltipArea.SetMessageText(LocaleUtils.UI_REFRESH_RAIDS.Localized()); acceptButton.gameObject.SetActive(false); acceptButton.enabled = false; @@ -572,18 +562,11 @@ private void RefreshUI() }, localPlayerInRaid)); }); - TooltipTextGetter tooltipTextGetter; HoverTooltipArea tooltipArea; Image image = server.GetComponent(); if (raidSettings.LocationId != entry.Location && !(raidSettings.LocationId.ToLower().StartsWith("sandbox") && entry.Location.ToLower().StartsWith("sandbox"))) { - tooltipTextGetter = new() - { - TooltipText = string.Format(LocaleUtils.UI_CANNOT_JOIN_RAID_OTHER_MAP.Localized(), - ColorUtils.ColorizeText(Colors.BLUE, entry.Location.Localized())) - }; - button.enabled = false; if (image != null) { @@ -592,18 +575,14 @@ private void RefreshUI() tooltipArea = joinButton.GetOrAddComponent(); tooltipArea.enabled = true; - tooltipArea.SetMessageText(tooltipTextGetter.GetText); + tooltipArea.SetMessageText(string.Format(LocaleUtils.UI_CANNOT_JOIN_RAID_OTHER_MAP.Localized(), + ColorUtils.ColorizeText(Colors.BLUE, entry.Location.Localized()))); continue; } if (raidSettings.SelectedDateTime != entry.Time) { - tooltipTextGetter = new() - { - TooltipText = LocaleUtils.UI_CANNOT_JOIN_RAID_OTHER_TIME.Localized() - }; - button.enabled = false; if (image != null) { @@ -612,7 +591,7 @@ private void RefreshUI() tooltipArea = joinButton.GetOrAddComponent(); tooltipArea.enabled = true; - tooltipArea.SetMessageText(tooltipTextGetter.GetText); + tooltipArea.SetMessageText(LocaleUtils.UI_CANNOT_JOIN_RAID_OTHER_TIME.Localized()); continue; } @@ -629,11 +608,6 @@ private void RefreshUI() errorText = LocaleUtils.UI_CANNOT_JOIN_RAID_PMC_AS_SCAV.Localized(); } - tooltipTextGetter = new() - { - TooltipText = errorText - }; - button.enabled = false; if (image != null) { @@ -642,7 +616,7 @@ private void RefreshUI() tooltipArea = joinButton.GetOrAddComponent(); tooltipArea.enabled = true; - tooltipArea.SetMessageText(tooltipTextGetter.GetText); + tooltipArea.SetMessageText(errorText); continue; } @@ -651,11 +625,6 @@ private void RefreshUI() { case LobbyEntry.ELobbyStatus.LOADING: { - tooltipTextGetter = new() - { - TooltipText = LocaleUtils.UI_HOST_STILL_LOADING.Localized() - }; - button.enabled = false; if (image != null) { @@ -664,17 +633,12 @@ private void RefreshUI() tooltipArea = joinButton.GetOrAddComponent(); tooltipArea.enabled = true; - tooltipArea.SetMessageText(tooltipTextGetter.GetText); + tooltipArea.SetMessageText(LocaleUtils.UI_HOST_STILL_LOADING.Localized()); } break; case LobbyEntry.ELobbyStatus.IN_GAME: if (!localPlayerInRaid) { - tooltipTextGetter = new() - { - TooltipText = LocaleUtils.UI_RAID_IN_PROGRESS.Localized() - }; - button.enabled = false; if (image != null) { @@ -683,28 +647,18 @@ private void RefreshUI() tooltipArea = joinButton.GetOrAddComponent(); tooltipArea.enabled = true; - tooltipArea.SetMessageText(tooltipTextGetter.GetText); + tooltipArea.SetMessageText(LocaleUtils.UI_RAID_IN_PROGRESS.Localized()); } else { if (!localPlayerDead) { - tooltipTextGetter = new() - { - TooltipText = LocaleUtils.UI_REJOIN_RAID.Localized() - }; - tooltipArea = joinButton.GetOrAddComponent(); tooltipArea.enabled = true; - tooltipArea.SetMessageText(tooltipTextGetter.GetText); + tooltipArea.SetMessageText(LocaleUtils.UI_REJOIN_RAID.Localized()); } else { - tooltipTextGetter = new() - { - TooltipText = LocaleUtils.UI_CANNOT_REJOIN_RAID_DIED.Localized() - }; - button.enabled = false; if (image != null) { @@ -713,19 +667,14 @@ private void RefreshUI() tooltipArea = joinButton.GetOrAddComponent(); tooltipArea.enabled = true; - tooltipArea.SetMessageText(tooltipTextGetter.GetText); + tooltipArea.SetMessageText(LocaleUtils.UI_CANNOT_REJOIN_RAID_DIED.Localized()); } } break; case LobbyEntry.ELobbyStatus.COMPLETE: - tooltipTextGetter = new() - { - TooltipText = LocaleUtils.UI_JOIN_RAID.Localized() - }; - tooltipArea = joinButton.GetOrAddComponent(); tooltipArea.enabled = true; - tooltipArea.SetMessageText(tooltipTextGetter.GetText); + tooltipArea.SetMessageText(LocaleUtils.UI_JOIN_RAID.Localized()); break; default: break; diff --git a/Fika.Core/UI/FikaUIUtils.cs b/Fika.Core/UI/FikaUIUtils.cs index 41267084..0df4ebfb 100644 --- a/Fika.Core/UI/FikaUIUtils.cs +++ b/Fika.Core/UI/FikaUIUtils.cs @@ -130,16 +130,6 @@ public static GClass3388 ShowFikaMessage(this ErrorScreen errorScreen, string ti return errorScreenHandler.context; } - public class TooltipTextGetter - { - public string GetText() - { - return TooltipText; - } - - public string TooltipText; - } - public enum EFikaRaidPresence { IN_MENU,