uichange Chemmaster (#14237)

This commit is contained in:
DEATHB4DEFEAT
2023-04-05 15:55:14 -07:00
committed by GitHub
parent b1852ea280
commit c02dd02c34
4 changed files with 70 additions and 91 deletions

View File

@@ -1,5 +1,6 @@
using System.Linq;
using Content.Client.Stylesheets;
using Content.Client.UserInterface.Controls;
using Content.Shared.Chemistry;
using Content.Shared.Chemistry.Reagent;
using Robust.Client.AutoGenerated;
@@ -18,7 +19,7 @@ namespace Content.Client.Chemistry.UI
/// Client-side UI used to control a <see cref="SharedChemMasterComponent"/>
/// </summary>
[GenerateTypedNameReferences]
public sealed partial class ChemMasterWindow : DefaultWindow
public sealed partial class ChemMasterWindow : FancyWindow
{
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
public event Action<BaseButton.ButtonEventArgs, ReagentButton>? OnReagentButtonPressed;
@@ -210,6 +211,8 @@ namespace Content.Client.Chemistry.UI
MakeReagentButton("5", ChemMasterReagentAmount.U5, reagent.ReagentId, true, StyleBase.ButtonOpenBoth),
MakeReagentButton("10", ChemMasterReagentAmount.U10, reagent.ReagentId, true, StyleBase.ButtonOpenBoth),
MakeReagentButton("25", ChemMasterReagentAmount.U25, reagent.ReagentId, true, StyleBase.ButtonOpenBoth),
MakeReagentButton("50", ChemMasterReagentAmount.U50, reagent.ReagentId, true, StyleBase.ButtonOpenBoth),
MakeReagentButton("100", ChemMasterReagentAmount.U100, reagent.ReagentId, true, StyleBase.ButtonOpenBoth),
MakeReagentButton(Loc.GetString("chem-master-window-buffer-all-amount"), ChemMasterReagentAmount.All, reagent.ReagentId, true, StyleBase.ButtonOpenLeft),
}
});
@@ -254,10 +257,9 @@ namespace Content.Client.Chemistry.UI
// Try to get the prototype for the given reagent. This gives us its name.
_prototypeManager.TryIndex(lineItem.Id, out ReagentPrototype? proto);
var name = proto?.LocalizedName
?? Loc.GetString("chem-master-window-unknown-reagent-text");
?? Loc.GetString("chem-master-window-unknown-reagent-text");
return (name, lineItem.Id, lineItem.Quantity);
})
.OrderBy(r => r.Item1);
@@ -292,6 +294,10 @@ namespace Content.Client.Chemistry.UI
"10", ChemMasterReagentAmount.U10, id, false, StyleBase.ButtonOpenBoth));
cs.Add(MakeReagentButton(
"25", ChemMasterReagentAmount.U25, id, false, StyleBase.ButtonOpenBoth));
cs.Add(MakeReagentButton(
"50", ChemMasterReagentAmount.U50, id, false, StyleBase.ButtonOpenBoth));
cs.Add(MakeReagentButton(
"100", ChemMasterReagentAmount.U100, id, false, StyleBase.ButtonOpenBoth));
cs.Add(MakeReagentButton(
Loc.GetString("chem-master-window-buffer-all-amount"),
ChemMasterReagentAmount.All, id, false, StyleBase.ButtonOpenLeft));
@@ -329,6 +335,5 @@ namespace Content.Client.Chemistry.UI
Id = id;
IsBuffer = isBuffer;
}
}
}