diff --git a/Content.Client/Entry/EntryPoint.cs b/Content.Client/Entry/EntryPoint.cs index 04f0acac97..a9ecb3a725 100644 --- a/Content.Client/Entry/EntryPoint.cs +++ b/Content.Client/Entry/EntryPoint.cs @@ -108,7 +108,6 @@ namespace Content.Client.Entry _prototypeManager.RegisterIgnore("npcFaction"); _prototypeManager.RegisterIgnore("lobbyBackground"); _prototypeManager.RegisterIgnore("advertisementsPack"); - _prototypeManager.RegisterIgnore("salvageMap"); _prototypeManager.RegisterIgnore("gamePreset"); _prototypeManager.RegisterIgnore("noiseChannel"); _prototypeManager.RegisterIgnore("spaceBiome"); diff --git a/Content.Client/Salvage/SalvageMagnetComponent.cs b/Content.Client/Salvage/SalvageMagnetComponent.cs deleted file mode 100644 index 83b765583d..0000000000 --- a/Content.Client/Salvage/SalvageMagnetComponent.cs +++ /dev/null @@ -1,7 +0,0 @@ -using Content.Shared.Salvage; -using Robust.Shared.GameStates; - -namespace Content.Client.Salvage; - -[NetworkedComponent, RegisterComponent] -public sealed partial class SalvageMagnetComponent : SharedSalvageMagnetComponent {} diff --git a/Content.Client/Salvage/UI/SalvageExpeditionWindow.xaml b/Content.Client/Salvage/UI/OfferingWindow.xaml similarity index 60% rename from Content.Client/Salvage/UI/SalvageExpeditionWindow.xaml rename to Content.Client/Salvage/UI/OfferingWindow.xaml index 67280c34f9..12f1f688c8 100644 --- a/Content.Client/Salvage/UI/SalvageExpeditionWindow.xaml +++ b/Content.Client/Salvage/UI/OfferingWindow.xaml @@ -3,10 +3,24 @@ Title="{Loc 'salvage-expedition-window-title'}" MinSize="800 360"> + + + SetWidth="96" + Margin="5"/> +/// Generic window for offering multiple selections with a timer. +/// +[GenerateTypedNameReferences] +public sealed partial class OfferingWindow : FancyWindow, + IComputerWindow +{ + [Dependency] private readonly IGameTiming _timing = default!; + + public bool Claimed; + public TimeSpan NextOffer; + private TimeSpan? _progression; + + /// + /// Time between NextOffers + /// + public TimeSpan Cooldown; + + /// + /// Time between Progressions + /// + public TimeSpan ProgressionCooldown; + + /// + /// Secondary timer used for tracking active progress. + /// + 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}"; + } + } + } +} diff --git a/Content.Client/Salvage/UI/OfferingWindowOption.xaml b/Content.Client/Salvage/UI/OfferingWindowOption.xaml new file mode 100644 index 0000000000..fc2bfaa94a --- /dev/null +++ b/Content.Client/Salvage/UI/OfferingWindowOption.xaml @@ -0,0 +1,24 @@ + + + + + + + + +