Files
wwdpublic/Content.Client/Guidebook/Controls/GuideFoodComposition.xaml.cs
Mnemotechnican 7974d2affe Food Recipe Guidebook (#783)
# Description
Adds an auto-generated list of recipes to the guidebook. This was mostly
made using the chemical list as a reference, so it's a bit shitcode-ey.

# TODO
- [X] Make less ugly (add paddings to table cells and fix colors)
- [X] Fix sprites not working
- [X] Unshitcode (if possible)

<details><summary><h1>Media</h1></summary>
<p>


https://github.com/user-attachments/assets/597cbec1-7114-480b-ab8d-5ed9f8b2e0c3

</p>
</details>

# Changelog
🆑
- add: The "food recipes" page in guidebook now contains an
automatically generated list of food recipes.
2024-10-19 12:41:54 +07:00

32 lines
923 B
C#

using Content.Client.UserInterface.ControlExtensions;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using JetBrains.Annotations;
using Robust.Client.AutoGenerated;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.XAML;
namespace Content.Client.Guidebook.Controls;
[UsedImplicitly, GenerateTypedNameReferences]
public sealed partial class GuideFoodComposition : BoxContainer, ISearchableControl
{
public GuideFoodComposition(ReagentPrototype proto, FixedPoint2 quantity)
{
RobustXamlLoader.Load(this);
ReagentLabel.Text = proto.LocalizedName;
AmountLabel.Text = quantity.ToString();
}
public bool CheckMatchesSearch(string query)
{
return this.ChildrenContainText(query);
}
public void SetHiddenState(bool state, string query)
{
Visible = CheckMatchesSearch(query) ? state : !state;
}
}