Skip to content

Commit

Permalink
more ui stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
deltanedas committed Feb 7, 2025
1 parent d0159f1 commit 396b8a3
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 14 deletions.
11 changes: 11 additions & 0 deletions Content.Client/_DV/Reputation/UI/Contract.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<BoxContainer xmlns="https://spacestation14.io"
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
Orientation="Horizontal"
HorizontalExpand="true"
MinHeight="64">
<Label Name="Title"/> <!-- Set in constructor -->
<BoxContainer Orientation="Vertical">
<Button Name="CompleteButton" Text="Complete"/>
<Button Name="RejectButton" Text="Reject"/>
</BoxContainer>
</BoxContainer>
28 changes: 28 additions & 0 deletions Content.Client/_DV/Reputation/UI/Contract.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
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 has a contract active.
/// </summary>
[GenerateTypedNameReferences]
public sealed partial class Contract : BoxContainer
{
public event Action OnComplete;
public event Action OnReject;

public ContractsWindow(string title)
{
RobustXamlLoader.Load(this);

Title.text = title;

CompleteButton.OnPressed += _ => OnComplete?.Invoke();
RejectButton.OnPressed += _ => OnReject?.Invoke();

OnComplete += () => Orphan();
OnReject += () => Orphan();
}
}
32 changes: 18 additions & 14 deletions Content.Client/_DV/Reputation/UI/ContractsWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Content.Client.UserInterface.Controls;
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;
Expand All @@ -11,6 +12,7 @@ public sealed partial class ContractsWindow : FancyWindow
[Dependency] private EntityManager _entMan = default!;

public event Action<int>? OnAccept;
public event Action<int>? OnComplete;
public event Action<int>? OnReject;

public EntityUid Owner;
Expand All @@ -30,28 +32,30 @@ public void UpdateState()
Level.Text = Loc.GetString(level.Name);
Reputation.Text = $"{comp.Reputation} Reputation";

Contracts.ClearChildren();
Contracts.RemoveAllChildren();
for (int i = 0; i < comp.Slots.Count; i++)
{
var box = new BoxContainer()
if (comp.Slots[i].ObjectiveTitle is {} title)
{
Orientation = Orientation.Horizontal
};
box.AddChild(new Label()
var contract = new Contract(title);
Contracts.AddChild(contract);
// TODO: green when objective is complete
}
else
{
Text = comp.Slots[i].ObjectiveTitle ?? "< no contract active >";
});
// TODO: green when objective is complete
// TODO: NextUnlock thing
// TODO: button to complete the contract
Contracts.AddChild(box);
Contracts.AddChild(new Label()
{
Text = "< no contract active >"
});
// TODO: NextUnlock thing
}
}

Offerings.ClearChildren();
for (int i = 0; i < comp.OfferingNames.Count; i++)
Offerings.RemoveAllChildren();
for (int i = 0; i < comp.OfferingTitles.Count; i++)
{
var index = i;
var offering = comp.OfferingNames[i];
var offering = comp.OfferingTitles[i];
var button = new Button()
{
Text = offering + " - 0 TC 0 REP" // TODO
Expand Down

0 comments on commit 396b8a3

Please sign in to comment.