-
Notifications
You must be signed in to change notification settings - Fork 510
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into 2024-09-07-Caveman
- Loading branch information
Showing
141 changed files
with
4,038 additions
and
2,387 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
Content.Client/_NF/CartridgeLoader/Cartridges/AppraisalUi.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using Content.Client.UserInterface.Fragments; | ||
using Content.Shared.CartridgeLoader.Cartridges; | ||
using Robust.Client.GameObjects; | ||
using Robust.Client.UserInterface; | ||
|
||
namespace Content.Client._NF.CartridgeLoader.Cartridges; | ||
|
||
public sealed partial class AppraisalUi : UIFragment | ||
{ | ||
private AppraisalUiFragment? _fragment; | ||
|
||
public override Control GetUIFragmentRoot() | ||
{ | ||
return _fragment!; | ||
} | ||
|
||
public override void Setup(BoundUserInterface userInterface, EntityUid? fragmentOwner) | ||
{ | ||
_fragment = new AppraisalUiFragment(); | ||
} | ||
|
||
public override void UpdateState(BoundUserInterfaceState state) | ||
{ | ||
if (state is not AppraisalUiState appraisalUiState) | ||
return; | ||
|
||
_fragment?.UpdateState(appraisalUiState.AppraisedItems); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
Content.Client/_NF/CartridgeLoader/Cartridges/AppraisalUiFragment.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<cartridges:AppraisalUiFragment xmlns:cartridges="clr-namespace:Content.Client._NF.CartridgeLoader.Cartridges" | ||
xmlns="https://spacestation14.io" Margin="1 0 2 0"> | ||
<PanelContainer StyleClasses="BackgroundDark"></PanelContainer> | ||
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True"> | ||
<BoxContainer Orientation="Vertical" MinHeight="32" MaxHeight="32" VerticalAlignment="Top" Margin="3 0"> | ||
<PanelContainer Name="HeaderPanel"> | ||
<BoxContainer Orientation="Horizontal" HorizontalExpand="True" Margin="4"> | ||
<Label HorizontalExpand="True" Text="{Loc 'appraisal-label-name'}"/> | ||
<Label HorizontalExpand="True" Text="{Loc 'appraisal-label-price'}"/> | ||
</BoxContainer> | ||
</PanelContainer> | ||
</BoxContainer> | ||
<ScrollContainer Name="ScrollContainer" HorizontalExpand="True" VerticalExpand="True"> | ||
<BoxContainer Orientation="Vertical" Name="AppraisedItemContainer" HorizontalExpand="True" VerticalExpand="True" VerticalAlignment="Top" Margin="3 0"/> | ||
</ScrollContainer> | ||
</BoxContainer> | ||
</cartridges:AppraisalUiFragment> |
65 changes: 65 additions & 0 deletions
65
Content.Client/_NF/CartridgeLoader/Cartridges/AppraisalUiFragment.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<AppraisedItem> 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); | ||
} | ||
} |
125 changes: 125 additions & 0 deletions
125
Content.Client/_NF/Kitchen/UI/AssemblerBoundUserInterface.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<int, EntityUid> _solids = new(); | ||
|
||
[ViewVariables] | ||
private readonly Dictionary<int, ReagentQuantity> _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<AssemblerMenu>(); | ||
_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<IconComponent>(entity, out var iconComponent)) | ||
{ | ||
texture = EntMan.System<SpriteSystem>().GetIcon(iconComponent); | ||
} | ||
else if (EntMan.TryGetComponent<SpriteComponent>(entity, out var spriteComponent)) | ||
{ | ||
texture = spriteComponent.Icon?.Default; | ||
} | ||
else | ||
{ | ||
continue; | ||
} | ||
|
||
var solidItem = _menu.IngredientsList.AddItem(EntMan.GetComponent<MetaDataComponent>(entity).EntityName, texture); | ||
var solidIndex = _menu.IngredientsList.IndexOf(solidItem); | ||
_solids.Add(solidIndex, entity); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.