MenuManagerAPI.Shared
1.0.3
dotnet add package MenuManagerAPI.Shared --version 1.0.3
NuGet\Install-Package MenuManagerAPI.Shared -Version 1.0.3
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MenuManagerAPI.Shared" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MenuManagerAPI.Shared" Version="1.0.3" />
<PackageReference Include="MenuManagerAPI.Shared" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MenuManagerAPI.Shared --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MenuManagerAPI.Shared, 1.0.3"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MenuManagerAPI.Shared@1.0.3
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MenuManagerAPI.Shared&version=1.0.3
#tool nuget:?package=MenuManagerAPI.Shared&version=1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Add a reference to MenuManagerAPI.Shared in your project using one of the methods below to get started!
- Download the source code and build it yourself.
- Download the latest release from the releases page.
- Install the package using the .NET CLI, run:
dotnet add package MenuManagerAPI.Shared.
Interface
public interface IMenuAPI
{
public IMenu GetMenu(string title, Action<CCSPlayerController>? backAction = null, Action<CCSPlayerController>? resetAction = null, MenuType? forceType = null);
public MenuType GetMenuType(CCSPlayerController player);
public bool HasOpenedMenu(CCSPlayerController player);
public void OpenMenu(IMenu menu, CCSPlayerController player);
public void OpenMenuToAll(IMenu menu);
public void CloseMenu(CCSPlayerController player);
public void CloseMenuForAll();
public void RefreshMenu(CCSPlayerController player);
}
Example Usage
// Included libraries
using MenuManagerAPI.Shared;
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Menu;
using CounterStrikeSharp.API.Modules.Commands;
using CounterStrikeSharp.API.Core.Capabilities;
using CounterStrikeSharp.API.Core.Attributes.Registration;
// Define plugin class
public class Plugin : BasePlugin
{
// Define module properties
public override string ModuleName => "Example Menu";
public override string ModuleVersion => "1.0.1";
public override string ModuleAuthor => "Striker-Nick";
public override string ModuleDescription => "Example Menu Plugin";
// Define class properties
private IMenuApi? _api;
private readonly PluginCapability<IMenuApi?> _pluginCapability = new("menu:api");
// Define class methods
public override void OnAllPluginsLoaded(bool hotReload)
{
_api = _pluginCapability.Get();
if (_api == null) Console.WriteLine("MenuManagerAPI not found...");
}
[ConsoleCommand("css_test_menu", "Test menu!")]
public void OnCommand(CCSPlayerController? player, CommandInfo command)
{
if (player != null)
{
IMenu? menu = _api.GetMenu("Menu Title");
menu!.PostSelectAction = PostSelectAction.Close;
for (int i = 0; i < 10; i++)
{
menu.AddMenuOption($"itemline{i}", (player, option) =>
{
player.PrintToChat($"Selected: {option.Text}");
//_api.CloseMenu(player);
});
}
menu.Open(player);
// _api.OpenMenu(menu, player);
}
}
}
Color Normalization
MenuManagerAPI provides robust color handling for menu text, giving developers fine control over how colors are rendered in Button Menus:
- Color Token Normalization:
- If your menu header or option contains a
{color}token, MenuManagerAPI will convert this to an HTML<font color='color'>...</font>tag for display. - If no color token is present, the configured color from your menu style (e.g.,
EnabledOptionColor,Title.Color) is used as a fallback. - You can use raw HTML
<font color='...'>tags in your menu text for advanced customization. These will be preserved and rendered as-is. - Color tokens will override all colors in the configuration file
- If your menu header or option contains a
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- CounterStrikeSharp.API (>= 1.0.362)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.