diff --git a/.envrc b/.envrc index 3550a30f2d..5def8fd66a 100644 --- a/.envrc +++ b/.envrc @@ -1 +1,4 @@ +if ! has nix_direnv_version || ! nix_direnv_version 2.3.0; then + source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.3.0/direnvrc" "sha256-Dmd+j63L84wuzgyjITIfSxSD57Tx7v51DMxVZOsiUD8=" +fi use flake diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 627126c918..ff52456cf3 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,15 +1,19 @@ # Last match in file takes precedence. +# Sorting by path instead of by who added it one day :( +/Resources/ConfigPresets/WizardsDen/ @Chief-Engineer + # Moony's Gargantuan List Of Things She Cares About, or MGLOTSCA for short. # You need to add your name to these entries, not make a new one, if you care about them. /Content.*/Bql/ @moonheart08 -/Content.*/Administration/ @moonheart08 @PaulRitter @DrSmugleaf +/Content.*/Administration/ @moonheart08 @PaulRitter @DrSmugleaf @Chief-Engineer /Content.*/Station/ @moonheart08 /Content.*/Maps/ @moonheart08 /Content.*/GameTicking/ @moonheart08 -/Resources/Server\ Info/ @moonheart08 -/Resources/engineCommandPerms.yml @moonheart08 -/Resources/clientCommandPerms.yml @moonheart08 +/Resources/ServerInfo/ @moonheart08 @Chief-Engineer +/Resources/ServerInfo/Guidebook/ @moonheart08 +/Resources/engineCommandPerms.yml @moonheart08 @Chief-Engineer +/Resources/clientCommandPerms.yml @moonheart08 @Chief-Engineer /Resources/Prototypes/species.yml @moonheart08 /Resources/Prototypes/Body/ @moonheart08 @mirrorcult @DrSmugleaf # suffering /Resources/Prototypes/Maps/ @moonheart08 @Emisse @@ -50,5 +54,6 @@ # SKREEEE /Content.*.Database/ @PJB3005 @DrSmugleaf +/Content.Shared.Database/Log*.cs @PJB3005 @DrSmugleaf @Chief-Engineer /Pow3r/ @PJB3005 /Content.Server/Power/Pow3r/ @PJB3005 diff --git a/Content.Client/Access/UI/AgentIDCardBoundUserInterface.cs b/Content.Client/Access/UI/AgentIDCardBoundUserInterface.cs index b9880eb8b6..6b6ce1e565 100644 --- a/Content.Client/Access/UI/AgentIDCardBoundUserInterface.cs +++ b/Content.Client/Access/UI/AgentIDCardBoundUserInterface.cs @@ -25,8 +25,8 @@ protected override void Open() _window.OpenCentered(); _window.OnClose += Close; - _window.OnNameEntered += OnNameChanged; - _window.OnJobEntered += OnJobChanged; + _window.OnNameChanged += OnNameChanged; + _window.OnJobChanged += OnJobChanged; } private void OnNameChanged(string newName) diff --git a/Content.Client/Access/UI/AgentIDCardWindow.xaml.cs b/Content.Client/Access/UI/AgentIDCardWindow.xaml.cs index 9813a2946e..1be816f027 100644 --- a/Content.Client/Access/UI/AgentIDCardWindow.xaml.cs +++ b/Content.Client/Access/UI/AgentIDCardWindow.xaml.cs @@ -7,16 +7,18 @@ namespace Content.Client.Access.UI [GenerateTypedNameReferences] public sealed partial class AgentIDCardWindow : DefaultWindow { - public event Action? OnNameEntered; - - public event Action? OnJobEntered; + public event Action? OnNameChanged; + public event Action? OnJobChanged; public AgentIDCardWindow() { RobustXamlLoader.Load(this); - NameLineEdit.OnTextEntered += e => OnNameEntered?.Invoke(e.Text); - JobLineEdit.OnTextEntered += e => OnJobEntered?.Invoke(e.Text); + NameLineEdit.OnTextEntered += e => OnNameChanged?.Invoke(e.Text); + NameLineEdit.OnFocusExit += e => OnNameChanged?.Invoke(e.Text); + + JobLineEdit.OnTextEntered += e => OnJobChanged?.Invoke(e.Text); + JobLineEdit.OnFocusExit += e => OnJobChanged?.Invoke(e.Text); } public void SetCurrentName(string name) diff --git a/Content.Client/Actions/ActionsSystem.cs b/Content.Client/Actions/ActionsSystem.cs index 08cdb8c832..3eac41d835 100644 --- a/Content.Client/Actions/ActionsSystem.cs +++ b/Content.Client/Actions/ActionsSystem.cs @@ -173,7 +173,7 @@ public void UnlinkAllActions() 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; } diff --git a/Content.Client/Arcade/BlockGameMenu.cs b/Content.Client/Arcade/BlockGameMenu.cs index 5452d7c5d0..17f150c756 100644 --- a/Content.Client/Arcade/BlockGameMenu.cs +++ b/Content.Client/Arcade/BlockGameMenu.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -20,16 +21,16 @@ namespace Content.Client.Arcade { public sealed class BlockGameMenu : DefaultWindow { - private static readonly Color OverlayBackgroundColor = new(74,74,81,180); - private static readonly Color OverlayShadowColor = new(0,0,0,83); + private static readonly Color OverlayBackgroundColor = new(74, 74, 81, 180); + private static readonly Color OverlayShadowColor = new(0, 0, 0, 83); - private static readonly Vector2 BlockSize = new(15,15); + private static readonly Vector2 BlockSize = new(15, 15); private readonly BlockGameBoundUserInterface _owner; private readonly PanelContainer _mainPanel; - private BoxContainer _gameRootContainer; + private readonly BoxContainer _gameRootContainer; private GridContainer _gameGrid = default!; private GridContainer _nextBlockGrid = default!; private GridContainer _holdBlockGrid = default!; @@ -82,7 +83,7 @@ public BlockGameMenu(BlockGameBoundUserInterface owner) _gameRootContainer.AddChild(_levelLabel); _gameRootContainer.AddChild(new Control { - MinSize = new Vector2(1,5) + MinSize = new Vector2(1, 5) }); _pointsLabel = new Label @@ -93,7 +94,7 @@ public BlockGameMenu(BlockGameBoundUserInterface owner) _gameRootContainer.AddChild(_pointsLabel); _gameRootContainer.AddChild(new Control { - MinSize = new Vector2(1,10) + MinSize = new Vector2(1, 10) }); var gameBox = new BoxContainer @@ -103,12 +104,12 @@ public BlockGameMenu(BlockGameBoundUserInterface owner) gameBox.AddChild(SetupHoldBox(backgroundTexture)); gameBox.AddChild(new Control { - MinSize = new Vector2(10,1) + MinSize = new Vector2(10, 1) }); gameBox.AddChild(SetupGameGrid(backgroundTexture)); gameBox.AddChild(new Control { - MinSize = new Vector2(10,1) + MinSize = new Vector2(10, 1) }); gameBox.AddChild(SetupNextBox(backgroundTexture)); @@ -116,7 +117,7 @@ public BlockGameMenu(BlockGameBoundUserInterface owner) _gameRootContainer.AddChild(new Control { - MinSize = new Vector2(1,10) + MinSize = new Vector2(1, 10) }); _pauseButton = new Button @@ -176,7 +177,7 @@ public BlockGameMenu(BlockGameBoundUserInterface owner) _owner.SendAction(BlockGamePlayerAction.NewGame); }; pauseMenuContainer.AddChild(_newGameButton); - pauseMenuContainer.AddChild(new Control{MinSize = new Vector2(1,10)}); + pauseMenuContainer.AddChild(new Control { MinSize = new Vector2(1, 10) }); _scoreBoardButton = new Button { @@ -185,7 +186,7 @@ public BlockGameMenu(BlockGameBoundUserInterface owner) }; _scoreBoardButton.OnPressed += (e) => _owner.SendAction(BlockGamePlayerAction.ShowHighscores); pauseMenuContainer.AddChild(_scoreBoardButton); - _unpauseButtonMargin = new Control {MinSize = new Vector2(1, 10), Visible = false}; + _unpauseButtonMargin = new Control { MinSize = new Vector2(1, 10), Visible = false }; pauseMenuContainer.AddChild(_unpauseButtonMargin); _unpauseButton = new Button @@ -239,13 +240,13 @@ public BlockGameMenu(BlockGameBoundUserInterface owner) VerticalAlignment = VAlignment.Center }; - gameOverMenuContainer.AddChild(new Label{Text = Loc.GetString("blockgame-menu-msg-game-over"),Align = Label.AlignMode.Center}); - gameOverMenuContainer.AddChild(new Control{MinSize = new Vector2(1,10)}); + gameOverMenuContainer.AddChild(new Label { Text = Loc.GetString("blockgame-menu-msg-game-over"), Align = Label.AlignMode.Center }); + gameOverMenuContainer.AddChild(new Control { MinSize = new Vector2(1, 10) }); - _finalScoreLabel = new Label{Align = Label.AlignMode.Center}; + _finalScoreLabel = new Label { Align = Label.AlignMode.Center }; gameOverMenuContainer.AddChild(_finalScoreLabel); - gameOverMenuContainer.AddChild(new Control{MinSize = new Vector2(1,10)}); + gameOverMenuContainer.AddChild(new Control { MinSize = new Vector2(1, 10) }); _finalNewGameButton = new Button { @@ -275,7 +276,7 @@ public BlockGameMenu(BlockGameBoundUserInterface owner) HorizontalAlignment = HAlignment.Center }; - var c = new Color(OverlayBackgroundColor.R,OverlayBackgroundColor.G,OverlayBackgroundColor.B,220); + var c = new Color(OverlayBackgroundColor.R, OverlayBackgroundColor.G, OverlayBackgroundColor.B, 220); var innerBack = new StyleBoxTexture { Texture = backgroundTexture, @@ -298,8 +299,8 @@ public BlockGameMenu(BlockGameBoundUserInterface owner) VerticalAlignment = VAlignment.Center }; - menuContainer.AddChild(new Label{Text = Loc.GetString("blockgame-menu-label-highscores")}); - menuContainer.AddChild(new Control{MinSize = new Vector2(1,10)}); + menuContainer.AddChild(new Label { Text = Loc.GetString("blockgame-menu-label-highscores") }); + menuContainer.AddChild(new Control { MinSize = new Vector2(1, 10) }); var highScoreBox = new BoxContainer { @@ -311,14 +312,14 @@ public BlockGameMenu(BlockGameBoundUserInterface owner) Align = Label.AlignMode.Center }; highScoreBox.AddChild(_localHighscoresLabel); - highScoreBox.AddChild(new Control{MinSize = new Vector2(40,1)}); + highScoreBox.AddChild(new Control { MinSize = new Vector2(40, 1) }); _globalHighscoresLabel = new Label { Align = Label.AlignMode.Center }; highScoreBox.AddChild(_globalHighscoresLabel); menuContainer.AddChild(highScoreBox); - menuContainer.AddChild(new Control{MinSize = new Vector2(1,10)}); + menuContainer.AddChild(new Control { MinSize = new Vector2(1, 10) }); _highscoreBackButton = new Button { Text = Loc.GetString("blockgame-menu-button-back"), @@ -359,7 +360,7 @@ private Control SetupGameGrid(Texture panelTex) HSeparationOverride = 1, VSeparationOverride = 1 }; - UpdateBlocks(new BlockGameBlock[0]); + UpdateBlocks(Array.Empty()); var back = new StyleBoxTexture { @@ -376,7 +377,7 @@ private Control SetupGameGrid(Texture panelTex) }; var backgroundPanel = new PanelContainer { - PanelOverride = new StyleBoxFlat{BackgroundColor = Color.FromHex("#86868d")} + PanelOverride = new StyleBoxFlat { BackgroundColor = Color.FromHex("#86868d") } }; backgroundPanel.AddChild(_gameGrid); gamePanel.AddChild(backgroundPanel); @@ -416,7 +417,7 @@ private Control SetupNextBox(Texture panelTex) nextBlockPanel.AddChild(nextCenterContainer); grid.AddChild(nextBlockPanel); - grid.AddChild(new Label{Text = Loc.GetString("blockgame-menu-label-next"), Align = Label.AlignMode.Center}); + grid.AddChild(new Label { Text = Loc.GetString("blockgame-menu-label-next"), Align = Label.AlignMode.Center }); return grid; } @@ -454,15 +455,17 @@ private Control SetupHoldBox(Texture panelTex) holdBlockPanel.AddChild(holdCenterContainer); grid.AddChild(holdBlockPanel); - grid.AddChild(new Label{Text = Loc.GetString("blockgame-menu-label-hold"), Align = Label.AlignMode.Center}); + grid.AddChild(new Label { Text = Loc.GetString("blockgame-menu-label-hold"), Align = Label.AlignMode.Center }); return grid; } protected override void KeyboardFocusExited() { - if (!IsOpen) return; - if(_gameOver) return; + if (!IsOpen) + return; + if (_gameOver) + return; TryPause(); } @@ -480,7 +483,8 @@ public void SetStarted() public void SetScreen(BlockGameMessages.BlockGameScreen screen) { - if (_gameOver) return; + if (_gameOver) + return; switch (screen) { @@ -512,9 +516,12 @@ public void SetScreen(BlockGameMessages.BlockGameScreen screen) private void CloseMenus() { - if(_mainPanel.Children.Contains(_menuRootContainer)) _mainPanel.RemoveChild(_menuRootContainer); - if(_mainPanel.Children.Contains(_gameOverRootContainer)) _mainPanel.RemoveChild(_gameOverRootContainer); - if(_mainPanel.Children.Contains(_highscoresRootContainer)) _mainPanel.RemoveChild(_highscoresRootContainer); + if (_mainPanel.Children.Contains(_menuRootContainer)) + _mainPanel.RemoveChild(_menuRootContainer); + if (_mainPanel.Children.Contains(_gameOverRootContainer)) + _mainPanel.RemoveChild(_gameOverRootContainer); + if (_mainPanel.Children.Contains(_highscoresRootContainer)) + _mainPanel.RemoveChild(_highscoresRootContainer); } public void SetGameoverInfo(int amount, int? localPlacement, int? globalPlacement) @@ -563,72 +570,56 @@ protected override void KeyBindDown(GUIBoundKeyEventArgs args) { base.KeyBindDown(args); - if(!_isPlayer || args.Handled) return; + if (!_isPlayer || args.Handled) + return; - if (args.Function == ContentKeyFunctions.ArcadeLeft) - { + else if (args.Function == ContentKeyFunctions.ArcadeLeft) _owner.SendAction(BlockGamePlayerAction.StartLeft); - } else if (args.Function == ContentKeyFunctions.ArcadeRight) - { _owner.SendAction(BlockGamePlayerAction.StartRight); - } else if (args.Function == ContentKeyFunctions.ArcadeUp) - { _owner.SendAction(BlockGamePlayerAction.Rotate); - } else if (args.Function == ContentKeyFunctions.Arcade3) - { _owner.SendAction(BlockGamePlayerAction.CounterRotate); - } else if (args.Function == ContentKeyFunctions.ArcadeDown) - { _owner.SendAction(BlockGamePlayerAction.SoftdropStart); - } else if (args.Function == ContentKeyFunctions.Arcade2) - { _owner.SendAction(BlockGamePlayerAction.Hold); - } else if (args.Function == ContentKeyFunctions.Arcade1) - { _owner.SendAction(BlockGamePlayerAction.Harddrop); - } } protected override void KeyBindUp(GUIBoundKeyEventArgs args) { base.KeyBindUp(args); - if(!_isPlayer || args.Handled) return; + if (!_isPlayer || args.Handled) + return; - if (args.Function == ContentKeyFunctions.ArcadeLeft) - { + else if (args.Function == ContentKeyFunctions.ArcadeLeft) _owner.SendAction(BlockGamePlayerAction.EndLeft); - } else if (args.Function == ContentKeyFunctions.ArcadeRight) - { _owner.SendAction(BlockGamePlayerAction.EndRight); - }else if (args.Function == ContentKeyFunctions.ArcadeDown) - { + else if (args.Function == ContentKeyFunctions.ArcadeDown) _owner.SendAction(BlockGamePlayerAction.SoftdropEnd); - } } public void UpdateNextBlock(BlockGameBlock[] blocks) { _nextBlockGrid.RemoveAllChildren(); - if (blocks.Length == 0) return; + if (blocks.Length == 0) + return; var columnCount = blocks.Max(b => b.Position.X) + 1; var rowCount = blocks.Max(b => b.Position.Y) + 1; _nextBlockGrid.Columns = columnCount; - for (int y = 0; y < rowCount; y++) + for (var y = 0; y < rowCount; y++) { - for (int x = 0; x < columnCount; x++) + for (var x = 0; x < columnCount; x++) { var c = GetColorForPosition(blocks, x, y); _nextBlockGrid.AddChild(new PanelContainer { - PanelOverride = new StyleBoxFlat {BackgroundColor = c}, + PanelOverride = new StyleBoxFlat { BackgroundColor = c }, MinSize = BlockSize, RectDrawClipMargin = 0 }); @@ -639,18 +630,19 @@ public void UpdateNextBlock(BlockGameBlock[] blocks) public void UpdateHeldBlock(BlockGameBlock[] blocks) { _holdBlockGrid.RemoveAllChildren(); - if (blocks.Length == 0) return; + if (blocks.Length == 0) + return; var columnCount = blocks.Max(b => b.Position.X) + 1; var rowCount = blocks.Max(b => b.Position.Y) + 1; _holdBlockGrid.Columns = columnCount; - for (int y = 0; y < rowCount; y++) + for (var y = 0; y < rowCount; y++) { - for (int x = 0; x < columnCount; x++) + for (var x = 0; x < columnCount; x++) { var c = GetColorForPosition(blocks, x, y); _holdBlockGrid.AddChild(new PanelContainer { - PanelOverride = new StyleBoxFlat {BackgroundColor = c}, + PanelOverride = new StyleBoxFlat { BackgroundColor = c }, MinSize = BlockSize, RectDrawClipMargin = 0 }); @@ -661,14 +653,14 @@ public void UpdateHeldBlock(BlockGameBlock[] blocks) public void UpdateBlocks(BlockGameBlock[] blocks) { _gameGrid.RemoveAllChildren(); - for (int y = 0; y < 20; y++) + for (var y = 0; y < 20; y++) { - for (int x = 0; x < 10; x++) + for (var x = 0; x < 10; x++) { var c = GetColorForPosition(blocks, x, y); _gameGrid.AddChild(new PanelContainer { - PanelOverride = new StyleBoxFlat {BackgroundColor = c}, + PanelOverride = new StyleBoxFlat { BackgroundColor = c }, MinSize = BlockSize, RectDrawClipMargin = 0 }); @@ -676,9 +668,9 @@ public void UpdateBlocks(BlockGameBlock[] blocks) } } - private Color GetColorForPosition(BlockGameBlock[] blocks, int x, int y) + private static Color GetColorForPosition(BlockGameBlock[] blocks, int x, int y) { - Color c = Color.Transparent; + var c = Color.Transparent; var matchingBlock = blocks.FirstOrNull(b => b.Position.X == x && b.Position.Y == y); if (matchingBlock.HasValue) { diff --git a/Content.Client/Arcade/SpaceVillainArcadeMenu.cs b/Content.Client/Arcade/SpaceVillainArcadeMenu.cs index bbd7635459..4f07593b0e 100644 --- a/Content.Client/Arcade/SpaceVillainArcadeMenu.cs +++ b/Content.Client/Arcade/SpaceVillainArcadeMenu.cs @@ -24,40 +24,46 @@ public SpaceVillainArcadeMenu(SpaceVillainArcadeBoundUserInterface owner) Title = Loc.GetString("spacevillain-menu-title"); Owner = owner; - var grid = new GridContainer {Columns = 1}; + var grid = new GridContainer { Columns = 1 }; - var infoGrid = new GridContainer {Columns = 3}; - infoGrid.AddChild(new Label{ Text = Loc.GetString("spacevillain-menu-label-player"), Align = Label.AlignMode.Center }); - infoGrid.AddChild(new Label{ Text = "|", Align = Label.AlignMode.Center }); - _enemyNameLabel = new Label{ Align = Label.AlignMode.Center}; + var infoGrid = new GridContainer { Columns = 3 }; + infoGrid.AddChild(new Label { Text = Loc.GetString("spacevillain-menu-label-player"), Align = Label.AlignMode.Center }); + infoGrid.AddChild(new Label { Text = "|", Align = Label.AlignMode.Center }); + _enemyNameLabel = new Label { Align = Label.AlignMode.Center }; infoGrid.AddChild(_enemyNameLabel); - _playerInfoLabel = new Label {Align = Label.AlignMode.Center}; + _playerInfoLabel = new Label { Align = Label.AlignMode.Center }; infoGrid.AddChild(_playerInfoLabel); - infoGrid.AddChild(new Label{ Text = "|", Align = Label.AlignMode.Center }); - _enemyInfoLabel = new Label {Align = Label.AlignMode.Center}; + infoGrid.AddChild(new Label { Text = "|", Align = Label.AlignMode.Center }); + _enemyInfoLabel = new Label { Align = Label.AlignMode.Center }; infoGrid.AddChild(_enemyInfoLabel); var centerContainer = new CenterContainer(); centerContainer.AddChild(infoGrid); grid.AddChild(centerContainer); - _playerActionLabel = new Label {Align = Label.AlignMode.Center}; + _playerActionLabel = new Label { Align = Label.AlignMode.Center }; grid.AddChild(_playerActionLabel); - _enemyActionLabel = new Label {Align = Label.AlignMode.Center}; + _enemyActionLabel = new Label { Align = Label.AlignMode.Center }; grid.AddChild(_enemyActionLabel); - var buttonGrid = new GridContainer {Columns = 3}; + var buttonGrid = new GridContainer { Columns = 3 }; _gameButtons[0] = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.Attack) - {Text = Loc.GetString("spacevillain-menu-button-attack")}; + { + Text = Loc.GetString("spacevillain-menu-button-attack") + }; buttonGrid.AddChild(_gameButtons[0]); _gameButtons[1] = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.Heal) - {Text = Loc.GetString("spacevillain-menu-button-heal")}; + { + Text = Loc.GetString("spacevillain-menu-button-heal") + }; buttonGrid.AddChild(_gameButtons[1]); _gameButtons[2] = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.Recharge) - {Text = Loc.GetString("spacevillain-menu-button-recharge")}; + { + Text = Loc.GetString("spacevillain-menu-button-recharge") + }; buttonGrid.AddChild(_gameButtons[2]); centerContainer = new CenterContainer(); @@ -65,7 +71,9 @@ public SpaceVillainArcadeMenu(SpaceVillainArcadeBoundUserInterface owner) grid.AddChild(centerContainer); var newGame = new ActionButton(Owner, SharedSpaceVillainArcadeComponent.PlayerAction.NewGame) - {Text = Loc.GetString("spacevillain-menu-button-new-game")}; + { + Text = Loc.GetString("spacevillain-menu-button-new-game") + }; grid.AddChild(newGame); Contents.AddChild(grid); @@ -84,7 +92,8 @@ private void UpdateMetadata(SharedSpaceVillainArcadeComponent.SpaceVillainArcade public void UpdateInfo(SharedSpaceVillainArcadeComponent.SpaceVillainArcadeDataUpdateMessage message) { - if(message is SharedSpaceVillainArcadeComponent.SpaceVillainArcadeMetaDataUpdateMessage metaMessage) UpdateMetadata(metaMessage); + if (message is SharedSpaceVillainArcadeComponent.SpaceVillainArcadeMetaDataUpdateMessage metaMessage) + UpdateMetadata(metaMessage); _playerInfoLabel.Text = $"HP: {message.PlayerHP} MP: {message.PlayerMP}"; _enemyInfoLabel.Text = $"HP: {message.EnemyHP} MP: {message.EnemyMP}"; @@ -97,7 +106,7 @@ private sealed class ActionButton : Button private readonly SpaceVillainArcadeBoundUserInterface _owner; private readonly SharedSpaceVillainArcadeComponent.PlayerAction _playerAction; - public ActionButton(SpaceVillainArcadeBoundUserInterface owner,SharedSpaceVillainArcadeComponent.PlayerAction playerAction) + public ActionButton(SpaceVillainArcadeBoundUserInterface owner, SharedSpaceVillainArcadeComponent.PlayerAction playerAction) { _owner = owner; _playerAction = playerAction; diff --git a/Content.Client/Arcade/UI/BlockGameBoundUserInterface.cs b/Content.Client/Arcade/UI/BlockGameBoundUserInterface.cs index cd74077c12..2abe9311fb 100644 --- a/Content.Client/Arcade/UI/BlockGameBoundUserInterface.cs +++ b/Content.Client/Arcade/UI/BlockGameBoundUserInterface.cs @@ -1,78 +1,76 @@ using Content.Shared.Arcade; using Robust.Client.GameObjects; -using Robust.Shared.GameObjects; -namespace Content.Client.Arcade.UI +namespace Content.Client.Arcade.UI; + +public sealed class BlockGameBoundUserInterface : BoundUserInterface { - public sealed class BlockGameBoundUserInterface : BoundUserInterface - { - private BlockGameMenu? _menu; + private BlockGameMenu? _menu; - public BlockGameBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey) - { - } + public BlockGameBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey) + { + } - protected override void Open() - { - base.Open(); + protected override void Open() + { + base.Open(); - _menu = new BlockGameMenu(this); - _menu.OnClose += Close; - _menu.OpenCentered(); - } + _menu = new BlockGameMenu(this); + _menu.OnClose += Close; + _menu.OpenCentered(); + } - protected override void ReceiveMessage(BoundUserInterfaceMessage message) + protected override void ReceiveMessage(BoundUserInterfaceMessage message) + { + switch (message) { - switch (message) - { - case BlockGameMessages.BlockGameVisualUpdateMessage updateMessage: - switch (updateMessage.GameVisualType) - { - case BlockGameMessages.BlockGameVisualType.GameField: - _menu?.UpdateBlocks(updateMessage.Blocks); - break; - case BlockGameMessages.BlockGameVisualType.HoldBlock: - _menu?.UpdateHeldBlock(updateMessage.Blocks); - break; - case BlockGameMessages.BlockGameVisualType.NextBlock: - _menu?.UpdateNextBlock(updateMessage.Blocks); - break; - } - break; - case BlockGameMessages.BlockGameScoreUpdateMessage scoreUpdate: - _menu?.UpdatePoints(scoreUpdate.Points); - break; - case BlockGameMessages.BlockGameUserStatusMessage userMessage: - _menu?.SetUsability(userMessage.IsPlayer); - break; - case BlockGameMessages.BlockGameSetScreenMessage statusMessage: - if (statusMessage.IsStarted) _menu?.SetStarted(); - _menu?.SetScreen(statusMessage.Screen); - if (statusMessage is BlockGameMessages.BlockGameGameOverScreenMessage gameOverScreenMessage) - _menu?.SetGameoverInfo(gameOverScreenMessage.FinalScore, gameOverScreenMessage.LocalPlacement, gameOverScreenMessage.GlobalPlacement); - break; - case BlockGameMessages.BlockGameHighScoreUpdateMessage highScoreUpdateMessage: - _menu?.UpdateHighscores(highScoreUpdateMessage.LocalHighscores, - highScoreUpdateMessage.GlobalHighscores); - break; - case BlockGameMessages.BlockGameLevelUpdateMessage levelUpdateMessage: - _menu?.UpdateLevel(levelUpdateMessage.Level); - break; - } + case BlockGameMessages.BlockGameVisualUpdateMessage updateMessage: + switch (updateMessage.GameVisualType) + { + case BlockGameMessages.BlockGameVisualType.GameField: + _menu?.UpdateBlocks(updateMessage.Blocks); + break; + case BlockGameMessages.BlockGameVisualType.HoldBlock: + _menu?.UpdateHeldBlock(updateMessage.Blocks); + break; + case BlockGameMessages.BlockGameVisualType.NextBlock: + _menu?.UpdateNextBlock(updateMessage.Blocks); + break; + } + break; + case BlockGameMessages.BlockGameScoreUpdateMessage scoreUpdate: + _menu?.UpdatePoints(scoreUpdate.Points); + break; + case BlockGameMessages.BlockGameUserStatusMessage userMessage: + _menu?.SetUsability(userMessage.IsPlayer); + break; + case BlockGameMessages.BlockGameSetScreenMessage statusMessage: + if (statusMessage.IsStarted) _menu?.SetStarted(); + _menu?.SetScreen(statusMessage.Screen); + if (statusMessage is BlockGameMessages.BlockGameGameOverScreenMessage gameOverScreenMessage) + _menu?.SetGameoverInfo(gameOverScreenMessage.FinalScore, gameOverScreenMessage.LocalPlacement, gameOverScreenMessage.GlobalPlacement); + break; + case BlockGameMessages.BlockGameHighScoreUpdateMessage highScoreUpdateMessage: + _menu?.UpdateHighscores(highScoreUpdateMessage.LocalHighscores, + highScoreUpdateMessage.GlobalHighscores); + break; + case BlockGameMessages.BlockGameLevelUpdateMessage levelUpdateMessage: + _menu?.UpdateLevel(levelUpdateMessage.Level); + break; } + } - public void SendAction(BlockGamePlayerAction action) - { - SendMessage(new BlockGameMessages.BlockGamePlayerActionMessage(action)); - } + public void SendAction(BlockGamePlayerAction action) + { + SendMessage(new BlockGameMessages.BlockGamePlayerActionMessage(action)); + } - protected override void Dispose(bool disposing) - { - base.Dispose(disposing); - if (!disposing) - return; + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + if (!disposing) + return; - _menu?.Dispose(); - } + _menu?.Dispose(); } } diff --git a/Content.Client/Arcade/UI/SpaceVillainArcadeBoundUserInterface.cs b/Content.Client/Arcade/UI/SpaceVillainArcadeBoundUserInterface.cs index bb1582d127..2ecc8b46a8 100644 --- a/Content.Client/Arcade/UI/SpaceVillainArcadeBoundUserInterface.cs +++ b/Content.Client/Arcade/UI/SpaceVillainArcadeBoundUserInterface.cs @@ -3,51 +3,45 @@ using Robust.Shared.ViewVariables; using static Content.Shared.Arcade.SharedSpaceVillainArcadeComponent; -namespace Content.Client.Arcade.UI -{ - public sealed class SpaceVillainArcadeBoundUserInterface : BoundUserInterface - { - [ViewVariables] private SpaceVillainArcadeMenu? _menu; +namespace Content.Client.Arcade.UI; - //public SharedSpaceVillainArcadeComponent SpaceVillainArcade; - - public SpaceVillainArcadeBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey) - { - SendAction(PlayerAction.RequestData); - } +public sealed class SpaceVillainArcadeBoundUserInterface : BoundUserInterface +{ + [ViewVariables] private SpaceVillainArcadeMenu? _menu; - public void SendAction(PlayerAction action) - { - SendMessage(new SpaceVillainArcadePlayerActionMessage(action)); - } + //public SharedSpaceVillainArcadeComponent SpaceVillainArcade; - protected override void Open() - { - base.Open(); + public SpaceVillainArcadeBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey) + { + SendAction(PlayerAction.RequestData); + } - /*if(!Owner.Owner.TryGetComponent(out SharedSpaceVillainArcadeComponent spaceVillainArcade)) - { - return; - } + public void SendAction(PlayerAction action) + { + SendMessage(new SpaceVillainArcadePlayerActionMessage(action)); + } - SpaceVillainArcade = spaceVillainArcade;*/ + protected override void Open() + { + base.Open(); - _menu = new SpaceVillainArcadeMenu(this); + _menu = new SpaceVillainArcadeMenu(this); - _menu.OnClose += Close; - _menu.OpenCentered(); - } + _menu.OnClose += Close; + _menu.OpenCentered(); + } - protected override void ReceiveMessage(BoundUserInterfaceMessage message) - { - if (message is SpaceVillainArcadeDataUpdateMessage msg) _menu?.UpdateInfo(msg); - } + protected override void ReceiveMessage(BoundUserInterfaceMessage message) + { + if (message is SpaceVillainArcadeDataUpdateMessage msg) + _menu?.UpdateInfo(msg); + } - protected override void Dispose(bool disposing) - { - base.Dispose(disposing); + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); - if (disposing) _menu?.Dispose(); - } + if (disposing) + _menu?.Dispose(); } } diff --git a/Content.Client/Cargo/BUI/CargoBountyConsoleBoundUserInterface.cs b/Content.Client/Cargo/BUI/CargoBountyConsoleBoundUserInterface.cs new file mode 100644 index 0000000000..63587d9875 --- /dev/null +++ b/Content.Client/Cargo/BUI/CargoBountyConsoleBoundUserInterface.cs @@ -0,0 +1,54 @@ +using Content.Client.Cargo.UI; +using Content.Shared.Cargo.Components; +using JetBrains.Annotations; +using Robust.Client.GameObjects; + +namespace Content.Client.Cargo.BUI; + +[UsedImplicitly] +public sealed class CargoBountyConsoleBoundUserInterface : BoundUserInterface +{ + [ViewVariables] + private CargoBountyMenu? _menu; + + public CargoBountyConsoleBoundUserInterface(ClientUserInterfaceComponent owner, Enum uiKey) : base(owner, uiKey) + { + + } + + protected override void Open() + { + base.Open(); + + _menu = new(); + + _menu.OnClose += Close; + + _menu.OnLabelButtonPressed += id => + { + SendMessage(new BountyPrintLabelMessage(id)); + }; + + _menu.OpenCentered(); + } + + protected override void UpdateState(BoundUserInterfaceState message) + { + base.UpdateState(message); + + if (message is not CargoBountyConsoleState state) + return; + + _menu?.UpdateEntries(state.Bounties); + } + + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + + if (!disposing) + return; + + _menu?.Dispose(); + } +} diff --git a/Content.Client/Cargo/UI/BountyEntry.xaml b/Content.Client/Cargo/UI/BountyEntry.xaml new file mode 100644 index 0000000000..e570b03746 --- /dev/null +++ b/Content.Client/Cargo/UI/BountyEntry.xaml @@ -0,0 +1,27 @@ + + + + + + + + + + + + - - + + HorizontalExpand="True"> - - - - - + + + + + + + + + + + + + + + - - diff --git a/Content.Client/Lathe/UI/LatheMenu.xaml.cs b/Content.Client/Lathe/UI/LatheMenu.xaml.cs index fd3319c434..7247db647b 100644 --- a/Content.Client/Lathe/UI/LatheMenu.xaml.cs +++ b/Content.Client/Lathe/UI/LatheMenu.xaml.cs @@ -1,4 +1,6 @@ -using System.Text; +using System.Linq; +using System.Text; +using Content.Client.Stylesheets; using Content.Shared.Lathe; using Content.Shared.Materials; using Content.Shared.Research.Prototypes; @@ -21,7 +23,6 @@ public sealed partial class LatheMenu : DefaultWindow public event Action? OnQueueButtonPressed; public event Action? OnServerListButtonPressed; - public event Action? OnServerSyncButtonPressed; public event Action? RecipeQueueAction; public List Recipes = new(); @@ -48,15 +49,13 @@ public LatheMenu(LatheBoundUserInterface owner) QueueButton.OnPressed += a => OnQueueButtonPressed?.Invoke(a); ServerListButton.OnPressed += a => OnServerListButtonPressed?.Invoke(a); - //refresh the bui state - ServerSyncButton.OnPressed += a => OnServerSyncButtonPressed?.Invoke(a); - if (_entityManager.TryGetComponent(owner.Lathe, out var latheComponent)) { - if (latheComponent.DynamicRecipes == null) + if (!latheComponent.DynamicRecipes.Any()) { ServerListButton.Visible = false; - ServerSyncButton.Visible = false; + QueueButton.RemoveStyleClass(StyleBase.ButtonOpenRight); + //QueueButton.AddStyleClass(StyleBase.ButtonSquare); } } } @@ -132,7 +131,7 @@ public void PopulateRecipes(EntityUid lathe) sb.Append('\n'); var adjustedAmount = SharedLatheSystem.AdjustMaterial(amount, prototype.ApplyMaterialDiscount, component.MaterialUseMultiplier); - + sb.Append(adjustedAmount); sb.Append(' '); sb.Append(Loc.GetString(proto.Name)); diff --git a/Content.Client/Lathe/UI/RecipeControl.xaml b/Content.Client/Lathe/UI/RecipeControl.xaml index 5ef5342185..cacbf84ff7 100644 --- a/Content.Client/Lathe/UI/RecipeControl.xaml +++ b/Content.Client/Lathe/UI/RecipeControl.xaml @@ -2,11 +2,13 @@