* JobRequirement refactor (#30347) * refactor JobRequirements * add profile support * fix * Update quartermaster.yml * sloth fixes * inport 30208 * Update DepartmentPrototype.cs * species restriction * left tweak stick * stringbuilder is cool! * Add JobRequirementOverride prototypes (#28607) * Add JobRequirementOverride prototypes * a * invert if * Add override that takes in prototypes directly * - fix: Errors. * - add: Add stuff. * - fix: Formatted message fix. * - add: Another requirement. --------- Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com> Co-authored-by: Leon Friedrich <60421075+ElectroJr@users.noreply.github.com>
65 lines
2.2 KiB
C#
65 lines
2.2 KiB
C#
using Content.Client.Lobby;
|
|
using Content.Client.UserInterface.Controls;
|
|
using Content.Shared.Preferences;
|
|
using Content.Shared.Preferences.Loadouts;
|
|
using Content.Shared.Preferences.Loadouts.Effects;
|
|
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.UserInterface.XAML;
|
|
using Robust.Shared.Player;
|
|
using Robust.Shared.Prototypes;
|
|
|
|
namespace Content.Client.Preferences.UI;
|
|
|
|
[GenerateTypedNameReferences]
|
|
public sealed partial class LoadoutWindow : FancyWindow
|
|
{
|
|
public event Action<ProtoId<LoadoutGroupPrototype>, ProtoId<ItemLoadoutPrototype>>? OnLoadoutPressed;
|
|
public event Action<ProtoId<LoadoutGroupPrototype>, ProtoId<ItemLoadoutPrototype>>? OnLoadoutUnpressed;
|
|
|
|
private List<LoadoutGroupContainer> _groups = new();
|
|
|
|
public HumanoidCharacterProfile Profile;
|
|
|
|
public LoadoutWindow(HumanoidCharacterProfile profile, RoleLoadout loadout, RoleLoadoutPrototype proto, ICommonSession session, IDependencyCollection collection)
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
Profile = profile;
|
|
var protoManager = collection.Resolve<IPrototypeManager>();
|
|
|
|
foreach (var group in proto.Groups)
|
|
{
|
|
if (!protoManager.TryIndex(group, out var groupProto))
|
|
continue;
|
|
|
|
var container = new LoadoutGroupContainer(profile, loadout, protoManager.Index(group), session, collection);
|
|
LoadoutGroupsContainer.AddTab(container, Loc.GetString(groupProto.Name));
|
|
_groups.Add(container);
|
|
|
|
container.OnLoadoutPressed += args =>
|
|
{
|
|
OnLoadoutPressed?.Invoke(group, args);
|
|
};
|
|
|
|
container.OnLoadoutUnpressed += args =>
|
|
{
|
|
OnLoadoutUnpressed?.Invoke(group, args);
|
|
};
|
|
}
|
|
}
|
|
|
|
public override void Close()
|
|
{
|
|
base.Close();
|
|
var controller = UserInterfaceManager.GetUIController<LobbyUIController>();
|
|
controller.SetDummyJob(null);
|
|
}
|
|
|
|
public void RefreshLoadouts(RoleLoadout loadout, ICommonSession session, IDependencyCollection collection)
|
|
{
|
|
foreach (var group in _groups)
|
|
{
|
|
group.RefreshLoadouts(Profile, loadout, session, collection);
|
|
}
|
|
}
|
|
}
|