Skip to content

Commit

Permalink
Update LanguageMenuUIController.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxxoTrystan committed May 3, 2024
1 parent 5ce48b2 commit 875cf7b
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace Content.Client.UserInterface.Systems.Language;
[UsedImplicitly]
public sealed class LanguageMenuUIController : UIController, IOnStateEntered<GameplayState>, IOnStateExited<GameplayState>
{
[UISystemDependency] private readonly LanguageSystem _languageSystem = default!;
public LanguageMenuWindow? _languageWindow;
private MenuButton? LanguageButton => UIManager.GetActiveUIWidgetOrNull<MenuBar.Widgets.GameTopMenuBar>()?.LanguageButton;

Expand All @@ -43,8 +44,7 @@ public void OnStateEntered(GameplayState state)
{
DebugTools.Assert(_languageWindow == null);

var clientLanguageSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<LanguageSystem>();
clientLanguageSystem.LanguagesUpdatedHook -= LanguagesUpdatedHook;
_languageSystem.LanguagesUpdatedHook -= LanguagesUpdatedHook;

_languageWindow = UIManager.CreateWindow<LanguageMenuWindow>();
LayoutContainer.SetAnchorPreset(_languageWindow, LayoutContainer.LayoutPreset.CenterTop);
Expand All @@ -60,8 +60,7 @@ public void OnStateExited(GameplayState state)
_languageWindow = null;
}

var clientLanguageSystem = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<LanguageSystem>();
clientLanguageSystem.LanguagesUpdatedHook -= LanguagesUpdatedHook;
_languageSystem.LanguagesUpdatedHook -= LanguagesUpdatedHook;

CommandBinds.Unregister<LanguageMenuUIController>();
}
Expand Down

0 comments on commit 875cf7b

Please sign in to comment.