ContextMenu (#3286)

* ContextMenu

* Updating to WPF.

* Updating to WPF.

* Margins
This commit is contained in:
Daniel Castro Razo
2021-02-25 19:42:16 -06:00
committed by GitHub
parent 51182c8469
commit f30a4d8a52
10 changed files with 1059 additions and 231 deletions

View File

@@ -0,0 +1,45 @@
#nullable enable
using Content.Client.GameObjects.EntitySystems;
using Content.Shared;
using Robust.Shared.Configuration;
using Robust.Shared.Console;
using Robust.Shared.IoC;
using ContextMenuView = Content.Client.UserInterface.ContextMenu.ContextMenuView;
namespace Content.Client.Commands
{
public class GroupingContextMenuCommand : IConsoleCommand
{
public string Command => "contextmenug";
public string Description => "Sets the contextmenu-groupingtype.";
public string Help => ($"Usage: contextmenug <0:{ContextMenuView.GroupingTypesCount}>");
public void Execute(IConsoleShell shell, string argStr, string[] args)
{
if (args.Length != 1)
{
shell.WriteLine(Help);
return;
}
if (!int.TryParse(args[0], out var id))
{
shell.WriteLine($"{args[0]} is not a valid integer.");
return;
}
if (id < 0 ||id > ContextMenuView.GroupingTypesCount - 1)
{
shell.WriteLine($"{args[0]} is not a valid integer.");
return;
}
var configurationManager = IoCManager.Resolve<IConfigurationManager>();
var cvar = CCVars.ContextMenuGroupingType;
configurationManager.SetCVar(cvar, id);
shell.WriteLine($"Context Menu Grouping set to type: {configurationManager.GetCVar(cvar)}");
}
}
}