Added auto label for ChemMaster (#5596)
This commit is contained in:
@@ -29,6 +29,7 @@ namespace Content.Client.Chemistry.UI
|
||||
public partial class ChemMasterWindow : SS14Window
|
||||
{
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
public event Action<string>? OnLabelEntered;
|
||||
public event Action<BaseButton.ButtonEventArgs, ChemButton>? OnChemButtonPressed;
|
||||
public readonly Button[] PillTypeButtons;
|
||||
|
||||
@@ -47,6 +48,7 @@ namespace Content.Client.Chemistry.UI
|
||||
{
|
||||
RobustXamlLoader.Load(this);
|
||||
IoCManager.InjectDependencies(this);
|
||||
LabelLineEdit.OnTextEntered += e => OnLabelEntered?.Invoke(e.Text);
|
||||
|
||||
//Pill type selection buttons, in total there are 20 pills.
|
||||
//Pill rsi file should have states named as pill1, pill2, and so on.
|
||||
@@ -75,7 +77,6 @@ namespace Content.Client.Chemistry.UI
|
||||
Group = pillTypeGroup
|
||||
};
|
||||
|
||||
|
||||
//Generate buttons textures
|
||||
var specifier = new SpriteSpecifier.Rsi(resourcePath, "pill" + (i + 1));
|
||||
TextureRect pillTypeTexture = new TextureRect
|
||||
@@ -111,6 +112,7 @@ namespace Content.Client.Chemistry.UI
|
||||
{
|
||||
var castState = (ChemMasterBoundUserInterfaceState) state;
|
||||
Title = castState.DispenserName;
|
||||
LabelLine = castState.Label;
|
||||
UpdatePanelInfo(castState);
|
||||
if (Contents.Children != null)
|
||||
{
|
||||
@@ -194,7 +196,8 @@ namespace Content.Client.Chemistry.UI
|
||||
|
||||
if (!state.BufferReagents.Any())
|
||||
{
|
||||
BufferInfo.Children.Add(new Label {Text = Loc.GetString("chem-master-window-buffer-empty-text") });
|
||||
BufferInfo.Children.Add(new Label { Text = Loc.GetString("chem-master-window-buffer-empty-text") });
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -250,6 +253,18 @@ namespace Content.Client.Chemistry.UI
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String LabelLine
|
||||
{
|
||||
get
|
||||
{
|
||||
return LabelLineEdit.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
LabelLineEdit.Text = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ChemButton : Button
|
||||
|
||||
Reference in New Issue
Block a user