Merge pull request #3 from space-wizards/master

Pull more changes from upstream
This commit is contained in:
moneyl
2019-05-14 16:52:00 -04:00
committed by GitHub
18 changed files with 478 additions and 406 deletions

View File

@@ -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;

View File

@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Content.Client</RootNamespace>
<AssemblyName>Content.Client</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ContentAssemblyTarget>..\RobustToolbox\bin\Client\Resources\Assemblies\</ContentAssemblyTarget>
<LangVersion>7.2</LangVersion>
@@ -75,6 +75,7 @@
<Compile Include="Chat\ChatManager.cs" />
<Compile Include="Commands\DebugCommands.cs" />
<Compile Include="EntryPoint.cs" />
<Compile Include="EscapeMenuOwner.cs" />
<Compile Include="GameObjects\Components\Actor\CharacterInterface.cs" />
<Compile Include="GameObjects\Components\DamageableComponent.cs" />
<Compile Include="GameObjects\Components\Doors\AirlockVisualizer2D.cs" />
@@ -120,10 +121,12 @@
<Compile Include="Interfaces\GameObjects\Components\Items\IHandsComponent.cs" />
<Compile Include="Research\LatheMenu.cs" />
<Compile Include="Research\LatheQueueMenu.cs" />
<Compile Include="UserInterface\EscapeMenu.cs" />
<Compile Include="UserInterface\HandsGui.cs" />
<Compile Include="GameObjects\Components\Power\PowerDebugTool.cs" />
<Compile Include="UserInterface\LobbyGui.cs" />
<Compile Include="UserInterface\NanoStyle.cs" />
<Compile Include="UserInterface\Placeholder.cs" />
<Compile Include="Utility\ResourceCacheExtensions.cs" />
<Compile Include="GameObjects\Components\Mobs\SpeciesVisualizer2D.cs" />
</ItemGroup>

View File

@@ -12,14 +12,12 @@ using Content.Client.Interfaces;
using Content.Client.Interfaces.GameObjects;
using Content.Client.Interfaces.Parallax;
using Content.Client.Parallax;
using Content.Shared.GameObjects.Components.Weapons.Ranged;
using Content.Shared.Interfaces;
using Robust.Client;
using Robust.Client.Interfaces;
using Robust.Client.Interfaces.Graphics.Overlays;
using Robust.Client.Interfaces.Input;
using Robust.Client.Player;
using Robust.Client.Utility;
using Robust.Shared.ContentPack;
using Robust.Shared.Interfaces.GameObjects;
using Robust.Shared.IoC;
@@ -31,14 +29,14 @@ using Content.Client.GameObjects.Components.Mobs;
using Content.Client.GameObjects.Components.Research;
using Content.Client.GameObjects.Components.Sound;
using Content.Client.Interfaces.Chat;
using Content.Client.Research;
using Content.Client.UserInterface;
using Content.Shared.GameObjects.Components.Markers;
using Content.Shared.GameObjects.Components.Materials;
using Content.Shared.GameObjects.Components.Mobs;
using Content.Shared.GameObjects.Components.Research;
using Robust.Client.Interfaces.State;
using Robust.Client.Interfaces.UserInterface;
using Robust.Shared.Log;
using Robust.Client.State.States;
namespace Content.Client
{
@@ -46,6 +44,7 @@ namespace Content.Client
{
#pragma warning disable 649
[Dependency] private readonly IPlayerManager _playerManager;
[Dependency] private readonly IEscapeMenuOwner _escapeMenuOwner;
#pragma warning restore 649
public override void Init()
@@ -139,6 +138,7 @@ namespace Content.Client
IoCManager.Register<IClientGameTicker, ClientGameTicker>();
IoCManager.Register<IParallaxManager, ParallaxManager>();
IoCManager.Register<IChatManager, ChatManager>();
IoCManager.Register<IEscapeMenuOwner, EscapeMenuOwner>();
IoCManager.BuildGraph();
IoCManager.Resolve<IParallaxManager>().LoadParallax();
@@ -146,11 +146,13 @@ namespace Content.Client
var stylesheet = new NanoStyle();
IoCManager.Resolve<IUserInterfaceManager>().Stylesheet = stylesheet.Stylesheet;
IoCManager.Resolve<IUserInterfaceManager>().Stylesheet = stylesheet.Stylesheet;
IoCManager.InjectDependencies(this);
}
_escapeMenuOwner.Initialize();
}
/// <summary>
/// Subscribe events to the player manager after the player manager is set up
/// </summary>

View File

@@ -0,0 +1,88 @@
using Content.Client.UserInterface;
using Robust.Client.Console;
using Robust.Client.Interfaces.Graphics;
using Robust.Client.Interfaces.Input;
using Robust.Client.Interfaces.Placement;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.Interfaces.State;
using Robust.Client.State.States;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Input;
using Robust.Shared.Interfaces.Configuration;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes;
namespace Content.Client
{
internal sealed class EscapeMenuOwner : IEscapeMenuOwner
{
#pragma warning disable 649
[Dependency] private readonly IStateManager _stateManager;
[Dependency] private readonly IDisplayManager _displayManager;
[Dependency] private readonly IClientConsole _clientConsole;
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager;
[Dependency] private readonly IPlacementManager _placementManager;
[Dependency] private readonly IPrototypeManager _prototypeManager;
[Dependency] private readonly IResourceCache _resourceCache;
[Dependency] private readonly IConfigurationManager _configurationManager;
[Dependency] private readonly IInputManager _inputManager;
#pragma warning restore 649
private EscapeMenu _escapeMenu;
public void Initialize()
{
_stateManager.OnStateChanged += StateManagerOnOnStateChanged;
}
private void StateManagerOnOnStateChanged(StateChangedEventArgs obj)
{
if (obj.NewState is GameScreen)
{
// Switched TO GameScreen.
_escapeMenu = new EscapeMenu(_displayManager, _clientConsole, _tileDefinitionManager, _placementManager,
_prototypeManager, _resourceCache, _configurationManager)
{
Visible = false
};
_escapeMenu.AddToScreen();
var escapeMenuCommand = InputCmdHandler.FromDelegate(session =>
{
if (_escapeMenu.Visible)
{
if (_escapeMenu.IsAtFront())
{
_escapeMenu.Visible = false;
}
else
{
_escapeMenu.MoveToFront();
}
}
else
{
_escapeMenu.OpenCentered();
}
});
_inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu, escapeMenuCommand);
}
else if (obj.OldState is GameScreen)
{
// Switched FROM GameScreen.
_escapeMenu.Dispose();
_escapeMenu = null;
_inputManager.SetInputCommand(EngineKeyFunctions.EscapeMenu, null);
}
}
}
public interface IEscapeMenuOwner
{
void Initialize();
}
}

View File

@@ -1,4 +1,5 @@
using System;
using System.Linq;
using Content.Client.Chat;
using Content.Client.Interfaces;
using Content.Client.Interfaces.Chat;
@@ -9,10 +10,14 @@ using Robust.Client;
using Robust.Client.Console;
using Robust.Client.Interfaces;
using Robust.Client.Interfaces.Input;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.Interfaces.UserInterface;
using Robust.Client.Player;
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 +32,9 @@ namespace Content.Client.GameTicking
[Dependency] private IBaseClient _baseClient;
[Dependency] private IChatManager _chatManager;
[Dependency] private IClientConsole _console;
[Dependency] private ILocalizationManager _localization;
[Dependency] private IResourceCache _resourceCache;
[Dependency] private IPlayerManager _playerManager;
#pragma warning restore 649
[ViewVariables] private bool _areWeReady;
@@ -46,10 +54,25 @@ namespace Content.Client.GameTicking
_netManager.RegisterNetMessage<MsgTickerLobbyStatus>(nameof(MsgTickerLobbyStatus), _lobbyStatus);
_baseClient.RunLevelChanged += BaseClientOnRunLevelChanged;
_playerManager.PlayerListUpdated += PlayerManagerOnPlayerListUpdated;
_initialized = true;
}
private void PlayerManagerOnPlayerListUpdated(object sender, EventArgs e)
{
if (_lobby == null)
{
return;
}
_lobby.OnlinePlayerItemList.Clear();
foreach (var session in _playerManager.Sessions.OrderBy(s => s.Name))
{
_lobby.OnlinePlayerItemList.AddItem(session.Name);
}
}
private void BaseClientOnRunLevelChanged(object sender, RunLevelChangedEventArgs e)
{
if (e.NewLevel != ClientRunLevel.Initialize)
@@ -83,11 +106,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 +118,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 +139,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 +167,11 @@ namespace Content.Client.GameTicking
_tickerState = TickerState.InLobby;
_lobby = new LobbyGui();
_lobby = new LobbyGui(_localization, _resourceCache);
_userInterfaceManager.StateRoot.AddChild(_lobby);
_lobby.SetAnchorAndMarginPreset(Control.LayoutPreset.Wide, margin: 20);
_chatManager.SetChatBox(_lobby.Chat);
_lobby.Chat.DefaultChatFormat = "ooc \"{0}\"";

View File

@@ -0,0 +1,121 @@
using Robust.Client.Console;
using Robust.Client.Interfaces.Graphics;
using Robust.Client.Interfaces.Placement;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.Interfaces.Configuration;
using Robust.Shared.Interfaces.Map;
using Robust.Shared.Prototypes;
namespace Content.Client.UserInterface
{
internal sealed class EscapeMenu : SS14Window
{
private readonly IClientConsole _console;
private readonly ITileDefinitionManager __tileDefinitionManager;
private readonly IPlacementManager _placementManager;
private readonly IPrototypeManager _prototypeManager;
private readonly IResourceCache _resourceCache;
private readonly IDisplayManager _displayManager;
private readonly IConfigurationManager _configSystem;
private BaseButton QuitButton;
private BaseButton OptionsButton;
private BaseButton SpawnEntitiesButton;
private BaseButton SpawnTilesButton;
private OptionsMenu optionsMenu;
public EscapeMenu(IDisplayManager displayManager,
IClientConsole console,
ITileDefinitionManager tileDefinitionManager,
IPlacementManager placementManager,
IPrototypeManager prototypeManager,
IResourceCache resourceCache,
IConfigurationManager configSystem) : base(displayManager)
{
_configSystem = configSystem;
_displayManager = displayManager;
_console = console;
__tileDefinitionManager = tileDefinitionManager;
_placementManager = placementManager;
_prototypeManager = prototypeManager;
_resourceCache = resourceCache;
PerformLayout();
}
private void PerformLayout()
{
optionsMenu = new OptionsMenu(_displayManager, _configSystem)
{
Visible = false
};
optionsMenu.AddToScreen();
Resizable = false;
HideOnClose = true;
Title = "Menu";
var vBox = new VBoxContainer {SeparationOverride = 2};
Contents.AddChild(vBox);
SpawnEntitiesButton = new Button {Text = "Spawn Entities"};
SpawnEntitiesButton.OnPressed += OnSpawnEntitiesButtonClicked;
vBox.AddChild(SpawnEntitiesButton);
SpawnTilesButton = new Button {Text = "Spawn Tiles"};
SpawnTilesButton.OnPressed += OnSpawnTilesButtonClicked;
vBox.AddChild(SpawnTilesButton);
// Add a spacer.
vBox.AddChild(new Control { CustomMinimumSize = (0, 5)});
OptionsButton = new Button {Text = "Options"};
OptionsButton.OnPressed += OnOptionsButtonClicked;
vBox.AddChild(OptionsButton);
QuitButton = new Button {Text = "Quit"};
QuitButton.OnPressed += OnQuitButtonClicked;
vBox.AddChild(QuitButton);
Size = CombinedMinimumSize;
}
private void OnQuitButtonClicked(BaseButton.ButtonEventArgs args)
{
_console.ProcessCommand("disconnect");
Dispose();
}
private void OnOptionsButtonClicked(BaseButton.ButtonEventArgs args)
{
optionsMenu.OpenCentered();
}
private void OnSpawnEntitiesButtonClicked(BaseButton.ButtonEventArgs args)
{
var window = new EntitySpawnWindow(_displayManager, _placementManager, _prototypeManager, _resourceCache);
window.AddToScreen();
window.OpenToLeft();
}
private void OnSpawnTilesButtonClicked(BaseButton.ButtonEventArgs args)
{
var window = new TileSpawnWindow(__tileDefinitionManager, _placementManager, _displayManager, _resourceCache);
window.AddToScreen();
window.OpenToLeft();
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (disposing)
{
optionsMenu.Dispose();
}
}
}
}

View File

@@ -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)

View File

@@ -1,36 +1,114 @@
using Content.Client.Chat;
using Robust.Client.UserInterface;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Interfaces.ResourceManagement;
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; }
public ItemList OnlinePlayerItemList { get; }
public Label ServerName => GetChild<Label>("Panel/VBoxContainer/TitleContainer/ServerName");
public Label StartTime => GetChild<Label>("Panel/VBoxContainer/HBoxContainer/LeftVBox/ReadyButtons/RoundStartText");
public Button ReadyButton =>
GetChild<Button>("Panel/VBoxContainer/HBoxContainer/LeftVBox/ReadyButtons/ReadyButton");
public Button ObserveButton =>
GetChild<Button>("Panel/VBoxContainer/HBoxContainer/LeftVBox/ReadyButtons/ObserveButton");
public Button LeaveButton => GetChild<Button>("Panel/VBoxContainer/TitleContainer/LeaveButton");
public ChatBox Chat { get; private set; }
protected override void Initialize()
public LobbyGui(ILocalizationManager localization, IResourceCache resourceCache)
{
base.Initialize();
PanelOverride = new StyleBoxFlat {BackgroundColor = new Color(37, 37, 45)};
PanelOverride.SetContentMarginOverride(StyleBox.Margin.All, 4);
var chatContainer = GetChild("Panel/VBoxContainer/HBoxContainer/LeftVBox");
Chat = new ChatBox {ReleaseFocusOnEnter = false};
chatContainer.AddChild(Chat);
Chat.SizeFlagsVertical = SizeFlags.FillExpand;
var vBox = new VBoxContainer();
AddChild(vBox);
{
// Title bar.
var titleContainer = new HBoxContainer();
vBox.AddChild(titleContainer);
var lobbyTitle = new Label
{
Text = localization.GetString("Lobby"),
SizeFlagsHorizontal = SizeFlags.None
};
lobbyTitle.AddStyleClass(NanoStyle.StyleClassLabelHeading);
titleContainer.AddChild(lobbyTitle);
titleContainer.AddChild(ServerName = new Label
{
SizeFlagsHorizontal = SizeFlags.ShrinkCenter | SizeFlags.Expand
});
ServerName.AddStyleClass(NanoStyle.StyleClassLabelHeading);
titleContainer.AddChild(LeaveButton = new Button
{
SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
Text = localization.GetString("Leave")
});
LeaveButton.AddStyleClass(NanoStyle.StyleClassButtonBig);
}
var hBox = new HBoxContainer {SizeFlagsVertical = SizeFlags.FillExpand};
vBox.AddChild(hBox);
{
var leftVBox = new VBoxContainer {SizeFlagsHorizontal = SizeFlags.FillExpand};
hBox.AddChild(leftVBox);
leftVBox.AddChild(new Placeholder(resourceCache)
{
SizeFlagsVertical = SizeFlags.FillExpand,
PlaceholderText = localization.GetString("Character UI\nPlaceholder")
});
var readyButtons = new HBoxContainer();
leftVBox.AddChild(readyButtons);
readyButtons.AddChild(ObserveButton = new Button
{
Text = localization.GetString("Observe")
});
ObserveButton.AddStyleClass(NanoStyle.StyleClassButtonBig);
readyButtons.AddChild(StartTime = new Label
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
Align = Label.AlignMode.Right
});
readyButtons.AddChild(ReadyButton = new Button
{
ToggleMode = true,
Text = localization.GetString("Ready Up")
});
ReadyButton.AddStyleClass(NanoStyle.StyleClassButtonBig);
leftVBox.AddChild(Chat = new ChatBox {SizeFlagsVertical = SizeFlags.FillExpand});
Chat.Input.PlaceHolder = localization.GetString("Talk!");
}
{
var rightVBox = new VBoxContainer {SizeFlagsHorizontal = SizeFlags.FillExpand};
hBox.AddChild(rightVBox);
rightVBox.AddChild(new Label
{
Text = localization.GetString("Online Players:")
});
rightVBox.AddChild(OnlinePlayerItemList = new ItemList
{
SizeFlagsVertical = SizeFlags.FillExpand,
//SelectMode = ItemList.ItemListSelectMode.None
});
rightVBox.AddChild(new Placeholder(resourceCache)
{
SizeFlagsVertical = SizeFlags.FillExpand,
PlaceholderText = localization.GetString("Server Info\nPlaceholder")
});
}
}
}
}

View File

@@ -12,6 +12,8 @@ namespace Content.Client.UserInterface
{
public sealed class NanoStyle
{
public const string StyleClassLabelHeading = "LabelHeading";
public const string StyleClassButtonBig = "ButtonBig";
private static readonly Color NanoGold = Color.FromHex("#A88B5E");
public Stylesheet Stylesheet { get; }
@@ -20,8 +22,8 @@ namespace Content.Client.UserInterface
{
var resCache = IoCManager.Resolve<IResourceCache>();
var notoSans12 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 12);
var notoSans16 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 16);
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
@@ -44,7 +46,7 @@ namespace Content.Client.UserInterface
Texture = buttonNormalTex,
};
buttonNormal.SetPatchMargin(StyleBox.Margin.All, 2);
buttonNormal.SetContentMarginOverride(StyleBox.Margin.Left | StyleBox.Margin.Right, 4);
buttonNormal.SetContentMarginOverride(StyleBox.Margin.Horizontal, 8);
var buttonHoverTex = resCache.GetTexture("/Nano/button_hover.png");
var buttonHover = new StyleBoxTexture
@@ -52,7 +54,7 @@ namespace Content.Client.UserInterface
Texture = buttonHoverTex,
};
buttonHover.SetPatchMargin(StyleBox.Margin.All, 2);
buttonHover.SetContentMarginOverride(StyleBox.Margin.Left | StyleBox.Margin.Right, 4);
buttonHover.SetContentMarginOverride(StyleBox.Margin.Horizontal, 8);
var buttonPressedTex = resCache.GetTexture("/Nano/button_pressed.png");
var buttonPressed = new StyleBoxTexture
@@ -60,7 +62,7 @@ namespace Content.Client.UserInterface
Texture = buttonPressedTex,
};
buttonPressed.SetPatchMargin(StyleBox.Margin.All, 2);
buttonPressed.SetContentMarginOverride(StyleBox.Margin.Left | StyleBox.Margin.Right, 4);
buttonPressed.SetContentMarginOverride(StyleBox.Margin.Horizontal, 8);
var buttonDisabledTex = resCache.GetTexture("/Nano/button_disabled.png");
var buttonDisabled = new StyleBoxTexture
@@ -68,7 +70,7 @@ namespace Content.Client.UserInterface
Texture = buttonDisabledTex,
};
buttonDisabled.SetPatchMargin(StyleBox.Margin.All, 2);
buttonDisabled.SetContentMarginOverride(StyleBox.Margin.Left | StyleBox.Margin.Right, 4);
buttonDisabled.SetContentMarginOverride(StyleBox.Margin.Horizontal, 8);
var lineEditTex = resCache.GetTexture("/Nano/lineedit.png");
var lineEdit = new StyleBoxTexture
@@ -141,6 +143,22 @@ namespace Content.Client.UserInterface
tooltipBox.SetPatchMargin(StyleBox.Margin.All, 2);
tooltipBox.SetContentMarginOverride(StyleBox.Margin.Horizontal, 5);
// Placeholder
var placeholderTexture = resCache.GetTexture("/Nano/placeholder.png");
var placeholder = new StyleBoxTexture { Texture = placeholderTexture };
placeholder.SetPatchMargin(StyleBox.Margin.All, 24);
placeholder.SetExpandMargin(StyleBox.Margin.All, -5);
var itemListBackgroundSelected = new StyleBoxFlat {BackgroundColor = new Color(75, 75, 86)};
itemListBackgroundSelected.SetContentMarginOverride(StyleBox.Margin.Vertical, 2);
itemListBackgroundSelected.SetContentMarginOverride(StyleBox.Margin.Horizontal, 4);
var itemListItemBackgroundDisabled = new StyleBoxFlat {BackgroundColor = new Color(10, 10, 12)};
itemListItemBackgroundDisabled.SetContentMarginOverride(StyleBox.Margin.Vertical, 2);
itemListItemBackgroundDisabled.SetContentMarginOverride(StyleBox.Margin.Horizontal, 4);
var itemListItemBackground = new StyleBoxFlat {BackgroundColor = new Color(55, 55, 68)};
itemListItemBackground.SetContentMarginOverride(StyleBox.Margin.Vertical, 2);
itemListItemBackground.SetContentMarginOverride(StyleBox.Margin.Horizontal, 4);
Stylesheet = new Stylesheet(new[]
{
// Default font.
@@ -319,74 +337,89 @@ 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,
itemListItemBackground),
new StyleProperty(ItemList.StylePropertyDisabledItemBackground,
itemListItemBackgroundDisabled),
new StyleProperty(ItemList.StylePropertySelectedItemBackground,
itemListBackgroundSelected)
}),
// 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),
ContentMarginLeftOverride = 4
})
}),
// Placeholder
new StyleRule(new SelectorElement(typeof(Placeholder), null, null, null), new []
{
new StyleProperty(PanelContainer.StylePropertyPanel, placeholder),
}),
new StyleRule(new SelectorElement(typeof(Label), new []{Placeholder.StyleClassPlaceholderText}, null, null), new []
{
new StyleProperty(Label.StylePropertyFont, notoSans16),
new StyleProperty(Label.StylePropertyFontColor, new Color(103, 103, 103, 128)),
}),
// Big Label
new StyleRule(new SelectorElement(typeof(Label), new []{StyleClassLabelHeading}, null, null), new []
{
new StyleProperty(Label.StylePropertyFont, notoSansBold16),
new StyleProperty(Label.StylePropertyFontColor, NanoGold),
} ),
// Big Button
new StyleRule(new SelectorElement(typeof(Button), new []{StyleClassButtonBig}, null, null), new []
{
new StyleProperty("font", notoSans16)
}),
});
}
}

View File

@@ -0,0 +1,31 @@
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.UserInterface.Controls;
namespace Content.Client.UserInterface
{
public sealed class Placeholder : PanelContainer
{
public const string StyleClassPlaceholderText = "PlaceholderText";
private readonly Label _label;
public string PlaceholderText
{
get => _label.Text;
set => _label.Text = value;
}
public Placeholder(IResourceCache _resourceCache)
{
_label = new Label
{
SizeFlagsHorizontal = SizeFlags.Fill,
SizeFlagsVertical = SizeFlags.Fill,
Align = Label.AlignMode.Center,
VAlign = Label.VAlignMode.Center
};
_label.AddStyleClass(StyleClassPlaceholderText);
AddChild(_label);
}
}
}

View File

@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Content.Server</RootNamespace>
<AssemblyName>Content.Server</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ContentAssemblyTarget>..\RobustToolbox\bin\Server\Resources\Assemblies\</ContentAssemblyTarget>
<OutputPath>..\bin\Content.Server\</OutputPath>

View File

@@ -9,7 +9,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Content.Shared</RootNamespace>
<AssemblyName>Content.Shared</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<OutputPath>bin\x86\Debug\</OutputPath>
<ErrorReport>prompt</ErrorReport>

View File

@@ -12,7 +12,7 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Content.Tests</RootNamespace>
<AssemblyName>Content.Tests</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TestProjectType>UnitTest</TestProjectType>
<OutputPath>..\bin\Content.Tests\</OutputPath>

View File

@@ -0,0 +1,2 @@
sample:
filter: true

View File

@@ -0,0 +1,2 @@
sample:
filter: true

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

View File

@@ -1,315 +0,0 @@
[gd_scene format=2]
[node name="Control" type="Control" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 1.0
anchor_bottom = 1.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
[node name="Panel" type="Panel" parent="." index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 20.0
margin_top = 20.0
margin_right = -20.0
margin_bottom = -20.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
[node name="VBoxContainer" type="VBoxContainer" parent="Panel" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 3.0
margin_top = 3.0
margin_right = -3.0
margin_bottom = -3.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
alignment = 0
[node name="TitleContainer" type="MarginContainer" parent="Panel/VBoxContainer" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 978.0
margin_bottom = 20.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
custom_constants/margin_right = 0
custom_constants/margin_top = 0
custom_constants/margin_left = 0
custom_constants/margin_bottom = 0
_sections_unfolded = [ "custom_constants", "custom_styles" ]
[node name="LobbyLabel" type="Label" parent="Panel/VBoxContainer/TitleContainer" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 3.0
margin_right = 43.0
margin_bottom = 17.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 0
size_flags_vertical = 4
text = "LOBBY"
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
_sections_unfolded = [ "Size Flags" ]
[node name="ServerName" type="Label" parent="Panel/VBoxContainer/TitleContainer" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 3.0
margin_right = 978.0
margin_bottom = 17.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Space Station 14"
align = 1
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="LeaveButton" type="Button" parent="Panel/VBoxContainer/TitleContainer" index="2"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 929.0
margin_right = 978.0
margin_bottom = 20.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 8
size_flags_vertical = 1
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null
text = "Leave"
flat = false
align = 1
_sections_unfolded = [ "Size Flags" ]
[node name="HBoxContainer" type="HBoxContainer" parent="Panel/VBoxContainer" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 24.0
margin_right = 978.0
margin_bottom = 554.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 3
alignment = 0
[node name="LeftVBox" type="VBoxContainer" parent="Panel/VBoxContainer/HBoxContainer" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 487.0
margin_bottom = 530.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 1
alignment = 0
[node name="LeftPanel" type="Container" parent="Panel/VBoxContainer/HBoxContainer/LeftVBox" index="0"]
editor/display_folded = true
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 487.0
margin_bottom = 506.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 3
[node name="RichTextLabel" type="RichTextLabel" parent="Panel/VBoxContainer/HBoxContainer/LeftVBox/LeftPanel" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 1.0
anchor_bottom = 1.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = true
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
bbcode_enabled = false
bbcode_text = ""
visible_characters = -1
percent_visible = 1.0
meta_underlined = true
tab_size = 4
text = "Welcome to the server!
Player count: 0"
scroll_active = true
scroll_following = false
selection_enabled = false
override_selected_font_color = false
[node name="ReadyButtons" type="HBoxContainer" parent="Panel/VBoxContainer/HBoxContainer/LeftVBox" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_top = 510.0
margin_right = 487.0
margin_bottom = 530.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 1
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
alignment = 0
[node name="ObserveButton" type="Button" parent="Panel/VBoxContainer/HBoxContainer/LeftVBox/ReadyButtons" index="0"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_right = 66.0
margin_bottom = 20.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
toggle_mode = false
enabled_focus_mode = 2
shortcut = null
group = null
text = "Observe"
flat = false
align = 1
[node name="RoundStartText" type="Label" parent="Panel/VBoxContainer/HBoxContainer/LeftVBox/ReadyButtons" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 70.0
margin_top = 3.0
margin_right = 411.0
margin_bottom = 17.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 2
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 4
text = "Round Starts In:"
align = 2
percent_visible = 1.0
lines_skipped = 0
max_lines_visible = -1
[node name="ReadyButton" type="Button" parent="Panel/VBoxContainer/HBoxContainer/LeftVBox/ReadyButtons" index="2"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 415.0
margin_right = 487.0
margin_bottom = 20.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
focus_mode = 2
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 1
size_flags_vertical = 1
toggle_mode = true
enabled_focus_mode = 2
shortcut = null
group = null
text = "Ready Up"
flat = false
align = 1
[node name="RightPanel" type="Container" parent="Panel/VBoxContainer/HBoxContainer" index="1"]
anchor_left = 0.0
anchor_top = 0.0
anchor_right = 0.0
anchor_bottom = 0.0
margin_left = 491.0
margin_right = 978.0
margin_bottom = 530.0
rect_pivot_offset = Vector2( 0, 0 )
rect_clip_content = false
mouse_filter = 0
mouse_default_cursor_shape = 0
size_flags_horizontal = 3
size_flags_vertical = 1