Skip to content

Commit 2b8c8de

Browse files
committed
Changed selected item to be based on transparent highlight color
1 parent 5b9586b commit 2b8c8de

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

src/SharpModMenu/PlayerMenuState.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,14 @@ private void DestroyEntities()
216216
ForegroundText = BackgroundText = Background = null;
217217
}
218218

219-
private static readonly Color HighlightTextColor = Color.FromArgb(247, 72, 67);
219+
private static readonly Color HighlightTextColor = Color.FromArgb(127, 255, 255, 64);
220220
private static readonly Color ForegroundTextColor = Color.FromArgb(229, 150, 32); // 245, 177, 103 with a white bg, maybe 240, 160, 30 at 95% opacity?
221221
private static readonly Color BackgroundTextColor = Color.FromArgb(234, 209, 175);
222222

223223
private void CreateEntities()
224224
{
225-
HighlightText = CreateWorldText(textColor: HighlightTextColor, false, -0.000f);
226-
ForegroundText = CreateWorldText(textColor: ForegroundTextColor, false, -0.000f);
225+
HighlightText = CreateWorldText(textColor: HighlightTextColor, false, 0.001f);
226+
ForegroundText = CreateWorldText(textColor: ForegroundTextColor, false, 0.000f);
227227
BackgroundText = CreateWorldText(textColor: BackgroundTextColor, false, -0.001f);
228228
Background = CreateWorldText(textColor: Color.FromArgb(200, 127, 127, 127), true, -0.002f);
229229
}
@@ -395,27 +395,28 @@ void writeLine(string text, TextStyling style, int? selectionIndex)
395395
BackgroundSb.AppendLine();
396396
}
397397

398-
StringBuilder? sb = null;
398+
StringBuilder sb = style.Foreground ? ForegroundTextSb : BackgroundTextSb;
399399

400-
if (style.Highlight)
401-
HighlightTextSb.Append("[ ]");
402-
403-
sb = style.Foreground ? ForegroundTextSb : BackgroundTextSb;
404400
if (selectionIndex.HasValue)
405401
{
406402
sb.Append($"{selectionIndex}. ");
407403
BackgroundSb.Append($"{selectionIndex}. ");
404+
405+
if (style.Highlight)
406+
HighlightTextSb.Append($"{selectionIndex}. ");
408407
}
409408
sb.Append(text);
410409
BackgroundSb.Append(text);
411410

411+
if (style.Highlight)
412+
HighlightTextSb.Append(text);
413+
412414
linesWrote++;
413415
}
414416

415417
BuildMenuStrings(CurrentMenu, writeLine);
416418

417419
var position = eyeAngles.Position + eyeAngles.Forward * 7.0f + eyeAngles.Right * MenuPosition.X + eyeAngles.Up * MenuPosition.Y;
418-
var highlightPosition = position + eyeAngles.Right * -0.055f;
419420
var angle = new Vector3()
420421
{
421422
Y = eyeAngles.Angle.Y + 270.0f, // -90?
@@ -437,7 +438,7 @@ void writeLine(string text, TextStyling style, int? selectionIndex)
437438
DestroyEntities();
438439
CreateEntities();
439440
}
440-
UpdateEntity(HighlightText!, predictedViewmodel, HighlightTextSb.ToString(), highlightPosition, angle);
441+
UpdateEntity(HighlightText!, predictedViewmodel, HighlightTextSb.ToString(), position, angle);
441442
UpdateEntity(ForegroundText!, predictedViewmodel, ForegroundTextSb.ToString(), position, angle);
442443
UpdateEntity(BackgroundText!, predictedViewmodel, BackgroundTextSb.ToString(), position, angle);
443444
UpdateEntity(Background!, predictedViewmodel, BackgroundSb.ToString(), position, angle);

0 commit comments

Comments
 (0)