From e45d57914cda1d1be618cfcc103421aa88eaad7c Mon Sep 17 00:00:00 2001 From: = <=> Date: Wed, 25 Feb 2026 20:59:31 +0500 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D1=80=D0=B0=D0=BD=D0=BD=D0=B8=D0=B9=20=D0=B2?= =?UTF-8?q?=D1=8B=D1=85=D0=BE=D0=B4=20=D0=BF=D1=80=D0=B8=20=D0=BE=D0=B1?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5=D0=BD=D0=B8=D0=B8=20=D1=81=D0=BF?= =?UTF-8?q?=D0=B8=D1=81=D0=BA=D0=B0=20=D0=B8=D0=BD=D0=B3=D1=80=D0=B5=D0=B4?= =?UTF-8?q?=D0=B8=D0=B5=D0=BD=D1=82=D0=BE=D0=B2=20(deleted=20entity=20?= =?UTF-8?q?=D1=82=D0=B5=D0=BF=D0=B5=D1=80=D1=8C=20=D0=BF=D1=80=D0=BE=D0=BF?= =?UTF-8?q?=D1=83=D1=81=D0=BA=D0=B0=D0=B5=D1=82=D1=81=D1=8F,=20=D0=B0=20?= =?UTF-8?q?=D0=BD=D0=B5=20=D0=BF=D1=80=D0=B5=D1=80=D1=8B=D0=B2=D0=B0=D0=B5?= =?UTF-8?q?=D1=82=20=D0=B2=D0=B5=D1=81=D1=8C=20=D1=86=D0=B8=D0=BA=D0=BB).?= =?UTF-8?q?=20=D0=92=D1=8B=D0=BD=D0=B5=D1=81=D0=B5=D0=BD=D0=B0=20=D0=BB?= =?UTF-8?q?=D0=BE=D0=B3=D0=B8=D0=BA=D0=B0=20=D0=BF=D0=BE=D0=BB=D1=83=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B8=D0=BA=D0=BE=D0=BD=D0=BA=D0=B8?= =?UTF-8?q?=20=D1=81=D1=83=D1=89=D0=BD=D0=BE=D1=81=D1=82=D0=B8=20=D0=B2=20?= =?UTF-8?q?=D0=BE=D1=82=D0=B4=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=B9=20helper?= =?UTF-8?q?=20=D0=B4=D0=BB=D1=8F=20=D0=BE=D0=B1=D0=BE=D0=B8=D1=85=20BUI.?= =?UTF-8?q?=20=D0=A3=D0=B1=D1=80=D0=B0=D0=BD=D1=8B=20=D0=BD=D0=B5=D0=B8?= =?UTF-8?q?=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D1=83=D0=B5=D0=BC=D1=8B?= =?UTF-8?q?=D0=B5=20=D0=BF=D0=BE=D0=BB=D1=8F/using=20=D0=B8=20=D1=83=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D1=89=D0=B5=D0=BD=D0=B0=20=D0=BE=D0=B1=D1=80=D0=B0?= =?UTF-8?q?=D0=B1=D0=BE=D1=82=D0=BA=D0=B0=20=D0=B2=D1=8B=D0=B1=D0=BE=D1=80?= =?UTF-8?q?=D0=B0=20=D0=B2=D1=80=D0=B5=D0=BC=D0=B5=D0=BD=D0=B8=20=D0=B2=20?= =?UTF-8?q?MicrowaveBoundUserInterface.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Kitchen/UI/MicrowaveBoundUserInterface.cs | 54 +++++++++---------- .../Kitchen/UI/AssemblerBoundUserInterface.cs | 47 ++++++++-------- 2 files changed, 47 insertions(+), 54 deletions(-) diff --git a/Content.Client/Kitchen/UI/MicrowaveBoundUserInterface.cs b/Content.Client/Kitchen/UI/MicrowaveBoundUserInterface.cs index 136e54b4ed..9e74dfa08f 100644 --- a/Content.Client/Kitchen/UI/MicrowaveBoundUserInterface.cs +++ b/Content.Client/Kitchen/UI/MicrowaveBoundUserInterface.cs @@ -1,11 +1,9 @@ -using Content.Shared.Chemistry.Reagent; using Content.Shared.Kitchen.Components; using JetBrains.Annotations; using Robust.Client.GameObjects; using Robust.Client.Graphics; using Robust.Client.UserInterface; using Robust.Client.UserInterface.Controls; -using Robust.Shared.Timing; namespace Content.Client.Kitchen.UI { @@ -18,9 +16,6 @@ namespace Content.Client.Kitchen.UI [ViewVariables] private readonly Dictionary _solids = new(); - [ViewVariables] - private readonly Dictionary _reagents = new(); - //Sunrise-Start private readonly string _menuTitle; private readonly string _leftFlavorText; @@ -52,16 +47,13 @@ namespace Content.Client.Kitchen.UI SendPredictedMessage(new MicrowaveEjectSolidIndexedMessage(EntMan.GetNetEntity(_solids[args.ItemIndex]))); }; - _menu.OnCookTimeSelected += (args, buttonIndex) => + _menu.OnCookTimeSelected += (args, _) => { var selectedCookTime = (uint) 0; - if (args.Button is MicrowaveMenu.MicrowaveCookTimeButton microwaveCookTimeButton) + if (args.Button is MicrowaveMenu.MicrowaveCookTimeButton actualButton) { - // args.Button is a MicrowaveCookTimeButton - var actualButton = (MicrowaveMenu.MicrowaveCookTimeButton) args.Button; - selectedCookTime = actualButton.CookTime == 0 ? 0 : actualButton.CookTime; - // SendMessage(new MicrowaveSelectCookTimeMessage((int) selectedCookTime / 5, actualButton.CookTime)); + selectedCookTime = actualButton.CookTime; SendPredictedMessage(new MicrowaveSelectCookTimeMessage((int) selectedCookTime / 5, actualButton.CookTime)); _menu.CookTimeInfoLabel.Text = Loc.GetString("microwave-bound-user-interface-cook-time-label", @@ -133,8 +125,6 @@ namespace Content.Client.Kitchen.UI private void RefreshContentsDisplay(EntityUid[] containedSolids) { - _reagents.Clear(); - if (_menu == null) return; _solids.Clear(); @@ -142,30 +132,36 @@ namespace Content.Client.Kitchen.UI foreach (var entity in containedSolids) { if (EntMan.Deleted(entity)) - { - return; - } - - // TODO just use sprite view - - Texture? texture; - if (EntMan.TryGetComponent(entity, out var iconComponent)) - { - texture = EntMan.System().GetIcon(iconComponent); - } - else if (EntMan.TryGetComponent(entity, out var spriteComponent)) - { - texture = spriteComponent.Icon?.Default; - } - else { continue; } + if (!TryGetEntityTexture(entity, out var texture)) + continue; + var solidItem = _menu.IngredientsList.AddItem(EntMan.GetComponent(entity).EntityName, texture); var solidIndex = _menu.IngredientsList.IndexOf(solidItem); _solids.Add(solidIndex, entity); } } + + private bool TryGetEntityTexture(EntityUid entity, out Texture? texture) + { + // TODO just use sprite view + if (EntMan.TryGetComponent(entity, out var iconComponent)) + { + texture = EntMan.System().GetIcon(iconComponent); + return true; + } + + if (EntMan.TryGetComponent(entity, out var spriteComponent)) + { + texture = spriteComponent.Icon?.Default; + return true; + } + + texture = null; + return false; + } } } diff --git a/Content.Client/_Sunrise/Kitchen/UI/AssemblerBoundUserInterface.cs b/Content.Client/_Sunrise/Kitchen/UI/AssemblerBoundUserInterface.cs index 6657be9147..871e96b778 100644 --- a/Content.Client/_Sunrise/Kitchen/UI/AssemblerBoundUserInterface.cs +++ b/Content.Client/_Sunrise/Kitchen/UI/AssemblerBoundUserInterface.cs @@ -1,5 +1,4 @@ using Content.Shared._Sunrise.Kitchen.Components; -using Content.Shared.Chemistry.Reagent; using Content.Shared.Kitchen.Components; using JetBrains.Annotations; using Robust.Client.GameObjects; @@ -17,9 +16,6 @@ namespace Content.Client._Sunrise.Kitchen.UI [ViewVariables] private readonly Dictionary _solids = new(); - [ViewVariables] - private readonly Dictionary _reagents = new(); - private readonly string _menuTitle; private readonly string _leftFlavorText; @@ -67,9 +63,6 @@ namespace Content.Client._Sunrise.Kitchen.UI // TODO move this to a component state and ensure the net ids. RefreshContentsDisplay(EntMan.GetEntityArray(cState.ContainedSolids)); - //Set the cook time info label - var cookTime = cState.CurrentCookTime.ToString(); - _menu.CookTimeInfoLabel.Text = Loc.GetString("assembler-bound-user-interface-insert-ingredients"); _menu.StartButton.Disabled = cState.IsMicrowaveBusy || cState.ContainedSolids.Length == 0; _menu.EjectButton.Disabled = cState.IsMicrowaveBusy || cState.ContainedSolids.Length == 0; @@ -87,8 +80,6 @@ namespace Content.Client._Sunrise.Kitchen.UI private void RefreshContentsDisplay(EntityUid[] containedSolids) { - _reagents.Clear(); - if (_menu == null) return; _solids.Clear(); @@ -96,30 +87,36 @@ namespace Content.Client._Sunrise.Kitchen.UI foreach (var entity in containedSolids) { if (EntMan.Deleted(entity)) - { - return; - } - - // TODO just use sprite view - - Texture? texture; - if (EntMan.TryGetComponent(entity, out var iconComponent)) - { - texture = EntMan.System().GetIcon(iconComponent); - } - else if (EntMan.TryGetComponent(entity, out var spriteComponent)) - { - texture = spriteComponent.Icon?.Default; - } - else { continue; } + if (!TryGetEntityTexture(entity, out var texture)) + continue; + var solidItem = _menu.IngredientsList.AddItem(EntMan.GetComponent(entity).EntityName, texture); var solidIndex = _menu.IngredientsList.IndexOf(solidItem); _solids.Add(solidIndex, entity); } } + + private bool TryGetEntityTexture(EntityUid entity, out Texture? texture) + { + // TODO just use sprite view + if (EntMan.TryGetComponent(entity, out var iconComponent)) + { + texture = EntMan.System().GetIcon(iconComponent); + return true; + } + + if (EntMan.TryGetComponent(entity, out var spriteComponent)) + { + texture = spriteComponent.Icon?.Default; + return true; + } + + texture = null; + return false; + } } }