-
Notifications
You must be signed in to change notification settings - Fork 523
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'PIRATE-BOOTIES' of https://github.com/Salvantrix/fronti…
…er-station-14 into PIRATE-BOOTIES
- Loading branch information
Showing
16 changed files
with
449 additions
and
22 deletions.
There are no files selected for viewing
57 changes: 57 additions & 0 deletions
57
Content.Client/_NF/Pirate/BUI/PirateBountyConsoleBoundUserInterface.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using Content.Client._NF.Pirate.UI; | ||
using Content.Shared._NF.Pirate.Components; | ||
using JetBrains.Annotations; | ||
|
||
namespace Content.Client._NF.Pirate.BUI; | ||
|
||
[UsedImplicitly] | ||
public sealed class PirateBountyConsoleBoundUserInterface : BoundUserInterface | ||
{ | ||
[ViewVariables] | ||
private PirateBountyMenu? _menu; | ||
|
||
public PirateBountyConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) | ||
{ | ||
} | ||
|
||
protected override void Open() | ||
{ | ||
base.Open(); | ||
|
||
_menu = new(); | ||
|
||
_menu.OnClose += Close; | ||
|
||
_menu.OnLabelButtonPressed += id => | ||
{ | ||
SendMessage(new PirateBountyPrintLabelMessage(id)); | ||
}; | ||
|
||
_menu.OnSkipButtonPressed += id => | ||
{ | ||
SendMessage(new PirateBountySkipMessage(id)); | ||
}; | ||
|
||
_menu.OpenCentered(); | ||
} | ||
|
||
protected override void UpdateState(BoundUserInterfaceState message) | ||
{ | ||
base.UpdateState(message); | ||
|
||
if (message is not PirateBountyConsoleState state) | ||
return; | ||
|
||
_menu?.UpdateEntries(state.Bounties, state.UntilNextSkip); | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
base.Dispose(disposing); | ||
|
||
if (!disposing) | ||
return; | ||
|
||
_menu?.Dispose(); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
Content.Client/_NF/Pirate/BUI/PiratePalletConsoleBoundUserInterface.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
using Content.Client._NF.Pirate.UI; | ||
using Content.Shared._NF.Pirate.BUI; | ||
using Content.Shared._NF.Pirate.Events; | ||
using Robust.Client.GameObjects; | ||
|
||
namespace Content.Client._NF.Pirate.BUI; | ||
|
||
public sealed class PiratePalletConsoleBoundUserInterface : BoundUserInterface | ||
{ | ||
[ViewVariables] | ||
private PiratePalletMenu? _menu; | ||
|
||
public PiratePalletConsoleBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) | ||
{ | ||
} | ||
|
||
protected override void Open() | ||
{ | ||
base.Open(); | ||
|
||
_menu = new PiratePalletMenu(); | ||
_menu.SellRequested += OnSell; | ||
_menu.OnClose += Close; | ||
|
||
_menu.OpenCentered(); | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
base.Dispose(disposing); | ||
if (disposing) | ||
{ | ||
_menu?.Dispose(); | ||
} | ||
} | ||
|
||
private void OnSell() | ||
{ | ||
SendMessage(new PiratePalletSellMessage()); | ||
} | ||
|
||
// TODO: remove this, nothing to update | ||
protected override void UpdateState(BoundUserInterfaceState state) | ||
{ | ||
base.UpdateState(state); | ||
|
||
if (state is not PiratePalletConsoleInterfaceState palletState) | ||
return; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Content.Shared._NF.Pirate; | ||
using Robust.Client.GameObjects; | ||
|
||
namespace Content.Client._NF.Pirate.Systems; | ||
|
||
public sealed partial class PirateSystem : SharedPirateSystem | ||
{ | ||
[Dependency] private readonly AnimationPlayerSystem _player = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
base.Initialize(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<BoxContainer xmlns="https://spacestation14.io" | ||
xmlns:customControls="clr-namespace:Content.Client.Administration.UI.CustomControls" | ||
Margin="10 10 10 0" | ||
HorizontalExpand="True" | ||
Visible="True"> | ||
<PanelContainer StyleClasses="AngleRect" HorizontalExpand="True"> | ||
<BoxContainer Orientation="Vertical" | ||
HorizontalExpand="True"> | ||
<BoxContainer Orientation="Horizontal"> | ||
<BoxContainer Orientation="Vertical" HorizontalExpand="True"> | ||
<RichTextLabel Name="RewardLabel"/> | ||
<RichTextLabel Name="ManifestLabel"/> | ||
</BoxContainer> | ||
<Control MinWidth="10"/> | ||
<BoxContainer Orientation="Vertical" MinWidth="120"> | ||
<BoxContainer Orientation="Horizontal" MinWidth="120"> | ||
<Button Name="PrintButton" | ||
Text="{Loc 'bounty-console-label-button-text'}" | ||
HorizontalExpand="False" | ||
HorizontalAlignment="Right" | ||
StyleClasses="OpenRight"/> | ||
<Button Name="SkipButton" | ||
Text="{Loc 'bounty-console-skip-button-text'}" | ||
HorizontalExpand="False" | ||
HorizontalAlignment="Right" | ||
StyleClasses="OpenLeft"/> | ||
</BoxContainer> | ||
<RichTextLabel Name="IdLabel" HorizontalAlignment="Right" Margin="0 0 5 0"/> | ||
</BoxContainer> | ||
</BoxContainer> | ||
<customControls:HSeparator Margin="5 10 5 10"/> | ||
<BoxContainer> | ||
<RichTextLabel Name="DescriptionLabel"/> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</PanelContainer> | ||
</BoxContainer> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
using Content.Client.Message; | ||
using Content.Shared._NF.Pirate; | ||
using Content.Shared._NF.Pirate.Prototypes; | ||
using Content.Shared.Random; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.XAML; | ||
using Robust.Shared.Prototypes; | ||
using Robust.Shared.Timing; | ||
using Serilog; | ||
|
||
namespace Content.Client._NF.Pirate.UI; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class PirateBountyEntry : BoxContainer | ||
{ | ||
[Dependency] private readonly IPrototypeManager _prototype = default!; | ||
|
||
public Action? OnLabelButtonPressed; | ||
public Action? OnSkipButtonPressed; | ||
|
||
public TimeSpan EndTime; | ||
public TimeSpan UntilNextSkip; | ||
|
||
public PirateBountyEntry(PirateBountyData bounty, TimeSpan untilNextSkip) | ||
{ | ||
RobustXamlLoader.Load(this); | ||
IoCManager.InjectDependencies(this); | ||
|
||
UntilNextSkip = untilNextSkip; | ||
|
||
if (!_prototype.TryIndex<PirateBountyPrototype>(bounty.Bounty, out var bountyPrototype)) | ||
return; | ||
|
||
var items = new List<string>(); | ||
foreach (var entry in bountyPrototype.Entries) | ||
{ | ||
items.Add(Loc.GetString("pirate-bounty-console-manifest-entry", | ||
("amount", entry.Amount), | ||
("item", Loc.GetString(entry.Name)))); | ||
} | ||
ManifestLabel.SetMarkup(Loc.GetString("pirate-bounty-console-manifest-label", ("item", string.Join(", ", items)))); | ||
RewardLabel.SetMarkup(Loc.GetString("pirate-bounty-console-reward-label", ("reward", bountyPrototype.Reward))); | ||
DescriptionLabel.SetMarkup(Loc.GetString("pirate-bounty-console-description-label", ("description", Loc.GetString(bountyPrototype.Description)))); | ||
IdLabel.SetMarkup(Loc.GetString("pirate-bounty-console-id-label", ("id", bounty.Id))); | ||
|
||
PrintButton.OnPressed += _ => OnLabelButtonPressed?.Invoke(); | ||
SkipButton.OnPressed += _ => OnSkipButtonPressed?.Invoke(); | ||
} | ||
|
||
private void UpdateSkipButton(float deltaSeconds) | ||
{ | ||
UntilNextSkip -= TimeSpan.FromSeconds(deltaSeconds); | ||
if (UntilNextSkip > TimeSpan.Zero) | ||
{ | ||
SkipButton.Label.Text = UntilNextSkip.ToString("mm\\:ss"); | ||
SkipButton.Disabled = true; | ||
return; | ||
} | ||
|
||
SkipButton.Label.Text = Loc.GetString("pirate-bounty-console-skip-button-text"); | ||
SkipButton.Disabled = false; | ||
} | ||
|
||
protected override void FrameUpdate(FrameEventArgs args) | ||
{ | ||
base.FrameUpdate(args); | ||
UpdateSkipButton(args.DeltaSeconds); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<controls:FancyWindow xmlns="https://spacestation14.io" | ||
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client" | ||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls" | ||
Title="{Loc 'pirate-bounty-console-menu-title'}" | ||
SetSize="550 420" | ||
MinSize="400 350"> | ||
<BoxContainer Orientation="Vertical" | ||
VerticalExpand="True" | ||
HorizontalExpand="True"> | ||
<PanelContainer VerticalExpand="True" HorizontalExpand="True" Margin="10"> | ||
<PanelContainer.PanelOverride> | ||
<gfx:StyleBoxFlat BackgroundColor="#1B1B1E" /> | ||
</PanelContainer.PanelOverride> | ||
<ScrollContainer HScrollEnabled="False" | ||
HorizontalExpand="True" | ||
VerticalExpand="True"> | ||
<BoxContainer Name="PirateBountyEntriesContainer" | ||
Orientation="Vertical" | ||
VerticalExpand="True" | ||
HorizontalExpand="True"> | ||
</BoxContainer> | ||
</ScrollContainer> | ||
</PanelContainer> | ||
<!-- Footer --> | ||
<BoxContainer Orientation="Vertical"> | ||
<PanelContainer StyleClasses="LowDivider" /> | ||
<BoxContainer Orientation="Horizontal" Margin="10 2 5 0" VerticalAlignment="Bottom"> | ||
<Label Text="{Loc 'pirate-bounty-console-flavor-left'}" StyleClasses="WindowFooterText" /> | ||
<Label Text="{Loc 'pirate-bounty-console-flavor-right'}" StyleClasses="WindowFooterText" | ||
HorizontalAlignment="Right" HorizontalExpand="True" Margin="0 0 5 0" /> | ||
<!-- TODO: Probably remove this vv --> | ||
<TextureRect StyleClasses="NTLogoDark" Stretch="KeepAspectCentered" | ||
VerticalAlignment="Center" HorizontalAlignment="Right" SetSize="19 19"/> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</BoxContainer> | ||
</controls:FancyWindow> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using Content.Client.UserInterface.Controls; | ||
using Content.Shared._NF.Pirate; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface; | ||
using Robust.Client.UserInterface.XAML; | ||
|
||
namespace Content.Client._NF.Pirate.UI; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class PirateBountyMenu : FancyWindow | ||
{ | ||
public Action<string>? OnLabelButtonPressed; | ||
public Action<string>? OnSkipButtonPressed; | ||
|
||
public PirateBountyMenu() | ||
{ | ||
RobustXamlLoader.Load(this); | ||
} | ||
|
||
public void UpdateEntries(List<PirateBountyData> bounties, TimeSpan untilNextSkip) | ||
{ | ||
PirateBountyEntriesContainer.Children.Clear(); | ||
foreach (var b in bounties) | ||
{ | ||
var entry = new PirateBountyEntry(b, untilNextSkip); | ||
entry.OnLabelButtonPressed += () => OnLabelButtonPressed?.Invoke(b.Id); | ||
entry.OnSkipButtonPressed += () => OnSkipButtonPressed?.Invoke(b.Id); | ||
|
||
PirateBountyEntriesContainer.AddChild(entry); | ||
} | ||
PirateBountyEntriesContainer.AddChild(new Control | ||
{ | ||
MinHeight = 10 | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<controls:FancyWindow xmlns="https://spacestation14.io" | ||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls" | ||
SetSize="300 150" | ||
MinSize="300 150" | ||
Title="{Loc 'pirate-pallet-console-menu-title'}"> | ||
<BoxContainer Orientation="Vertical" Margin="5"> | ||
<Button Name="SellButton" | ||
Text="{Loc 'pirate-pallet-sell-button'}"/> | ||
<TextureButton VerticalExpand="True" /> | ||
</BoxContainer> | ||
</controls:FancyWindow> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using Content.Client.UserInterface.Controls; | ||
using Content.Shared._NF.Pirate; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.XAML; | ||
|
||
namespace Content.Client._NF.Pirate.UI; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class PiratePalletMenu : FancyWindow | ||
{ | ||
public Action? SellRequested; | ||
|
||
public PiratePalletMenu() | ||
{ | ||
RobustXamlLoader.Load(this); | ||
SellButton.OnPressed += OnSellPressed; | ||
} | ||
|
||
private void OnSellPressed(BaseButton.ButtonEventArgs obj) | ||
{ | ||
SellRequested?.Invoke(); | ||
} | ||
} |
Oops, something went wrong.