Files
Fildrance 19f3497b35 refactor: simple radial menu for easier creation (#34639)
* it works! kinda

* so it works now

* minor cleanup

* central button now is useful too

* more cleanup

* minor cleanup

* more cleanup

* refactor: migrated code from toolbox (as it was rejected as too specific)

* feat: moved border drawing for radial menu into RadialMenuTextureButton. Radial menu position setting into was moved to OverrideArrange to not being called on every frame

* refactor: major reworks!

* renamed DrawBagleSector to DrawAnnulusSector

* Remove strange indexing

* Regularize math

* refactor: re-orienting segment elements to be Y-mirrored

* refactor: extracted radial menu radius multiplier property, changed color pallet for radial menu button

* refactor: removed icon backgrounds on textures used in current radial menu buttons with sectors, RadialContainer Radius renamed and now actually changed control radius.

* refactor: in RadialMenuTextureButtonWithSector all sector colors are converted to and from sRGB in property getter-setters

* refactor: renamed srgb to include Srgb suffix so devs gonna see that its srgb clearly

* fix: enabled any functional keys pressed when pushing radial menu buttons

* fix: radial menu sector now scales with UIScale

* fix: accept only one event when clicking on radial menu ContextualButton

* fix: now radial menu buttons accepts only click/alt-click, now clicks outside menu closes menu always

* feat: simple radial menu prototype for easier creation

* refactor: cleanup, restored emote filtering, button models now have class hierarchy

* refactor: remove usage of closure from 'outside code'

* refactor: remove non existing type from UiControlTest

* refactor: remove unused using

* refactor: revert ability to declare radial menu layers in xaml, scale 32px sprites using scale in radial menu

* refactor: whitespaces

* refactor: subscribe for dispose on existing radial menus

* feat: now simple radial menu button models can have custom color for each sector background (and hover background color). Also added OpenOverMouseScreenPosition inside SimpleRadialMenu

* fix: AI door menu now can be closed by verb if it gets unpowered

* refactor: simplify hiding border, extended xml-doc for simple radial menu settings

* refactor: remove linq

* fix: fix AI radial action serialization using invalid type

* refactor: fix duplicate ShowDeviceNotRespondingPopup for AI by properly checking if it can interact

* refactor: whitespaces, changed list to array in simple radial button preparing methods

---------

Co-authored-by: pa.pecherskij <pa.pecherskij@interfax.ru>
Co-authored-by: Eoin Mcloughlin <helloworld@eoinrul.es>
2025-03-31 12:57:47 +03:00

57 lines
1.7 KiB
C#

using System.Linq;
using Content.Client.LateJoin;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.ContentPack;
using Robust.Shared.IoC;
using Robust.Shared.Reflection;
namespace Content.IntegrationTests.Tests.UserInterface;
[TestFixture]
public sealed class UiControlTest
{
// You should not be adding to this.
private Type[] _ignored = new Type[]
{
typeof(LateJoinGui),
};
/// <summary>
/// Tests that all windows can be instantiated successfully.
/// </summary>
[Test]
public async Task TestWindows()
{
var pair = await PoolManager.GetServerClient(new PoolSettings()
{
Connected = true,
});
var activator = pair.Client.ResolveDependency<IDynamicTypeFactory>();
var refManager = pair.Client.ResolveDependency<IReflectionManager>();
var loader = pair.Client.ResolveDependency<IModLoader>();
await pair.Client.WaitAssertion(() =>
{
foreach (var type in refManager.GetAllChildren(typeof(BaseWindow)))
{
if (type.IsAbstract || _ignored.Contains(type))
continue;
if (!loader.IsContentType(type))
continue;
// If it has no empty ctor then skip it instead of figuring out what args it needs.
var ctor = type.GetConstructor(Type.EmptyTypes);
if (ctor == null)
continue;
// Don't inject because the control themselves have to do it.
activator.CreateInstance(type, oneOff: true, inject: false);
}
});
await pair.CleanReturnAsync();
}
}