Re-organize style sheets and add StyleSpace.

This commit is contained in:
Pieter-Jan Briers
2020-04-04 15:10:51 +02:00
parent ff36b2dcc7
commit 5edfa2db34
23 changed files with 279 additions and 72 deletions

View File

@@ -6,6 +6,7 @@ using Content.Client.Interfaces.Parallax;
using Content.Client.Parallax; using Content.Client.Parallax;
using Content.Client.Sandbox; using Content.Client.Sandbox;
using Content.Client.UserInterface; using Content.Client.UserInterface;
using Content.Client.UserInterface.Stylesheets;
using Content.Client.Utility; using Content.Client.Utility;
using Content.Shared.Interfaces; using Content.Shared.Interfaces;
using Robust.Shared.IoC; using Robust.Shared.IoC;
@@ -27,6 +28,7 @@ namespace Content.Client
IoCManager.Register<IModuleManager, ClientModuleManager>(); IoCManager.Register<IModuleManager, ClientModuleManager>();
IoCManager.Register<IClientPreferencesManager, ClientPreferencesManager>(); IoCManager.Register<IClientPreferencesManager, ClientPreferencesManager>();
IoCManager.Register<IItemSlotManager, ItemSlotManager>(); IoCManager.Register<IItemSlotManager, ItemSlotManager>();
IoCManager.Register<IStylesheetManager, StylesheetManager>();
} }
} }
} }

View File

@@ -1,4 +1,4 @@
using System; using System;
using Content.Client.GameObjects.Components.Actor; using Content.Client.GameObjects.Components.Actor;
using Content.Client.Input; using Content.Client.Input;
using Content.Client.Interfaces; using Content.Client.Interfaces;
@@ -8,6 +8,7 @@ using Content.Client.Parallax;
using Content.Client.Sandbox; using Content.Client.Sandbox;
using Content.Client.State; using Content.Client.State;
using Content.Client.UserInterface; using Content.Client.UserInterface;
using Content.Client.UserInterface.Stylesheets;
using Content.Shared.GameObjects.Components; using Content.Shared.GameObjects.Components;
using Content.Shared.GameObjects.Components.Cargo; using Content.Shared.GameObjects.Components.Cargo;
using Content.Shared.GameObjects.Components.Chemistry; using Content.Shared.GameObjects.Components.Chemistry;
@@ -167,10 +168,7 @@ namespace Content.Client
IoCManager.Resolve<IParallaxManager>().LoadParallax(); IoCManager.Resolve<IParallaxManager>().LoadParallax();
IoCManager.Resolve<IBaseClient>().PlayerJoinedServer += SubscribePlayerAttachmentEvents; IoCManager.Resolve<IBaseClient>().PlayerJoinedServer += SubscribePlayerAttachmentEvents;
IoCManager.Resolve<IStylesheetManager>().Initialize();
var stylesheet = new NanoStyle();
IoCManager.Resolve<IUserInterfaceManager>().Stylesheet = stylesheet.Stylesheet;
IoCManager.InjectDependencies(this); IoCManager.InjectDependencies(this);

View File

@@ -5,7 +5,6 @@ using Robust.Client.Interfaces.Input;
using Robust.Client.Interfaces.Placement; using Robust.Client.Interfaces.Placement;
using Robust.Client.Interfaces.ResourceManagement; using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.Interfaces.State; using Robust.Client.Interfaces.State;
using Robust.Client.State.States;
using Robust.Shared.Input; using Robust.Shared.Input;
using Robust.Shared.Interfaces.Configuration; using Robust.Shared.Interfaces.Configuration;
using Robust.Shared.Interfaces.Map; using Robust.Shared.Interfaces.Map;

View File

@@ -1,5 +1,6 @@
using Content.Client.GameObjects.Components.Mobs; using Content.Client.GameObjects.Components.Mobs;
using Content.Client.UserInterface; using Content.Client.UserInterface;
using Content.Client.UserInterface.Stylesheets;
using Robust.Client.Interfaces.GameObjects.Components; using Robust.Client.Interfaces.GameObjects.Components;
using Robust.Client.Interfaces.ResourceManagement; using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.UserInterface; using Robust.Client.UserInterface;
@@ -68,7 +69,7 @@ namespace Content.Client.GameObjects.Components.Actor
(SubText = new Label (SubText = new Label
{ {
SizeFlagsVertical = SizeFlags.None, SizeFlagsVertical = SizeFlags.None,
StyleClasses = {NanoStyle.StyleClassLabelSubText} StyleClasses = {StyleNano.StyleClassLabelSubText}
}) })
} }
} }

View File

@@ -1,4 +1,5 @@
using Content.Client.UserInterface; using Content.Client.UserInterface;
using Content.Client.UserInterface.Stylesheets;
using Content.Client.Utility; using Content.Client.Utility;
using Robust.Shared.Timing; using Robust.Shared.Timing;
using Content.Shared.GameObjects.Components.Chemistry; using Content.Shared.GameObjects.Components.Chemistry;
@@ -49,7 +50,7 @@ namespace Content.Client.GameObjects.Components.Chemistry
public StatusControl(InjectorComponent parent) public StatusControl(InjectorComponent parent)
{ {
_parent = parent; _parent = parent;
_label = new RichTextLabel { StyleClasses = { NanoStyle.StyleClassItemStatus } }; _label = new RichTextLabel { StyleClasses = { StyleNano.StyleClassItemStatus } };
AddChild(_label); AddChild(_label);
parent._uiUpdateNeeded = true; parent._uiUpdateNeeded = true;

View File

@@ -1,5 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using Content.Client.UserInterface; using Content.Client.UserInterface;
using Content.Client.UserInterface.Stylesheets;
using Content.Shared.Chemistry; using Content.Shared.Chemistry;
using Content.Shared.GameObjects.Components.Chemistry; using Content.Shared.GameObjects.Components.Chemistry;
using Robust.Client.Graphics.Drawing; using Robust.Client.Graphics.Drawing;
@@ -218,7 +219,7 @@ namespace Content.Client.GameObjects.Components.Chemistry
new Label new Label
{ {
Text = $"{state.BeakerCurrentVolume}/{state.BeakerMaxVolume}", Text = $"{state.BeakerCurrentVolume}/{state.BeakerMaxVolume}",
StyleClasses = {NanoStyle.StyleClassLabelSecondaryColor} StyleClasses = {StyleNano.StyleClassLabelSecondaryColor}
} }
} }
}); });
@@ -247,12 +248,12 @@ namespace Content.Client.GameObjects.Components.Chemistry
new Label new Label
{ {
Text = $"{name}: ", Text = $"{name}: ",
StyleClasses = {NanoStyle.StyleClassPowerStateGood} StyleClasses = {StyleNano.StyleClassPowerStateGood}
}, },
new Label new Label
{ {
Text = $"{reagent.Quantity}u", Text = $"{reagent.Quantity}u",
StyleClasses = {NanoStyle.StyleClassPowerStateGood} StyleClasses = {StyleNano.StyleClassPowerStateGood}
} }
} }
}); });
@@ -267,7 +268,7 @@ namespace Content.Client.GameObjects.Components.Chemistry
new Label new Label
{ {
Text = $"{reagent.Quantity}u", Text = $"{reagent.Quantity}u",
StyleClasses = {NanoStyle.StyleClassLabelSecondaryColor} StyleClasses = {StyleNano.StyleClassLabelSecondaryColor}
} }
} }
}); });

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Linq; using System.Linq;
using Content.Client.UserInterface; using Content.Client.UserInterface;
using Content.Client.UserInterface.Stylesheets;
using Content.Shared.Preferences.Appearance; using Content.Shared.Preferences.Appearance;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Client.GameObjects.Components.UserInterface; using Robust.Client.GameObjects.Components.UserInterface;
@@ -126,9 +127,9 @@ namespace Content.Client.GameObjects.Components
var vBox = new VBoxContainer(); var vBox = new VBoxContainer();
AddChild(vBox); AddChild(vBox);
vBox.AddChild(_colorSliderR = new ColorSlider(NanoStyle.StyleClassSliderRed)); vBox.AddChild(_colorSliderR = new ColorSlider(StyleNano.StyleClassSliderRed));
vBox.AddChild(_colorSliderG = new ColorSlider(NanoStyle.StyleClassSliderGreen)); vBox.AddChild(_colorSliderG = new ColorSlider(StyleNano.StyleClassSliderGreen));
vBox.AddChild(_colorSliderB = new ColorSlider(NanoStyle.StyleClassSliderBlue)); vBox.AddChild(_colorSliderB = new ColorSlider(StyleNano.StyleClassSliderBlue));
Action colorValueChanged = ColorValueChanged; Action colorValueChanged = ColorValueChanged;
_colorSliderR.OnValueChanged += colorValueChanged; _colorSliderR.OnValueChanged += colorValueChanged;

View File

@@ -1,5 +1,6 @@
using System; using System;
using Content.Client.UserInterface; using Content.Client.UserInterface;
using Content.Client.UserInterface.Stylesheets;
using Content.Shared.GameObjects.Components.Power; using Content.Shared.GameObjects.Components.Power;
using Robust.Client.GameObjects.Components.UserInterface; using Robust.Client.GameObjects.Components.UserInterface;
using Robust.Client.Graphics.Drawing; using Robust.Client.Graphics.Drawing;
@@ -47,15 +48,15 @@ namespace Content.Client.GameObjects.Components.Power
{ {
case ApcExternalPowerState.None: case ApcExternalPowerState.None:
_externalPowerStateLabel.Text = "None"; _externalPowerStateLabel.Text = "None";
_externalPowerStateLabel.SetOnlyStyleClass(NanoStyle.StyleClassPowerStateNone); _externalPowerStateLabel.SetOnlyStyleClass(StyleNano.StyleClassPowerStateNone);
break; break;
case ApcExternalPowerState.Low: case ApcExternalPowerState.Low:
_externalPowerStateLabel.Text = "Low"; _externalPowerStateLabel.Text = "Low";
_externalPowerStateLabel.SetOnlyStyleClass(NanoStyle.StyleClassPowerStateLow); _externalPowerStateLabel.SetOnlyStyleClass(StyleNano.StyleClassPowerStateLow);
break; break;
case ApcExternalPowerState.Good: case ApcExternalPowerState.Good:
_externalPowerStateLabel.Text = "Good"; _externalPowerStateLabel.Text = "Good";
_externalPowerStateLabel.SetOnlyStyleClass(NanoStyle.StyleClassPowerStateGood); _externalPowerStateLabel.SetOnlyStyleClass(StyleNano.StyleClassPowerStateGood);
break; break;
default: default:
throw new ArgumentOutOfRangeException(); throw new ArgumentOutOfRangeException();
@@ -140,7 +141,7 @@ namespace Content.Client.GameObjects.Components.Power
var externalStatus = new HBoxContainer(); var externalStatus = new HBoxContainer();
var externalStatusLabel = new Label {Text = "External Power: "}; var externalStatusLabel = new Label {Text = "External Power: "};
ExternalPowerStateLabel = new Label {Text = "Good"}; ExternalPowerStateLabel = new Label {Text = "Good"};
ExternalPowerStateLabel.SetOnlyStyleClass(NanoStyle.StyleClassPowerStateGood); ExternalPowerStateLabel.SetOnlyStyleClass(StyleNano.StyleClassPowerStateGood);
externalStatus.AddChild(externalStatusLabel); externalStatus.AddChild(externalStatusLabel);
externalStatus.AddChild(ExternalPowerStateLabel); externalStatus.AddChild(ExternalPowerStateLabel);
rows.AddChild(externalStatus); rows.AddChild(externalStatus);

View File

@@ -1,4 +1,5 @@
using Content.Client.UserInterface; using Content.Client.UserInterface;
using Content.Client.UserInterface.Stylesheets;
using Content.Client.Utility; using Content.Client.Utility;
using Content.Shared.GameObjects.Components; using Content.Shared.GameObjects.Components;
using Robust.Client.UserInterface; using Robust.Client.UserInterface;
@@ -38,7 +39,7 @@ namespace Content.Client.GameObjects.Components
public StatusControl(StackComponent parent) public StatusControl(StackComponent parent)
{ {
_parent = parent; _parent = parent;
_label = new RichTextLabel {StyleClasses = {NanoStyle.StyleClassItemStatus}}; _label = new RichTextLabel {StyleClasses = {StyleNano.StyleClassItemStatus}};
AddChild(_label); AddChild(_label);
parent._uiUpdateNeeded = true; parent._uiUpdateNeeded = true;

View File

@@ -1,6 +1,7 @@
using System; using System;
using Content.Client.Animations; using Content.Client.Animations;
using Content.Client.UserInterface; using Content.Client.UserInterface;
using Content.Client.UserInterface.Stylesheets;
using Content.Client.Utility; using Content.Client.Utility;
using Content.Shared.GameObjects; using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components.Weapons.Ranged; using Content.Shared.GameObjects.Components.Weapons.Ranged;
@@ -174,7 +175,7 @@ namespace Content.Client.GameObjects.Components.Weapons.Ranged
(_noMagazineLabel = new Label (_noMagazineLabel = new Label
{ {
Text = "No Magazine!", Text = "No Magazine!",
StyleClasses = {NanoStyle.StyleClassItemStatus} StyleClasses = {StyleNano.StyleClassItemStatus}
}) })
} }
}, },

View File

@@ -1,5 +1,6 @@
using System; using System;
using Content.Client.UserInterface; using Content.Client.UserInterface;
using Content.Client.UserInterface.Stylesheets;
using Content.Client.Utility; using Content.Client.Utility;
using Content.Shared.GameObjects; using Content.Shared.GameObjects;
using Content.Shared.GameObjects.Components; using Content.Shared.GameObjects.Components;
@@ -46,7 +47,7 @@ namespace Content.Client.GameObjects.Components
public StatusControl(WelderComponent parent) public StatusControl(WelderComponent parent)
{ {
_parent = parent; _parent = parent;
_label = new RichTextLabel {StyleClasses = {NanoStyle.StyleClassItemStatus}}; _label = new RichTextLabel {StyleClasses = {StyleNano.StyleClassItemStatus}};
AddChild(_label); AddChild(_label);
parent._uiUpdateNeeded = true; parent._uiUpdateNeeded = true;

View File

@@ -1,5 +1,5 @@
using Content.Client.GameObjects.Components.Instruments; using Content.Client.GameObjects.Components.Instruments;
using Content.Client.UserInterface; using Content.Client.UserInterface.Stylesheets;
using Robust.Client.Audio.Midi; using Robust.Client.Audio.Midi;
using Robust.Client.Graphics.Drawing; using Robust.Client.Graphics.Drawing;
using Robust.Client.Interfaces.UserInterface; using Robust.Client.Interfaces.UserInterface;
@@ -148,7 +148,7 @@ namespace Content.Client.Instruments
Align = Label.AlignMode.Center, Align = Label.AlignMode.Center,
SizeFlagsVertical = SizeFlags.ShrinkCenter, SizeFlagsVertical = SizeFlags.ShrinkCenter,
SizeFlagsHorizontal = SizeFlags.ShrinkCenter, SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
StyleClasses = {NanoStyle.StyleClassLabelBig}, StyleClasses = {StyleNano.StyleClassLabelBig},
Text = Loc.GetString("MIDI support is currently\nnot available on your platform.") Text = Loc.GetString("MIDI support is currently\nnot available on your platform.")
} }
} }

View File

@@ -9,6 +9,7 @@ using Robust.Shared.Localization;
using Robust.Shared.Maths; using Robust.Shared.Maths;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Content.Client.UserInterface.Stylesheets;
namespace Content.Client.UserInterface.Cargo namespace Content.Client.UserInterface.Cargo
{ {
@@ -57,7 +58,7 @@ namespace Content.Client.UserInterface.Cargo
var accountName = new HBoxContainer(); var accountName = new HBoxContainer();
var accountNameLabel = new Label { var accountNameLabel = new Label {
Text = _loc.GetString("Account Name: "), Text = _loc.GetString("Account Name: "),
StyleClasses = { NanoStyle.StyleClassLabelKeyText } StyleClasses = { StyleNano.StyleClassLabelKeyText }
}; };
_accountNameLabel = new Label { _accountNameLabel = new Label {
Text = "None" //Owner.Bank.Account.Name Text = "None" //Owner.Bank.Account.Name
@@ -70,7 +71,7 @@ namespace Content.Client.UserInterface.Cargo
var pointsLabel = new Label var pointsLabel = new Label
{ {
Text = _loc.GetString("Points: "), Text = _loc.GetString("Points: "),
StyleClasses = { NanoStyle.StyleClassLabelKeyText } StyleClasses = { StyleNano.StyleClassLabelKeyText }
}; };
_pointsLabel = new Label _pointsLabel = new Label
{ {
@@ -84,7 +85,7 @@ namespace Content.Client.UserInterface.Cargo
var shuttleStatusLabel = new Label var shuttleStatusLabel = new Label
{ {
Text = _loc.GetString("Shuttle Status: "), Text = _loc.GetString("Shuttle Status: "),
StyleClasses = { NanoStyle.StyleClassLabelKeyText } StyleClasses = { StyleNano.StyleClassLabelKeyText }
}; };
_shuttleStatusLabel = new Label _shuttleStatusLabel = new Label
{ {
@@ -410,13 +411,13 @@ namespace Content.Client.UserInterface.Cargo
ProductName = new Label ProductName = new Label
{ {
SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsHorizontal = SizeFlags.FillExpand,
StyleClasses = { NanoStyle.StyleClassLabelSubText }, StyleClasses = { StyleNano.StyleClassLabelSubText },
ClipText = true ClipText = true
}; };
Description = new Label Description = new Label
{ {
SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsHorizontal = SizeFlags.FillExpand,
StyleClasses = { NanoStyle.StyleClassLabelSubText }, StyleClasses = { StyleNano.StyleClassLabelSubText },
ClipText = true ClipText = true
}; };
vBox.AddChild(ProductName); vBox.AddChild(ProductName);
@@ -426,14 +427,14 @@ namespace Content.Client.UserInterface.Cargo
Approve = new Button Approve = new Button
{ {
Text = "Approve", Text = "Approve",
StyleClasses = { NanoStyle.StyleClassLabelSubText } StyleClasses = { StyleNano.StyleClassLabelSubText }
}; };
hBox.AddChild(Approve); hBox.AddChild(Approve);
Cancel = new Button Cancel = new Button
{ {
Text = "Cancel", Text = "Cancel",
StyleClasses = { NanoStyle.StyleClassLabelSubText } StyleClasses = { StyleNano.StyleClassLabelSubText }
}; };
hBox.AddChild(Cancel); hBox.AddChild(Cancel);

View File

@@ -1,6 +1,7 @@
using System.Linq; using System.Linq;
using Content.Client.GameObjects.Components.Mobs; using Content.Client.GameObjects.Components.Mobs;
using Content.Client.Interfaces; using Content.Client.Interfaces;
using Content.Client.UserInterface.Stylesheets;
using Content.Client.Utility; using Content.Client.Utility;
using Content.Shared.Jobs; using Content.Shared.Jobs;
using Content.Shared.Preferences; using Content.Shared.Preferences;
@@ -67,7 +68,7 @@ namespace Content.Client.UserInterface
{ {
SizeFlagsHorizontal = SizeFlags.Expand | SizeFlags.ShrinkEnd, SizeFlagsHorizontal = SizeFlags.Expand | SizeFlags.ShrinkEnd,
Text = Loc.GetString("Save and close"), Text = Loc.GetString("Save and close"),
StyleClasses = {NanoStyle.StyleClassButtonBig} StyleClasses = {StyleNano.StyleClassButtonBig}
}; };
var topHBox = new HBoxContainer var topHBox = new HBoxContainer
@@ -83,7 +84,7 @@ namespace Content.Client.UserInterface
new Label new Label
{ {
Text = Loc.GetString("Character Setup"), Text = Loc.GetString("Character Setup"),
StyleClasses = {NanoStyle.StyleClassLabelHeadingBigger}, StyleClasses = {StyleNano.StyleClassLabelHeadingBigger},
VAlign = Label.VAlignMode.Center, VAlign = Label.VAlignMode.Center,
SizeFlagsHorizontal = SizeFlags.Expand | SizeFlags.ShrinkCenter SizeFlagsHorizontal = SizeFlags.Expand | SizeFlags.ShrinkCenter
} }
@@ -99,7 +100,7 @@ namespace Content.Client.UserInterface
{ {
PanelOverride = new StyleBoxFlat PanelOverride = new StyleBoxFlat
{ {
BackgroundColor = NanoStyle.NanoGold, BackgroundColor = StyleNano.NanoGold,
ContentMarginTopOverride = 2 ContentMarginTopOverride = 2
} }
}); });
@@ -146,7 +147,7 @@ namespace Content.Client.UserInterface
hBox.AddChild(new PanelContainer hBox.AddChild(new PanelContainer
{ {
PanelOverride = new StyleBoxFlat {BackgroundColor = NanoStyle.NanoGold}, PanelOverride = new StyleBoxFlat {BackgroundColor = StyleNano.NanoGold},
CustomMinimumSize = (2, 0) CustomMinimumSize = (2, 0)
}); });
_humanoidProfileEditor = new HumanoidProfileEditor(preferencesManager, prototypeManager); _humanoidProfileEditor = new HumanoidProfileEditor(preferencesManager, prototypeManager);

View File

@@ -0,0 +1,14 @@
using Content.Client.UserInterface.Stylesheets;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
namespace Content.Client.UserInterface.Controls
{
public sealed class HighDivider : Control
{
public HighDivider()
{
Children.Add(new PanelContainer {StyleClasses = {StyleBase.ClassHighDivider}});
}
}
}

View File

@@ -1,5 +1,6 @@
using System.Collections.Generic; using System.Collections.Generic;
using Content.Client.GameObjects.Components; using Content.Client.GameObjects.Components;
using Content.Client.UserInterface.Stylesheets;
using Content.Client.Utility; using Content.Client.Utility;
using Robust.Client.Graphics.Drawing; using Robust.Client.Graphics.Drawing;
using Robust.Client.UserInterface; using Robust.Client.UserInterface;
@@ -57,7 +58,7 @@ namespace Content.Client.UserInterface
(_itemNameLabel = new Label (_itemNameLabel = new Label
{ {
ClipText = true, ClipText = true,
StyleClasses = {NanoStyle.StyleClassItemStatus} StyleClasses = {StyleNano.StyleClassItemStatus}
}) })
} }
} }

View File

@@ -1,5 +1,6 @@
using Content.Client.Chat; using Content.Client.Chat;
using Content.Client.Interfaces; using Content.Client.Interfaces;
using Content.Client.UserInterface.Stylesheets;
using Content.Client.Utility; using Content.Client.Utility;
using Robust.Client.Graphics.Drawing; using Robust.Client.Graphics.Drawing;
using Robust.Client.Interfaces.ResourceManagement; using Robust.Client.Interfaces.ResourceManagement;
@@ -69,7 +70,7 @@ namespace Content.Client.UserInterface
new Label new Label
{ {
Text = Loc.GetString("Lobby"), Text = Loc.GetString("Lobby"),
StyleClasses = {NanoStyle.StyleClassLabelHeadingBigger}, StyleClasses = {StyleNano.StyleClassLabelHeadingBigger},
/*MarginBottom = 40, /*MarginBottom = 40,
MarginLeft = 8,*/ MarginLeft = 8,*/
VAlign = Label.VAlignMode.Center VAlign = Label.VAlignMode.Center
@@ -78,7 +79,7 @@ namespace Content.Client.UserInterface
}, },
(ServerName = new Label (ServerName = new Label
{ {
StyleClasses = {NanoStyle.StyleClassLabelHeadingBigger}, StyleClasses = {StyleNano.StyleClassLabelHeadingBigger},
/*MarginBottom = 40, /*MarginBottom = 40,
GrowHorizontal = GrowDirection.Both,*/ GrowHorizontal = GrowDirection.Both,*/
VAlign = Label.VAlignMode.Center, VAlign = Label.VAlignMode.Center,
@@ -88,7 +89,7 @@ namespace Content.Client.UserInterface
{ {
SizeFlagsHorizontal = SizeFlags.ShrinkEnd, SizeFlagsHorizontal = SizeFlags.ShrinkEnd,
Text = Loc.GetString("Leave"), Text = Loc.GetString("Leave"),
StyleClasses = {NanoStyle.StyleClassButtonBig}, StyleClasses = {StyleNano.StyleClassButtonBig},
//GrowHorizontal = GrowDirection.Begin //GrowHorizontal = GrowDirection.Begin
}) })
} }
@@ -100,7 +101,7 @@ namespace Content.Client.UserInterface
{ {
PanelOverride = new StyleBoxFlat PanelOverride = new StyleBoxFlat
{ {
BackgroundColor = NanoStyle.NanoGold, BackgroundColor = StyleNano.NanoGold,
ContentMarginTopOverride = 2 ContentMarginTopOverride = 2
}, },
}); });
@@ -146,20 +147,20 @@ namespace Content.Client.UserInterface
(ObserveButton = new Button (ObserveButton = new Button
{ {
Text = Loc.GetString("Observe"), Text = Loc.GetString("Observe"),
StyleClasses = {NanoStyle.StyleClassButtonBig} StyleClasses = {StyleNano.StyleClassButtonBig}
}), }),
(StartTime = new Label (StartTime = new Label
{ {
SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsHorizontal = SizeFlags.FillExpand,
Align = Label.AlignMode.Right, Align = Label.AlignMode.Right,
FontColorOverride = Color.DarkGray, FontColorOverride = Color.DarkGray,
StyleClasses = {NanoStyle.StyleClassLabelBig} StyleClasses = {StyleNano.StyleClassLabelBig}
}), }),
(ReadyButton = new Button (ReadyButton = new Button
{ {
ToggleMode = true, ToggleMode = true,
Text = Loc.GetString("Ready Up"), Text = Loc.GetString("Ready Up"),
StyleClasses = {NanoStyle.StyleClassButtonBig} StyleClasses = {StyleNano.StyleClassButtonBig}
}), }),
} }
} }
@@ -188,7 +189,7 @@ namespace Content.Client.UserInterface
hBox.AddChild(new PanelContainer hBox.AddChild(new PanelContainer
{ {
PanelOverride = new StyleBoxFlat {BackgroundColor = NanoStyle.NanoGold}, CustomMinimumSize = (2, 0) PanelOverride = new StyleBoxFlat {BackgroundColor = StyleNano.NanoGold}, CustomMinimumSize = (2, 0)
}); });
{ {

View File

@@ -1,3 +1,4 @@
using Content.Client.UserInterface.Stylesheets;
using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.Controls;
using Robust.Shared.Maths; using Robust.Shared.Maths;
@@ -14,7 +15,7 @@ namespace Content.Client.UserInterface
{ {
Children = {(_label = new Label Children = {(_label = new Label
{ {
StyleClasses = {NanoStyle.StyleClassLabelHeading} StyleClasses = {StyleNano.StyleClassLabelHeading}
})} })}
}; };
AddChild(_panel); AddChild(_panel);

View File

@@ -0,0 +1,12 @@
using Robust.Client.UserInterface;
namespace Content.Client.UserInterface.Stylesheets
{
public interface IStylesheetManager
{
Stylesheet SheetNano { get; }
Stylesheet SheetSpace { get; }
void Initialize();
}
}

View File

@@ -0,0 +1,47 @@
using Content.Client.Utility;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.UserInterface;
namespace Content.Client.UserInterface.Stylesheets
{
public abstract class StyleBase
{
public const string ClassHighDivider = "HighDivider";
public const string StyleClassLabelHeading = "LabelHeading";
public const string StyleClassLabelSubText = "LabelSubText";
public abstract Stylesheet Stylesheet { get; }
protected StyleRule[] BaseRules { get; }
protected StyleBoxTexture BaseButton { get; }
protected StyleBase(IResourceCache resCache)
{
var notoSans12 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 12);
// Button styles.
var buttonTex = resCache.GetTexture("/Nano/button.svg.96dpi.png");
BaseButton = new StyleBoxTexture
{
Texture = buttonTex,
};
BaseButton.SetPatchMargin(StyleBox.Margin.All, 10);
BaseButton.SetPadding(StyleBox.Margin.All, 1);
BaseButton.SetContentMarginOverride(StyleBox.Margin.Vertical, 2);
BaseButton.SetContentMarginOverride(StyleBox.Margin.Horizontal, 14);
BaseRules = new[]
{
// Default font.
new StyleRule(
new SelectorElement(null, null, null, null),
new[]
{
new StyleProperty("font", notoSans12),
}),
};
}
}
}

View File

@@ -1,29 +1,29 @@
using Content.Client.GameObjects.EntitySystems; using System.Linq;
using Content.Client.GameObjects.EntitySystems;
using Content.Client.Utility; using Content.Client.Utility;
using Robust.Client.Graphics.Drawing; using Robust.Client.Graphics.Drawing;
using Robust.Client.Interfaces.ResourceManagement; using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.UserInterface; using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls; using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.IoC;
using Robust.Shared.Maths; using Robust.Shared.Maths;
namespace Content.Client.UserInterface namespace Content.Client.UserInterface.Stylesheets
{ {
public sealed class NanoStyle public sealed class StyleNano : StyleBase
{ {
public const string StyleClassSliderRed = "Red"; public const string StyleClassSliderRed = "Red";
public const string StyleClassSliderGreen = "Green"; public const string StyleClassSliderGreen = "Green";
public const string StyleClassSliderBlue = "Blue"; public const string StyleClassSliderBlue = "Blue";
public const string StyleClassLabelHeading = "LabelHeading";
public const string StyleClassLabelHeadingBigger = "LabelHeadingBigger"; public const string StyleClassLabelHeadingBigger = "LabelHeadingBigger";
public const string StyleClassLabelSubText = "LabelSubText";
public const string StyleClassLabelKeyText = "LabelKeyText"; public const string StyleClassLabelKeyText = "LabelKeyText";
public const string StyleClassLabelSecondaryColor = "LabelSecondaryColor"; public const string StyleClassLabelSecondaryColor = "LabelSecondaryColor";
public const string StyleClassLabelBig = "LabelBig"; public const string StyleClassLabelBig = "LabelBig";
public const string StyleClassButtonBig = "ButtonBig"; public const string StyleClassButtonBig = "ButtonBig";
public static readonly Color NanoGold = Color.FromHex("#A88B5E"); public static readonly Color NanoGold = Color.FromHex("#A88B5E");
public static readonly Color ButtonColorDefault = Color.FromHex("#464966"); public static readonly Color ButtonColorDefault = Color.FromHex("#464966");
public static readonly Color ButtonColorHovered = Color.FromHex("#575b7f"); public static readonly Color ButtonColorHovered = Color.FromHex("#575b7f");
public static readonly Color ButtonColorPressed = Color.FromHex("#3e6c45"); public static readonly Color ButtonColorPressed = Color.FromHex("#3e6c45");
@@ -36,12 +36,10 @@ namespace Content.Client.UserInterface
public const string StyleClassItemStatus = "ItemStatus"; public const string StyleClassItemStatus = "ItemStatus";
public Stylesheet Stylesheet { get; } public override Stylesheet Stylesheet { get; }
public NanoStyle() public StyleNano(IResourceCache resCache) : base(resCache)
{ {
var resCache = IoCManager.Resolve<IResourceCache>();
var notoSans8 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 8);
var notoSans10 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 10); var notoSans10 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 10);
var notoSans12 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 12); var notoSans12 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 12);
var notoSansBold12 = resCache.GetFont("/Nano/NotoSans/NotoSans-Bold.ttf", 12); var notoSansBold12 = resCache.GetFont("/Nano/NotoSans/NotoSans-Bold.ttf", 12);
@@ -69,16 +67,10 @@ namespace Content.Client.UserInterface
var textureInvertedTriangle = resCache.GetTexture("/Nano/inverted_triangle.svg.png"); var textureInvertedTriangle = resCache.GetTexture("/Nano/inverted_triangle.svg.png");
// Button styles. // Button styles.
var buttonTex = resCache.GetTexture("/Nano/button.svg.96dpi.png"); var buttonNormal = new StyleBoxTexture(BaseButton)
var buttonNormal = new StyleBoxTexture
{ {
Texture = buttonTex,
Modulate = ButtonColorDefault Modulate = ButtonColorDefault
}; };
buttonNormal.SetPatchMargin(StyleBox.Margin.All, 10);
buttonNormal.SetPadding(StyleBox.Margin.All, 1);
buttonNormal.SetContentMarginOverride(StyleBox.Margin.Vertical, 2);
buttonNormal.SetContentMarginOverride(StyleBox.Margin.Horizontal, 14);
var buttonHover = new StyleBoxTexture(buttonNormal) var buttonHover = new StyleBoxTexture(buttonNormal)
{ {
@@ -248,16 +240,8 @@ namespace Content.Client.UserInterface
var sliderFillRed = new StyleBoxTexture(sliderFillBox) {Modulate = Color.Red}; var sliderFillRed = new StyleBoxTexture(sliderFillBox) {Modulate = Color.Red};
var sliderFillBlue = new StyleBoxTexture(sliderFillBox) {Modulate = Color.Blue}; var sliderFillBlue = new StyleBoxTexture(sliderFillBox) {Modulate = Color.Blue};
Stylesheet = new Stylesheet(new[] Stylesheet = new Stylesheet(BaseRules.Concat(new[]
{ {
// Default font.
new StyleRule(
new SelectorElement(null, null, null, null),
new[]
{
new StyleProperty("font", notoSans12),
}),
// Window title. // Window title.
new StyleRule( new StyleRule(
new SelectorElement(typeof(Label), new[] {SS14Window.StyleClassWindowTitle}, null, null), new SelectorElement(typeof(Label), new[] {SS14Window.StyleClassWindowTitle}, null, null),
@@ -721,7 +705,12 @@ namespace Content.Client.UserInterface
{ {
new StyleProperty(Label.StylePropertyAlignMode, Label.AlignMode.Center), new StyleProperty(Label.StylePropertyAlignMode, Label.AlignMode.Center),
}), }),
});
new StyleRule(new SelectorElement(typeof(PanelContainer), new []{ ClassHighDivider}, null, null), new []
{
new StyleProperty(PanelContainer.StylePropertyPanel, new StyleBoxFlat { BackgroundColor = NanoGold, ContentMarginBottomOverride = 2, ContentMarginLeftOverride = 2}),
})
}).ToList());
} }
} }
} }

View File

@@ -0,0 +1,107 @@
using System.Linq;
using Content.Client.Utility;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Shared.Maths;
namespace Content.Client.UserInterface.Stylesheets
{
public class StyleSpace : StyleBase
{
public static readonly Color SpaceRed = Color.FromHex("#9b2236");
public static readonly Color ButtonColorDefault = Color.FromHex("#464966");
public static readonly Color ButtonColorHovered = Color.FromHex("#575b7f");
public static readonly Color ButtonColorPressed = Color.FromHex("#3e6c45");
public static readonly Color ButtonColorDisabled = Color.FromHex("#30313c");
public override Stylesheet Stylesheet { get; }
public StyleSpace(IResourceCache resCache) : base(resCache)
{
var notoSans10 = resCache.GetFont("/Nano/NotoSans/NotoSans-Regular.ttf", 10);
var notoSansBold16 = resCache.GetFont("/Nano/NotoSans/NotoSans-Bold.ttf", 16);
// Button styles.
var buttonNormal = new StyleBoxTexture(BaseButton)
{
Modulate = ButtonColorDefault
};
var buttonHover = new StyleBoxTexture(buttonNormal)
{
Modulate = ButtonColorHovered
};
var buttonPressed = new StyleBoxTexture(buttonNormal)
{
Modulate = ButtonColorPressed
};
var buttonDisabled = new StyleBoxTexture(buttonNormal)
{
Modulate = ButtonColorDisabled
};
Stylesheet = new Stylesheet(BaseRules.Concat(new StyleRule[]
{
// Big Label
new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassLabelHeading}, null, null), new[]
{
new StyleProperty(Label.StylePropertyFont, notoSansBold16),
new StyleProperty(Label.StylePropertyFontColor, SpaceRed),
}),
// Small Label
new StyleRule(new SelectorElement(typeof(Label), new[] {StyleClassLabelSubText}, null, null), new[]
{
new StyleProperty(Label.StylePropertyFont, notoSans10),
new StyleProperty(Label.StylePropertyFontColor, Color.DarkGray),
}),
new StyleRule(new SelectorElement(typeof(PanelContainer), new[] {ClassHighDivider}, null, null), new[]
{
new StyleProperty(PanelContainer.StylePropertyPanel,
new StyleBoxFlat
{
BackgroundColor = SpaceRed, ContentMarginBottomOverride = 2, ContentMarginLeftOverride = 2
}),
}),
// Regular buttons!
new StyleRule(new SelectorElement(typeof(ContainerButton), new[] { ContainerButton.StyleClassButton }, null, new[] {ContainerButton.StylePseudoClassNormal}), new[]
{
new StyleProperty(ContainerButton.StylePropertyStyleBox, buttonNormal),
}),
new StyleRule(new SelectorElement(typeof(ContainerButton), new[] { ContainerButton.StyleClassButton }, null, new[] {ContainerButton.StylePseudoClassHover}), new[]
{
new StyleProperty(ContainerButton.StylePropertyStyleBox, buttonHover),
}),
new StyleRule(new SelectorElement(typeof(ContainerButton), new[] { ContainerButton.StyleClassButton }, null, new[] {ContainerButton.StylePseudoClassPressed}), new[]
{
new StyleProperty(ContainerButton.StylePropertyStyleBox, buttonPressed),
}),
new StyleRule(new SelectorElement(typeof(ContainerButton), new[] { ContainerButton.StyleClassButton }, null, new[] {ContainerButton.StylePseudoClassDisabled}), new[]
{
new StyleProperty(ContainerButton.StylePropertyStyleBox, buttonDisabled),
}),
new StyleRule(new SelectorElement(typeof(Label), new[] { Button.StyleClassButton }, null, null), new[]
{
new StyleProperty(Label.StylePropertyAlignMode, Label.AlignMode.Center),
}),
new StyleRule(new SelectorChild(
new SelectorElement(typeof(Button), null, null, new[] {ContainerButton.StylePseudoClassDisabled}),
new SelectorElement(typeof(Label), null, null, null)),
new[]
{
new StyleProperty("font-color", Color.FromHex("#E5E5E581")),
}),
}).ToList());
}
}
}

View File

@@ -0,0 +1,26 @@
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.Interfaces.UserInterface;
using Robust.Client.UserInterface;
using Robust.Shared.IoC;
namespace Content.Client.UserInterface.Stylesheets
{
public sealed class StylesheetManager : IStylesheetManager
{
#pragma warning disable 649
[Dependency] private readonly IUserInterfaceManager _userInterfaceManager;
[Dependency] private readonly IResourceCache _resourceCache;
#pragma warning restore 649
public Stylesheet SheetNano { get; private set; }
public Stylesheet SheetSpace { get; private set; }
public void Initialize()
{
SheetNano = new StyleNano(_resourceCache).Stylesheet;
SheetSpace = new StyleSpace(_resourceCache).Stylesheet;
_userInterfaceManager.Stylesheet = SheetNano;
}
}
}