Merge branch 'master' of https://github.com/space-wizards/space-station-14
This commit is contained in:
@@ -25,12 +25,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.
|
||||
@@ -49,11 +49,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;
|
||||
@@ -80,8 +78,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();
|
||||
@@ -182,18 +180,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;
|
||||
@@ -209,7 +195,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)
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ using Content.Client.UserInterface;
|
||||
using Content.Shared.GameObjects.Components.Chemistry;
|
||||
using Content.Shared.GameObjects.Components.Markers;
|
||||
using Content.Shared.GameObjects.Components.Research;
|
||||
using Content.Shared.GameObjects.Components.VendingMachines;
|
||||
using Content.Shared.Interfaces;
|
||||
using Robust.Client;
|
||||
using Robust.Client.Interfaces;
|
||||
using Robust.Client.Interfaces.Graphics.Overlays;
|
||||
using Robust.Client.Interfaces.Input;
|
||||
@@ -42,6 +42,7 @@ namespace Content.Client
|
||||
|
||||
var registerIgnore = new[]
|
||||
{
|
||||
"Breakable",
|
||||
"Interactable",
|
||||
"Destructible",
|
||||
"Temperature",
|
||||
@@ -94,6 +95,7 @@ namespace Content.Client
|
||||
"PowerCell",
|
||||
"AiController",
|
||||
"PlayerInputMover",
|
||||
"Computer"
|
||||
};
|
||||
|
||||
foreach (var ignoreName in registerIgnore)
|
||||
@@ -105,6 +107,8 @@ namespace Content.Client
|
||||
factory.Register<SharedSpawnPointComponent>();
|
||||
factory.Register<SolutionComponent>();
|
||||
|
||||
factory.Register<SharedVendingMachineComponent>();
|
||||
|
||||
prototypes.RegisterIgnore("material");
|
||||
|
||||
IoCManager.Register<IGameHud, GameHud>();
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
using Content.Shared.GameObjects.Components;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using Robust.Shared.Utility;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
|
||||
namespace Content.Client.GameObjects.Components
|
||||
{
|
||||
public sealed class ComputerVisualizer2D : AppearanceVisualizer
|
||||
{
|
||||
private string KeyboardState = "generic_key";
|
||||
private string ScreenState = "generic";
|
||||
|
||||
public override void LoadData(YamlMappingNode node)
|
||||
{
|
||||
base.LoadData(node);
|
||||
|
||||
if (node.TryGetNode("key", out var scalar))
|
||||
{
|
||||
KeyboardState = scalar.AsString();
|
||||
}
|
||||
|
||||
if (node.TryGetNode("screen", out scalar))
|
||||
{
|
||||
ScreenState = scalar.AsString();
|
||||
}
|
||||
}
|
||||
|
||||
public override void InitializeEntity(IEntity entity)
|
||||
{
|
||||
base.InitializeEntity(entity);
|
||||
|
||||
var sprite = entity.GetComponent<ISpriteComponent>();
|
||||
sprite.LayerSetState(Layers.Screen, ScreenState);
|
||||
sprite.LayerSetState(Layers.Keyboard, $"{KeyboardState}_off");
|
||||
sprite.LayerSetState(Layers.KeyboardOn, KeyboardState);
|
||||
}
|
||||
|
||||
public override void OnChangeData(AppearanceComponent component)
|
||||
{
|
||||
base.OnChangeData(component);
|
||||
|
||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
||||
|
||||
if (!component.TryGetData(ComputerVisuals.Powered, out bool powered))
|
||||
{
|
||||
powered = true;
|
||||
}
|
||||
|
||||
component.TryGetData(ComputerVisuals.Broken, out bool broken);
|
||||
|
||||
if (broken)
|
||||
{
|
||||
sprite.LayerSetState(Layers.Body, "broken");
|
||||
sprite.LayerSetState(Layers.Screen, "computer_broken");
|
||||
}
|
||||
else
|
||||
{
|
||||
sprite.LayerSetState(Layers.Body, "computer");
|
||||
sprite.LayerSetState(Layers.Screen, ScreenState);
|
||||
}
|
||||
|
||||
sprite.LayerSetVisible(Layers.Screen, powered);
|
||||
sprite.LayerSetVisible(Layers.KeyboardOn, powered);
|
||||
}
|
||||
|
||||
public enum Layers
|
||||
{
|
||||
Body,
|
||||
Screen,
|
||||
Keyboard,
|
||||
KeyboardOn
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -43,7 +43,7 @@ namespace Content.Client.GameObjects
|
||||
base.Initialize();
|
||||
|
||||
_window = new HumanInventoryWindow(_loc, _resourceCache);
|
||||
|
||||
_window.OnClose += () => GameHud.InventoryButtonDown = false;
|
||||
foreach (var (slot, button) in _window.Buttons)
|
||||
{
|
||||
button.OnPressed = AddToInventory;
|
||||
@@ -185,7 +185,7 @@ namespace Content.Client.GameObjects
|
||||
|
||||
// Right column
|
||||
AddButton(Slots.EARS, "ears", (2 * (size + sep), 0));
|
||||
AddButton(Slots.IDCARD, "mask", (2 * (size + sep), size + sep));
|
||||
AddButton(Slots.IDCARD, "id", (2 * (size + sep), size + sep));
|
||||
AddButton(Slots.GLOVES, "gloves", (2 * (size + sep), 2 * (size + sep)));
|
||||
|
||||
// Far right column.
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
using Content.Client.VendingMachines;
|
||||
using Content.Shared.GameObjects.Components.VendingMachines;
|
||||
using Robust.Client.GameObjects.Components.UserInterface;
|
||||
using Robust.Shared.GameObjects.Components.UserInterface;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.ViewVariables;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.VendingMachines
|
||||
{
|
||||
class VendingMachineBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
[ViewVariables]
|
||||
private VendingMachineMenu _menu;
|
||||
|
||||
public SharedVendingMachineComponent VendingMachine { get; private set; }
|
||||
|
||||
public VendingMachineBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
|
||||
{
|
||||
SendMessage(new SharedVendingMachineComponent.InventorySyncRequestMessage());
|
||||
}
|
||||
|
||||
protected override void Open()
|
||||
{
|
||||
base.Open();
|
||||
|
||||
if(!Owner.Owner.TryGetComponent(out SharedVendingMachineComponent vendingMachine))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
VendingMachine = vendingMachine;
|
||||
|
||||
_menu = new VendingMachineMenu() { Owner = this, Title = Owner.Owner.Name };
|
||||
_menu.Populate(VendingMachine.Inventory);
|
||||
|
||||
_menu.OnClose += Close;
|
||||
_menu.OpenCentered();
|
||||
}
|
||||
|
||||
public void Eject(string ID)
|
||||
{
|
||||
SendMessage(new SharedVendingMachineComponent.VendingMachineEjectMessage(ID));
|
||||
}
|
||||
|
||||
protected override void ReceiveMessage(BoundUserInterfaceMessage message)
|
||||
{
|
||||
switch(message)
|
||||
{
|
||||
case SharedVendingMachineComponent.VendingMachineInventoryMessage msg:
|
||||
_menu.Populate(msg.Inventory);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
if(!disposing) { return; }
|
||||
_menu?.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
using System;
|
||||
using Content.Client.GameObjects.Components.Doors;
|
||||
using Robust.Client.Animations;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.GameObjects.Components.Animations;
|
||||
using Robust.Client.Interfaces.GameObjects.Components;
|
||||
using Robust.Shared.Interfaces.GameObjects;
|
||||
using YamlDotNet.RepresentationModel;
|
||||
using static Content.Shared.GameObjects.Components.VendingMachines.SharedVendingMachineComponent;
|
||||
|
||||
namespace Content.Client.GameObjects.Components.VendingMachines
|
||||
{
|
||||
public class VendingMachineVisualizer2D : AppearanceVisualizer
|
||||
{
|
||||
// TODO: The length of these animations is supposed to be dictated
|
||||
// by the vending machine's pack prototype's `AnimationDuration`
|
||||
// but we have no good way of passing that data from the server
|
||||
// to the client at the moment. Rework Visualizers?
|
||||
private const string DeniedAnimationKey = "deny";
|
||||
private const string EjectAnimationKey = "eject";
|
||||
|
||||
private Animation _deniedAnimation;
|
||||
private Animation _ejectAnimation;
|
||||
|
||||
public override void LoadData(YamlMappingNode node)
|
||||
{
|
||||
base.LoadData(node);
|
||||
_deniedAnimation = new Animation {Length = TimeSpan.FromSeconds(1.2f)};
|
||||
{
|
||||
var flick = new AnimationTrackSpriteFlick();
|
||||
_deniedAnimation.AnimationTracks.Add(flick);
|
||||
flick.LayerKey = VendingMachineVisualLayers.Base;
|
||||
flick.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame("deny", 0f));
|
||||
}
|
||||
|
||||
_ejectAnimation = new Animation {Length = TimeSpan.FromSeconds(1.2f)};
|
||||
{
|
||||
var flick = new AnimationTrackSpriteFlick();
|
||||
_ejectAnimation.AnimationTracks.Add(flick);
|
||||
flick.LayerKey = VendingMachineVisualLayers.Base;
|
||||
flick.KeyFrames.Add(new AnimationTrackSpriteFlick.KeyFrame("eject", 0f));
|
||||
}
|
||||
}
|
||||
|
||||
public override void InitializeEntity(IEntity entity)
|
||||
{
|
||||
base.InitializeEntity(entity);
|
||||
|
||||
if (!entity.HasComponent<AnimationPlayerComponent>())
|
||||
{
|
||||
entity.AddComponent<AnimationPlayerComponent>();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnChangeData(AppearanceComponent component)
|
||||
{
|
||||
var sprite = component.Owner.GetComponent<ISpriteComponent>();
|
||||
var animPlayer = component.Owner.GetComponent<AnimationPlayerComponent>();
|
||||
if (!component.TryGetData(VendingMachineVisuals.VisualState, out VendingMachineVisualState state))
|
||||
{
|
||||
state = VendingMachineVisualState.Normal;
|
||||
}
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case VendingMachineVisualState.Normal:
|
||||
sprite.LayerSetState(VendingMachineVisualLayers.Base, "normal");
|
||||
break;
|
||||
case VendingMachineVisualState.Off:
|
||||
sprite.LayerSetState(VendingMachineVisualLayers.Base, "off");
|
||||
break;
|
||||
case VendingMachineVisualState.Broken:
|
||||
sprite.LayerSetState(VendingMachineVisualLayers.Base, "broken");
|
||||
break;
|
||||
case VendingMachineVisualState.Deny:
|
||||
if (!animPlayer.HasRunningAnimation(DeniedAnimationKey))
|
||||
{
|
||||
animPlayer.Play(_deniedAnimation, DeniedAnimationKey);
|
||||
}
|
||||
|
||||
break;
|
||||
case VendingMachineVisualState.Eject:
|
||||
if (!animPlayer.HasRunningAnimation(EjectAnimationKey))
|
||||
{
|
||||
animPlayer.Play(_ejectAnimation, EjectAnimationKey);
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
public enum VendingMachineVisualLayers
|
||||
{
|
||||
Base,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
@@ -19,8 +17,7 @@ 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 +34,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 +50,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 +81,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 +112,6 @@ namespace Content.Client.Research
|
||||
SizeFlagsVertical = SizeFlags.FillExpand,
|
||||
};
|
||||
|
||||
|
||||
|
||||
Items.OnItemSelected += ItemSelected;
|
||||
|
||||
AmountLineEdit = new LineEdit()
|
||||
@@ -143,19 +129,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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -39,14 +39,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");
|
||||
|
||||
65
Content.Client/VendingMachines/VendingMachineMenu.cs
Normal file
65
Content.Client/VendingMachines/VendingMachineMenu.cs
Normal file
@@ -0,0 +1,65 @@
|
||||
using Content.Client.GameObjects.Components.VendingMachines;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.IoC;
|
||||
using Robust.Shared.Maths;
|
||||
using System.Collections.Generic;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
using Robust.Client.Interfaces.ResourceManagement;
|
||||
using Robust.Shared.GameObjects;
|
||||
using Robust.Shared.Prototypes;
|
||||
using static Content.Shared.GameObjects.Components.VendingMachines.SharedVendingMachineComponent;
|
||||
|
||||
namespace Content.Client.VendingMachines
|
||||
{
|
||||
class VendingMachineMenu : SS14Window
|
||||
{
|
||||
protected override Vector2? CustomSize => (300, 450);
|
||||
|
||||
private readonly ItemList _items;
|
||||
private List<VendingMachineInventoryEntry> _cachedInventory;
|
||||
|
||||
#pragma warning disable CS0649
|
||||
[Dependency]
|
||||
private IResourceCache _resourceCache;
|
||||
[Dependency]
|
||||
private readonly IPrototypeManager _prototypeManager;
|
||||
#pragma warning restore
|
||||
public VendingMachineBoundUserInterface Owner { get; set; }
|
||||
|
||||
public VendingMachineMenu()
|
||||
{
|
||||
IoCManager.InjectDependencies(this);
|
||||
|
||||
_items = new ItemList()
|
||||
{
|
||||
SizeFlagsStretchRatio = 8,
|
||||
SizeFlagsVertical = SizeFlags.FillExpand,
|
||||
};
|
||||
_items.OnItemSelected += ItemSelected;
|
||||
|
||||
Contents.AddChild(_items);
|
||||
}
|
||||
|
||||
public void Populate(List<VendingMachineInventoryEntry> inventory)
|
||||
{
|
||||
_items.Clear();
|
||||
_cachedInventory = inventory;
|
||||
foreach (VendingMachineInventoryEntry entry in inventory)
|
||||
{
|
||||
Texture icon = null;
|
||||
if(_prototypeManager.TryIndex(entry.ID, out EntityPrototype prototype))
|
||||
{
|
||||
icon = IconComponent.GetPrototypeIcon(prototype, _resourceCache).TextureFor(Direction.South);
|
||||
}
|
||||
_items.AddItem($"{entry.ID} ({entry.Amount} left)", icon);
|
||||
}
|
||||
}
|
||||
|
||||
public void ItemSelected(ItemList.ItemListSelectedEventArgs args)
|
||||
{
|
||||
Owner.Eject(_cachedInventory[args.ItemIndex].ID);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user