This commit is contained in:
Juzlus 2025-09-23 04:53:25 +02:00
parent a36fdbf92d
commit 04a4fdce0d
143 changed files with 3565 additions and 2344 deletions

View file

@ -35,11 +35,13 @@ public class WasdManager : IWasdMenuManager
menuPlayer?.OpenSubMenu(menu);
}
public IWasdMenu CreateMenu(string title = "", string controlText = "")
public IWasdMenu CreateMenu(string title, string itemText, string itemHoverText, string controlText)
{
WasdMenu menu = new()
{
Title = title,
ItemText = itemText,
ItemHoverText = itemHoverText,
ControlText = controlText
};
return menu;

View file

@ -6,6 +6,8 @@ namespace WASDMenuAPI.Classes;
public class WasdMenu : IWasdMenu
{
public string Title { get; set; } = "";
public string ItemText { get; set; } = "";
public string ItemHoverText { get; set; } = "";
public string ControlText { get; set; } = "";
public LinkedList<IWasdMenuOption>? Options { get; set; } = new();
public LinkedListNode<IWasdMenuOption>? Prev { get; set; } = null;

View file

@ -123,14 +123,22 @@ public class WasdMenuPlayer
return;
StringBuilder builder = new();
string itemText = "";
string itemHoverText = "";
string endControl = "";
LinkedListNode<IWasdMenuOption>? option = MenuStart;
if (!string.IsNullOrEmpty(option?.Value?.Parent?.Title))
builder.AppendLine($"{option.Value.Parent?.Title}</u><font class='fontSize-m' color='white'><br>");
builder.AppendLine(option.Value.Parent?.Title ?? "");
if (!string.IsNullOrEmpty(option?.Value?.Parent?.ItemText))
itemText = option?.Value?.Parent?.ItemText ?? "";
if (!string.IsNullOrEmpty(option?.Value?.Parent?.ItemHoverText))
itemHoverText = option?.Value?.Parent?.ItemHoverText ?? "";
if (!string.IsNullOrEmpty(option?.Value?.Parent?.ControlText))
endControl = option?.Value?.Parent?.ControlText ?? "";
endControl = option?.Value?.Parent?.ControlText ?? "";
int shown = 0;
int maxOptions = VisibleOptions;
@ -176,10 +184,10 @@ public class WasdMenuPlayer
else
text = SafeSubstring(text, 0, maxLength);
builder.AppendLine($"</font><font color='purple'>[ </font><font color='orange'>{text}</font><font color='purple'> ]</font><font color='white'> <br>");
builder.AppendLine(string.Format(itemHoverText, text));
}
else
builder.AppendLine($"<font color='{color ?? "white"}'>{SafeSubstring(text, 0, maxLength)}</font> <br>");
builder.AppendLine(string.Format(itemText, $"<font {(string.IsNullOrEmpty(color) ? "" : $"color='{color}'")}'>{SafeSubstring(text, 0, maxLength)}</font>"));
option = option.Next;
shown++;
@ -188,7 +196,6 @@ public class WasdMenuPlayer
if (!string.IsNullOrEmpty(endControl))
builder.AppendLine(endControl);
builder.AppendLine("</div>");
CenterHtml = builder.ToString();
}