|
| 1 | +     |
| 2 | + |
1 | 3 | # MenuManagerAPI |
2 | 4 |
|
3 | 5 | MenuManagerAPI takes the powerful groundwork established by [MenuManagerCS2](https://github.com/NickFox007/MenuManagerCS2) and elevates it. We've refined the core concepts to offer a smarter, faster, and more versatile experience, focusing on: |
@@ -158,45 +160,12 @@ Below is an example of the actual `en.json` lang file. You can add or override k |
158 | 160 | } |
159 | 161 | ``` |
160 | 162 |
|
161 | | -## Color Normalization (For Developers) |
162 | | - |
163 | | -MenuManagerAPI provides robust color handling for menu text, giving developers fine control over how colors are rendered in Button Menus: |
164 | | - |
165 | | -- **Color Token Normalization:** |
166 | | - - If your menu header or option contains a `{color}` token, MenuManagerAPI will convert this to an HTML `<font color='color'>...</font>` tag for display. |
167 | | - - If no color token is present, the configured color from your menu style (e.g., `EnabledOptionColor`, `Title.Color`) is used as a fallback. |
168 | | -<<<<<<< Updated upstream |
169 | | - |
170 | | -- **HTML Support:** |
171 | | -======= |
172 | | ->>>>>>> Stashed changes |
173 | | - - You can use raw HTML `<font color='...'>` tags in your menu text for advanced customization. These will be preserved and rendered as-is. |
174 | | - - Color tokens will override all colors in the configuration file |
175 | | - |
176 | | -**Summary:** |
177 | | - - Use `{color}` tokens for simple, portable colorization. This can be from a config file or directly hard-coded. |
178 | | - - Use raw HTML for advanced needs. |
179 | | - |
180 | | -## Why MenuManagerAPI is Better (For Developers & Servers) |
| 163 | +# API |
| 164 | +Add a reference to `MenuManagerAPI.Shared` to your project in one of the following ways: |
181 | 165 |
|
182 | | -MenuManagerAPI is designed from the ground up for both developer productivity and server performance: |
183 | | - |
184 | | -### For Developers |
185 | | -- **Consistent, Predictable API:** The API is stable and mirrors CounterStrikeSharp and MenuManagerCS2, making migration and integration easy. |
186 | | -- **Automatic Color Handling:** No need to manually parse or wrap color tokens—MenuManagerAPI does it for you, with clear config options. |
187 | | -- **Multiple Menu Types:** Easily switch between Button, Chat, Center, and Console menus. Player preferences are respected automatically. |
188 | | -- **Extensible & Modular:** Built with dependency injection and clean separation of concerns, so you can add features or swap out components with minimal friction. |
189 | | -- **Strong Typing & Null Safety:** All config and API surfaces are strongly typed, reducing runtime errors and making code easier to reason about. |
190 | | - |
191 | | -### For Servers |
192 | | -- **Performance Optimized:** Uses pooled StringBuilders and efficient rendering logic to minimize allocations and maximize responsiveness, even with large menus. |
193 | | - - **Global OnTick Listener:** Like CounterStrikeSharp's built-in ChatMenu and CenterHtmlMenu, MenuManagerAPI uses a global OnTick listener to track and update all open menus. This ensures centralized state management and a consistent, robust user experience—no stale menus, no memory leaks, and smooth updates for all players. |
194 | | -- **Event-Driven Cleanup:** Menu state is always cleaned up on round end, disconnect, or map change—no memory leaks or stale menus. |
195 | | -- **Graceful Degradation:** If a menu type or dependency is missing, the system falls back to chat commands or other available types, ensuring menus always work. |
196 | | -- **Player Preference Persistence:** Menu type and settings are stored per-player, so users always get their preferred experience. |
197 | | -- **Battle-Tested:** Built on lessons learned from MenuManagerCS2 and WASDMenuAPI, with a focus on reliability and real-world usability. |
198 | | - |
199 | | -**Bottom Line:** MenuManagerAPI is the most robust, developer-friendly, and performant menu system for CounterStrikeSharp servers. It saves you time, reduces bugs, and gives your players a better experience. |
| 166 | +1. Download the source code and build it yourself. |
| 167 | +2. Download the latest release from the [releases](https://github.com/nickj609/MenuManagerAPI/releases) page. |
| 168 | +3. Install the package using the .NET CLI, run: `dotnet add package MenuManagerAPI.Shared`. |
200 | 169 |
|
201 | 170 | ## Interface |
202 | 171 |
|
@@ -268,18 +237,20 @@ public class Plugin : BasePlugin |
268 | 237 | } |
269 | 238 | } |
270 | 239 | ``` |
| 240 | +## Color Normalization |
| 241 | + |
| 242 | +MenuManagerAPI provides robust color handling for menu text, giving developers fine control over how colors are rendered in Button Menus: |
| 243 | + |
| 244 | +- **Color Token Normalization:** |
| 245 | + - If your menu header or option contains a `{color}` token, MenuManagerAPI will convert this to an HTML `<font color='color'>...</font>` tag for display. |
| 246 | + - If no color token is present, the configured color from your menu style (e.g., `EnabledOptionColor`, `Title.Color`) is used as a fallback. |
| 247 | + - You can use raw HTML `<font color='...'>` tags in your menu text for advanced customization. These will be preserved and rendered as-is. |
| 248 | + - Color tokens will override all colors in the configuration file |
| 249 | + |
| 250 | +**Summary:** |
| 251 | + - Use `{color}` tokens for simple, portable colorization. This can be from a config file or directly hard-coded. |
| 252 | + - Use raw HTML for advanced needs. |
271 | 253 |
|
272 | | -## TODO |
273 | | -- [x] Chat Menu |
274 | | -- [x] Center Menu |
275 | | -- [x] Console Menu |
276 | | -- [x] Button Menu |
277 | | - - [x] Sound |
278 | | - - [x] Styling |
279 | | - - [x] Option Counter |
280 | | - - [x] Velocity Modifier |
281 | | - - [x] Global OnTick function |
282 | | - |
283 | | -## Need Help? |
| 254 | +# Need Help? |
284 | 255 |
|
285 | 256 | Still need help? [create a new issue](https://github.com/nickj609/MenuManagerAPI/issues/new/choose). |
0 commit comments