diff --git a/docs/CenterHtmlFallbackCropped.png b/docs/CenterHtmlFallbackCropped.png index a225d3d..96ce4be 100644 Binary files a/docs/CenterHtmlFallbackCropped.png and b/docs/CenterHtmlFallbackCropped.png differ diff --git a/src/SharpModMenu/PlayerMenuState.cs b/src/SharpModMenu/PlayerMenuState.cs index dad9839..fd2759d 100644 --- a/src/SharpModMenu/PlayerMenuState.cs +++ b/src/SharpModMenu/PlayerMenuState.cs @@ -358,6 +358,7 @@ public Vector2 MenuPosition private nint MenuCurrentObserver { get; set; } = nint.Zero; private ObserverMode MenuCurrentObserverMode { get; set; } private CBaseEntity? MenuCurrentViewmodel { get; set; } + public bool DrawActiveMenu() { return false; // nothing to parent to right now, further work needed @@ -391,12 +392,9 @@ public bool DrawActiveMenu() CurrentMenu.IsDirty = false; var observerInfo = Player.GetObserverInfo(); + CanUseKeybinds = observerInfo.Mode == ObserverMode.FirstPerson && observerInfo.Observing?.Index == Player.Pawn.Index; if (observerInfo.Mode != ObserverMode.FirstPerson) - { - CanUseKeybinds = false; return false; - } - CanUseKeybinds = observerInfo.Mode == ObserverMode.FirstPerson && observerInfo.Observing?.Index == Player.Pawn.Index; var maybeEyeAngles = observerInfo.GetEyeAngles(); if (!maybeEyeAngles.HasValue) @@ -487,6 +485,9 @@ void writeLine(string text, TextStyling style, int? selectionIndex) public void DrawActiveMenuHtml() { + var observerInfo = Player.GetObserverInfo(); + CanUseKeybinds = observerInfo.Mode == ObserverMode.FirstPerson && observerInfo.Observing?.Index == Player.Pawn.Index; + if (CurrentMenu is null) { HtmlContent = null; @@ -494,14 +495,14 @@ public void DrawActiveMenuHtml() } bool firstLine = true; - int linesWrote = 0; void writeLine(string text, TextStyling style, int? selectIndex) { - if (string.IsNullOrEmpty(text)) - return; - if (text.IndexOf('\n') >= 0) + { text = text.Replace("\n", "
"); + while (text.Contains("

")) + text = text.Replace("

", "
.
"); + } if (firstLine) firstLine = false; @@ -516,9 +517,11 @@ void writeLine(string text, TextStyling style, int? selectIndex) { Foreground: false, Highlight: false } => "#E7CCA5", }; - var selectionPrefix = selectIndex.HasValue ? $"/{selectIndex.Value} " : string.Empty; - HtmlTextSb.Append($"{selectionPrefix}{text}"); - linesWrote++; + var selectionPrefix = selectIndex.HasValue ? $"{selectIndex.Value}. " : string.Empty; + if (string.IsNullOrEmpty(text)) + HtmlTextSb.Append($"."); + else + HtmlTextSb.Append($"{selectionPrefix}{text}"); } HtmlTextSb.Clear();