<LayoutContainer Name="ViewportContainer" HorizontalExpand="True" VerticalExpand="True">
<controls:MainViewport Name="MainViewport"/>
</LayoutContainer>
- <menuBar:GameTopMenuBar Name="TopBar" Access="Protected" />
+ <BoxContainer Name="TopLeft" Access="Protected" Orientation="Vertical">
+ <BoxContainer Orientation="Horizontal">
+ <menuBar:GameTopMenuBar Name="TopBar" Access="Protected" />
+ <!-- Buffer so big votes don't skew it -->
+ <Control/>
+ </BoxContainer>
+ <Control Name="VoteMenu" Access="Public" Margin="0 10 0 10"/>
+ </BoxContainer>
<widgets:GhostGui Name="Ghost" Access="Protected" />
<hotbar:HotbarGui Name="Hotbar" Access="Protected" />
<actions:ActionsBar Name="Actions" Access="Protected" />
using Content.Client.UserInterface.Systems.Chat.Widgets;
using Robust.Client.AutoGenerated;
-using Robust.Client.UserInterface;
-using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
namespace Content.Client.UserInterface.Screens;
SetAnchorPreset(MainViewport, LayoutPreset.Wide);
SetAnchorPreset(ViewportContainer, LayoutPreset.Wide);
- SetAnchorAndMarginPreset(TopBar, LayoutPreset.TopLeft, margin: 10);
+ SetAnchorAndMarginPreset(TopLeft, LayoutPreset.TopLeft, margin: 10);
SetAnchorAndMarginPreset(Actions, LayoutPreset.BottomLeft, margin: 10);
SetAnchorAndMarginPreset(Ghost, LayoutPreset.BottomWide, margin: 80);
SetAnchorAndMarginPreset(Hotbar, LayoutPreset.BottomWide, margin: 5);
<controls:RecordedSplitContainer Name="ScreenContainer" HorizontalExpand="True" VerticalExpand="True" SplitWidth="0" StretchDirection="TopLeft">
<LayoutContainer Name="ViewportContainer" HorizontalExpand="True" VerticalExpand="True">
<controls:MainViewport Name="MainViewport"/>
+ <Control Name="VoteMenu" Access="Public"/>
<widgets:GhostGui Name="Ghost" Access="Protected" />
<hotbar:HotbarGui Name="Hotbar" Access="Protected" />
<actions:ActionsBar Name="Actions" Access="Protected" />
using Content.Client.UserInterface.Systems.Chat.Widgets;
using Robust.Client.AutoGenerated;
-using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
SetAnchorPreset(ScreenContainer, LayoutPreset.Wide);
SetAnchorPreset(ViewportContainer, LayoutPreset.Wide);
SetAnchorPreset(MainViewport, LayoutPreset.Wide);
+ SetAnchorAndMarginPreset(VoteMenu, LayoutPreset.TopLeft, margin: 10);
SetAnchorAndMarginPreset(Actions, LayoutPreset.BottomLeft, margin: 10);
SetAnchorAndMarginPreset(Ghost, LayoutPreset.BottomWide, margin: 80);
SetAnchorAndMarginPreset(Hotbar, LayoutPreset.BottomWide, margin: 5);
--- /dev/null
+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();
+ }
+}
}
_popupContainer = container;
+ SetVoteData();
+ }
+
+ private void SetVoteData()
+ {
+ if (_popupContainer == null)
+ return;
foreach (var (vId, vote) in _votes)
{
@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)
_votes.Remove(voteId);
if (_votePopups.TryGetValue(voteId, out var toRemove))
{
+
toRemove.Orphan();
_votePopups.Remove(voteId);
}