Pretty up the microwave menu, add click sounds. Remove some unnecessary ToList() calls. Remove unnecessary IoC resolves.
This commit is contained in:
@@ -16,6 +16,10 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
{
|
||||
public class MicrowaveBoundUserInterface : BoundUserInterface
|
||||
{
|
||||
#pragma warning disable 649
|
||||
[Dependency] private readonly IEntityManager _entityManager;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager;
|
||||
#pragma warning restore 649
|
||||
private MicrowaveMenu _menu;
|
||||
|
||||
private Dictionary<int, EntityUid> _solids = new Dictionary<int, EntityUid>();
|
||||
@@ -38,7 +42,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
_menu.OnCookTimeSelected += args =>
|
||||
{
|
||||
var actualButton = args.Button as Button;
|
||||
var newTime = (byte) int.Parse(actualButton.Text);
|
||||
var newTime = (uint) int.Parse(actualButton.Text);
|
||||
_menu.VisualCookTime = newTime;
|
||||
SendMessage(new SharedMicrowaveComponent.MicrowaveSelectCookTimeMessage(newTime));
|
||||
};
|
||||
@@ -75,7 +79,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
_menu.IngredientsList.Clear();
|
||||
foreach (var item in reagents)
|
||||
{
|
||||
IoCManager.Resolve<IPrototypeManager>().TryIndex(item.ReagentId, out ReagentPrototype proto);
|
||||
_prototypeManager.TryIndex(item.ReagentId, out ReagentPrototype proto);
|
||||
|
||||
_menu.IngredientsList.AddItem($"{item.Quantity} {proto.Name}");
|
||||
}
|
||||
@@ -83,7 +87,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
_solids.Clear();
|
||||
foreach (var entityID in solids)
|
||||
{
|
||||
var entity = IoCManager.Resolve<IEntityManager>().GetEntity(entityID);
|
||||
var entity = _entityManager.GetEntity(entityID);
|
||||
|
||||
if (entity.TryGetComponent(out IconComponent icon))
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using Robust.Client.Graphics.Drawing;
|
||||
using Robust.Client.UserInterface;
|
||||
using Robust.Client.UserInterface.Controls;
|
||||
using Robust.Client.UserInterface.CustomControls;
|
||||
using Robust.Shared.Localization;
|
||||
@@ -15,7 +16,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
|
||||
public event Action<BaseButton.ButtonEventArgs> OnCookTimeSelected;
|
||||
|
||||
public byte VisualCookTime { get; set; }
|
||||
public uint VisualCookTime = 1;
|
||||
|
||||
public Button StartButton { get;}
|
||||
public Button EjectButton { get;}
|
||||
@@ -81,6 +82,13 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
buttonGridContainer.AddChild(StartButton);
|
||||
buttonGridContainer.AddChild(EjectButton);
|
||||
vSplit.AddChild(buttonGridContainer);
|
||||
|
||||
//Padding
|
||||
vSplit.AddChild(new Control
|
||||
{
|
||||
CustomMinimumSize = (0, 15),
|
||||
SizeFlagsVertical = SizeFlags.Fill,
|
||||
});
|
||||
|
||||
CookTimeButtonGroup = new ButtonGroup();
|
||||
CookTimeButtonVbox = new VBoxContainer
|
||||
@@ -107,9 +115,12 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
index+=5;
|
||||
}
|
||||
|
||||
var cookTimeOneSecondButton = (Button)CookTimeButtonVbox.GetChild(0);
|
||||
cookTimeOneSecondButton.Pressed = true;
|
||||
|
||||
_cookTimeInfoLabel = new Label
|
||||
{
|
||||
Text = Loc.GetString("COOK TIME:"),
|
||||
Text = Loc.GetString($"COOK TIME: {VisualCookTime}"),
|
||||
Align = Label.AlignMode.Center,
|
||||
Modulate = Color.White,
|
||||
SizeFlagsVertical = SizeFlags.ShrinkCenter
|
||||
@@ -120,18 +131,20 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
SizeFlagsVertical = SizeFlags.FillExpand,
|
||||
ModulateSelfOverride = Color.Red,
|
||||
CustomMinimumSize = (100, 128),
|
||||
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.Black},
|
||||
PanelOverride = new StyleBoxFlat {BackgroundColor = Color.Black.WithAlpha(0.5f)},
|
||||
|
||||
Children =
|
||||
{
|
||||
|
||||
new VBoxContainer
|
||||
{
|
||||
|
||||
Children =
|
||||
{
|
||||
|
||||
new PanelContainer
|
||||
{
|
||||
PanelOverride = new StyleBoxFlat(){BackgroundColor = Color.Red.WithAlpha(0.2f)},
|
||||
PanelOverride = new StyleBoxFlat(){BackgroundColor = Color.Gray.WithAlpha(0.2f)},
|
||||
|
||||
Children =
|
||||
{
|
||||
@@ -162,6 +175,7 @@ namespace Content.Client.GameObjects.Components.Kitchen
|
||||
SizeFlagsHorizontal = SizeFlags.FillExpand,
|
||||
Children =
|
||||
{
|
||||
|
||||
innerTimerPanel
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user