Skip to content

Commit

Permalink
Revert "OnStateUpdate Update now LanguageSelector"
Browse files Browse the repository at this point in the history
This reverts commit 1750226.
  • Loading branch information
FoxxoTrystan committed Mar 18, 2024
1 parent 1750226 commit 2282345
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
using Content.Client.UserInterface.Systems.Chat.Controls;
using Content.Shared.Language;
using Robust.Shared.Utility;
using Content.Client._NF.Language;
using static Content.Shared.Language.Systems.SharedLanguageSystem;

namespace Content.Client._NF.Language.Systems.Chat.Controls;

Expand Down Expand Up @@ -82,8 +80,16 @@ public static string LanguageSelectorName(LanguagePrototype language, bool full
return name[..5];
}

public void UpdateLanguageSelectButton(LanguagePrototype language)
{
Text = LanguageSelectorName(language);
}
// public Color ChannelSelectColor(ChatSelectChannel channel)
// {
// return channel switch
// {
// ChatSelectChannel.Radio => Color.LimeGreen,
// ChatSelectChannel.LOOC => Color.MediumTurquoise,
// ChatSelectChannel.OOC => Color.LightSkyBlue,
// ChatSelectChannel.Dead => Color.MediumPurple,
// ChatSelectChannel.Admin => Color.HotPink,
// _ => Color.DarkGray
// };
// }
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
using Robust.Shared.Input.Binding;
using Robust.Shared.Utility;
using static Robust.Client.UserInterface.Controls.BaseButton;
using Content.Client.UserInterface.Systems.Chat.Widgets;
using Content.Client.Language.Systems;
using Content.Shared.Language;
using Content.Shared.Language.Systems;

namespace Content.Client.UserInterface.Systems.Language;

Expand All @@ -22,10 +18,10 @@ public sealed class LanguageMenuUIController : UIController, IOnStateEntered<Gam
{
public LanguageMenuWindow? _languageWindow;
private MenuButton? LanguageButton => UIManager.GetActiveUIWidgetOrNull<MenuBar.Widgets.GameTopMenuBar>()?.LanguageButton;

public string? LastPreferredLanguage;
public Action<List<string>>? LanguagesChanged;
[Dependency] private readonly IConsoleHost _consoleHost = default!;
[Dependency] private readonly LanguageSystem _language = default!;

public override void Initialize()
{
Expand Down Expand Up @@ -119,28 +115,16 @@ private void ToggleWindow()

private void OnStateUpdate(LanguageMenuStateMessage ev)
{
var chatBox = UIManager.ActiveScreen?.GetWidget<ChatBox>() ?? UIManager.ActiveScreen?.GetWidget<ResizableChatBox>();
if (chatBox != null)
{
var clangauge = _language.GetLanguage(ev.CurrentLanguage);
if (clangauge != null)
{
chatBox.ChatInput.LanguageSelector.UpdateLanguageSelectButton(clangauge);
}
}

if (_languageWindow == null)
return;

_languageWindow.UpdateState(ev);
LanguagesChanged?.Invoke(ev.Options);
}

public void RequestUpdate()
{
EntityManager.EntityNetManager?.SendSystemNetworkMessage(new RequestLanguageMenuStateMessage());
}

public void SetLanguage(string id)
{
_consoleHost.ExecuteCommand("lsselectlang " + id);
Expand Down

0 comments on commit 2282345

Please sign in to comment.