Misc replay related changes (#17102)
This commit is contained in:
@@ -173,7 +173,7 @@ namespace Content.Client.Actions
|
||||
public void LinkAllActions(ActionsComponent? actions = null)
|
||||
{
|
||||
var player = _playerManager.LocalPlayer?.ControlledEntity;
|
||||
if (player == null || !Resolve(player.Value, ref actions))
|
||||
if (player == null || !Resolve(player.Value, ref actions, false))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ using Robust.Shared.Utility;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using Content.Shared.Eye.Blinding.Components;
|
||||
using Robust.Client;
|
||||
using static Content.Shared.Interaction.SharedInteractionSystem;
|
||||
using static Robust.Client.UserInterface.Controls.BoxContainer;
|
||||
|
||||
@@ -28,6 +29,7 @@ namespace Content.Client.Examine
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
||||
[Dependency] private readonly VerbSystem _verbSystem = default!;
|
||||
[Dependency] private readonly IBaseClient _client = default!;
|
||||
|
||||
public const string StyleClassEntityTooltip = "entity-tooltip";
|
||||
|
||||
@@ -341,10 +343,10 @@ namespace Content.Client.Examine
|
||||
canSeeClearly = false;
|
||||
|
||||
OpenTooltip(playerEnt.Value, entity, centeredOnCursor, false, knowTarget: canSeeClearly);
|
||||
if (entity.IsClientSide())
|
||||
if (entity.IsClientSide()
|
||||
|| _client.RunLevel == ClientRunLevel.SinglePlayerGame) // i.e. a replay
|
||||
{
|
||||
message = GetExamineText(entity, playerEnt);
|
||||
|
||||
UpdateTooltipInfo(playerEnt.Value, entity, message);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -21,11 +21,18 @@ namespace Content.Client.GameTicking.Managers
|
||||
[Dependency] private readonly IStateManager _stateManager = default!;
|
||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||
[Dependency] private readonly IConfigurationManager _configManager = default!;
|
||||
[Dependency] private readonly BackgroundAudioSystem _backgroundAudio = default!;
|
||||
[Dependency] private readonly SharedAudioSystem _audio = default!;
|
||||
|
||||
[ViewVariables] private bool _initialized;
|
||||
private Dictionary<EntityUid, Dictionary<string, uint?>> _jobsAvailable = new();
|
||||
private Dictionary<EntityUid, string> _stationNames = new();
|
||||
|
||||
/// <summary>
|
||||
/// The current round-end window. Could be used to support re-opening the window after closing it.
|
||||
/// </summary>
|
||||
private RoundEndSummaryWindow? _window;
|
||||
|
||||
[ViewVariables] public bool AreWeReady { get; private set; }
|
||||
[ViewVariables] public bool IsGameStarted { get; private set; }
|
||||
[ViewVariables] public string? LobbySong { get; private set; }
|
||||
@@ -127,13 +134,17 @@ namespace Content.Client.GameTicking.Managers
|
||||
if (message.LobbySong != null)
|
||||
{
|
||||
LobbySong = message.LobbySong;
|
||||
Get<BackgroundAudioSystem>().StartLobbyMusic();
|
||||
_backgroundAudio.StartLobbyMusic();
|
||||
}
|
||||
|
||||
RestartSound = message.RestartSound;
|
||||
|
||||
// Don't open duplicate windows (mainly for replays).
|
||||
if (_window?.RoundId == message.RoundId)
|
||||
return;
|
||||
|
||||
//This is not ideal at all, but I don't see an immediately better fit anywhere else.
|
||||
var roundEnd = new RoundEndSummaryWindow(message.GamemodeTitle, message.RoundEndText, message.RoundDuration, message.RoundId, message.AllPlayersEndInfo, _entityManager);
|
||||
_window = new RoundEndSummaryWindow(message.GamemodeTitle, message.RoundEndText, message.RoundDuration, message.RoundId, message.AllPlayersEndInfo, _entityManager);
|
||||
}
|
||||
|
||||
private void RoundRestartCleanup(RoundRestartCleanupEvent ev)
|
||||
@@ -147,7 +158,7 @@ namespace Content.Client.GameTicking.Managers
|
||||
return;
|
||||
}
|
||||
|
||||
SoundSystem.Play(RestartSound, Filter.Empty());
|
||||
_audio.PlayGlobal(RestartSound, Filter.Local(), false);
|
||||
|
||||
// Cleanup the sound, we only want it to play when the round restarts after it ends normally.
|
||||
RestartSound = null;
|
||||
|
||||
@@ -13,7 +13,8 @@ using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Client.Gameplay
|
||||
{
|
||||
public sealed class GameplayState : GameplayStateBase, IMainViewportState
|
||||
[Virtual]
|
||||
public class GameplayState : GameplayStateBase, IMainViewportState
|
||||
{
|
||||
[Dependency] private readonly IEyeManager _eyeManager = default!;
|
||||
[Dependency] private readonly IOverlayManager _overlayManager = default!;
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
using Content.Client.Changelog;
|
||||
using Content.Client.Parallax;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.AutoGenerated;
|
||||
using Robust.Client.ResourceManagement;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.XAML;
|
||||
using Robust.Shared;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Localization;
|
||||
|
||||
namespace Content.Client.MainMenu.UI
|
||||
{
|
||||
|
||||
@@ -12,6 +12,7 @@ namespace Content.Client.RoundEnd
|
||||
public sealed class RoundEndSummaryWindow : DefaultWindow
|
||||
{
|
||||
private readonly IEntityManager _entityManager;
|
||||
public int RoundId;
|
||||
|
||||
public RoundEndSummaryWindow(string gm, string roundEnd, TimeSpan roundTimeSpan, int roundId,
|
||||
RoundEndMessageEvent.RoundEndPlayerInfo[] info, IEntityManager entityManager)
|
||||
@@ -28,6 +29,7 @@ namespace Content.Client.RoundEnd
|
||||
// "clown slipped the crew x times.", "x shots were fired this round.", etc.
|
||||
// Also good for serious info.
|
||||
|
||||
RoundId = roundId;
|
||||
var roundEndTabs = new TabContainer();
|
||||
roundEndTabs.AddChild(MakeRoundEndSummaryTab(gm, roundEnd, roundTimeSpan, roundId));
|
||||
roundEndTabs.AddChild(MakePlayerManifestoTab(info));
|
||||
|
||||
@@ -108,18 +108,6 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
|
||||
|
||||
public void OnStateEntered(GameplayState state)
|
||||
{
|
||||
DebugTools.Assert(_window == null);
|
||||
|
||||
_window = UIManager.CreateWindow<ActionsWindow>();
|
||||
LayoutContainer.SetAnchorPreset(_window, LayoutContainer.LayoutPreset.CenterTop);
|
||||
|
||||
_window.OnOpen += OnWindowOpened;
|
||||
_window.OnClose += OnWindowClosed;
|
||||
_window.ClearButton.OnPressed += OnClearPressed;
|
||||
_window.SearchBar.OnTextChanged += OnSearchChanged;
|
||||
_window.FilterButton.OnItemSelected += OnFilterSelected;
|
||||
|
||||
|
||||
if (_actionsSystem != null)
|
||||
{
|
||||
_actionsSystem.ActionAdded += OnActionAdded;
|
||||
@@ -328,18 +316,6 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
|
||||
_actionsSystem.ActionsUpdated -= OnActionsUpdated;
|
||||
}
|
||||
|
||||
if (_window != null)
|
||||
{
|
||||
_window.OnOpen -= OnWindowOpened;
|
||||
_window.OnClose -= OnWindowClosed;
|
||||
_window.ClearButton.OnPressed -= OnClearPressed;
|
||||
_window.SearchBar.OnTextChanged -= OnSearchChanged;
|
||||
_window.FilterButton.OnItemSelected -= OnFilterSelected;
|
||||
|
||||
_window.Dispose();
|
||||
_window = null;
|
||||
}
|
||||
|
||||
CommandBinds.Unregister<ActionUIController>();
|
||||
}
|
||||
|
||||
@@ -779,10 +755,32 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
|
||||
|
||||
ActionsBar.PageButtons.LeftArrow.OnPressed -= OnLeftArrowPressed;
|
||||
ActionsBar.PageButtons.RightArrow.OnPressed -= OnRightArrowPressed;
|
||||
|
||||
if (_window != null)
|
||||
{
|
||||
_window.OnOpen -= OnWindowOpened;
|
||||
_window.OnClose -= OnWindowClosed;
|
||||
_window.ClearButton.OnPressed -= OnClearPressed;
|
||||
_window.SearchBar.OnTextChanged -= OnSearchChanged;
|
||||
_window.FilterButton.OnItemSelected -= OnFilterSelected;
|
||||
|
||||
_window.Dispose();
|
||||
_window = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadGui()
|
||||
{
|
||||
DebugTools.Assert(_window == null);
|
||||
_window = UIManager.CreateWindow<ActionsWindow>();
|
||||
LayoutContainer.SetAnchorPreset(_window, LayoutContainer.LayoutPreset.CenterTop);
|
||||
|
||||
_window.OnOpen += OnWindowOpened;
|
||||
_window.OnClose += OnWindowClosed;
|
||||
_window.ClearButton.OnPressed += OnClearPressed;
|
||||
_window.SearchBar.OnTextChanged += OnSearchChanged;
|
||||
_window.FilterButton.OnItemSelected += OnFilterSelected;
|
||||
|
||||
if (ActionsBar == null)
|
||||
{
|
||||
return;
|
||||
@@ -791,7 +789,6 @@ public sealed class ActionUIController : UIController, IOnStateChanged<GameplayS
|
||||
ActionsBar.PageButtons.LeftArrow.OnPressed += OnLeftArrowPressed;
|
||||
ActionsBar.PageButtons.RightArrow.OnPressed += OnRightArrowPressed;
|
||||
|
||||
|
||||
RegisterActionContainer(ActionsBar.ActionsContainer);
|
||||
|
||||
_actionsSystem?.LinkAllActions();
|
||||
|
||||
Reference in New Issue
Block a user