diff --git a/Content.Client/Kitchen/UI/MicrowaveBoundUserInterface.cs b/Content.Client/Kitchen/UI/MicrowaveBoundUserInterface.cs index 643ac47054b..0fa82d230d8 100644 --- a/Content.Client/Kitchen/UI/MicrowaveBoundUserInterface.cs +++ b/Content.Client/Kitchen/UI/MicrowaveBoundUserInterface.cs @@ -21,8 +21,24 @@ public sealed class MicrowaveBoundUserInterface : BoundUserInterface [ViewVariables] private readonly Dictionary _reagents = new(); + // Frontier: UI parameters + private readonly string _menuTitle; + private readonly string _leftFlavorText; + public MicrowaveBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) { + // Frontier: switch UI params based on key + if ((MicrowaveUiKey)uiKey == MicrowaveUiKey.ElectricRangeKey) + { + _menuTitle = "microwave-menu-range-title"; + _leftFlavorText = "microwave-menu-range-footer-flavor-left"; + } + else + { + _menuTitle = "microwave-menu-title"; + _leftFlavorText = "microwave-menu-footer-flavor-left"; + } + // End Frontier } protected override void Open() @@ -60,6 +76,11 @@ protected override void Open() ("time", Loc.GetString("microwave-menu-instant-button"))); } }; + + // Frontier: UI customization + _menu.Title = Loc.GetString(_menuTitle); + _menu.LeftFooter.Text = Loc.GetString(_leftFlavorText); + // End Frontier } protected override void UpdateState(BoundUserInterfaceState state) diff --git a/Content.Client/Kitchen/UI/MicrowaveMenu.xaml b/Content.Client/Kitchen/UI/MicrowaveMenu.xaml index cd81ea0a9bf..c99462d9e7a 100644 --- a/Content.Client/Kitchen/UI/MicrowaveMenu.xaml +++ b/Content.Client/Kitchen/UI/MicrowaveMenu.xaml @@ -98,7 +98,7 @@ - - + + GetRsiTexture("/Textures/Objects/Weapons/Melee/kitchen_knife.rsi", "icon"), _ => GetRsiTexture("/Textures/Structures/meat_spike.rsi", "spike") }; + ProcessingTextures.AddChild(processingTexture); // Frontier } private void GenerateControl(FoodSlicingData entry) @@ -80,7 +83,9 @@ private void GenerateControl(FoodSlicingData entry) SetSource(ent); ProcessingLabel.Text = Loc.GetString("guidebook-food-processing-slicing"); - ProcessingTexture.Texture = GetRsiTexture("/Textures/Objects/Misc/utensils.rsi", "plastic_knife"); + var processingTexture = new TextureRect(); // Frontier + processingTexture.Texture = GetRsiTexture("/Textures/Objects/Misc/utensils.rsi", "plastic_knife"); + ProcessingTextures.AddChild(processingTexture); // Frontier } private void GenerateControl(FoodRecipeData entry) @@ -101,8 +106,49 @@ private void GenerateControl(FoodRecipeData entry) var combinedIngredients = string.Join("\n", combinedLiquids.Union(combinedSolids)); SourceLabel.Text = Loc.GetString("guidebook-food-processing-recipe", ("ingredients", combinedIngredients)); // Frontier: SetMessage processingTypes = new(); + if (recipeType.HasFlag(MicrowaveRecipeType.Microwave)) + { + processingTexture = new TextureRect(); + if (recipe.SecretRecipe) + processingTexture.Texture = GetRsiTexture("/Textures/Structures/Machines/microwave_syndie.rsi", "mw"); + else + processingTexture.Texture = GetRsiTexture("/Textures/Structures/Machines/microwave.rsi", "mw"); + ProcessingTextures.AddChild(processingTexture); + processingTypes.Add(Loc.GetString("guidebook-food-processing-type-microwave")); + } + if (recipeType.HasFlag(MicrowaveRecipeType.Oven)) + { + processingTexture = new TextureRect(); + if (recipe.SecretRecipe) + processingTexture.Texture = GetRsiTexture("/Textures/_NF/Structures/Machines/oven_syndie.rsi", "composite_off"); + else + processingTexture.Texture = GetRsiTexture("/Textures/_NF/Structures/Machines/oven.rsi", "composite_off"); + ProcessingTextures.AddChild(processingTexture); + processingTypes.Add(Loc.GetString("guidebook-food-processing-type-oven")); + } + if (recipeType.HasFlag(MicrowaveRecipeType.Assembler)) + { + processingTexture = new TextureRect(); + processingTexture.Texture = GetRsiTexture("/Textures/_NF/Structures/Machines/assembler.rsi", "assembler"); + ProcessingTextures.AddChild(processingTexture); + processingTypes.Add(Loc.GetString("guidebook-food-processing-type-assembler")); + } + if (recipeType.HasFlag(MicrowaveRecipeType.MedicalAssembler)) + { + processingTexture = new TextureRect(); + processingTexture.Texture = GetRsiTexture("/Textures/_NF/Structures/Machines/medical_assembler.rsi", "mediwave-base"); + ProcessingTextures.AddChild(processingTexture); + processingTypes.Add(Loc.GetString("guidebook-food-processing-type-medical-assembler")); + } + if (processingTypes.Count <= 0) + processingTypes.Add(Loc.GetString("guidebook-food-processing-type-generic")); + var processingTypeString = string.Join('/', processingTypes); + // End Frontier + ProcessingLabel.Text = Loc.GetString("guidebook-food-processing-cooking", ("processingTypes", processingTypeString), ("time", recipe.CookTime)); } private void GenerateControl(FoodReactionData entry) @@ -118,7 +164,9 @@ private void GenerateControl(FoodReactionData entry) .Where(it => it.Length > 0); SourceLabel.Text = Loc.GetString("guidebook-food-processing-recipe", ("ingredients", string.Join("\n", combinedReagents))); // Frontier: SetMessage + + + + + + + + + + + + + diff --git a/Content.Client/_NF/CartridgeLoader/Cartridges/AppraisalUiFragment.xaml.cs b/Content.Client/_NF/CartridgeLoader/Cartridges/AppraisalUiFragment.xaml.cs new file mode 100644 index 00000000000..fbffdce9450 --- /dev/null +++ b/Content.Client/_NF/CartridgeLoader/Cartridges/AppraisalUiFragment.xaml.cs @@ -0,0 +1,65 @@ +using Content.Shared.CartridgeLoader.Cartridges; +using Robust.Client.AutoGenerated; +using Robust.Client.Graphics; +using Robust.Client.UserInterface.Controls; +using Robust.Client.UserInterface.XAML; + +namespace Content.Client._NF.CartridgeLoader.Cartridges; + +[GenerateTypedNameReferences] +public sealed partial class AppraisalUiFragment : BoxContainer +{ + private readonly StyleBoxFlat _styleBox = new() + { + BackgroundColor = Color.Transparent, + BorderColor = Color.FromHex("#5a5a5a"), + BorderThickness = new Thickness(0, 0, 0, 1) + }; + + public AppraisalUiFragment() + { + RobustXamlLoader.Load(this); + Orientation = LayoutOrientation.Vertical; + HorizontalExpand = true; + VerticalExpand = true; + HeaderPanel.PanelOverride = _styleBox; + } + + public void UpdateState(List items) + { + AppraisedItemContainer.RemoveAllChildren(); + + //Reverse the list so the oldest entries appear at the bottom + items.Reverse(); + + //Enable scrolling if there are more entries that can fit on the screen + ScrollContainer.HScrollEnabled = items.Count > 9; + + foreach (var item in items) + { + AddAppraisedItem(item); + } + } + + private void AddAppraisedItem(AppraisedItem item) + { + var row = new BoxContainer(); + row.HorizontalExpand = true; + row.Orientation = LayoutOrientation.Horizontal; + row.Margin = new Thickness(4); + + var nameLabel = new Label(); + nameLabel.Text = item.Name; + nameLabel.HorizontalExpand = true; + nameLabel.ClipText = true; + row.AddChild(nameLabel); + + var valueLabel = new Label(); + valueLabel.Text = item.AppraisedPrice; + valueLabel.HorizontalExpand = true; + valueLabel.ClipText = true; + row.AddChild(valueLabel); + + AppraisedItemContainer.AddChild(row); + } +} diff --git a/Content.Client/_NF/Kitchen/UI/AssemblerBoundUserInterface.cs b/Content.Client/_NF/Kitchen/UI/AssemblerBoundUserInterface.cs new file mode 100644 index 00000000000..3c05b3aea70 --- /dev/null +++ b/Content.Client/_NF/Kitchen/UI/AssemblerBoundUserInterface.cs @@ -0,0 +1,125 @@ +using Content.Shared._NF.Kitchen.Components; +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; + +namespace Content.Client._NF.Kitchen.UI +{ + [UsedImplicitly] + public sealed class AssemblerBoundUserInterface : BoundUserInterface + { + [ViewVariables] + private AssemblerMenu? _menu; + + [ViewVariables] + private readonly Dictionary _solids = new(); + + [ViewVariables] + private readonly Dictionary _reagents = new(); + + private readonly string _menuTitle; + private readonly string _leftFlavorText; + + public AssemblerBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) + { + if ((MicrowaveUiKey)uiKey == MicrowaveUiKey.MedicalAssemblerKey) + { + _menuTitle = "assembler-menu-medical-title"; + _leftFlavorText = "assembler-menu-medical-footer-flavor-left"; + } + else + { + _menuTitle = "assembler-menu-title"; + _leftFlavorText = "assembler-menu-footer-flavor-left"; + } + } + + protected override void Open() + { + base.Open(); + _menu = this.CreateWindow(); + _menu.StartButton.OnPressed += _ => SendPredictedMessage(new AssemblerStartCookMessage()); + _menu.EjectButton.OnPressed += _ => SendPredictedMessage(new MicrowaveEjectMessage()); + _menu.IngredientsList.OnItemSelected += args => + { + SendPredictedMessage(new MicrowaveEjectSolidIndexedMessage(EntMan.GetNetEntity(_solids[args.ItemIndex]))); + }; + + _menu.Title = Loc.GetString(_menuTitle); + _menu.LeftFooter.Text = Loc.GetString(_leftFlavorText); + } + + protected override void UpdateState(BoundUserInterfaceState state) + { + base.UpdateState(state); + if (state is not MicrowaveUpdateUserInterfaceState cState || _menu == null) + { + return; + } + + _menu.IsBusy = cState.IsMicrowaveBusy; + _menu.CurrentCooktimeEnd = cState.CurrentCookTimeEnd; + + _menu.ToggleBusyDisableOverlayPanel(cState.IsMicrowaveBusy || cState.ContainedSolids.Length == 0); + // 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; + + //Set the "micowave light" ui color to indicate if the microwave is busy or not + if (cState.IsMicrowaveBusy && cState.ContainedSolids.Length > 0) + { + _menu.IngredientsPanel.PanelOverride = new StyleBoxFlat { BackgroundColor = Color.FromHex("#947300") }; + } + else + { + _menu.IngredientsPanel.PanelOverride = new StyleBoxFlat { BackgroundColor = Color.FromHex("#1B1B1E") }; + } + } + + private void RefreshContentsDisplay(EntityUid[] containedSolids) + { + _reagents.Clear(); + + if (_menu == null) return; + + _solids.Clear(); + _menu.IngredientsList.Clear(); + 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; + } + + var solidItem = _menu.IngredientsList.AddItem(EntMan.GetComponent(entity).EntityName, texture); + var solidIndex = _menu.IngredientsList.IndexOf(solidItem); + _solids.Add(solidIndex, entity); + } + } + } +} diff --git a/Content.Client/_NF/Kitchen/UI/AssemblerMenu.xaml b/Content.Client/_NF/Kitchen/UI/AssemblerMenu.xaml new file mode 100644 index 00000000000..8de5f2643ee --- /dev/null +++ b/Content.Client/_NF/Kitchen/UI/AssemblerMenu.xaml @@ -0,0 +1,95 @@ + + + + + + + + + + + + + + + +