diff --git a/Content.Client/Effects/ColorFlashEffectSystem.cs b/Content.Client/Effects/ColorFlashEffectSystem.cs index e909fdffaa..cb361e7310 100644 --- a/Content.Client/Effects/ColorFlashEffectSystem.cs +++ b/Content.Client/Effects/ColorFlashEffectSystem.cs @@ -111,7 +111,7 @@ public sealed class ColorFlashEffectSystem : SharedColorFlashEffectSystem var animation = GetDamageAnimation(ent, color, sprite, ev.AnimationLength); - if (animation == null) + if (animation == null) continue; var comp = EnsureComp(ent); @@ -121,9 +121,3 @@ public sealed class ColorFlashEffectSystem : SharedColorFlashEffectSystem } } } - -/// -/// Raised on an entity to change the target for a color flash effect. -/// -[ByRefEvent] -public record struct GetFlashEffectTargetEvent(EntityUid Target); diff --git a/Content.Client/Ghost/GhostRoleRadioBoundUserInterface.cs b/Content.Client/Ghost/GhostRoleRadioBoundUserInterface.cs deleted file mode 100644 index fb0a83eeaa..0000000000 --- a/Content.Client/Ghost/GhostRoleRadioBoundUserInterface.cs +++ /dev/null @@ -1,104 +0,0 @@ -// SPDX-FileCopyrightText: 2024 Aiden -// SPDX-FileCopyrightText: 2024 Alzore <140123969+Blackern5000@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Brandon Hu <103440971+Brandon-Huu@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 CaasGit <87243814+CaasGit@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Chief-Engineer <119664036+Chief-Engineer@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Cojoke <83733158+Cojoke-dot@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 DrSmugleaf <10968691+DrSmugleaf@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 DrSmugleaf -// SPDX-FileCopyrightText: 2024 Ed <96445749+TheShuEd@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Emisse <99158783+Emisse@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 EmoGarbage404 -// SPDX-FileCopyrightText: 2024 Eoin Mcloughlin -// SPDX-FileCopyrightText: 2024 Errant <35878406+Errant-4@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Flareguy <78941145+Flareguy@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Hrosts <35345601+Hrosts@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 IProduceWidgets <107586145+IProduceWidgets@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Ian -// SPDX-FileCopyrightText: 2024 Ilya246 <57039557+Ilya246@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Joel Zimmerman -// SPDX-FileCopyrightText: 2024 JustCone <141039037+JustCone14@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Killerqu00 <47712032+Killerqu00@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Ko4ergaPunk <62609550+Ko4ergaPunk@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Kukutis96513 <146854220+Kukutis96513@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Lye <128915833+Lyroth001@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 MerrytheManokit <167581110+MerrytheManokit@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Mervill -// SPDX-FileCopyrightText: 2024 Mr. 27 <45323883+Dutch-VanDerLinde@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 MureixloI <132683811+MureixloI@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 NakataRin <45946146+NakataRin@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Nemanja <98561806+EmoGarbage404@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 OrangeMoronage9622 -// SPDX-FileCopyrightText: 2024 PJBot -// SPDX-FileCopyrightText: 2024 Pieter-Jan Briers -// SPDX-FileCopyrightText: 2024 Plykiya <58439124+Plykiya@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Preston Smith <92108534+thetolbean@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Psychpsyo <60073468+Psychpsyo@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Repo <47093363+Titian3@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 RiceMar1244 <138547931+RiceMar1244@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Simon <63975668+Simyon264@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 SlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Stalen <33173619+stalengd@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 TakoDragon <69509841+BackeTako@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Thomas <87614336+Aeshus@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 TsjipTsjip <19798667+TsjipTsjip@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Ubaser <134914314+UbaserB@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Unkn0wn_Gh0st -// SPDX-FileCopyrightText: 2024 Vasilis -// SPDX-FileCopyrightText: 2024 Vigers Ray <60344369+VigersRay@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 beck-thompson <107373427+beck-thompson@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 deathride58 -// SPDX-FileCopyrightText: 2024 deltanedas <39013340+deltanedas@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 deltanedas <@deltanedas:kde.org> -// SPDX-FileCopyrightText: 2024 dffdff2423 -// SPDX-FileCopyrightText: 2024 eoineoineoin -// SPDX-FileCopyrightText: 2024 foboscheshir <156405958+foboscheshir@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 lzk <124214523+lzk228@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 metalgearsloth -// SPDX-FileCopyrightText: 2024 nikthechampiongr <32041239+nikthechampiongr@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 plykiya -// SPDX-FileCopyrightText: 2024 saintmuntzer <47153094+saintmuntzer@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 shamp <140359015+shampunj@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 slarticodefast <161409025+slarticodefast@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 strO0pwafel <153459934+strO0pwafel@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 stroopwafel -// SPDX-FileCopyrightText: 2024 themias <89101928+themias@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 to4no_fix <156101927+chavonadelal@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 voidnull000 <18663194+voidnull000@users.noreply.github.com> -// SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com> -// -// SPDX-License-Identifier: AGPL-3.0-or-later - -using Content.Shared.Ghost.Roles; -using Robust.Client.UserInterface; -using Robust.Shared.Prototypes; - -namespace Content.Client.Ghost; - -public sealed class GhostRoleRadioBoundUserInterface : BoundUserInterface -{ - private GhostRoleRadioMenu? _ghostRoleRadioMenu; - - public GhostRoleRadioBoundUserInterface(EntityUid owner, Enum uiKey) : base(owner, uiKey) - { - IoCManager.InjectDependencies(this); - } - - protected override void Open() - { - base.Open(); - - _ghostRoleRadioMenu = this.CreateWindow(); - _ghostRoleRadioMenu.SetEntity(Owner); - _ghostRoleRadioMenu.SendGhostRoleRadioMessageAction += SendGhostRoleRadioMessage; - } - - private void SendGhostRoleRadioMessage(ProtoId protoId) - { - SendMessage(new GhostRoleRadioMessage(protoId)); - } -} \ No newline at end of file diff --git a/Content.Client/Ghost/GhostRoleRadioMenu.xaml b/Content.Client/Ghost/GhostRoleRadioMenu.xaml deleted file mode 100644 index 171ee6043e..0000000000 --- a/Content.Client/Ghost/GhostRoleRadioMenu.xaml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - diff --git a/Content.Client/Ghost/GhostRoleRadioMenu.xaml.cs b/Content.Client/Ghost/GhostRoleRadioMenu.xaml.cs deleted file mode 100644 index 80141d42a9..0000000000 --- a/Content.Client/Ghost/GhostRoleRadioMenu.xaml.cs +++ /dev/null @@ -1,182 +0,0 @@ -// SPDX-FileCopyrightText: 2024 Aiden -// SPDX-FileCopyrightText: 2024 Alzore <140123969+Blackern5000@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Brandon Hu <103440971+Brandon-Huu@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 CaasGit <87243814+CaasGit@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Chief-Engineer <119664036+Chief-Engineer@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Cojoke <83733158+Cojoke-dot@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 DrSmugleaf <10968691+DrSmugleaf@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 DrSmugleaf -// SPDX-FileCopyrightText: 2024 Ed <96445749+TheShuEd@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Emisse <99158783+Emisse@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 EmoGarbage404 -// SPDX-FileCopyrightText: 2024 Errant <35878406+Errant-4@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Flareguy <78941145+Flareguy@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Hrosts <35345601+Hrosts@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 IProduceWidgets <107586145+IProduceWidgets@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Ian -// SPDX-FileCopyrightText: 2024 Ilya246 <57039557+Ilya246@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Joel Zimmerman -// SPDX-FileCopyrightText: 2024 JustCone <141039037+JustCone14@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Killerqu00 <47712032+Killerqu00@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Ko4ergaPunk <62609550+Ko4ergaPunk@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Kukutis96513 <146854220+Kukutis96513@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Leon Friedrich <60421075+ElectroJr@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Lye <128915833+Lyroth001@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 MerrytheManokit <167581110+MerrytheManokit@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Mervill -// SPDX-FileCopyrightText: 2024 Mr. 27 <45323883+Dutch-VanDerLinde@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 MureixloI <132683811+MureixloI@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 NakataRin <45946146+NakataRin@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Nemanja <98561806+EmoGarbage404@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 OrangeMoronage9622 -// SPDX-FileCopyrightText: 2024 PJBot -// SPDX-FileCopyrightText: 2024 Pieter-Jan Briers -// SPDX-FileCopyrightText: 2024 Plykiya <58439124+Plykiya@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Preston Smith <92108534+thetolbean@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Psychpsyo <60073468+Psychpsyo@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Repo <47093363+Titian3@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 RiceMar1244 <138547931+RiceMar1244@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 ShadowCommander <10494922+ShadowCommander@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Simon <63975668+Simyon264@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 SlamBamActionman <83650252+SlamBamActionman@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Stalen <33173619+stalengd@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 TakoDragon <69509841+BackeTako@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Thomas <87614336+Aeshus@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 TsjipTsjip <19798667+TsjipTsjip@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Ubaser <134914314+UbaserB@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 Unkn0wn_Gh0st -// SPDX-FileCopyrightText: 2024 Vasilis -// SPDX-FileCopyrightText: 2024 Vigers Ray <60344369+VigersRay@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 beck-thompson <107373427+beck-thompson@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 deathride58 -// SPDX-FileCopyrightText: 2024 deltanedas <39013340+deltanedas@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 deltanedas <@deltanedas:kde.org> -// SPDX-FileCopyrightText: 2024 dffdff2423 -// SPDX-FileCopyrightText: 2024 eoineoineoin -// SPDX-FileCopyrightText: 2024 foboscheshir <156405958+foboscheshir@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 lzk <124214523+lzk228@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 metalgearsloth -// SPDX-FileCopyrightText: 2024 nikthechampiongr <32041239+nikthechampiongr@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 plykiya -// SPDX-FileCopyrightText: 2024 saintmuntzer <47153094+saintmuntzer@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 shamp <140359015+shampunj@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 slarticodefast <161409025+slarticodefast@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 strO0pwafel <153459934+strO0pwafel@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 stroopwafel -// SPDX-FileCopyrightText: 2024 themias <89101928+themias@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 to4no_fix <156101927+chavonadelal@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 voidnull000 <18663194+voidnull000@users.noreply.github.com> -// SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com> -// SPDX-FileCopyrightText: 2025 Eoin Mcloughlin -// SPDX-FileCopyrightText: 2025 Fildrance -// SPDX-FileCopyrightText: 2025 pa.pecherskij -// -// SPDX-License-Identifier: AGPL-3.0-or-later - -using Content.Client.UserInterface.Controls; -using Content.Shared.Ghost.Roles; -using Content.Shared.Ghost.Roles.Components; -using Robust.Client.UserInterface; -using Robust.Client.UserInterface.Controls; -using Robust.Client.UserInterface.XAML; -using Robust.Shared.Prototypes; -using System.Numerics; - -namespace Content.Client.Ghost; - -public sealed partial class GhostRoleRadioMenu : RadialMenu -{ - [Dependency] private readonly EntityManager _entityManager = default!; - [Dependency] private readonly IPrototypeManager _prototypeManager = default!; - - public event Action>? SendGhostRoleRadioMessageAction; - - public EntityUid Entity { get; set; } - - public GhostRoleRadioMenu() - { - IoCManager.InjectDependencies(this); - RobustXamlLoader.Load(this); - } - - public void SetEntity(EntityUid uid) - { - Entity = uid; - RefreshUI(); - } - - private void RefreshUI() - { - // The main control that will contain all the clickable options - var main = FindControl("Main"); - - // The purpose of this radial UI is for ghost role radios that allow you to select - // more than one potential option, such as with kobolds/lizards. - // This means that it won't show anything if SelectablePrototypes is empty. - if (!_entityManager.TryGetComponent(Entity, out var comp)) - return; - - foreach (var ghostRoleProtoString in comp.SelectablePrototypes) - { - // For each prototype we find we want to create a button that uses the name of the ghost role - // as the hover tooltip, and the icon is taken from either the ghost role entityprototype - // or the indicated icon entityprototype. - if (!_prototypeManager.TryIndex(ghostRoleProtoString, out var ghostRoleProto)) - continue; - - var button = new GhostRoleRadioMenuButton() - { - SetSize = new Vector2(64, 64), - ToolTip = Loc.GetString(ghostRoleProto.Name), - ProtoId = ghostRoleProto.ID, - }; - - var entProtoView = new EntityPrototypeView() - { - SetSize = new Vector2(48, 48), - VerticalAlignment = VAlignment.Center, - HorizontalAlignment = HAlignment.Center, - Stretch = SpriteView.StretchMode.Fill - }; - - // pick the icon if it exists, otherwise fallback to the ghost role's entity - if (_prototypeManager.TryIndex(ghostRoleProto.IconPrototype, out var iconProto)) - entProtoView.SetPrototype(iconProto); - else - entProtoView.SetPrototype(ghostRoleProto.EntityPrototype); - - button.AddChild(entProtoView); - main.AddChild(button); - AddGhostRoleRadioMenuButtonOnClickActions(main); - } - } - - private void AddGhostRoleRadioMenuButtonOnClickActions(Control control) - { - var mainControl = control as RadialContainer; - - if (mainControl == null) - return; - - foreach (var child in mainControl.Children) - { - var castChild = child as GhostRoleRadioMenuButton; - - if (castChild == null) - continue; - - castChild.OnButtonUp += _ => - { - SendGhostRoleRadioMessageAction?.Invoke(castChild.ProtoId); - Close(); - }; - } - } -} - -public sealed class GhostRoleRadioMenuButton : RadialMenuTextureButtonWithSector -{ - public ProtoId ProtoId { get; set; } -} \ No newline at end of file diff --git a/Content.Client/Polymorph/Systems/ChameleonProjectorSystem.cs b/Content.Client/Polymorph/Systems/ChameleonProjectorSystem.cs index 0e9b03c9f2..5ba4878c6d 100644 --- a/Content.Client/Polymorph/Systems/ChameleonProjectorSystem.cs +++ b/Content.Client/Polymorph/Systems/ChameleonProjectorSystem.cs @@ -1,12 +1,3 @@ -// SPDX-FileCopyrightText: 2024 Piras314 -// SPDX-FileCopyrightText: 2024 deltanedas <39013340+deltanedas@users.noreply.github.com> -// SPDX-FileCopyrightText: 2024 deltanedas <@deltanedas:kde.org> -// SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com> -// -// SPDX-License-Identifier: AGPL-3.0-or-later - -using Content.Client.Effects; -using Content.Client.Smoking; using Content.Shared.Chemistry.Components; using Content.Shared.Polymorph.Components; using Content.Shared.Polymorph.Systems; @@ -19,20 +10,14 @@ public sealed class ChameleonProjectorSystem : SharedChameleonProjectorSystem [Dependency] private readonly SharedAppearanceSystem _appearance = default!; private EntityQuery _appearanceQuery; - private EntityQuery _spriteQuery; public override void Initialize() { base.Initialize(); _appearanceQuery = GetEntityQuery(); - _spriteQuery = GetEntityQuery(); SubscribeLocalEvent(OnHandleState); - - SubscribeLocalEvent(OnStartup); - SubscribeLocalEvent(OnShutdown); - SubscribeLocalEvent(OnGetFlashEffectTargetEvent); } private void OnHandleState(Entity ent, ref AfterAutoHandleStateEvent args) @@ -40,30 +25,9 @@ public sealed class ChameleonProjectorSystem : SharedChameleonProjectorSystem CopyComp(ent); CopyComp(ent); CopyComp(ent); - CopyComp(ent); // reload appearance to hopefully prevent any invisible layers if (_appearanceQuery.TryComp(ent, out var appearance)) _appearance.QueueUpdate(ent, appearance); } - - private void OnStartup(Entity ent, ref ComponentStartup args) - { - if (!_spriteQuery.TryComp(ent, out var sprite)) - return; - - ent.Comp.WasVisible = sprite.Visible; - sprite.Visible = false; - } - - private void OnShutdown(Entity ent, ref ComponentShutdown args) - { - if (_spriteQuery.TryComp(ent, out var sprite)) - sprite.Visible = ent.Comp.WasVisible; - } - - private void OnGetFlashEffectTargetEvent(Entity ent, ref GetFlashEffectTargetEvent args) - { - args.Target = ent.Comp.Disguise; - } } diff --git a/Content.Client/UserInterface/Controls/RadialMenu.cs b/Content.Client/UserInterface/Controls/RadialMenu.cs index 4aeb87bede..5f56ad7f86 100644 --- a/Content.Client/UserInterface/Controls/RadialMenu.cs +++ b/Content.Client/UserInterface/Controls/RadialMenu.cs @@ -3,8 +3,6 @@ using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.CustomControls; using System.Linq; using System.Numerics; -using Robust.Client.Graphics; - namespace Content.Client.UserInterface.Controls; @@ -18,7 +16,7 @@ public class RadialMenu : BaseWindow /// /// Set a style class to be applied to the contextual button when it is set to move the user back through previous layers of the radial menu - /// + /// public string? BackButtonStyleClass { get @@ -62,8 +60,8 @@ public class RadialMenu : BaseWindow /// A free floating menu which enables the quick display of one or more radial containers /// /// - /// Only one radial container is visible at a time (each container forming a separate 'layer' within - /// the menu), along with a contextual button at the menu center, which will either return the user + /// Only one radial container is visible at a time (each container forming a separate 'layer' within + /// the menu), along with a contextual button at the menu center, which will either return the user /// to the previous layer or close the menu if there are no previous layers left to traverse. /// To create a functional radial menu, simply parent one or more named radial containers to it, /// and populate the radial containers with RadialMenuButtons. Setting the TargetLayer field of these @@ -255,322 +253,3 @@ public class RadialMenuTextureButton : TextureButton return null; } } - -public interface IRadialMenuItemWithSector -{ - /// - /// Angle in radian where button sector should start. - /// - public float AngleSectorFrom { set; } - - /// - /// Angle in radian where button sector should end. - /// - public float AngleSectorTo { set; } - - /// - /// Outer radius for drawing segment and pointer detection. - /// - public float OuterRadius { set; } - - /// - /// Outer radius for drawing segment and pointer detection. - /// - public float InnerRadius { set; } - - /// - /// Offset in radian by which menu button should be rotated. - /// - public float AngleOffset { set; } - - /// - /// Coordinates of center in parent component - button container. - /// - public Vector2 ParentCenter { set; } -} - -[Virtual] -public class RadialMenuTextureButtonWithSector : RadialMenuTextureButton, IRadialMenuItemWithSector -{ - private Vector2[]? _sectorPointsForDrawing; - - private float _angleSectorFrom; - private float _angleSectorTo; - private float _outerRadius; - private float _innerRadius; - private float _angleOffset; - - private bool _isWholeCircle; - private Vector2? _parentCenter; - - private Color _backgroundColorSrgb = Color.ToSrgb(new Color(70, 73, 102, 128)); - private Color _hoverBackgroundColorSrgb = Color.ToSrgb(new Color(87, 91, 127, 128)); - private Color _borderColorSrgb = Color.ToSrgb(new Color(173, 216, 230, 70)); - private Color _hoverBorderColorSrgb = Color.ToSrgb(new Color(87, 91, 127, 128)); - - /// - /// Marker, that control should render border of segment. Is false by default. - /// - /// - /// By default color of border is same as color of background. Use - /// and to change it. - /// - public bool DrawBorder { get; set; } = false; - - /// - /// Marker, that control should render background of all sector. Is true by default. - /// - public bool DrawBackground { get; set; } = true; - - /// - /// Marker, that control should render separator lines. - /// Separator lines are used to visually separate sector of radial menu items. - /// Is true by default - /// - public bool DrawSeparators { get; set; } = true; - - /// - /// Color of background in non-hovered state. Accepts RGB color, works with sRGB for DrawPrimitive internally. - /// - public Color BackgroundColor - { - get => Color.FromSrgb(_backgroundColorSrgb); - set => _backgroundColorSrgb = Color.ToSrgb(value); - } - - /// - /// Color of background in hovered state. Accepts RGB color, works with sRGB for DrawPrimitive internally. - /// - public Color HoverBackgroundColor - { - get => Color.FromSrgb(_hoverBackgroundColorSrgb); - set => _hoverBackgroundColorSrgb = Color.ToSrgb(value); - } - - /// - /// Color of button border. Accepts RGB color, works with sRGB for DrawPrimitive internally. - /// - public Color BorderColor - { - get => Color.FromSrgb(_borderColorSrgb); - set => _borderColorSrgb = Color.ToSrgb(value); - } - - /// - /// Color of button border when button is hovered. Accepts RGB color, works with sRGB for DrawPrimitive internally. - /// - public Color HoverBorderColor - { - get => Color.FromSrgb(_hoverBorderColorSrgb); - set => _hoverBorderColorSrgb = Color.ToSrgb(value); - } - - /// - /// Color of separator lines. - /// Separator lines are used to visually separate sector of radial menu items. - /// - public Color SeparatorColor { get; set; } = new Color(128, 128, 128, 128); - - /// - float IRadialMenuItemWithSector.AngleSectorFrom - { - set - { - _angleSectorFrom = value; - _isWholeCircle = IsWholeCircle(value, _angleSectorTo); - } - } - - /// - float IRadialMenuItemWithSector.AngleSectorTo - { - set - { - _angleSectorTo = value; - _isWholeCircle = IsWholeCircle(_angleSectorFrom, value); - } - } - - /// - float IRadialMenuItemWithSector.OuterRadius { set => _outerRadius = value; } - - /// - float IRadialMenuItemWithSector.InnerRadius { set => _innerRadius = value; } - - /// - public float AngleOffset { set => _angleOffset = value; } - - /// - Vector2 IRadialMenuItemWithSector.ParentCenter { set => _parentCenter = value; } - - /// - /// A simple texture button that can move the user to a different layer within a radial menu - /// - public RadialMenuTextureButtonWithSector() - { - } - - /// - protected override void Draw(DrawingHandleScreen handle) - { - base.Draw(handle); - - if (_parentCenter == null) - { - return; - } - - // draw sector where space that button occupies actually is - var containerCenter = (_parentCenter.Value - Position) * UIScale; - - var angleFrom = _angleSectorFrom + _angleOffset; - var angleTo = _angleSectorTo + _angleOffset; - if (DrawBackground) - { - var segmentColor = DrawMode == DrawModeEnum.Hover - ? _hoverBackgroundColorSrgb - : _backgroundColorSrgb; - - DrawAnnulusSector(handle, containerCenter, _innerRadius * UIScale, _outerRadius * UIScale, angleFrom, angleTo, segmentColor); - } - - if (DrawBorder) - { - var borderColor = DrawMode == DrawModeEnum.Hover - ? _hoverBorderColorSrgb - : _borderColorSrgb; - DrawAnnulusSector(handle, containerCenter, _innerRadius * UIScale, _outerRadius * UIScale, angleFrom, angleTo, borderColor, false); - } - - if (!_isWholeCircle && DrawSeparators) - { - DrawSeparatorLines(handle, containerCenter, _innerRadius * UIScale, _outerRadius * UIScale, angleFrom, angleTo, SeparatorColor); - } - } - - /// - protected override bool HasPoint(Vector2 point) - { - if (_parentCenter == null) - { - return base.HasPoint(point); - } - - var outerRadiusSquared = _outerRadius * _outerRadius; - var innerRadiusSquared = _innerRadius * _innerRadius; - - var distSquared = (point + Position - _parentCenter.Value).LengthSquared(); - var isInRadius = distSquared < outerRadiusSquared && distSquared > innerRadiusSquared; - if (!isInRadius) - { - return false; - } - - // difference from the center of the parent to the `point` - var pointFromParent = point + Position - _parentCenter.Value; - - // Flip Y to get from ui coordinates to natural coordinates - var angle = MathF.Atan2(-pointFromParent.Y, pointFromParent.X) - _angleOffset; - if (angle < 0) - { - // atan2 range is -pi->pi, while angle sectors are - // 0->2pi, so remap the result into that range - angle = MathF.PI * 2 + angle; - } - - var isInAngle = angle >= _angleSectorFrom && angle < _angleSectorTo; - return isInAngle; - } - - /// - /// Draw segment between two concentrated circles from and to certain angles. - /// - /// Drawing handle, to which rendering should be delegated. - /// Point where circle center should be. - /// Radius of internal circle. - /// Radius of external circle. - /// Angle in radian, from which sector should start. - /// Angle in radian, from which sector should start. - /// Color for drawing. - /// Should figure be filled, or have only border. - private void DrawAnnulusSector( - DrawingHandleScreen drawingHandleScreen, - Vector2 center, - float radiusInner, - float radiusOuter, - float angleSectorFrom, - float angleSectorTo, - Color color, - bool filled = true - ) - { - const float minimalSegmentSize = MathF.Tau / 128f; - - var requestedSegmentSize = angleSectorTo - angleSectorFrom; - var segmentCount = (int)(requestedSegmentSize / minimalSegmentSize) + 1; - var anglePerSegment = requestedSegmentSize / (segmentCount - 1); - - var bufferSize = segmentCount * 2; - if (_sectorPointsForDrawing == null || _sectorPointsForDrawing.Length != bufferSize) - { - _sectorPointsForDrawing ??= new Vector2[bufferSize]; - } - - for (var i = 0; i < segmentCount; i++) - { - var angle = angleSectorFrom + anglePerSegment * i; - - // Flip Y to get from ui coordinates to natural coordinates - var unitPos = new Vector2(MathF.Cos(angle), -MathF.Sin(angle)); - var outerPoint = center + unitPos * radiusOuter; - var innerPoint = center + unitPos * radiusInner; - if (filled) - { - // to make filled sector we need to create strip from triangles - _sectorPointsForDrawing[i * 2] = outerPoint; - _sectorPointsForDrawing[i * 2 + 1] = innerPoint; - } - else - { - // to make border of sector we need points ordered as sequences on radius - _sectorPointsForDrawing[i] = outerPoint; - _sectorPointsForDrawing[bufferSize - 1 - i] = innerPoint; - } - } - - var type = filled - ? DrawPrimitiveTopology.TriangleStrip - : DrawPrimitiveTopology.LineStrip; - drawingHandleScreen.DrawPrimitives(type, _sectorPointsForDrawing, color); - } - - private static void DrawSeparatorLines( - DrawingHandleScreen drawingHandleScreen, - Vector2 center, - float radiusInner, - float radiusOuter, - float angleSectorFrom, - float angleSectorTo, - Color color - ) - { - var fromPoint = new Angle(-angleSectorFrom).RotateVec(Vector2.UnitX); - drawingHandleScreen.DrawLine( - center + fromPoint * radiusOuter, - center + fromPoint * radiusInner, - color - ); - - var toPoint = new Angle(-angleSectorTo).RotateVec(Vector2.UnitX); - drawingHandleScreen.DrawLine( - center + toPoint * radiusOuter, - center + toPoint * radiusInner, - color - ); - } - - private static bool IsWholeCircle(float angleSectorFrom, float angleSectorTo) - { - return new Angle(angleSectorFrom).EqualsApprox(new Angle(angleSectorTo)); - } -} diff --git a/Content.Client/UserInterface/Systems/Ghost/GhostUIController.cs b/Content.Client/UserInterface/Systems/Ghost/GhostUIController.cs index 856f32684b..ceea62848b 100644 --- a/Content.Client/UserInterface/Systems/Ghost/GhostUIController.cs +++ b/Content.Client/UserInterface/Systems/Ghost/GhostUIController.cs @@ -64,7 +64,7 @@ public sealed class GhostUIController : UIController, IOnSystemChanged 0) { - GhostRolesButton.StyleClasses.Add(StyleBase.ButtonCaution); + GhostRolesButton.StyleClasses.Add(StyleBase.ButtonDanger); } else { - GhostRolesButton.StyleClasses.Remove(StyleBase.ButtonCaution); + GhostRolesButton.StyleClasses.Remove(StyleBase.ButtonDanger); } } diff --git a/Content.Client/_Shitcode/Wizard/MagicMirror/WizardMirrorBoundUserInterface.cs b/Content.Client/_Shitcode/Wizard/MagicMirror/WizardMirrorBoundUserInterface.cs deleted file mode 100644 index 05628e2533..0000000000 --- a/Content.Client/_Shitcode/Wizard/MagicMirror/WizardMirrorBoundUserInterface.cs +++ /dev/null @@ -1,52 +0,0 @@ -// SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com> -// SPDX-FileCopyrightText: 2025 Aviu00 <93730715+Aviu00@users.noreply.github.com> -// SPDX-FileCopyrightText: 2025 Misandry -// SPDX-FileCopyrightText: 2025 gus -// -// SPDX-License-Identifier: AGPL-3.0-or-later - -using Content.Shared._Shitcode.Wizard.MagicMirror; -using JetBrains.Annotations; -using Robust.Client.UserInterface; - -namespace Content.Client._Shitcode.Wizard.MagicMirror; - -[UsedImplicitly] -public sealed class WizardMirrorBoundUserInterface(EntityUid owner, Enum uiKey) : BoundUserInterface(owner, uiKey) -{ - [ViewVariables] - private WizardMirrorWindow? _window; - - protected override void Open() - { - base.Open(); - - _window = this.CreateWindow(); - - if (EntMan.TryGetComponent(Owner, out WizardMirrorComponent? mirror)) - _window.AllowedSpecies = new(mirror.AllowedSpecies); - - _window.Save += OnSave; - } - - private void OnSave() - { - var profile = _window?.Profile; - if (profile != null) - SendMessage(new WizardMirrorMessage(profile)); - } - - protected override void UpdateState(BoundUserInterfaceState state) - { - base.UpdateState(state); - - if (state is not WizardMirrorUiState data) - return; - - if (_window == null) - return; - - _window.LoadedProfile = data.Profile.Clone(); - _window.SetProfile(data.Profile); - } -} diff --git a/Content.Client/_Shitcode/Wizard/MagicMirror/WizardMirrorSystem.cs b/Content.Client/_Shitcode/Wizard/MagicMirror/WizardMirrorSystem.cs deleted file mode 100644 index 9451e5ca77..0000000000 --- a/Content.Client/_Shitcode/Wizard/MagicMirror/WizardMirrorSystem.cs +++ /dev/null @@ -1,12 +0,0 @@ -// SPDX-FileCopyrightText: 2025 Aiden <28298836+Aidenkrz@users.noreply.github.com> -// SPDX-FileCopyrightText: 2025 Aviu00 <93730715+Aviu00@users.noreply.github.com> -// SPDX-FileCopyrightText: 2025 Misandry -// SPDX-FileCopyrightText: 2025 gus -// -// SPDX-License-Identifier: AGPL-3.0-or-later - -using Content.Shared._Shitcode.Wizard.MagicMirror; - -namespace Content.Client._Shitcode.Wizard.MagicMirror; - -public sealed class WizardMirrorSystem : SharedWizardMirrorSystem; diff --git a/Content.Client/_Shitcode/Wizard/MagicMirror/WizardMirrorWindow.xaml b/Content.Client/_Shitcode/Wizard/MagicMirror/WizardMirrorWindow.xaml deleted file mode 100644 index 0896984cd2..0000000000 --- a/Content.Client/_Shitcode/Wizard/MagicMirror/WizardMirrorWindow.xaml +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - -