Add CS2-SimpleAdmin documentation site

Introduces a new documentation site for CS2-SimpleAdmin using Docusaurus, including developer API references, tutorials, user guides, and module documentation. Removes the CleanModule example and updates FunCommands and ExampleModule. Also updates main plugin and API files to support new documentation and module structure.
This commit is contained in:
Dawid Bepierszcz
2025-10-20 01:27:01 +02:00
parent 21a5de6b3d
commit b0d8696756
74 changed files with 32732 additions and 279 deletions

View File

@@ -151,6 +151,18 @@ public interface ICS2_SimpleAdminApi
/// <param name="commandName">Command name for permission override checking (optional, e.g., "css_god").</param>
void RegisterMenu(string categoryId, string menuId, string menuName, Func<CCSPlayerController, object> menuFactory, string? permission = null, string? commandName = null);
/// <summary>
/// Registers a menu in a category with automatic context passing.
/// RECOMMENDED: Use this overload to eliminate duplication of categoryId and menuName in factory methods.
/// </summary>
/// <param name="categoryId">The category to add this menu to.</param>
/// <param name="menuId">Unique identifier for the menu.</param>
/// <param name="menuName">Display name of the menu.</param>
/// <param name="menuFactory">Factory function that receives player and menu context.</param>
/// <param name="permission">Required permission to access this menu (optional).</param>
/// <param name="commandName">Command name for permission override checking (optional, e.g., "css_god").</param>
void RegisterMenu(string categoryId, string menuId, string menuName, Func<CCSPlayerController, MenuContext, object> menuFactory, string? permission = null, string? commandName = null);
/// <summary>
/// Unregisters a menu from a category.
/// </summary>
@@ -161,11 +173,29 @@ public interface ICS2_SimpleAdminApi
/// </summary>
object CreateMenuWithBack(string title, string categoryId, CCSPlayerController player);
/// <summary>
/// Creates a menu with an automatic back button using menu context.
/// RECOMMENDED: Use this overload when calling from a context-aware menu factory to avoid title/category duplication.
/// </summary>
/// <param name="context">Menu context containing title and category information.</param>
/// <param name="player">The player who will see the menu.</param>
object CreateMenuWithBack(MenuContext context, CCSPlayerController player);
/// <summary>
/// Creates a menu with a list of players with filter and action.
/// </summary>
object CreateMenuWithPlayers(string title, string categoryId, CCSPlayerController admin, Func<CCSPlayerController, bool> filter, Action<CCSPlayerController, CCSPlayerController> onSelect);
/// <summary>
/// Creates a menu with a list of players using menu context.
/// RECOMMENDED: Use this overload when calling from a context-aware menu factory to avoid title/category duplication.
/// </summary>
/// <param name="context">Menu context containing title and category information.</param>
/// <param name="admin">The admin player opening the menu.</param>
/// <param name="filter">Filter function to determine which players to show.</param>
/// <param name="onSelect">Action to execute when a player is selected.</param>
object CreateMenuWithPlayers(MenuContext context, CCSPlayerController admin, Func<CCSPlayerController, bool> filter, Action<CCSPlayerController, CCSPlayerController> onSelect);
/// <summary>
/// Adds an option to the menu (extension method helper).
/// </summary>

View File

@@ -0,0 +1,48 @@
using CounterStrikeSharp.API.Core;
namespace CS2_SimpleAdminApi;
/// <summary>
/// Provides contextual information about a menu to its factory function.
/// This eliminates the need to duplicate category IDs and menu titles when creating menus.
/// </summary>
public class MenuContext
{
/// <summary>
/// The category ID this menu belongs to (e.g., "fun", "players").
/// Used for automatic "Back" button navigation.
/// </summary>
public string CategoryId { get; init; } = string.Empty;
/// <summary>
/// The unique identifier for this menu within its category.
/// </summary>
public string MenuId { get; init; } = string.Empty;
/// <summary>
/// The display title of the menu (from registration).
/// </summary>
public string MenuTitle { get; init; } = string.Empty;
/// <summary>
/// The permission required to access this menu (if any).
/// </summary>
public string? Permission { get; init; }
/// <summary>
/// The command name for permission override checking (if any).
/// </summary>
public string? CommandName { get; init; }
/// <summary>
/// Creates a new MenuContext with the specified values.
/// </summary>
public MenuContext(string categoryId, string menuId, string menuTitle, string? permission = null, string? commandName = null)
{
CategoryId = categoryId;
MenuId = menuId;
MenuTitle = menuTitle;
Permission = permission;
CommandName = commandName;
}
}