Fix vote popup (#14940)

This commit is contained in:
metalgearsloth
2023-03-29 19:36:30 +11:00
committed by GitHub
parent 5314c85de8
commit 4cbd5ef1ca
6 changed files with 63 additions and 8 deletions

View File

@@ -0,0 +1,37 @@
using Content.Client.UserInterface.Screens;
using Content.Client.UserInterface.Systems.Gameplay;
using Content.Client.Voting;
using Robust.Client.UserInterface.Controllers;
namespace Content.Client.UserInterface.Systems.Vote;
public sealed class VoteUIController : UIController
{
[Dependency] private readonly IVoteManager _votes = default!;
public override void Initialize()
{
base.Initialize();
var gameplayStateLoad = UIManager.GetUIController<GameplayStateLoadController>();
gameplayStateLoad.OnScreenLoad += OnScreenLoad;
gameplayStateLoad.OnScreenUnload += OnScreenUnload;
}
private void OnScreenLoad()
{
switch (UIManager.ActiveScreen)
{
case DefaultGameScreen game:
_votes.SetPopupContainer(game.VoteMenu);
break;
case SeparatedChatGameScreen separated:
_votes.SetPopupContainer(separated.VoteMenu);
break;
}
}
private void OnScreenUnload()
{
_votes.ClearPopupContainer();
}
}