v.1.1.7
This commit is contained in:
parent
a36fdbf92d
commit
04a4fdce0d
143 changed files with 3565 additions and 2344 deletions
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ namespace WASDSharedAPI;
|
|||
public interface 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; }
|
||||
// previous option node
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public interface IWasdMenuManager
|
|||
//open menu as submenu
|
||||
public void OpenSubMenu(CCSPlayerController? player, IWasdMenu? menu);
|
||||
//create new menu object
|
||||
public IWasdMenu CreateMenu(string title = "", string ControlText = "");
|
||||
public IWasdMenu CreateMenu(string title, string itemText, string itemHoverText, string ControlText);
|
||||
public bool HasMenu(CCSPlayerController? player);
|
||||
public void UpdateActiveMenu(CCSPlayerController? player, Dictionary<string, Action<CCSPlayerController, IWasdMenuOption>> list);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue