UI system refactor; submodule update.

This commit is contained in:
Pieter-Jan Briers
2019-08-14 22:04:35 +02:00
parent 6be135a137
commit 9cb37a6376
12 changed files with 150 additions and 199 deletions

View File

@@ -24,12 +24,12 @@ namespace Content.Client.Chat
private ILocalizationManager localize = IoCManager.Resolve<ILocalizationManager>();
public LineEdit Input { get; private set; }
public OutputPanel contents;
public OutputPanel Contents { get; }
// Buttons for filtering
public Button AllButton;
public Button LocalButton;
public Button OOCButton;
public Button AllButton { get; }
public Button LocalButton { get; }
public Button OOCButton { get; }
/// <summary>
/// Index while cycling through the input history. -1 means not going through history.
@@ -48,11 +48,9 @@ namespace Content.Client.Chat
public bool ReleaseFocusOnEnter { get; set; } = true;
protected override void Initialize()
public ChatBox()
{
base.Initialize();
MarginLeft = -475.0f;
MarginLeft = -475.0f;
MarginTop = 10.0f;
MarginRight = -10.0f;
MarginBottom = 235.0f;
@@ -79,8 +77,8 @@ namespace Content.Client.Chat
MarginLeftOverride = 4, MarginRightOverride = 4,
SizeFlagsVertical = SizeFlags.FillExpand
};
contents = new OutputPanel();
contentMargin.AddChild(contents);
Contents = new OutputPanel();
contentMargin.AddChild(Contents);
vBox.AddChild(contentMargin);
Input = new LineEdit();
@@ -176,18 +174,6 @@ namespace Content.Client.Chat
}
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
if (disposing)
{
TextSubmitted = null;
Input = null;
contents = null;
}
}
public event TextSubmitHandler TextSubmitted;
public event FilterToggledHandler FilterToggled;
@@ -203,7 +189,7 @@ namespace Content.Client.Chat
formatted.PushColor(color);
formatted.AddText(message);
formatted.Pop();
contents.AddMessage(formatted);
Contents.AddMessage(formatted);
}
private void Input_OnTextEntered(LineEdit.LineEditEventArgs args)

View File

@@ -1,7 +1,6 @@
using System.Collections.Generic;
using Content.Client.Interfaces.Chat;
using Content.Shared.Chat;
using Robust.Client;
using Robust.Client.Console;
using Robust.Client.Interfaces.Graphics.ClientEye;
using Robust.Client.Interfaces.UserInterface;
@@ -274,7 +273,7 @@ namespace Content.Client.Chat
private void RepopulateChat(IEnumerable<StoredChatMessage> filteredMessages)
{
_currentChatBox.contents.Clear();
_currentChatBox.Contents.Clear();
foreach (var msg in filteredMessages)
{

View File

@@ -1,5 +1,4 @@
using Content.Client.Interfaces.Chat;
using Robust.Client;
using Robust.Client.Interfaces.Graphics.ClientEye;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
@@ -32,14 +31,14 @@ namespace Content.Client.Chat
private readonly IEntity _senderEntity;
private readonly IChatManager _chatManager;
private Control _panel;
private readonly Control _panel;
private float _timeLeft = TotalTime;
public float VerticalOffset { get; set; }
private float _verticalOffsetAchieved;
public float ContentHeight { get; }
public float ContentHeight { get; private set; }
public SpeechBubble(string text, IEntity senderEntity, IEyeManager eyeManager, IChatManager chatManager)
{
@@ -68,6 +67,8 @@ namespace Content.Client.Chat
AddChild(_panel);
ForceRunStyleUpdate();
_panel.Size = _panel.CombinedMinimumSize;
ContentHeight = _panel.Height;
Size = (_panel.Width, 0);

View File

@@ -85,14 +85,11 @@ namespace Content.Client
private float _timeLeft;
public Vector2 InitialPos { get; set; }
protected override void Initialize()
public PopupLabel()
{
base.Initialize();
ShadowOffsetXOverride = 1;
ShadowOffsetYOverride = 1;
FontColorShadowOverride = Color.Black;
}
public void Update(FrameEventArgs eventArgs)

View File

@@ -3,62 +3,50 @@ using System.Collections.Generic;
using System.Linq;
using Content.Client.GameObjects.Components.Construction;
using Content.Shared.Construction;
using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.Interfaces.GameObjects;
using Robust.Client.Interfaces.Graphics;
using Robust.Client.Interfaces.Placement;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.Placement;
using Robust.Client.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.Utility;
using Robust.Shared.Enums;
using Robust.Shared.Interfaces.GameObjects.Components;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
namespace Content.Client.Construction
{
public class ConstructionMenu : SS14Window
{
#pragma warning disable CS0649
[Dependency]
readonly IPrototypeManager PrototypeManager;
[Dependency]
readonly IResourceCache ResourceCache;
[Dependency] readonly IPrototypeManager PrototypeManager;
[Dependency] readonly IResourceCache ResourceCache;
#pragma warning restore
public ConstructorComponent Owner { get; set; }
Button BuildButton;
Button EraseButton;
LineEdit SearchBar;
Tree RecipeList;
TextureRect InfoIcon;
Label InfoLabel;
ItemList StepList;
private readonly Button BuildButton;
private readonly Button EraseButton;
private readonly LineEdit SearchBar;
private readonly Tree RecipeList;
private readonly TextureRect InfoIcon;
private readonly Label InfoLabel;
private readonly ItemList StepList;
private CategoryNode RootCategory;
CategoryNode RootCategory;
// This list is flattened in such a way that the top most deepest category is first.
List<CategoryNode> FlattenedCategories;
PlacementManager Placement;
private List<CategoryNode> FlattenedCategories;
private readonly PlacementManager Placement;
public ConstructionMenu()
{
Size = new Vector2(500.0f, 350.0f);
}
Size = (500, 350);
protected override void Initialize()
{
base.Initialize();
IoCManager.InjectDependencies(this);
Placement = (PlacementManager)IoCManager.Resolve<IPlacementManager>();
Placement = (PlacementManager) IoCManager.Resolve<IPlacementManager>();
Placement.PlacementCanceled += OnPlacementCanceled;
Title = "Construction";
@@ -66,18 +54,18 @@ namespace Content.Client.Construction
var hSplitContainer = new HSplitContainer();
// Left side
var recipes = new VBoxContainer("Recipes") {CustomMinimumSize = new Vector2(150.0f, 0.0f)};
SearchBar = new LineEdit("Search") {PlaceHolder = "Search"};
RecipeList = new Tree("Tree") {SizeFlagsVertical = SizeFlags.FillExpand, HideRoot = true};
var recipes = new VBoxContainer {CustomMinimumSize = new Vector2(150.0f, 0.0f)};
SearchBar = new LineEdit {PlaceHolder = "Search"};
RecipeList = new Tree {SizeFlagsVertical = SizeFlags.FillExpand, HideRoot = true};
recipes.AddChild(SearchBar);
recipes.AddChild(RecipeList);
hSplitContainer.AddChild(recipes);
// Right side
var guide = new VBoxContainer("Guide");
var info = new HBoxContainer("Info");
InfoIcon = new TextureRect("TextureRect");
InfoLabel = new Label("Label")
var guide = new VBoxContainer();
var info = new HBoxContainer();
InfoIcon = new TextureRect();
InfoLabel = new Label
{
SizeFlagsHorizontal = SizeFlags.FillExpand, SizeFlagsVertical = SizeFlags.ShrinkCenter
};
@@ -85,7 +73,7 @@ namespace Content.Client.Construction
info.AddChild(InfoLabel);
guide.AddChild(info);
var stepsLabel = new Label("Label")
var stepsLabel = new Label
{
SizeFlagsHorizontal = SizeFlags.ShrinkCenter,
SizeFlagsVertical = SizeFlags.ShrinkCenter,
@@ -93,14 +81,14 @@ namespace Content.Client.Construction
};
guide.AddChild(stepsLabel);
StepList = new ItemList("StepsList")
StepList = new ItemList
{
SizeFlagsVertical = SizeFlags.FillExpand, SelectMode = ItemList.ItemListSelectMode.None
};
guide.AddChild(StepList);
var buttonsContainer = new HBoxContainer("Buttons");
BuildButton = new Button("BuildButton")
var buttonsContainer = new HBoxContainer();
BuildButton = new Button
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
TextAlign = Button.AlignMode.Center,
@@ -108,7 +96,7 @@ namespace Content.Client.Construction
Disabled = true,
ToggleMode = false
};
EraseButton = new Button("EraseButton")
EraseButton = new Button
{
TextAlign = Button.AlignMode.Center, Text = "Clear Ghosts", ToggleMode = true
};
@@ -140,7 +128,7 @@ namespace Content.Client.Construction
void OnItemSelected()
{
var prototype = (ConstructionPrototype)RecipeList.Selected.Metadata;
var prototype = (ConstructionPrototype) RecipeList.Selected.Metadata;
if (prototype == null)
{
@@ -163,6 +151,7 @@ namespace Content.Client.Construction
{
continue;
}
Texture icon;
string text;
switch (forward)
@@ -171,20 +160,24 @@ namespace Content.Client.Construction
switch (mat.Material)
{
case ConstructionStepMaterial.MaterialType.Metal:
icon = ResourceCache.GetResource<TextureResource>("/Textures/Objects/sheet_metal.png");
icon = ResourceCache.GetResource<TextureResource>(
"/Textures/Objects/sheet_metal.png");
text = $"Metal x{mat.Amount}";
break;
case ConstructionStepMaterial.MaterialType.Glass:
icon = ResourceCache.GetResource<TextureResource>("/Textures/Objects/sheet_glass.png");
icon = ResourceCache.GetResource<TextureResource>(
"/Textures/Objects/sheet_glass.png");
text = $"Glass x{mat.Amount}";
break;
case ConstructionStepMaterial.MaterialType.Cable:
icon = ResourceCache.GetResource<TextureResource>("/Textures/Objects/cable_coil.png");
icon = ResourceCache.GetResource<TextureResource>(
"/Textures/Objects/cable_coil.png");
text = $"Cable Coil x{mat.Amount}";
break;
default:
throw new NotImplementedException();
}
break;
case ConstructionStepTool tool:
switch (tool.Tool)
@@ -198,20 +191,24 @@ namespace Content.Client.Construction
text = "Crowbar";
break;
case ConstructionStepTool.ToolType.Screwdriver:
icon = ResourceCache.GetResource<TextureResource>("/Textures/Objects/screwdriver.png");
icon = ResourceCache.GetResource<TextureResource>(
"/Textures/Objects/screwdriver.png");
text = "Screwdriver";
break;
case ConstructionStepTool.ToolType.Welder:
icon = ResourceCache.GetResource<RSIResource>("/Textures/Objects/tools.rsi").RSI["welder"].Frame0;
icon = ResourceCache.GetResource<RSIResource>("/Textures/Objects/tools.rsi")
.RSI["welder"].Frame0;
text = $"Welding tool ({tool.Amount} fuel)";
break;
case ConstructionStepTool.ToolType.Wirecutters:
icon = ResourceCache.GetResource<TextureResource>("/Textures/Objects/wirecutter.png");
icon = ResourceCache.GetResource<TextureResource>(
"/Textures/Objects/wirecutter.png");
text = "Wirecutters";
break;
default:
throw new NotImplementedException();
}
break;
default:
throw new NotImplementedException();
@@ -230,7 +227,7 @@ namespace Content.Client.Construction
void OnBuildPressed(Button.ButtonEventArgs args)
{
var prototype = (ConstructionPrototype)RecipeList.Selected.Metadata;
var prototype = (ConstructionPrototype) RecipeList.Selected.Metadata;
if (prototype == null)
{
return;
@@ -278,6 +275,7 @@ namespace Content.Client.Construction
subNode = new CategoryNode(category, currentNode);
currentNode.ChildCategories.Add(category, subNode);
}
currentNode = subNode;
}
@@ -356,6 +354,7 @@ namespace Content.Client.Construction
continue;
}
}
var subItem = RecipeList.CreateItem(ItemForNode(node));
subItem.Text = prototype.Name;
subItem.Metadata = prototype;
@@ -377,7 +376,10 @@ namespace Content.Client.Construction
{
public readonly string Name;
public readonly CategoryNode Parent;
public SortedDictionary<string, CategoryNode> ChildCategories = new SortedDictionary<string, CategoryNode>();
public SortedDictionary<string, CategoryNode>
ChildCategories = new SortedDictionary<string, CategoryNode>();
public List<ConstructionPrototype> Prototypes = new List<ConstructionPrototype>();
public int FlattenedIndex = -1;

View File

@@ -1,18 +1,13 @@
using System;
using Content.Client.UserInterface;
using Content.Shared.GameObjects.Components.Power;
using NJsonSchema.Validation;
using OpenTK.Graphics.OpenGL4;
using Robust.Client.GameObjects.Components.UserInterface;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Interfaces.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.GameObjects.Components.UserInterface;
using Robust.Shared.IoC;
using Robust.Shared.Maths;
using Robust.Shared.Utility;
namespace Content.Client.GameObjects.Components.Power
{
@@ -72,34 +67,34 @@ namespace Content.Client.GameObjects.Components.Power
_chargeBar.Value = castState.Charge;
UpdateChargeBarColor(castState.Charge);
float ChargePercentage = (castState.Charge / _chargeBar.MaxValue) * 100.0f;
_window.ChargePercentage.Text = " " + ChargePercentage.ToString("0.00") + "%";
var chargePercentage = (castState.Charge / _chargeBar.MaxValue) * 100.0f;
_window.ChargePercentage.Text = " " + chargePercentage.ToString("0.00") + "%";
}
private void UpdateChargeBarColor(float charge)
{
float normalizedCharge = charge / _chargeBar.MaxValue;
var normalizedCharge = charge / _chargeBar.MaxValue;
float leftHue = 0.0f;// Red
float middleHue = 0.066f;// Orange
float rightHue = 0.33f;// Green
float saturation = 1.0f;// Uniform saturation
float value = 0.8f;// Uniform value / brightness
float alpha = 1.0f;// Uniform alpha
const float leftHue = 0.0f; // Red
const float middleHue = 0.066f; // Orange
const float rightHue = 0.33f; // Green
const float saturation = 1.0f; // Uniform saturation
const float value = 0.8f; // Uniform value / brightness
const float alpha = 1.0f; // Uniform alpha
// These should add up to 1.0 or your transition won't be smooth
float leftSideSize = 0.5f;// Fraction of _chargeBar lerped from leftHue to middleHue
float rightSideSize = 0.5f;// Fraction of _chargeBar lerped from middleHue to rightHue
const float leftSideSize = 0.5f; // Fraction of _chargeBar lerped from leftHue to middleHue
const float rightSideSize = 0.5f; // Fraction of _chargeBar lerped from middleHue to rightHue
float finalHue;
if (normalizedCharge <= leftSideSize)
{
normalizedCharge /= leftSideSize;// Adjust range to 0.0 to 1.0
normalizedCharge /= leftSideSize; // Adjust range to 0.0 to 1.0
finalHue = FloatMath.Lerp(leftHue, middleHue, normalizedCharge);
}
else
{
normalizedCharge = (normalizedCharge - leftSideSize) / rightSideSize;// Adjust range to 0.0 to 1.0.
normalizedCharge = (normalizedCharge - leftSideSize) / rightSideSize; // Adjust range to 0.0 to 1.0.
finalHue = FloatMath.Lerp(middleHue, rightHue, normalizedCharge);
}
@@ -109,7 +104,7 @@ namespace Content.Client.GameObjects.Components.Power
_chargeBar.ForegroundStyleBoxOverride = new StyleBoxFlat();
}
var foregroundStyleBoxOverride = (StyleBoxFlat)_chargeBar.ForegroundStyleBoxOverride;
var foregroundStyleBoxOverride = (StyleBoxFlat) _chargeBar.ForegroundStyleBoxOverride;
foregroundStyleBoxOverride.BackgroundColor =
Color.FromHsv(new Vector4(finalHue, saturation, value, alpha));
}
@@ -134,29 +129,29 @@ namespace Content.Client.GameObjects.Components.Power
public ApcWindow()
{
Title = "APC";
var rows = new VBoxContainer("Rows");
var rows = new VBoxContainer();
var statusHeader = new Label("StatusHeader") { Text = "Power Status: " };
var statusHeader = new Label {Text = "Power Status: "};
rows.AddChild(statusHeader);
var breaker = new HBoxContainer("Breaker");
var breakerLabel = new Label("Label") { Text = "Main Breaker: " };
BreakerButton = new CheckButton {Name = "Breaker", Text = "Toggle"};
var breaker = new HBoxContainer();
var breakerLabel = new Label {Text = "Main Breaker: "};
BreakerButton = new CheckButton {Text = "Toggle"};
breaker.AddChild(breakerLabel);
breaker.AddChild(BreakerButton);
rows.AddChild(breaker);
var externalStatus = new HBoxContainer("ExternalStatus");
var externalStatusLabel = new Label("Label") { Text = "External Power: " };
ExternalPowerStateLabel = new Label("Status") { Text = "Good" };
var externalStatus = new HBoxContainer();
var externalStatusLabel = new Label {Text = "External Power: "};
ExternalPowerStateLabel = new Label {Text = "Good"};
ExternalPowerStateLabel.SetOnlyStyleClass(NanoStyle.StyleClassPowerStateGood);
externalStatus.AddChild(externalStatusLabel);
externalStatus.AddChild(ExternalPowerStateLabel);
rows.AddChild(externalStatus);
var charge = new HBoxContainer("Charge");
var chargeLabel = new Label("Label") { Text = "Charge:" };
ChargeBar = new ProgressBar("Charge")
var charge = new HBoxContainer();
var chargeLabel = new Label {Text = "Charge:"};
ChargeBar = new ProgressBar
{
SizeFlagsHorizontal = Control.SizeFlags.FillExpand,
MinValue = 0.0f,
@@ -164,7 +159,7 @@ namespace Content.Client.GameObjects.Components.Power
Page = 0.0f,
Value = 0.5f
};
ChargePercentage = new Label("ChargePercentage");
ChargePercentage = new Label();
charge.AddChild(chargeLabel);
charge.AddChild(ChargeBar);
charge.AddChild(ChargePercentage);

View File

@@ -30,7 +30,7 @@ namespace Content.Client.GameObjects.Components.Storage
base.OnAdd();
Window = new StorageWindow()
{ StorageEntity = this};
{StorageEntity = this};
}
public override void OnRemove()
@@ -44,7 +44,8 @@ namespace Content.Client.GameObjects.Components.Storage
base.ExposeData(serializer);
}
public override void HandleMessage(ComponentMessage message, INetChannel netChannel = null, IComponent component = null)
public override void HandleMessage(ComponentMessage message, INetChannel netChannel = null,
IComponent component = null)
{
switch (message)
{
@@ -108,32 +109,27 @@ namespace Content.Client.GameObjects.Components.Storage
public StorageWindow()
{
Size = new Vector2(180.0f, 320.0f);
}
protected override void Initialize()
{
base.Initialize();
Size = (180, 320);
Title = "Storage Item";
RectClipContent = true;
VSplitContainer = new VBoxContainer("VSplitContainer");
Information = new Label("Information")
VSplitContainer = new VBoxContainer();
Information = new Label
{
Text = "Items: 0 Volume: 0/0 Stuff",
SizeFlagsVertical = SizeFlags.ShrinkCenter
};
VSplitContainer.AddChild(Information);
var listScrollContainer = new ScrollContainer("ListScrollContainer")
var listScrollContainer = new ScrollContainer
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsHorizontal = SizeFlags.FillExpand,
HScrollEnabled = true,
VScrollEnabled = true
};
EntityList = new VBoxContainer("EntityList")
EntityList = new VBoxContainer
{
SizeFlagsHorizontal = SizeFlags.FillExpand
};
@@ -182,7 +178,8 @@ namespace Content.Client.GameObjects.Components.Storage
//Sets information about entire storage container current capacity
if (StorageEntity.StorageCapacityMax != 0)
{
Information.Text = String.Format("Items: {0}, Stored: {1}/{2}", storagelist.Count, StorageEntity.StorageSizeUsed, StorageEntity.StorageCapacityMax);
Information.Text = String.Format("Items: {0}, Stored: {1}/{2}", storagelist.Count,
StorageEntity.StorageSizeUsed, StorageEntity.StorageCapacityMax);
}
else
{
@@ -196,7 +193,7 @@ namespace Content.Client.GameObjects.Components.Storage
/// <param name="args"></param>
private void OnItemButtonToggled(BaseButton.ButtonToggledEventArgs args)
{
var control = (EntityButton)args.Button.Parent;
var control = (EntityButton) args.Button.Parent;
args.Button.Pressed = false;
StorageEntity.Interact(control.EntityuID);
}
@@ -208,17 +205,15 @@ namespace Content.Client.GameObjects.Components.Storage
private class EntityButton : PanelContainer
{
public EntityUid EntityuID { get; set; }
public Button ActualButton { get; private set; }
public SpriteView EntitySpriteView { get; private set; }
public Control EntityControl { get; private set; }
public Label EntityName { get; private set; }
public Label EntitySize { get; private set; }
public Button ActualButton { get; }
public SpriteView EntitySpriteView { get; }
public Control EntityControl { get; }
public Label EntityName { get; }
public Label EntitySize { get; }
protected override void Initialize()
public EntityButton()
{
base.Initialize();
ActualButton = new Button("Button")
ActualButton = new Button
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
@@ -227,12 +222,12 @@ namespace Content.Client.GameObjects.Components.Storage
};
AddChild(ActualButton);
var hBoxContainer = new HBoxContainer("HBoxContainer") {MouseFilter = MouseFilterMode.Ignore};
EntitySpriteView = new SpriteView("SpriteView")
var hBoxContainer = new HBoxContainer {MouseFilter = MouseFilterMode.Ignore};
EntitySpriteView = new SpriteView
{
CustomMinimumSize = new Vector2(32.0f, 32.0f), MouseFilter = MouseFilterMode.Ignore
};
EntityName = new Label("Name")
EntityName = new Label
{
SizeFlagsVertical = SizeFlags.ShrinkCenter,
Text = "Backpack",
@@ -241,11 +236,11 @@ namespace Content.Client.GameObjects.Components.Storage
hBoxContainer.AddChild(EntitySpriteView);
hBoxContainer.AddChild(EntityName);
EntityControl = new Control("Control")
EntityControl = new Control
{
SizeFlagsHorizontal = SizeFlags.FillExpand, MouseFilter = MouseFilterMode.Ignore
};
EntitySize = new Label("Size")
EntitySize = new Label
{
SizeFlagsVertical = SizeFlags.ShrinkCenter,
Text = "Size 6",

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Content.Shared.GameObjects;
using Content.Shared.GameObjects.EntitySystemMessages;
using Content.Shared.Input;
@@ -66,7 +65,7 @@ namespace Content.Client.GameObjects.EntitySystems
_currentPopup = new Popup();
_currentPopup.UserInterfaceManager.StateRoot.AddChild(_currentPopup);
_currentPopup.OnPopupHide += _closeContextMenu;
var vBox = new VBoxContainer("ButtonBox");
var vBox = new VBoxContainer();
_currentPopup.AddChild(vBox);
vBox.AddChild(new Label {Text = "Waiting on Server..."});
@@ -94,7 +93,7 @@ namespace Content.Client.GameObjects.EntitySystems
_currentPopup = new Popup();
_currentPopup.OnPopupHide += _closeContextMenu;
var vBox = new VBoxContainer("ButtonBox");
var vBox = new VBoxContainer();
_currentPopup.AddChild(vBox);
foreach (var entity in entities)
{

View File

@@ -2,8 +2,6 @@ using System.Collections.Generic;
using Content.Client.GameObjects.Components.Research;
using Content.Shared.Materials;
using Content.Shared.Research;
using Robust.Client.Interfaces.Graphics;
using Robust.Client.Interfaces.ResourceManagement;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
@@ -12,15 +10,13 @@ using Robust.Shared.IoC;
using Robust.Shared.Maths;
using Robust.Shared.Prototypes;
using Robust.Shared.Timers;
using Robust.Shared.Utility;
namespace Content.Client.Research
{
public class LatheMenu : SS14Window
{
#pragma warning disable CS0649
[Dependency]
private IPrototypeManager PrototypeManager;
[Dependency] private IPrototypeManager PrototypeManager;
#pragma warning restore
private ItemList Items;
@@ -37,15 +33,6 @@ namespace Content.Client.Research
public LatheMenu()
{
}
public LatheMenu(string name) : base(name)
{
}
protected override void Initialize()
{
base.Initialize();
IoCManager.InjectDependencies(this);
Title = "Lathe Menu";
@@ -62,15 +49,15 @@ namespace Content.Client.Research
margin.SetAnchorAndMarginPreset(LayoutPreset.Wide);
var vbox = new VBoxContainer()
var vBox = new VBoxContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
SeparationOverride = 5,
};
vbox.SetAnchorAndMarginPreset(LayoutPreset.Wide);
vBox.SetAnchorAndMarginPreset(LayoutPreset.Wide);
var hboxButtons = new HBoxContainer()
var hBoxButtons = new HBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
@@ -93,7 +80,7 @@ namespace Content.Client.Research
spacer.SetAnchorAndMarginPreset(LayoutPreset.Wide);
var hboxFilter = new HBoxContainer()
var hBoxFilter = new HBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
SizeFlagsVertical = SizeFlags.FillExpand,
@@ -124,8 +111,6 @@ namespace Content.Client.Research
SizeFlagsVertical = SizeFlags.FillExpand,
};
Items.OnItemSelected += ItemSelected;
AmountLineEdit = new LineEdit()
@@ -143,19 +128,19 @@ namespace Content.Client.Research
SizeFlagsStretchRatio = 3
};
hboxButtons.AddChild(spacer);
hboxButtons.AddChild(QueueButton);
hBoxButtons.AddChild(spacer);
hBoxButtons.AddChild(QueueButton);
hboxFilter.AddChild(SearchBar);
hboxFilter.AddChild(filterButton);
hBoxFilter.AddChild(SearchBar);
hBoxFilter.AddChild(filterButton);
vbox.AddChild(hboxButtons);
vbox.AddChild(hboxFilter);
vbox.AddChild(Items);
vbox.AddChild(AmountLineEdit);
vbox.AddChild(Materials);
vBox.AddChild(hBoxButtons);
vBox.AddChild(hBoxFilter);
vBox.AddChild(Items);
vBox.AddChild(AmountLineEdit);
vBox.AddChild(Materials);
margin.AddChild(vbox);
margin.AddChild(vBox);
Contents.AddChild(margin);
}

View File

@@ -1,13 +1,9 @@
using Content.Client.GameObjects.Components.Research;
using Content.Shared.Research;
using Robust.Client.Graphics;
using Robust.Client.Graphics.Drawing;
using Robust.Client.Interfaces.Graphics;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Client.Utility;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Maths;
using Robust.Shared.ViewVariables;
@@ -25,11 +21,9 @@ namespace Content.Client.Research
private Label Description;
private TextureRect Icon;
protected override void Initialize()
public LatheQueueMenu()
{
base.Initialize();
Title = "Lathe Queue";
Title = "Lathe Queue";
var margin = new MarginContainer()
{
@@ -41,9 +35,9 @@ namespace Content.Client.Research
margin.SetAnchorAndMarginPreset(LayoutPreset.Wide);
var vbox = new VBoxContainer();
var vBox = new VBoxContainer();
vbox.SetAnchorAndMarginPreset(LayoutPreset.Wide);
vBox.SetAnchorAndMarginPreset(LayoutPreset.Wide);
var descMargin = new MarginContainer()
{
@@ -55,7 +49,7 @@ namespace Content.Client.Research
SizeFlagsStretchRatio = 2,
};
var hbox = new HBoxContainer()
var hBox = new HBoxContainer()
{
SizeFlagsHorizontal = SizeFlags.FillExpand,
};
@@ -66,7 +60,7 @@ namespace Content.Client.Research
SizeFlagsStretchRatio = 2,
};
var vboxInfo = new VBoxContainer()
var vBoxInfo = new VBoxContainer()
{
SizeFlagsVertical = SizeFlags.FillExpand,
SizeFlagsStretchRatio = 3,
@@ -94,18 +88,18 @@ namespace Content.Client.Research
SelectMode = ItemList.ItemListSelectMode.None
};
vboxInfo.AddChild(NameLabel);
vboxInfo.AddChild(Description);
vBoxInfo.AddChild(NameLabel);
vBoxInfo.AddChild(Description);
hbox.AddChild(Icon);
hbox.AddChild(vboxInfo);
hBox.AddChild(Icon);
hBox.AddChild(vBoxInfo);
descMargin.AddChild(hbox);
descMargin.AddChild(hBox);
vbox.AddChild(descMargin);
vbox.AddChild(QueueList);
vBox.AddChild(descMargin);
vBox.AddChild(QueueList);
margin.AddChild(vbox);
margin.AddChild(vBox);
Contents.AddChild(margin);

View File

@@ -37,14 +37,12 @@ namespace Content.Client.UserInterface
private UIBox2i _handL;
private UIBox2i _handR;
private SpriteView LeftSpriteView;
private SpriteView RightSpriteView;
private TextureRect ActiveHandRect;
private readonly SpriteView LeftSpriteView;
private readonly SpriteView RightSpriteView;
private readonly TextureRect ActiveHandRect;
protected override void Initialize()
public HandsGui()
{
base.Initialize();
IoCManager.InjectDependencies(this);
ToolTip = _loc.GetString("Your hands");