Fix some UI refactor stuff (#11293)
* add this back * comment out double changelog toggle * add back stuff
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
using Content.Client.Administration.Managers;
|
using Content.Client.Administration.Managers;
|
||||||
using Content.Client.Changelog;
|
using Content.Client.Changelog;
|
||||||
|
using Content.Client.CharacterInterface;
|
||||||
using Content.Client.Chat.Managers;
|
using Content.Client.Chat.Managers;
|
||||||
using Content.Client.Options;
|
using Content.Client.Options;
|
||||||
using Content.Client.Eui;
|
using Content.Client.Eui;
|
||||||
@@ -30,6 +31,7 @@ using Content.Shared.Markers;
|
|||||||
using Robust.Client;
|
using Robust.Client;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.Input;
|
using Robust.Client.Input;
|
||||||
|
using Robust.Client.Player;
|
||||||
using Robust.Client.State;
|
using Robust.Client.State;
|
||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Shared.Configuration;
|
using Robust.Shared.Configuration;
|
||||||
@@ -40,11 +42,14 @@ using Robust.Shared.Configuration;
|
|||||||
using Robust.Shared.ContentPack;
|
using Robust.Shared.ContentPack;
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
using Robust.Shared.Timing;
|
||||||
|
|
||||||
namespace Content.Client.Entry
|
namespace Content.Client.Entry
|
||||||
{
|
{
|
||||||
public sealed class EntryPoint : GameClient
|
public sealed class EntryPoint : GameClient
|
||||||
{
|
{
|
||||||
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
|
[Dependency] private readonly IEntityManager _entityManager = default!;
|
||||||
[Dependency] private readonly IBaseClient _baseClient = default!;
|
[Dependency] private readonly IBaseClient _baseClient = default!;
|
||||||
[Dependency] private readonly IGameController _gameController = default!;
|
[Dependency] private readonly IGameController _gameController = default!;
|
||||||
[Dependency] private readonly IStateManager _stateManager = default!;
|
[Dependency] private readonly IStateManager _stateManager = default!;
|
||||||
@@ -165,6 +170,8 @@ namespace Content.Client.Entry
|
|||||||
_overlayManager.AddOverlay(new FlashOverlay());
|
_overlayManager.AddOverlay(new FlashOverlay());
|
||||||
_overlayManager.AddOverlay(new RadiationPulseOverlay());
|
_overlayManager.AddOverlay(new RadiationPulseOverlay());
|
||||||
|
|
||||||
|
_baseClient.PlayerJoinedServer += SubscribePlayerAttachmentEvents;
|
||||||
|
_baseClient.PlayerLeaveServer += UnsubscribePlayerAttachmentEvents;
|
||||||
_gameHud.Initialize();
|
_gameHud.Initialize();
|
||||||
_chatManager.Initialize();
|
_chatManager.Initialize();
|
||||||
_clientPreferencesManager.Initialize();
|
_clientPreferencesManager.Initialize();
|
||||||
@@ -189,6 +196,56 @@ namespace Content.Client.Entry
|
|||||||
SwitchToDefaultState();
|
SwitchToDefaultState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Update(ModUpdateLevel level, FrameEventArgs frameEventArgs)
|
||||||
|
{
|
||||||
|
base.Update(level, frameEventArgs);
|
||||||
|
|
||||||
|
switch (level)
|
||||||
|
{
|
||||||
|
case ModUpdateLevel.FramePreEngine:
|
||||||
|
// TODO: Turn IChatManager into an EntitySystem and remove the line below.
|
||||||
|
IoCManager.Resolve<IChatManager>().FrameUpdate(frameEventArgs);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Subscribe events to the player manager after the player manager is set up
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="sender"></param>
|
||||||
|
/// <param name="args"></param>
|
||||||
|
public void SubscribePlayerAttachmentEvents(object? sender, EventArgs args)
|
||||||
|
{
|
||||||
|
if (_playerManager.LocalPlayer != null)
|
||||||
|
{
|
||||||
|
_playerManager.LocalPlayer.EntityAttached += AttachPlayerToEntity;
|
||||||
|
_playerManager.LocalPlayer.EntityDetached += DetachPlayerFromEntity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void UnsubscribePlayerAttachmentEvents(object? sender, EventArgs args)
|
||||||
|
{
|
||||||
|
if (_playerManager.LocalPlayer != null)
|
||||||
|
{
|
||||||
|
_playerManager.LocalPlayer.EntityAttached -= AttachPlayerToEntity;
|
||||||
|
_playerManager.LocalPlayer.EntityDetached -= DetachPlayerFromEntity;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AttachPlayerToEntity(EntityAttachedEventArgs eventArgs)
|
||||||
|
{
|
||||||
|
// TODO This is shitcode. Move this to an entity system, FOR FUCK'S SAKE
|
||||||
|
_entityManager.AddComponent<CharacterInterfaceComponent>(eventArgs.NewEntity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DetachPlayerFromEntity(EntityDetachedEventArgs eventArgs)
|
||||||
|
{
|
||||||
|
// TODO This is shitcode. Move this to an entity system, FOR FUCK'S SAKE
|
||||||
|
if (!_entityManager.Deleted(eventArgs.OldEntity))
|
||||||
|
{
|
||||||
|
_entityManager.RemoveComponent<CharacterInterfaceComponent>(eventArgs.OldEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void SwitchToDefaultState(bool disconnected = false)
|
private void SwitchToDefaultState(bool disconnected = false)
|
||||||
{
|
{
|
||||||
// Fire off into state dependent on launcher or not.
|
// Fire off into state dependent on launcher or not.
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ public sealed class EscapeUIController : UIController, IOnStateEntered<GameplayS
|
|||||||
_escapeWindow.ChangelogButton.OnPressed += _ =>
|
_escapeWindow.ChangelogButton.OnPressed += _ =>
|
||||||
{
|
{
|
||||||
CloseEscapeWindow();
|
CloseEscapeWindow();
|
||||||
UIManager.GetUIController<ChangelogUIController>().ToggleWindow();
|
// Put this back when changelog button no longer controls the window
|
||||||
|
// UIManager.GetUIController<ChangelogUIController>().ToggleWindow();
|
||||||
};
|
};
|
||||||
|
|
||||||
_escapeWindow.RulesButton.OnPressed += _ =>
|
_escapeWindow.RulesButton.OnPressed += _ =>
|
||||||
|
|||||||
Reference in New Issue
Block a user