* Loadouts redux * Loadout window mockup * More workout * rent * validation * Developments * bcs * More cleanup * Rebuild working * Fix model and loading * obsession * efcore * We got a stew goin * Cleanup * Optional + SeniorEngineering fix * Fixes * Update science.yml * add add * Automatic naming * Update nukeops * Coming together * Right now * stargate * rejig the UI * weh * Loadouts tweaks * Merge conflicts + ordering fix * yerba mate * chocolat * More updates * Add multi-selection support * test h * fikss * a * add tech assistant and hazard suit * huh * Latest changes * add medical loadouts * and science * finish security loadouts * cargo * service done * added wildcards * add command * Move restrictions * Finalising * Fix existing work * Localise next batch * clothing fix * Fix storage names * review * the scooping room * Test fixes * Xamlify * Xamlify this too * Update Resources/Prototypes/Loadouts/Jobs/Medical/paramedic.yml Co-authored-by: Mr. 27 <45323883+Dutch-VanDerLinde@users.noreply.github.com> * Update Resources/Prototypes/Loadouts/loadout_groups.yml Co-authored-by: Mr. 27 <45323883+Dutch-VanDerLinde@users.noreply.github.com> * Update Resources/Prototypes/Loadouts/Jobs/Civilian/clown.yml Co-authored-by: Mr. 27 <45323883+Dutch-VanDerLinde@users.noreply.github.com> * Update Resources/Prototypes/Loadouts/Jobs/Civilian/clown.yml Co-authored-by: Mr. 27 <45323883+Dutch-VanDerLinde@users.noreply.github.com> * Update Resources/Prototypes/Loadouts/loadout_groups.yml Co-authored-by: Mr. 27 <45323883+Dutch-VanDerLinde@users.noreply.github.com> * Update Resources/Prototypes/Loadouts/Jobs/Security/detective.yml Co-authored-by: Mr. 27 <45323883+Dutch-VanDerLinde@users.noreply.github.com> * Update Resources/Prototypes/Loadouts/loadout_groups.yml Co-authored-by: Mr. 27 <45323883+Dutch-VanDerLinde@users.noreply.github.com> * ben * Margins --------- Co-authored-by: Firewatch <54725557+musicmanvr@users.noreply.github.com> Co-authored-by: Mr. 27 <koolthunder019@gmail.com> Co-authored-by: Mr. 27 <45323883+Dutch-VanDerLinde@users.noreply.github.com>
75 lines
2.1 KiB
C#
75 lines
2.1 KiB
C#
using Content.Shared.Clothing;
|
|
using Content.Shared.Preferences.Loadouts;
|
|
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Client.UserInterface.CustomControls;
|
|
using Robust.Client.UserInterface.XAML;
|
|
using Robust.Shared.Map;
|
|
using Robust.Shared.Prototypes;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Content.Client.Preferences.UI;
|
|
|
|
[GenerateTypedNameReferences]
|
|
public sealed partial class LoadoutContainer : BoxContainer
|
|
{
|
|
[Dependency] private readonly IEntityManager _entManager = default!;
|
|
[Dependency] private readonly IPrototypeManager _protoManager = default!;
|
|
|
|
private readonly EntityUid? _entity;
|
|
|
|
public Button Select => SelectButton;
|
|
|
|
public LoadoutContainer(ProtoId<LoadoutPrototype> proto, bool disabled, FormattedMessage? reason)
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
IoCManager.InjectDependencies(this);
|
|
|
|
SelectButton.Disabled = disabled;
|
|
|
|
if (disabled && reason != null)
|
|
{
|
|
var tooltip = new Tooltip();
|
|
tooltip.SetMessage(reason);
|
|
SelectButton.TooltipSupplier = _ => tooltip;
|
|
}
|
|
|
|
if (_protoManager.TryIndex(proto, out var loadProto))
|
|
{
|
|
var ent = _entManager.System<LoadoutSystem>().GetFirstOrNull(loadProto);
|
|
|
|
if (ent != null)
|
|
{
|
|
_entity = _entManager.SpawnEntity(ent, MapCoordinates.Nullspace);
|
|
Sprite.SetEntity(_entity);
|
|
|
|
var spriteTooltip = new Tooltip();
|
|
spriteTooltip.SetMessage(FormattedMessage.FromUnformatted(_entManager.GetComponent<MetaDataComponent>(_entity.Value).EntityDescription));
|
|
Sprite.TooltipSupplier = _ => spriteTooltip;
|
|
}
|
|
}
|
|
}
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
base.Dispose(disposing);
|
|
|
|
if (!disposing)
|
|
return;
|
|
|
|
_entManager.DeleteEntity(_entity);
|
|
}
|
|
|
|
public bool Pressed
|
|
{
|
|
get => SelectButton.Pressed;
|
|
set => SelectButton.Pressed = value;
|
|
}
|
|
|
|
public string? Text
|
|
{
|
|
get => SelectButton.Text;
|
|
set => SelectButton.Text = value;
|
|
}
|
|
}
|