Files
tbd-station-14/Content.Shared/Verbs/VerbCategory.cs
Leon Friedrich 49296e33a0 Refactor Context Menus and make them use XAML & stylesheets (#4768)
* XAML verb menu

* fix ghost FOV

* spacing

* rename missed "ContextMenu"->"EntityMenu" instances

* move visibility checks to verb system

* update comment

* Remove CanSeeContainerCheck

* use ScrollContainer measure option

* MaxWidth / texxt line wrapping

* verb category default

Now when you click on a verb category, it should default to running the first member of that category.

This makes it much more convenient to eject/insert when there is only a single option

* only apply style to first verb category entry

* Use new visibility flags

* FoV -> Fov

* Revert "only apply style to first verb category entry"

This reverts commit 9a6a17dba600e3ae0421caed59fcab145c260c99.

* make all entity menu visibility checks clientside

* Fix empty unbuckle category

* fix merge
2021-10-27 22:21:19 -07:00

59 lines
2.2 KiB
C#

using Robust.Shared.Localization;
using Robust.Shared.Serialization;
using Robust.Shared.Utility;
using System;
namespace Content.Shared.Verbs
{
/// <summary>
/// Contains combined name and icon information for a verb category.
/// </summary>
[Serializable, NetSerializable]
public class VerbCategory
{
public readonly string Text;
public readonly SpriteSpecifier? Icon;
/// <summary>
/// If true, the members of this verb category will be shown in the context menu as a row of icons without
/// any text.
/// </summary>
/// <remarks>
/// For example, the 'Rotate' category simply shows two icons for rotating left and right.
/// </remarks>
public readonly bool IconsOnly;
public VerbCategory(string text, string? icon, bool iconsOnly = false)
{
Text = Loc.GetString(text);
Icon = icon == null ? null : new SpriteSpecifier.Texture(new ResourcePath(icon));
IconsOnly = iconsOnly;
}
public static readonly VerbCategory Debug =
new("verb-categories-debug", "/Textures/Interface/VerbIcons/debug.svg.192dpi.png");
public static readonly VerbCategory Eject =
new("verb-categories-eject", "/Textures/Interface/VerbIcons/eject.svg.192dpi.png");
public static readonly VerbCategory Insert =
new("verb-categories-insert", "/Textures/Interface/VerbIcons/insert.svg.192dpi.png");
public static readonly VerbCategory Buckle =
new("verb-categories-buckle", "/Textures/Interface/VerbIcons/buckle.svg.192dpi.png");
public static readonly VerbCategory Unbuckle =
new("verb-categories-unbuckle", "/Textures/Interface/VerbIcons/unbuckle.svg.192dpi.png");
public static readonly VerbCategory Rotate =
new("verb-categories-rotate", "/Textures/Interface/VerbIcons/refresh.svg.192dpi.png", iconsOnly: true);
public static readonly VerbCategory SetTransferAmount =
new("verb-categories-transfer", "/Textures/Interface/VerbIcons/spill.svg.192dpi.png");
public static readonly VerbCategory Split =
new("verb-categories-split", null);
}
}