forked from space-wizards/space-station-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.
Salvage magnet revamp (space-wizards#23119)
* Generic offering window * More work * weh * Parity * Progression meter * magnet * rona * PG asteroid work * code red * Asteroid spawnings * clams * a * Marker fixes * More fixes * Workings of biome asteroids * A * Fix this loading code * a * Fix masking * weh * Fixes * Magnet claiming * toe * petogue * magnet * Bunch of fixes * Fix default * Fixes * asteroids * Fix offerings * Localisation and a bunch of fixes * a * Fixes * Preliminary draft * Announcement fixes * Fixes and bump spawn rate * Fix asteroid spawns and UI * More fixes * Expeditions fix * fix * Gravity * Fix announcement rounding * a * Offset tweak * sus * jankass * Fix merge
- Loading branch information
1 parent
98f5f47
commit bf79acd
Showing
66 changed files
with
2,249 additions
and
1,244 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 was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
using Content.Client.Computer; | ||
using Content.Client.UserInterface.Controls; | ||
using Content.Shared.Shuttles.BUIStates; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.Graphics; | ||
using Robust.Client.UserInterface.XAML; | ||
using Robust.Shared.Timing; | ||
|
||
namespace Content.Client.Salvage.UI; | ||
|
||
/// <summary> | ||
/// Generic window for offering multiple selections with a timer. | ||
/// </summary> | ||
[GenerateTypedNameReferences] | ||
public sealed partial class OfferingWindow : FancyWindow, | ||
IComputerWindow<EmergencyConsoleBoundUserInterfaceState> | ||
{ | ||
[Dependency] private readonly IGameTiming _timing = default!; | ||
|
||
public bool Claimed; | ||
public TimeSpan NextOffer; | ||
private TimeSpan? _progression; | ||
|
||
/// <summary> | ||
/// Time between NextOffers | ||
/// </summary> | ||
public TimeSpan Cooldown; | ||
|
||
/// <summary> | ||
/// Time between Progressions | ||
/// </summary> | ||
public TimeSpan ProgressionCooldown; | ||
|
||
/// <summary> | ||
/// Secondary timer used for tracking active progress. | ||
/// </summary> | ||
public TimeSpan? Progression | ||
{ | ||
get => _progression; | ||
set | ||
{ | ||
if (_progression == value) | ||
return; | ||
|
||
_progression = value; | ||
|
||
if (value == null) | ||
{ | ||
ProgressionBox.Visible = false; | ||
} | ||
else | ||
{ | ||
ProgressionBox.Visible = true; | ||
} | ||
} | ||
} | ||
|
||
public OfferingWindow() | ||
{ | ||
RobustXamlLoader.Load(this); | ||
IoCManager.InjectDependencies(this); | ||
|
||
ProgressionBar.ForegroundStyleBoxOverride = new StyleBoxFlat(Color.FromHex("#C74EBD")); | ||
} | ||
|
||
public void AddOption(OfferingWindowOption option) | ||
{ | ||
Container.AddChild(option); | ||
} | ||
|
||
public void ClearOptions() | ||
{ | ||
Container.DisposeAllChildren(); | ||
} | ||
|
||
protected override void FrameUpdate(FrameEventArgs args) | ||
{ | ||
base.FrameUpdate(args); | ||
|
||
if (_progression != null) | ||
{ | ||
var remaining = _progression.Value - _timing.CurTime; | ||
|
||
if (remaining < TimeSpan.Zero) | ||
{ | ||
ProgressionBar.Value = 1f; | ||
ProgressionText.Text = "00:00"; | ||
} | ||
else | ||
{ | ||
ProgressionBar.Value = 1f - (float) (remaining / ProgressionCooldown); | ||
ProgressionText.Text = $"{remaining.Minutes:00}:{remaining.Seconds:00}"; | ||
} | ||
} | ||
|
||
if (Claimed) | ||
{ | ||
NextOfferBar.Value = 1f; | ||
NextOfferText.Text = "00:00"; | ||
} | ||
else | ||
{ | ||
var remaining = NextOffer - _timing.CurTime; | ||
|
||
if (remaining < TimeSpan.Zero) | ||
{ | ||
NextOfferBar.Value = 1f; | ||
NextOfferText.Text = "00:00"; | ||
} | ||
else | ||
{ | ||
NextOfferBar.Value = 1f - (float) (remaining / Cooldown); | ||
NextOfferText.Text = $"{remaining.Minutes:00}:{remaining.Seconds:00}"; | ||
} | ||
} | ||
} | ||
} |
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 @@ | ||
<PanelContainer xmlns="https://spacestation14.io" | ||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls" | ||
HorizontalExpand="True" | ||
Name="BigPanel" | ||
Margin="5 0"> | ||
<BoxContainer Orientation="Vertical" | ||
Margin="5 5"> | ||
<!-- Title box --> | ||
<controls:StripeBack> | ||
<Label Name="TitleStripe" | ||
HorizontalAlignment="Center" | ||
Margin="0 5 0 5"/> | ||
</controls:StripeBack> | ||
<BoxContainer Orientation="Vertical" Name="ContentBox"/> | ||
<!-- Buffer so all claim buttons are in the same position --> | ||
<Control VerticalExpand="True"/> | ||
<Button Name="ClaimButton" | ||
HorizontalExpand="True" | ||
VerticalAlignment="Bottom" | ||
ToggleMode="True" | ||
Disabled="True" | ||
Text="{Loc 'offering-window-claim'}"/> | ||
</BoxContainer> | ||
</PanelContainer> |
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,87 @@ | ||
using System.Linq; | ||
using Content.Client.Computer; | ||
using Content.Client.Stylesheets; | ||
using Content.Client.UserInterface.Controls; | ||
using Content.Shared.CCVar; | ||
using Content.Shared.Parallax.Biomes; | ||
using Content.Shared.Procedural; | ||
using Content.Shared.Salvage; | ||
using Content.Shared.Salvage.Expeditions; | ||
using Content.Shared.Salvage.Expeditions.Modifiers; | ||
using Content.Shared.Shuttles.BUIStates; | ||
using Robust.Client.AutoGenerated; | ||
using Robust.Client.Graphics; | ||
using Robust.Client.UserInterface; | ||
using Robust.Client.UserInterface.Controls; | ||
using Robust.Client.UserInterface.XAML; | ||
using Robust.Shared.Configuration; | ||
using Robust.Shared.Prototypes; | ||
using Robust.Shared.Timing; | ||
using Robust.Shared.Utility; | ||
|
||
namespace Content.Client.Salvage.UI; | ||
|
||
/// <summary> | ||
/// Generic window for offering multiple selections with a timer. | ||
/// </summary> | ||
[GenerateTypedNameReferences] | ||
public sealed partial class OfferingWindowOption : PanelContainer | ||
{ | ||
private bool _claimed; | ||
|
||
public string? Title | ||
{ | ||
get => TitleStripe.Text; | ||
set => TitleStripe.Text = value; | ||
} | ||
|
||
public event Action<BaseButton.ButtonEventArgs>? ClaimPressed; | ||
|
||
public OfferingWindowOption() | ||
{ | ||
RobustXamlLoader.Load(this); | ||
IoCManager.InjectDependencies(this); | ||
|
||
LayoutContainer.SetAnchorPreset(this, LayoutContainer.LayoutPreset.Wide); | ||
BigPanel.PanelOverride = new StyleBoxFlat(new Color(30, 30, 34)); | ||
|
||
ClaimButton.OnPressed += args => | ||
{ | ||
ClaimPressed?.Invoke(args); | ||
}; | ||
} | ||
|
||
public void AddContent(Control control) | ||
{ | ||
ContentBox.AddChild(control); | ||
} | ||
|
||
public bool Disabled | ||
{ | ||
get => ClaimButton.Disabled; | ||
set => ClaimButton.Disabled = value; | ||
} | ||
|
||
public bool Claimed | ||
{ | ||
get => _claimed; | ||
set | ||
{ | ||
if (_claimed == value) | ||
return; | ||
|
||
_claimed = value; | ||
|
||
if (_claimed) | ||
{ | ||
ClaimButton.AddStyleClass(StyleBase.ButtonCaution); | ||
ClaimButton.Text = Loc.GetString("offering-window-claimed"); | ||
} | ||
else | ||
{ | ||
ClaimButton.RemoveStyleClass(StyleBase.ButtonCaution); | ||
ClaimButton.Text = Loc.GetString("offering-window-claim"); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.