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

@@ -95,6 +95,13 @@ namespace Content.Client.Voting
}
_popupContainer = container;
SetVoteData();
}
private void SetVoteData()
{
if (_popupContainer == null)
return;
foreach (var (vId, vote) in _votes)
{
@@ -121,9 +128,13 @@ namespace Content.Client.Voting
@new = true;
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>()
.PlayGlobal("/Audio/Effects/voteding.ogg", Filter.Local(), false);
// TODO: It would be better if this used a per-state container, i.e. a container
// for the lobby and each HUD layout.
SetPopupContainer(_userInterfaceManager.WindowRoot);
// Refresh
var container = _popupContainer;
ClearPopupContainer();
if (container != null)
SetPopupContainer(container);
// New vote from the server.
var vote = new ActiveVote(voteId)
@@ -142,6 +153,7 @@ namespace Content.Client.Voting
_votes.Remove(voteId);
if (_votePopups.TryGetValue(voteId, out var toRemove))
{
toRemove.Orphan();
_votePopups.Remove(voteId);
}