Fix in-game voting (#12932)

* Fix in-game voting

* Add comment

* Re-enable vote.restart_enabled by default
This commit is contained in:
Kevin Zheng
2022-12-18 17:13:37 -08:00
committed by GitHub
parent 0147003036
commit 72e1a5e109
3 changed files with 5 additions and 3 deletions

View File

@@ -71,7 +71,6 @@ namespace Content.Client.Lobby
}; };
LayoutContainer.SetAnchorPreset(_lobby, LayoutContainer.LayoutPreset.Wide); LayoutContainer.SetAnchorPreset(_lobby, LayoutContainer.LayoutPreset.Wide);
_voteManager.SetPopupContainer(_lobby.VoteContainer);
_lobby.ServerName.Text = _baseClient.GameInfo?.ServerName; //The eye of refactor gazes upon you... _lobby.ServerName.Text = _baseClient.GameInfo?.ServerName; //The eye of refactor gazes upon you...
UpdateLobbyUi(); UpdateLobbyUi();

View File

@@ -34,6 +34,7 @@ namespace Content.Client.Voting
[Dependency] private readonly IGameTiming _gameTiming = default!; [Dependency] private readonly IGameTiming _gameTiming = default!;
[Dependency] private readonly IClientConsoleHost _console = default!; [Dependency] private readonly IClientConsoleHost _console = default!;
[Dependency] private readonly IBaseClient _client = default!; [Dependency] private readonly IBaseClient _client = default!;
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager = default!;
private readonly Dictionary<StandardVoteType, TimeSpan> _standardVoteTimeouts = new(); private readonly Dictionary<StandardVoteType, TimeSpan> _standardVoteTimeouts = new();
private readonly Dictionary<int, ActiveVote> _votes = new(); private readonly Dictionary<int, ActiveVote> _votes = new();
@@ -120,6 +121,9 @@ namespace Content.Client.Voting
@new = true; @new = true;
IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>() IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<AudioSystem>()
.PlayGlobal("/Audio/Effects/voteding.ogg", Filter.Local(), false); .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);
// New vote from the server. // New vote from the server.
var vote = new ActiveVote(voteId) var vote = new ActiveVote(voteId)

View File

@@ -911,12 +911,11 @@ namespace Content.Shared.CCVar
public static readonly CVarDef<bool> VoteEnabled = public static readonly CVarDef<bool> VoteEnabled =
CVarDef.Create("vote.enabled", true, CVar.SERVERONLY); CVarDef.Create("vote.enabled", true, CVar.SERVERONLY);
// TODO HUD REFACTOR REENABLE
/// <summary> /// <summary>
/// See vote.enabled, but specific to restart votes /// See vote.enabled, but specific to restart votes
/// </summary> /// </summary>
public static readonly CVarDef<bool> VoteRestartEnabled = public static readonly CVarDef<bool> VoteRestartEnabled =
CVarDef.Create("vote.restart_enabled", false, CVar.SERVERONLY); CVarDef.Create("vote.restart_enabled", true, CVar.SERVERONLY);
/// <summary> /// <summary>
/// See vote.enabled, but specific to preset votes /// See vote.enabled, but specific to preset votes