Verb icon tiling (#8457)

This commit is contained in:
Leon Friedrich
2022-05-26 12:41:03 +12:00
committed by GitHub
parent ddddaceeff
commit 71a9ddc5f4
3 changed files with 10 additions and 4 deletions

View File

@@ -29,7 +29,7 @@ namespace Content.Client.ContextMenu.UI
/// <summary>
/// This is the main body of the menu. The menu entries should be added to this object.
/// </summary>
public BoxContainer MenuBody = new() { Orientation = LayoutOrientation.Vertical };
public GridContainer MenuBody = new();
private ContextMenuPresenter _presenter;
@@ -41,6 +41,7 @@ namespace Content.Client.ContextMenu.UI
_presenter = presenter;
ParentElement = parentElement;
// TODO xaml controls now have the access options -> re-xamlify all this.
//XAML controls are private. So defining and adding MenuBody here instead.
Scroll.AddChild(MenuBody);

View File

@@ -129,8 +129,7 @@ namespace Content.Client.Verbs.UI
AddElement(element.SubMenu, subElement);
}
if (category.IconsOnly)
element.SubMenu.MenuBody.Orientation = LayoutOrientation.Horizontal;
element.SubMenu.MenuBody.Columns = category.Columns;
}
/// <summary>

View File

@@ -13,6 +13,12 @@ namespace Content.Shared.Verbs
public readonly SpriteSpecifier? Icon;
/// <summary>
/// Columns for the grid layout that shows the verbs in this category. If <see cref="IconsOnly"/> is false,
/// this should very likely be set to 1.
/// </summary>
public int Columns = 1;
/// <summary>
/// If true, the members of this verb category will be shown in the context menu as a row of icons without
/// any text.
@@ -51,7 +57,7 @@ namespace Content.Shared.Verbs
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);
new("verb-categories-rotate", "/Textures/Interface/VerbIcons/refresh.svg.192dpi.png", iconsOnly: true) { Columns = 5};
public static readonly VerbCategory SetTransferAmount =
new("verb-categories-transfer", "/Textures/Interface/VerbIcons/spill.svg.192dpi.png");