mirror of
https://github.com/WWhiteDreamProject/wwdpublic.git
synced 2026-04-18 05:59:03 +03:00
<!-- This is a semi-strict format, you can add/remove sections as needed but the order/format should be kept the same Remove these comments before submitting --> # Description <!-- Explain this PR in as much detail as applicable Some example prompts to consider: How might this affect the game? The codebase? What might be some alternatives to this? How/Who does this benefit/hurt [the game/codebase]? --> port bar sings selection, as well as corrections for the same from wizards. prs: https://github.com/space-wizards/space-station-14/pull/29068 https://github.com/space-wizards/space-station-14/pull/33467 https://github.com/space-wizards/space-station-14/pull/35490 https://github.com/space-wizards/space-station-14/pull/31517 https://github.com/space-wizards/space-station-14/pull/35296 --- # TODO <!-- A list of everything you have to do before this PR is "complete" You probably won't have to complete everything before merging but it's good to leave future references --> - [x] Task - [x] Completed Task --- <!-- This is default collapsed, readers click to expand it and see all your media The PR media section can get very large at times, so this is a good way to keep it clean The title is written using HTML tags The title must be within the <summary> tags or you won't see it --> <details><summary><h1>Media</h1></summary> <p>   </p> </details> --- # Changelog <!-- You can add an author after the `🆑` to change the name that appears in the changelog (ex: `🆑 Death`) Leaving it blank will default to your GitHub display name This includes all available types for the changelog --> 🆑 EmoGarbage404, Winkarst-cpu, robinthedragon, spderman3333, lzk228 and Will-Oliver-Br - add: The design on the bar sign can now be changed via a menu. - add: Bar signs now have a maintenance panel and AI can interact with them. - add: New barsign Maltroach (based on sign by MoffNyan, from tgstation) - tweak: Electronic bar signs can now be destroyed. - fix: Fix stray pixel in officer beersky barsign --------- Co-authored-by: Nemanja <98561806+EmoGarbage404@users.noreply.github.com> Co-authored-by: Winkarst <74284083+Winkarst-cpu@users.noreply.github.com> Co-authored-by: Winkarst <74284083+Winkarst-cpu@users.noreply.github.co> Co-authored-by: slarticodefast <161409025+slarticodefast@users.noreply.github.com> Co-authored-by: spderman3333 <118777573+spderman3333@users.noreply.github.com> Co-authored-by: lzk <124214523+lzk228@users.noreply.github.com> Co-authored-by: robinthedragon <92946919+robinthedragon@users.noreply.github.com> (cherry picked from commit 7f00e12904dee186ca356c8df3a8577b6c8d8ceb)
51 lines
1.4 KiB
C#
51 lines
1.4 KiB
C#
using Content.Client.UserInterface.Controls;
|
|
using Content.Shared.BarSign;
|
|
using Robust.Client.AutoGenerated;
|
|
using Robust.Client.UserInterface.XAML;
|
|
|
|
namespace Content.Client.BarSign.Ui;
|
|
|
|
[GenerateTypedNameReferences]
|
|
public sealed partial class BarSignMenu : FancyWindow
|
|
{
|
|
private string? _currentId;
|
|
|
|
private readonly List<BarSignPrototype> _cachedPrototypes = new();
|
|
|
|
public event Action<string>? OnSignSelected;
|
|
|
|
public BarSignMenu(BarSignPrototype? currentSign, List<BarSignPrototype> signs)
|
|
{
|
|
RobustXamlLoader.Load(this);
|
|
_currentId = currentSign?.ID;
|
|
|
|
_cachedPrototypes.Clear();
|
|
_cachedPrototypes = signs;
|
|
foreach (var proto in _cachedPrototypes)
|
|
{
|
|
SignOptions.AddItem(Loc.GetString(proto.Name));
|
|
}
|
|
|
|
SignOptions.OnItemSelected += idx =>
|
|
{
|
|
OnSignSelected?.Invoke(_cachedPrototypes[idx.Id].ID);
|
|
SignOptions.SelectId(idx.Id);
|
|
};
|
|
|
|
if (currentSign != null)
|
|
{
|
|
var idx = _cachedPrototypes.IndexOf(currentSign);
|
|
SignOptions.TrySelectId(idx);
|
|
}
|
|
}
|
|
|
|
public void UpdateState(BarSignPrototype newSign)
|
|
{
|
|
if (_currentId != null && newSign.ID == _currentId)
|
|
return;
|
|
_currentId = newSign.ID;
|
|
var idx = _cachedPrototypes.IndexOf(newSign);
|
|
SignOptions.TrySelectId(idx);
|
|
}
|
|
}
|