forked from Vault-Overseers/nuclear-14
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
92 changed files
with
2,235 additions
and
436 deletions.
There are no files selected for viewing
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
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
39 changes: 39 additions & 0 deletions
39
Content.Client/UndecidedLoadout/UndecidedLoadoutBackpackMenu.xaml
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,39 @@ | ||
<controls:FancyWindow xmlns="https://spacestation14.io" | ||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls" | ||
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client" | ||
Title="{Loc 'undecided-loadout-window-title'}" | ||
MinSize="700 700"> | ||
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalExpand="True"> | ||
<!-- First Informational panel --> | ||
<Label Text="{Loc 'undecided-loadout-window-description'}" Margin="5 5"/> | ||
<controls:HLine Color="#404040" Thickness="2" Margin="0 5"/> | ||
<Label Name="SelectedSets" Text="{Loc 'undecided-loadout-window-selected'}" Margin="5 5"/> | ||
|
||
<!-- Second sets panel --> | ||
<PanelContainer Margin="5 5"> | ||
<PanelContainer.PanelOverride> | ||
<gfx:StyleBoxFlat BackgroundColor="#050505" /> | ||
</PanelContainer.PanelOverride> | ||
<ScrollContainer | ||
HScrollEnabled="False" | ||
MinSize="0 600" | ||
SizeFlagsStretchRatio="2" | ||
VerticalExpand="True"> | ||
<BoxContainer Name="SetsGrid" Orientation="Vertical" MinSize="460 200"> | ||
<!-- Sets is filled by code --> | ||
|
||
</BoxContainer> | ||
</ScrollContainer> | ||
</PanelContainer> | ||
|
||
<!-- Third approve button panel --> | ||
<PanelContainer Margin="10"> | ||
<Button Name="ApproveButton" | ||
Text="{Loc 'undecided-loadout-window-approve-button'}" | ||
Margin="0 5" | ||
Access="Public" | ||
HorizontalAlignment ="Right" | ||
StyleClasses="OpenRight"/> | ||
</PanelContainer> | ||
</BoxContainer> | ||
</controls:FancyWindow> |
57 changes: 57 additions & 0 deletions
57
Content.Client/UndecidedLoadout/UndecidedLoadoutBackpackMenu.xaml.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.UserInterface.Controls; | ||
using Content.Shared.UndecidedLoadout; | ||
using Content.Client.UndecidedLoadout; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.GameObjects; | ||
using Robust.Client.UserInterface.XAML; | ||
|
||
namespace Content.Client.UndecidedLoadout; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class UndecidedLoadoutBackpackMenu : FancyWindow | ||
{ | ||
[Dependency] private readonly IEntitySystemManager _sysMan = default!; | ||
private readonly SpriteSystem _spriteSystem; | ||
|
||
private readonly UndecidedLoadoutBackpackBoundUserInterface _owner; | ||
|
||
public UndecidedLoadoutBackpackMenu(UndecidedLoadoutBackpackBoundUserInterface owner) | ||
{ | ||
RobustXamlLoader.Load(this); | ||
IoCManager.InjectDependencies(this); | ||
_spriteSystem = _sysMan.GetEntitySystem<SpriteSystem>(); | ||
|
||
_owner = owner; | ||
|
||
ApproveButton.OnButtonDown += (args) => | ||
{ | ||
_owner.SendApprove(); | ||
}; | ||
} | ||
|
||
public void UpdateState(UndecidedLoadoutBackpackBoundUserInterfaceState state) | ||
{ | ||
SetsGrid.RemoveAllChildren(); | ||
int count = 0; | ||
int selectedNumber = 0; | ||
foreach (var set in state.Sets) | ||
{ | ||
var child = new UndecidedLoadoutBackpackSet(set.Value, _spriteSystem); | ||
|
||
child.SetButton.OnButtonDown += (args) => | ||
{ | ||
_owner.SendChangeSelected(set.Key); | ||
}; | ||
|
||
SetsGrid.AddChild(child); | ||
|
||
count++; | ||
|
||
if (set.Value.Selected) | ||
selectedNumber++; | ||
} | ||
|
||
SelectedSets.Text = Loc.GetString("undecided-loadout-window-selected", ("selectedCount", selectedNumber), ("maxCount", state.MaxSelectedSets)); | ||
ApproveButton.Disabled = selectedNumber == state.MaxSelectedSets ? false : true; | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
Content.Client/UndecidedLoadout/UndecidedLoadoutBackpackSet.xaml
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,23 @@ | ||
<Control xmlns="https://spacestation14.io" | ||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls" | ||
xmlns:gfx="clr-namespace:Robust.Client.Graphics;assembly=Robust.Client"> | ||
<!-- Name and button --> | ||
<PanelContainer Margin="5 5 0 5"> | ||
<PanelContainer.PanelOverride> | ||
<gfx:StyleBoxFlat BackgroundColor="#18211b" /> | ||
</PanelContainer.PanelOverride> | ||
<BoxContainer Orientation="Vertical" HorizontalExpand="True"> | ||
<GridContainer Margin="5" Columns="2" MinSize="600 0"> | ||
<Label Name="SetName" Text="Set" StyleClasses="StatusFieldTitle"></Label> | ||
<Button Margin="0 10" Name="SetButton" Text="Select" StyleClasses="OpenRight" Access="Public" HorizontalAlignment="Right"/> | ||
</GridContainer> | ||
<controls:HLine Color="#404040" Thickness="1" Margin="0 5"/> | ||
<!-- Icon and Description --> | ||
<GridContainer Margin="0 5" Columns="2"> | ||
<TextureRect Name="Icon" Margin="10" Stretch="KeepAspectCentered" | ||
VerticalAlignment="Center" HorizontalAlignment="Right" SetSize="64 64"/> | ||
<Label Name="SetDescription" Text="Description"></Label> | ||
</GridContainer> | ||
</BoxContainer> | ||
</PanelContainer> | ||
</Control> |
54 changes: 54 additions & 0 deletions
54
Content.Client/UndecidedLoadout/UndecidedLoadoutBoundUserInterface.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,54 @@ | ||
using Content.Shared.UndecidedLoadout; | ||
using JetBrains.Annotations; | ||
using Robust.Client.GameObjects; | ||
|
||
namespace Content.Client.UndecidedLoadout; | ||
|
||
[UsedImplicitly] | ||
public sealed class UndecidedLoadoutBackpackBoundUserInterface : BoundUserInterface | ||
{ | ||
private UndecidedLoadoutBackpackMenu? _window; | ||
|
||
public UndecidedLoadoutBackpackBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) { } | ||
|
||
protected override void Open() | ||
{ | ||
base.Open(); | ||
|
||
_window = new UndecidedLoadoutBackpackMenu(this); | ||
_window.OnClose += Close; | ||
_window.OpenCentered(); | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
base.Dispose(disposing); | ||
if (!disposing) | ||
return; | ||
|
||
if (_window != null) | ||
_window.OnClose -= Close; | ||
|
||
_window?.Dispose(); | ||
} | ||
|
||
protected override void UpdateState(BoundUserInterfaceState state) | ||
{ | ||
base.UpdateState(state); | ||
|
||
if (state is not UndecidedLoadoutBackpackBoundUserInterfaceState current) | ||
return; | ||
|
||
_window?.UpdateState(current); | ||
} | ||
|
||
public void SendChangeSelected(int setNumber) | ||
{ | ||
SendMessage(new UndecidedLoadoutBackpackChangeSetMessage(setNumber)); | ||
} | ||
|
||
public void SendApprove() | ||
{ | ||
SendMessage(new UndecidedLoadoutBackpackApproveMessage()); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
Content.Client/UndecidedLoadout/UndecidedLoadoutSet.xaml.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,22 @@ | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.UserInterface; | ||
using Robust.Client.UserInterface.XAML; | ||
using Content.Shared.UndecidedLoadout; | ||
using Robust.Client.GameObjects; | ||
|
||
namespace Content.Client.UndecidedLoadout; | ||
|
||
[GenerateTypedNameReferences] | ||
public sealed partial class UndecidedLoadoutBackpackSet : Control | ||
{ | ||
public UndecidedLoadoutBackpackSet(UndecidedLoadoutBackpackSetInfo set, SpriteSystem spriteSystem) | ||
{ | ||
RobustXamlLoader.Load(this); | ||
|
||
Icon.Texture = spriteSystem.Frame0(set.Sprite); | ||
SetName.Text = Loc.GetString(set.Name); | ||
SetDescription.Text = Loc.GetString(set.Description); | ||
SetButton.Text = Loc.GetString(set.Selected ? "undecided-loadout-button-deselect" : "undecided-loadout-button-select"); | ||
SetButton.ModulateSelfOverride = set.Selected ? new Color(40, 84, 35) : new Color(68, 75, 103); | ||
} | ||
} |
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
26 changes: 26 additions & 0 deletions
26
Content.Server/_N14/UndecidedLoadout/Components/UndecidedLoadoutBackpackComponent.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,26 @@ | ||
using Content.Server.UndecidedLoadout.Systems; | ||
using Content.Shared.UndecidedLoadout; | ||
using Robust.Shared.Audio; | ||
using Robust.Shared.Prototypes; | ||
|
||
namespace Content.Server.UndecidedLoadout.Components; | ||
|
||
/// <summary> | ||
/// This component stores the possible contents of the backpack, | ||
/// which can be selected via the interface. | ||
/// </summary> | ||
[RegisterComponent, Access(typeof(UndecidedLoadoutBackpackSystem))] | ||
public sealed partial class UndecidedLoadoutBackpackComponent : Component | ||
{ | ||
/// <summary> | ||
/// List of sets available for selection | ||
/// </summary> | ||
[DataField] | ||
public List<ProtoId<UndecidedLoadoutBackpackSetPrototype>> PossibleSets = new(); | ||
|
||
[DataField] | ||
public List<int> SelectedSets = new(); | ||
|
||
[DataField] | ||
public SoundSpecifier ApproveSound = new SoundPathSpecifier("/Audio/Effects/rustle1.ogg"); | ||
} |
Oops, something went wrong.