49 lines
1.2 KiB
C#
49 lines
1.2 KiB
C#
using Content.Shared._DV.Reputation;
|
|
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.UserInterface.Controls;
|
|
using Robust.Client.UserInterface.XAML;
|
|
|
|
namespace Content.Client._DV.Reputation.UI;
|
|
|
|
/// <summary>
|
|
/// Contract control placed in a slot that with no contract.
|
|
/// </summary>
|
|
[GenerateTypedNameReferences]
|
|
public sealed partial class ContractOffering : BoxContainer
|
|
{
|
|
public event Action? OnAccept;
|
|
public event Action? OnReject;
|
|
public event Action? OnUnlock;
|
|
|
|
public bool AcceptDisabled
|
|
{
|
|
get
|
|
{
|
|
return AcceptButton.Disabled;
|
|
}
|
|
set
|
|
{
|
|
AcceptButton.Disabled = value;
|
|
}
|
|
}
|
|
|
|
public ContractOffering(OfferingSlot slot)
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
|
|
if (slot.Title is {} title)
|
|
Title.Text = title;
|
|
else
|
|
Title.Visible = false;
|
|
|
|
UnlockLabel.NextUnlock = slot.NextUnlock;
|
|
UnlockLabel.OnUnlock += () => OnUnlock?.Invoke();
|
|
|
|
OnUnlock += () => ButtonsContainer.Visible = true;
|
|
ButtonsContainer.Visible = !UnlockLabel.IsLocked;
|
|
|
|
AcceptButton.OnPressed += _ => OnAccept?.Invoke();
|
|
RejectButton.OnPressed += _ => OnReject?.Invoke();
|
|
}
|
|
}
|