From c0edf2aeedb0e5c115ef6287302f8abb727352fb Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Wed, 8 May 2019 23:19:17 +0200 Subject: [PATCH 01/12] Clean up NanoStyle: 1. Run code formatting. 2. Condense some rules down. --- Content.Client/UserInterface/NanoStyle.cs | 57 +++++++++-------------- 1 file changed, 23 insertions(+), 34 deletions(-) diff --git a/Content.Client/UserInterface/NanoStyle.cs b/Content.Client/UserInterface/NanoStyle.cs index d86d848b68..c173895609 100644 --- a/Content.Client/UserInterface/NanoStyle.cs +++ b/Content.Client/UserInterface/NanoStyle.cs @@ -21,7 +21,6 @@ namespace Content.Client.UserInterface var resCache = IoCManager.Resolve(); var notoSans12 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 12); var notoSansBold16 = resCache.GetFont("/Nano/NotoSans/NotoSans-Bold.ttf", 16); - var animalSilence40 = resCache.GetFont("/Fonts/Animal Silence.otf", 40); var textureCloseButton = resCache.GetTexture("/Nano/cross.svg.png"); var windowHeaderTex = resCache.GetTexture("/Nano/window_header.png"); var windowHeader = new StyleBoxTexture @@ -319,68 +318,58 @@ namespace Content.Client.UserInterface new StyleRule(new SelectorElement(typeof(ProgressBar), null, null, null), new[] { - new StyleProperty(ProgressBar.StylePropertyBackground, progressBarBackground) - }), - - new StyleRule(new SelectorElement(typeof(ProgressBar), null, null, null), - new[] - { + new StyleProperty(ProgressBar.StylePropertyBackground, progressBarBackground), new StyleProperty(ProgressBar.StylePropertyForeground, progressBarForeground) }), // CheckBox - new StyleRule(new SelectorElement(typeof(CheckBox), null, null, null), new [] + new StyleRule(new SelectorElement(typeof(CheckBox), null, null, null), new[] { new StyleProperty(CheckBox.StylePropertyIcon, checkBoxTextureUnchecked), }), - new StyleRule(new SelectorElement(typeof(CheckBox), null, null, Button.StylePseudoClassPressed), new [] + new StyleRule(new SelectorElement(typeof(CheckBox), null, null, Button.StylePseudoClassPressed), new[] { new StyleProperty(CheckBox.StylePropertyIcon, checkBoxTextureChecked), }), - new StyleRule(new SelectorElement(typeof(CheckBox), null, null, null), new [] + new StyleRule(new SelectorElement(typeof(CheckBox), null, null, null), new[] { new StyleProperty(CheckBox.StylePropertyHSeparation, 3), }), // Tooltip - new StyleRule(new SelectorElement(typeof(Tooltip), null, null, null), new [] + new StyleRule(new SelectorElement(typeof(Tooltip), null, null, null), new[] { new StyleProperty(PanelContainer.StylePropertyPanel, tooltipBox) }), // Entity tooltip - new StyleRule(new SelectorElement(typeof(PanelContainer), new []{ExamineSystem.StyleClassEntityTooltip}, null, null), new [] - { - new StyleProperty(PanelContainer.StylePropertyPanel, tooltipBox) - }), + new StyleRule( + new SelectorElement(typeof(PanelContainer), new[] {ExamineSystem.StyleClassEntityTooltip}, null, + null), new[] + { + new StyleProperty(PanelContainer.StylePropertyPanel, tooltipBox) + }), // ItemList - new StyleRule(new SelectorElement(typeof(ItemList), null, null, null), new [] + new StyleRule(new SelectorElement(typeof(ItemList), null, null, null), new[] { - new StyleProperty(ItemList.StylePropertyBackground, new StyleBoxFlat { BackgroundColor = new Color(32, 32, 40)}) - }), - new StyleRule(new SelectorElement(typeof(ItemList), null, null, null), new [] - { - new StyleProperty(ItemList.StylePropertyItemBackground, new StyleBoxFlat { BackgroundColor = new Color(55, 55, 68)}) - }), - new StyleRule(new SelectorElement(typeof(ItemList), null, null, null), new [] - { - new StyleProperty(ItemList.StylePropertyDisabledItemBackground, new StyleBoxFlat { BackgroundColor = new Color(10, 10, 12)}) - }), - new StyleRule(new SelectorElement(typeof(ItemList), null, null, null), new [] - { - new StyleProperty(ItemList.StylePropertySelectedItemBackground, new StyleBoxFlat { BackgroundColor = new Color(75, 75, 86)}) + new StyleProperty(ItemList.StylePropertyBackground, + new StyleBoxFlat {BackgroundColor = new Color(32, 32, 40)}), + new StyleProperty(ItemList.StylePropertyItemBackground, + new StyleBoxFlat {BackgroundColor = new Color(55, 55, 68)}), + new StyleProperty(ItemList.StylePropertyDisabledItemBackground, + new StyleBoxFlat {BackgroundColor = new Color(10, 10, 12)}), + new StyleProperty(ItemList.StylePropertySelectedItemBackground, + new StyleBoxFlat {BackgroundColor = new Color(75, 75, 86)}) }), // Tree - new StyleRule(new SelectorElement(typeof(Tree), null, null, null), new [] - { - new StyleProperty(Tree.StylePropertyBackground, new StyleBoxFlat { BackgroundColor = new Color(32, 32, 40)}) - }), - new StyleRule(new SelectorElement(typeof(Tree), null, null, null), new [] + new StyleRule(new SelectorElement(typeof(Tree), null, null, null), new[] { + new StyleProperty(Tree.StylePropertyBackground, + new StyleBoxFlat {BackgroundColor = new Color(32, 32, 40)}), new StyleProperty(Tree.StylePropertyItemBoxSelected, new StyleBoxFlat { BackgroundColor = new Color(55, 55, 68), From fa8fbc49f503f38f56024a6e9c6011ee91519227 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sat, 11 May 2019 16:05:28 +0200 Subject: [PATCH 02/12] Update submodule. --- RobustToolbox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RobustToolbox b/RobustToolbox index 0340cecd6d..17ebeac107 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 0340cecd6d3823db386b553aa27cb61478e7a1bb +Subproject commit 17ebeac107d65c3b27a3f3e7dbabbbe6ed09116c From 57bcb2a16d8a3fee64fdebe4fac5ef4642add55f Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sat, 11 May 2019 16:05:41 +0200 Subject: [PATCH 03/12] Make content UI scaling aware. --- Content.Client/Chat/ChatBox.cs | 1 - Content.Client/UserInterface/HandsGui.cs | 27 ++++++++++--------- .../Nano/checkbox_checked.svg.96dpi.png.yml | 2 ++ .../Nano/checkbox_unchecked.svg.96dpi.png.yml | 2 ++ 4 files changed, 19 insertions(+), 13 deletions(-) create mode 100644 Resources/Nano/checkbox_checked.svg.96dpi.png.yml create mode 100644 Resources/Nano/checkbox_unchecked.svg.96dpi.png.yml diff --git a/Content.Client/Chat/ChatBox.cs b/Content.Client/Chat/ChatBox.cs index 2060c1e4e9..8e756d59ad 100644 --- a/Content.Client/Chat/ChatBox.cs +++ b/Content.Client/Chat/ChatBox.cs @@ -1,6 +1,5 @@ using System.Collections.Generic; using Content.Shared.Chat; -using Robust.Client.Console; using Robust.Client.Graphics.Drawing; using Robust.Client.Input; using Robust.Client.UserInterface; diff --git a/Content.Client/UserInterface/HandsGui.cs b/Content.Client/UserInterface/HandsGui.cs index fd0dc3371b..779e74c744 100644 --- a/Content.Client/UserInterface/HandsGui.cs +++ b/Content.Client/UserInterface/HandsGui.cs @@ -36,8 +36,8 @@ namespace Content.Client.UserInterface private IEntity LeftHand; private IEntity RightHand; - private UIBox2i handL; - private UIBox2i handR; + private UIBox2i _handL; + private UIBox2i _handR; private SpriteView LeftSpriteView; private SpriteView RightSpriteView; @@ -60,24 +60,24 @@ namespace Content.Client.UserInterface SetMarginsPreset(LayoutPreset.CenterBottom); SetAnchorPreset(LayoutPreset.CenterBottom); - handL = new UIBox2i(0, 0, BOX_SIZE, BOX_SIZE); - handR = handL.Translated(new Vector2i(BOX_SIZE + BOX_SPACING, 0)); + _handL = new UIBox2i(0, 0, BOX_SIZE, BOX_SIZE); + _handR = _handL.Translated(new Vector2i(BOX_SIZE + BOX_SPACING, 0)); MouseFilter = MouseFilterMode.Stop; LeftSpriteView = new SpriteView {MouseFilter = MouseFilterMode.Ignore}; AddChild(LeftSpriteView); - LeftSpriteView.Size = handL.Size; - LeftSpriteView.Position = handL.TopLeft; + LeftSpriteView.Size = _handL.Size; + LeftSpriteView.Position = _handL.TopLeft; RightSpriteView = new SpriteView {MouseFilter = MouseFilterMode.Ignore}; AddChild(RightSpriteView); - RightSpriteView.Size = handR.Size; - RightSpriteView.Position = handR.TopLeft; + RightSpriteView.Size = _handR.Size; + RightSpriteView.Position = _handR.TopLeft; } protected override Vector2 CalculateMinimumSize() { - return new Vector2(BOX_SIZE * 2 + 1, BOX_SIZE); + return new Vector2(BOX_SIZE * 2 + 1, BOX_SIZE) * UIScale; } protected override void Draw(DrawingHandleScreen handle) @@ -87,6 +87,9 @@ namespace Content.Client.UserInterface var leftActive = hands.ActiveIndex == "left"; + var handL = new UIBox2(_handL.TopLeft * UIScale, _handL.BottomRight * UIScale); + var handR = new UIBox2(_handR.TopLeft * UIScale, _handR.BottomRight * UIScale); + handle.DrawStyleBox(handBox, leftActive ? handL : handR); handle.DrawStyleBox(inactiveHandBox, leftActive ? handR : handL); } @@ -187,15 +190,15 @@ namespace Content.Client.UserInterface protected override bool HasPoint(Vector2 point) { - return handL.Contains((Vector2i) point) || handR.Contains((Vector2i) point); + return _handL.Contains((Vector2i) point) || _handR.Contains((Vector2i) point); } protected override void MouseDown(GUIMouseButtonEventArgs args) { base.MouseDown(args); - var leftHandContains = handL.Contains((Vector2i) args.RelativePosition); - var rightHandContains = handR.Contains((Vector2i) args.RelativePosition); + var leftHandContains = _handL.Contains((Vector2i) args.RelativePosition); + var rightHandContains = _handR.Contains((Vector2i) args.RelativePosition); string handIndex; if (leftHandContains) diff --git a/Resources/Nano/checkbox_checked.svg.96dpi.png.yml b/Resources/Nano/checkbox_checked.svg.96dpi.png.yml new file mode 100644 index 0000000000..5c43e23305 --- /dev/null +++ b/Resources/Nano/checkbox_checked.svg.96dpi.png.yml @@ -0,0 +1,2 @@ +sample: + filter: true diff --git a/Resources/Nano/checkbox_unchecked.svg.96dpi.png.yml b/Resources/Nano/checkbox_unchecked.svg.96dpi.png.yml new file mode 100644 index 0000000000..5c43e23305 --- /dev/null +++ b/Resources/Nano/checkbox_unchecked.svg.96dpi.png.yml @@ -0,0 +1,2 @@ +sample: + filter: true From 9a1f37d47627f83089560d22b4c09a78191bbb52 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Sat, 11 May 2019 16:10:09 +0200 Subject: [PATCH 04/12] Update submodule, switch to .NET Framework 4.7.2 --- Content.Client/Content.Client.csproj | 2 +- Content.Server/Content.Server.csproj | 2 +- Content.Shared/Content.Shared.csproj | 2 +- Content.Tests/Content.Tests.csproj | 2 +- RobustToolbox | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Content.Client/Content.Client.csproj b/Content.Client/Content.Client.csproj index 68385e7420..9740c1c11e 100644 --- a/Content.Client/Content.Client.csproj +++ b/Content.Client/Content.Client.csproj @@ -9,7 +9,7 @@ Properties Content.Client Content.Client - v4.7.1 + v4.7.2 512 ..\RobustToolbox\bin\Client\Resources\Assemblies\ 7.2 diff --git a/Content.Server/Content.Server.csproj b/Content.Server/Content.Server.csproj index 735f47fc61..6eb2763531 100644 --- a/Content.Server/Content.Server.csproj +++ b/Content.Server/Content.Server.csproj @@ -9,7 +9,7 @@ Properties Content.Server Content.Server - v4.7.1 + v4.7.2 512 ..\RobustToolbox\bin\Server\Resources\Assemblies\ ..\bin\Content.Server\ diff --git a/Content.Shared/Content.Shared.csproj b/Content.Shared/Content.Shared.csproj index 94c90549c4..d0d433d44f 100644 --- a/Content.Shared/Content.Shared.csproj +++ b/Content.Shared/Content.Shared.csproj @@ -9,7 +9,7 @@ Properties Content.Shared Content.Shared - v4.7.1 + v4.7.2 512 bin\x86\Debug\ prompt diff --git a/Content.Tests/Content.Tests.csproj b/Content.Tests/Content.Tests.csproj index 24a1eb115f..81dd901b74 100644 --- a/Content.Tests/Content.Tests.csproj +++ b/Content.Tests/Content.Tests.csproj @@ -12,7 +12,7 @@ Properties Content.Tests Content.Tests - v4.7.1 + v4.7.2 512 UnitTest ..\bin\Content.Tests\ diff --git a/RobustToolbox b/RobustToolbox index 17ebeac107..f954bcb3e8 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit 17ebeac107d65c3b27a3f3e7dbabbbe6ed09116c +Subproject commit f954bcb3e882232c0ad9f4df88522f4b0230765e From 331cfaa1c595f2ab78d604250ca01dbe66469033 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Tue, 14 May 2019 00:23:02 +0200 Subject: [PATCH 05/12] Update submodule. --- RobustToolbox | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RobustToolbox b/RobustToolbox index f954bcb3e8..4d233ef6c2 160000 --- a/RobustToolbox +++ b/RobustToolbox @@ -1 +1 @@ -Subproject commit f954bcb3e882232c0ad9f4df88522f4b0230765e +Subproject commit 4d233ef6c2edf9d148c7862c377cbab9bae80b79 From 88c29abe5e8a8455df3dca0a5f0678a71f3f8019 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Tue, 14 May 2019 00:23:58 +0200 Subject: [PATCH 06/12] Transition lobby from tscn to C#, localization support for lobby. --- .../GameTicking/ClientGameTicker.cs | 17 +- Content.Client/UserInterface/LobbyGui.cs | 96 ++++-- Resources/Scenes/Lobby/Lobby.tscn | 315 ------------------ 3 files changed, 84 insertions(+), 344 deletions(-) delete mode 100644 Resources/Scenes/Lobby/Lobby.tscn diff --git a/Content.Client/GameTicking/ClientGameTicker.cs b/Content.Client/GameTicking/ClientGameTicker.cs index c0fa89cbd0..94443ebdc1 100644 --- a/Content.Client/GameTicking/ClientGameTicker.cs +++ b/Content.Client/GameTicking/ClientGameTicker.cs @@ -10,9 +10,11 @@ using Robust.Client.Console; using Robust.Client.Interfaces; using Robust.Client.Interfaces.Input; using Robust.Client.Interfaces.UserInterface; +using Robust.Client.UserInterface; using Robust.Shared.Input; using Robust.Shared.Interfaces.Network; using Robust.Shared.IoC; +using Robust.Shared.Localization; using Robust.Shared.Utility; using Robust.Shared.ViewVariables; @@ -27,6 +29,7 @@ namespace Content.Client.GameTicking [Dependency] private IBaseClient _baseClient; [Dependency] private IChatManager _chatManager; [Dependency] private IClientConsole _console; + [Dependency] private ILocalizationManager _localization; #pragma warning restore 649 [ViewVariables] private bool _areWeReady; @@ -83,11 +86,11 @@ namespace Content.Client.GameTicking { if (difference.TotalSeconds < -5) { - text = "Right Now?"; + text = _localization.GetString("Right Now?"); } else { - text = "Right Now"; + text = _localization.GetString("Right Now"); } } else @@ -95,7 +98,7 @@ namespace Content.Client.GameTicking text = $"{(int) Math.Floor(difference.TotalMinutes)}:{difference.Seconds:D2}"; } - _lobby.StartTime.Text = "Round Starts In: " + text; + _lobby.StartTime.Text = _localization.GetString("Round Starts In: {0}", text); } private void _lobbyStatus(MsgTickerLobbyStatus message) @@ -116,14 +119,14 @@ namespace Content.Client.GameTicking if (_gameStarted) { - _lobby.ReadyButton.Text = "Join"; + _lobby.ReadyButton.Text = _localization.GetString("Join"); _lobby.ReadyButton.ToggleMode = false; _lobby.ReadyButton.Pressed = false; } else { _lobby.StartTime.Text = ""; - _lobby.ReadyButton.Text = "Ready Up"; + _lobby.ReadyButton.Text = _localization.GetString("Ready Up"); _lobby.ReadyButton.ToggleMode = true; _lobby.ReadyButton.Pressed = _areWeReady; } @@ -144,9 +147,11 @@ namespace Content.Client.GameTicking _tickerState = TickerState.InLobby; - _lobby = new LobbyGui(); + _lobby = new LobbyGui(_localization); _userInterfaceManager.StateRoot.AddChild(_lobby); + _lobby.SetAnchorAndMarginPreset(Control.LayoutPreset.Wide, margin: 20); + _chatManager.SetChatBox(_lobby.Chat); _lobby.Chat.DefaultChatFormat = "ooc \"{0}\""; diff --git a/Content.Client/UserInterface/LobbyGui.cs b/Content.Client/UserInterface/LobbyGui.cs index 64f6e65402..21439f80bf 100644 --- a/Content.Client/UserInterface/LobbyGui.cs +++ b/Content.Client/UserInterface/LobbyGui.cs @@ -1,36 +1,86 @@ using Content.Client.Chat; +using Robust.Client.Graphics.Drawing; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; -using Robust.Client.UserInterface.CustomControls; -using Robust.Shared.Utility; +using Robust.Shared.Localization; +using Robust.Shared.Maths; namespace Content.Client.UserInterface { - public class LobbyGui : Control + internal sealed class LobbyGui : PanelContainer { - protected override ResourcePath ScenePath => new ResourcePath("/Scenes/Lobby/Lobby.tscn"); + public Label ServerName { get; } + public Label StartTime { get; } + public Button ReadyButton { get; } + public Button ObserveButton { get; } + public Button LeaveButton { get; } + public ChatBox Chat { get; set; } - public Label ServerName => GetChild