Small UI refactor pieces (#11026)
* ActionType rename Name to DisplayName * Gameplay State rename+move
This commit is contained in:
@@ -306,7 +306,7 @@ namespace Content.Client.Actions.UI
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Standardize(action.Name.ToString()).Contains(standardizedSearch))
|
||||
if (Standardize(action.DisplayName.ToString()).Contains(standardizedSearch))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ namespace Content.Client.Actions.UI
|
||||
|
||||
private Control SupplyTooltip(Control? sender)
|
||||
{
|
||||
var name = FormattedMessage.FromMarkupPermissive(Loc.GetString(Action.Name));
|
||||
var name = FormattedMessage.FromMarkupPermissive(Loc.GetString(Action.DisplayName));
|
||||
var decr = FormattedMessage.FromMarkupPermissive(Loc.GetString(Action.Description));
|
||||
|
||||
var tooltip = new ActionAlertTooltip(name, decr);
|
||||
|
||||
@@ -164,7 +164,7 @@ namespace Content.Client.Actions.UI
|
||||
extra = Loc.GetString("ui-actionslot-charges", ("charges", Action.Charges));
|
||||
}
|
||||
|
||||
var name = FormattedMessage.FromMarkupPermissive(Loc.GetString(Action.Name));
|
||||
var name = FormattedMessage.FromMarkupPermissive(Loc.GetString(Action.DisplayName));
|
||||
var decr = FormattedMessage.FromMarkupPermissive(Loc.GetString(Action.Description));
|
||||
|
||||
var tooltip = new ActionAlertTooltip(name, decr, extra);
|
||||
|
||||
@@ -14,6 +14,7 @@ using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Timing;
|
||||
using System.Threading;
|
||||
using Content.Client.Gameplay;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.ResourceManagement;
|
||||
using Timer = Robust.Shared.Timing.Timer;
|
||||
@@ -165,7 +166,7 @@ namespace Content.Client.Audio
|
||||
StartLobbyMusic();
|
||||
return;
|
||||
}
|
||||
else if (args.NewState is GameScreen)
|
||||
else if (args.NewState is GameplayState)
|
||||
{
|
||||
StartAmbience();
|
||||
}
|
||||
@@ -195,7 +196,7 @@ namespace Content.Client.Audio
|
||||
|
||||
private void AmbienceCVarChanged(float volume)
|
||||
{
|
||||
if (_stateManager.CurrentState is GameScreen)
|
||||
if (_stateManager.CurrentState is GameplayState)
|
||||
{
|
||||
StartAmbience();
|
||||
}
|
||||
@@ -237,7 +238,7 @@ namespace Content.Client.Audio
|
||||
if (_currentCollection == null)
|
||||
return;
|
||||
|
||||
if (enabled && _stateManager.CurrentState is GameScreen && _currentCollection.ID == _stationAmbience.ID)
|
||||
if (enabled && _stateManager.CurrentState is GameplayState && _currentCollection.ID == _stationAmbience.ID)
|
||||
{
|
||||
StartAmbience();
|
||||
}
|
||||
@@ -252,7 +253,7 @@ namespace Content.Client.Audio
|
||||
if (_currentCollection == null)
|
||||
return;
|
||||
|
||||
if (enabled && _stateManager.CurrentState is GameScreen && _currentCollection.ID == _spaceAmbience.ID)
|
||||
if (enabled && _stateManager.CurrentState is GameplayState && _currentCollection.ID == _spaceAmbience.ID)
|
||||
{
|
||||
StartAmbience();
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Client.Chat.UI;
|
||||
using Content.Client.Gameplay;
|
||||
using Content.Client.Viewport;
|
||||
using Content.Shared.Chat;
|
||||
using Content.Shared.Input;
|
||||
@@ -12,28 +13,28 @@ namespace Content.Client.Chat
|
||||
public static void SetupChatInputHandlers(IInputManager inputManager, ChatBox chatBox)
|
||||
{
|
||||
inputManager.SetInputCommand(ContentKeyFunctions.FocusChat,
|
||||
InputCmdHandler.FromDelegate(_ => GameScreen.FocusChat(chatBox)));
|
||||
InputCmdHandler.FromDelegate(_ => GameplayState.FocusChat(chatBox)));
|
||||
|
||||
inputManager.SetInputCommand(ContentKeyFunctions.FocusLocalChat,
|
||||
InputCmdHandler.FromDelegate(_ => GameScreen.FocusChannel(chatBox, ChatSelectChannel.Local)));
|
||||
InputCmdHandler.FromDelegate(_ => GameplayState.FocusChannel(chatBox, ChatSelectChannel.Local)));
|
||||
|
||||
inputManager.SetInputCommand(ContentKeyFunctions.FocusWhisperChat,
|
||||
InputCmdHandler.FromDelegate(_ => GameScreen.FocusChannel(chatBox, ChatSelectChannel.Whisper)));
|
||||
InputCmdHandler.FromDelegate(_ => GameplayState.FocusChannel(chatBox, ChatSelectChannel.Whisper)));
|
||||
|
||||
inputManager.SetInputCommand(ContentKeyFunctions.FocusOOC,
|
||||
InputCmdHandler.FromDelegate(_ => GameScreen.FocusChannel(chatBox, ChatSelectChannel.OOC)));
|
||||
InputCmdHandler.FromDelegate(_ => GameplayState.FocusChannel(chatBox, ChatSelectChannel.OOC)));
|
||||
|
||||
inputManager.SetInputCommand(ContentKeyFunctions.FocusAdminChat,
|
||||
InputCmdHandler.FromDelegate(_ => GameScreen.FocusChannel(chatBox, ChatSelectChannel.Admin)));
|
||||
InputCmdHandler.FromDelegate(_ => GameplayState.FocusChannel(chatBox, ChatSelectChannel.Admin)));
|
||||
|
||||
inputManager.SetInputCommand(ContentKeyFunctions.FocusRadio,
|
||||
InputCmdHandler.FromDelegate(_ => GameScreen.FocusChannel(chatBox, ChatSelectChannel.Radio)));
|
||||
InputCmdHandler.FromDelegate(_ => GameplayState.FocusChannel(chatBox, ChatSelectChannel.Radio)));
|
||||
|
||||
inputManager.SetInputCommand(ContentKeyFunctions.FocusDeadChat,
|
||||
InputCmdHandler.FromDelegate(_ => GameScreen.FocusChannel(chatBox, ChatSelectChannel.Dead)));
|
||||
InputCmdHandler.FromDelegate(_ => GameplayState.FocusChannel(chatBox, ChatSelectChannel.Dead)));
|
||||
|
||||
inputManager.SetInputCommand(ContentKeyFunctions.FocusConsoleChat,
|
||||
InputCmdHandler.FromDelegate(_ => GameScreen.FocusChannel(chatBox, ChatSelectChannel.Console)));
|
||||
InputCmdHandler.FromDelegate(_ => GameplayState.FocusChannel(chatBox, ChatSelectChannel.Console)));
|
||||
|
||||
inputManager.SetInputCommand(ContentKeyFunctions.CycleChatChannelForward,
|
||||
InputCmdHandler.FromDelegate(_ => chatBox.CycleChatChannel(true)));
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Client.Administration.Managers;
|
||||
using Content.Client.Chat.UI;
|
||||
using Content.Client.Gameplay;
|
||||
using Content.Client.Ghost;
|
||||
using Content.Client.Viewport;
|
||||
using Content.Shared.Administration;
|
||||
@@ -200,7 +201,7 @@ namespace Content.Client.Chat.Managers
|
||||
// can always hear server (nobody can actually send server messages).
|
||||
FilterableChannels |= ChatChannel.Server;
|
||||
|
||||
if (_stateManager.CurrentState is GameScreenBase)
|
||||
if (_stateManager.CurrentState is GameplayStateBase)
|
||||
{
|
||||
// can always hear local / radio / emote when in the game
|
||||
FilterableChannels |= ChatChannel.Local;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Content.Client.Examine;
|
||||
using Content.Client.Gameplay;
|
||||
using Content.Client.Verbs;
|
||||
using Content.Client.Viewport;
|
||||
using Content.Shared.CCVar;
|
||||
@@ -156,7 +157,7 @@ namespace Content.Client.ContextMenu.UI
|
||||
if (args.State != BoundKeyState.Down)
|
||||
return false;
|
||||
|
||||
if (_stateManager.CurrentState is not GameScreenBase)
|
||||
if (_stateManager.CurrentState is not GameplayStateBase)
|
||||
return false;
|
||||
|
||||
var coords = args.Coordinates.ToMap(_entityManager);
|
||||
|
||||
@@ -145,7 +145,7 @@ public sealed class DecalPlacementSystem : EntitySystem
|
||||
|
||||
ev.Action = new WorldTargetAction()
|
||||
{
|
||||
Name = $"{_decalId} ({_decalColor.ToHex()}, {(int) _decalAngle.Degrees})", // non-unique actions may be considered duplicates when saving/loading.
|
||||
DisplayName = $"{_decalId} ({_decalColor.ToHex()}, {(int) _decalAngle.Degrees})", // non-unique actions may be considered duplicates when saving/loading.
|
||||
Icon = decalProto.Sprite,
|
||||
Repeat = true,
|
||||
CheckCanAccess = false,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Client.CombatMode;
|
||||
using Content.Client.Gameplay;
|
||||
using Content.Client.Outline;
|
||||
using Content.Client.Viewport;
|
||||
using Content.Shared.ActionBlocker;
|
||||
@@ -303,7 +304,7 @@ namespace Content.Client.DragDrop
|
||||
|
||||
IList<EntityUid> entities;
|
||||
|
||||
if (_stateManager.CurrentState is GameScreen screen)
|
||||
if (_stateManager.CurrentState is GameplayState screen)
|
||||
{
|
||||
entities = screen.GetEntitiesUnderPosition(args.Coordinates);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Client.Gameplay;
|
||||
using Content.Client.HUD;
|
||||
using Content.Client.Viewport;
|
||||
using Robust.Client.Console;
|
||||
@@ -27,7 +28,7 @@ namespace Content.Client.EscapeMenu
|
||||
|
||||
private void StateManagerOnOnStateChanged(StateChangedEventArgs obj)
|
||||
{
|
||||
if (obj.NewState is GameScreenBase)
|
||||
if (obj.NewState is GameplayStateBase)
|
||||
{
|
||||
// Switched TO GameScreen.
|
||||
_escapeMenu = new UI.EscapeMenu(_consoleHost);
|
||||
@@ -37,7 +38,7 @@ namespace Content.Client.EscapeMenu
|
||||
_inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu,
|
||||
InputCmdHandler.FromDelegate(_ => Enabled()));
|
||||
}
|
||||
else if (obj.OldState is GameScreenBase)
|
||||
else if (obj.OldState is GameplayStateBase)
|
||||
{
|
||||
// Switched FROM GameScreen.
|
||||
_escapeMenu?.Dispose();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Client.Audio;
|
||||
using Content.Client.Gameplay;
|
||||
using Content.Client.Lobby;
|
||||
using Content.Client.RoundEnd;
|
||||
using Content.Client.Viewport;
|
||||
@@ -109,7 +110,7 @@ namespace Content.Client.GameTicking.Managers
|
||||
|
||||
private void JoinGame(TickerJoinGameEvent message)
|
||||
{
|
||||
_stateManager.RequestStateChange<GameScreen>();
|
||||
_stateManager.RequestStateChange<GameplayState>();
|
||||
}
|
||||
|
||||
private void LobbyCountdown(TickerLobbyCountdownEvent message)
|
||||
|
||||
@@ -6,6 +6,7 @@ using Content.Client.Construction.UI;
|
||||
using Content.Client.Hands;
|
||||
using Content.Client.HUD;
|
||||
using Content.Client.HUD.UI;
|
||||
using Content.Client.Viewport;
|
||||
using Content.Client.Voting;
|
||||
using Content.Shared.Chat;
|
||||
using Content.Shared.CCVar;
|
||||
@@ -15,14 +16,11 @@ using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Timing;
|
||||
using Robust.Shared.ViewVariables;
|
||||
|
||||
namespace Content.Client.Viewport
|
||||
namespace Content.Client.Gameplay
|
||||
{
|
||||
public sealed class GameScreen : GameScreenBase, IMainViewportState
|
||||
public sealed class GameplayState : GameplayStateBase, IMainViewportState
|
||||
{
|
||||
public static readonly Vector2i ViewportSize = (EyeManager.PixelsPerMeter * 21, EyeManager.PixelsPerMeter * 15);
|
||||
|
||||
@@ -9,20 +9,17 @@ using Robust.Client.State;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.Containers;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Input;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Map;
|
||||
using Robust.Shared.Maths;
|
||||
using Robust.Shared.Timing;
|
||||
|
||||
namespace Content.Client.Viewport
|
||||
namespace Content.Client.Gameplay
|
||||
{
|
||||
// OH GOD.
|
||||
// Ok actually it's fine.
|
||||
// Instantiated dynamically through the StateManager, Dependencies will be resolved.
|
||||
[Virtual]
|
||||
public class GameScreenBase : State, IEntityEventSubscriber
|
||||
public class GameplayStateBase : State, IEntityEventSubscriber
|
||||
{
|
||||
[Dependency] private readonly IInputManager _inputManager = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
@@ -1,3 +1,4 @@
|
||||
using Content.Client.Gameplay;
|
||||
using Content.Client.Lobby;
|
||||
using Content.Client.Viewport;
|
||||
using Content.Shared.CCVar;
|
||||
@@ -42,7 +43,7 @@ public sealed class RulesManager : SharedRulesManager
|
||||
|
||||
private void OnStateChanged(StateChangedEventArgs args)
|
||||
{
|
||||
if (args.NewState is not (GameScreen or LobbyState))
|
||||
if (args.NewState is not (GameplayState or LobbyState))
|
||||
return;
|
||||
|
||||
if (!_shouldShowRules)
|
||||
|
||||
@@ -86,7 +86,7 @@ public sealed partial class MappingSystem : EntitySystem
|
||||
{
|
||||
CheckCanInteract = false,
|
||||
Event = actionEvent,
|
||||
Name = tileDef.Name,
|
||||
DisplayName = tileDef.Name,
|
||||
Icon = tileIcon
|
||||
};
|
||||
|
||||
@@ -99,7 +99,7 @@ public sealed partial class MappingSystem : EntitySystem
|
||||
{
|
||||
CheckCanInteract = false,
|
||||
Event = actionEvent,
|
||||
Name = "action-name-mapping-erase",
|
||||
DisplayName = "action-name-mapping-erase",
|
||||
Icon = _deleteIcon,
|
||||
};
|
||||
|
||||
@@ -113,7 +113,7 @@ public sealed partial class MappingSystem : EntitySystem
|
||||
{
|
||||
CheckCanInteract = false,
|
||||
Event = actionEvent,
|
||||
Name = actionEvent.EntityType,
|
||||
DisplayName = actionEvent.EntityType,
|
||||
Icon = new SpriteSpecifier.EntityPrototype(actionEvent.EntityType),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Content.Client.ContextMenu.UI;
|
||||
using Content.Client.Gameplay;
|
||||
using Content.Client.Interactable.Components;
|
||||
using Content.Client.Viewport;
|
||||
using Content.Shared.CCVar;
|
||||
@@ -109,7 +110,7 @@ public sealed class InteractionOutlineSystem : EntitySystem
|
||||
// Potentially change someday? who knows.
|
||||
var currentState = _stateManager.CurrentState;
|
||||
|
||||
if (currentState is not GameScreen screen) return;
|
||||
if (currentState is not GameplayState screen) return;
|
||||
|
||||
EntityUid? entityToClick = null;
|
||||
var renderScale = 1;
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Content.Client.ContextMenu.UI;
|
||||
using Content.Client.Examine;
|
||||
using Content.Client.Gameplay;
|
||||
using Content.Client.Popups;
|
||||
using Content.Client.Verbs.UI;
|
||||
using Content.Client.Viewport;
|
||||
@@ -92,7 +93,7 @@ namespace Content.Client.Verbs
|
||||
{
|
||||
result = null;
|
||||
|
||||
if (_stateManager.CurrentState is not GameScreenBase gameScreenBase)
|
||||
if (_stateManager.CurrentState is not GameplayStateBase gameScreenBase)
|
||||
return false;
|
||||
|
||||
var player = _playerManager.LocalPlayer?.ControlledEntity;
|
||||
|
||||
Reference in New Issue
Block a user