2.10.13: mods draw with the dynamic font (no font warning flood), mod time in PerfStats, PERF report every 5 min in game, redesigned announcement cards in the MSCO menu

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-23 21:10:07 +02:00
co-authored by Claude Opus 5.5
parent b2ff221526
commit 1da5e3bb59
5 changed files with 76 additions and 17 deletions
+36 -12
View File
@@ -72,7 +72,8 @@ namespace MSCO
string layoutError;
GUIStyle dangerStyle;
GUIStyle windowBox, sidebarBox, rowBox, accentBox, pillStyle, pillMutedStyle, chipOnStyle, chipOffStyle;
GUIStyle featuredRowBox, pillFeaturedStyle, pillDangerStyle, newsTitleStyle;
GUIStyle featuredRowBox, pillFeaturedStyle, pillDangerStyle, newsTitleStyle, newsBoxStyle, newsTextStyle, newsCloseStyle;
Texture2D texNewsInfo, texNewsWarning, texNewsCritical;
// Ankündigungen/Wartung vom Keymaster - nur im Layout-Durchgang übernehmen (Liste kann sich im Hintergrund ändern)
List<Announcement> shownNews;
bool shownMaintenance;
@@ -432,26 +433,35 @@ namespace MSCO
shownMaintenanceText = SiteStatus.MaintenanceMessage;
}
if (shownMaintenance)
NewsBox("MAINTENANCE", pillFeaturedStyle, "MSCO is in maintenance right now",
NewsBox("MAINTENANCE", pillDangerStyle, texNewsCritical, "MSCO is in maintenance right now",
string.IsNullOrEmpty(shownMaintenanceText) ? "Some things may not work for a while." : shownMaintenanceText, null);
foreach (Announcement a in shownNews)
NewsBox(a.Level == "critical" ? "IMPORTANT" : a.Level == "warning" ? "NOTICE" : "INFO",
a.Level == "critical" ? pillDangerStyle : a.Level == "warning" ? pillFeaturedStyle : pillMutedStyle, a.Title, a.Text, a.Id);
a.Level == "critical" ? pillDangerStyle : a.Level == "warning" ? pillFeaturedStyle : pillMutedStyle,
a.Level == "critical" ? texNewsCritical : a.Level == "warning" ? texNewsWarning : texNewsInfo, a.Title, a.Text, a.Id);
if (shownMaintenance || shownNews.Count > 0) GUILayout.Space(S(10));
}
void NewsBox(string label, GUIStyle pill, string title, string text, string id)
void NewsBox(string label, GUIStyle pill, Texture2D stripe, string title, string text, string id)
{
GUILayout.BeginVertical(rowBox);
GUILayout.BeginVertical(newsBoxStyle);
GUILayout.BeginHorizontal();
GUILayout.Label(label, pill, GUILayout.Height(S(20)), GUILayout.ExpandWidth(false));
GUILayout.Space(S(8));
GUILayout.Label(title, newsTitleStyle, GUILayout.ExpandWidth(true));
if (id != null && GUILayout.Button("×", tabStyle, GUILayout.Width(S(28)), GUILayout.Height(S(22)))) dismissedNews.Add(id);
// Abzeichen und Titel gleich hoch und mittig - sonst sitzt der Titel tiefer als das Abzeichen
GUILayout.Label(label, pill, GUILayout.Height(S(22)), GUILayout.ExpandWidth(false));
GUILayout.Space(S(10));
GUILayout.Label(title, newsTitleStyle, GUILayout.MinHeight(S(22)), GUILayout.ExpandWidth(true));
if (id != null && GUILayout.Button(new GUIContent("×", "Hide"), newsCloseStyle, GUILayout.Width(S(24)), GUILayout.Height(S(22))))
dismissedNews.Add(id);
GUILayout.EndHorizontal();
if (!string.IsNullOrEmpty(text)) GUILayout.Label(text, textStyle);
if (!string.IsNullOrEmpty(text)) GUILayout.Label(text, newsTextStyle);
GUILayout.EndVertical();
GUILayout.Space(S(6));
// Farbiger Balken links (Art der Ankündigung)
if (Event.current.type == EventType.Repaint)
{
Rect box = GUILayoutUtility.GetLastRect();
GUI.DrawTexture(new Rect(box.x, box.y + S(10), S(3), box.height - S(20)), stripe);
}
GUILayout.Space(S(8));
}
void DrawNameField(MultiplayerManager mp, float width)
@@ -1195,7 +1205,6 @@ namespace MSCO
headerCellStyle = Label(P(11), Muted, FontStyle.Bold);
headerCellStyle.alignment = TextAnchor.MiddleLeft;
rowNameStyle = Label(P(14), Color.white, FontStyle.Normal);
newsTitleStyle = new GUIStyle(rowNameStyle) { wordWrap = true }; // erst nach rowNameStyle (Kopie davon)
rowNameStyle.alignment = TextAnchor.MiddleLeft;
pingGoodStyle = new GUIStyle(rowNameStyle);
pingGoodStyle.normal.textColor = Online;
@@ -1238,6 +1247,21 @@ namespace MSCO
fieldStyle.focused.background = UiTheme.RoundedEx(Hex(0x19, 0x19, 0x1e), Hex(0x19, 0x19, 0x1e), Accent, true, P(10), P(10) * 2 + 4);
fieldStyle.border = new RectOffset(P(10) + 2, P(10) + 2, P(10) + 2, P(10) + 2);
// Ankündigungen: Karte mit Innenabstand, Titel fett auf Höhe des Abzeichens, Text gut lesbar
newsBoxStyle = UiTheme.Card(Field, P(10));
newsBoxStyle.padding = new RectOffset(P(18), P(12), P(12), P(12));
newsTitleStyle = Label(P(15), Color.white, FontStyle.Bold);
newsTitleStyle.alignment = TextAnchor.MiddleLeft;
newsTitleStyle.wordWrap = true;
newsTextStyle = Label(P(13), new Color(0.86f, 0.86f, 0.9f), FontStyle.Normal);
newsTextStyle.wordWrap = true;
newsTextStyle.margin = new RectOffset(0, 0, P(6), 0);
newsCloseStyle = Label(P(18), Muted, FontStyle.Normal);
newsCloseStyle.alignment = TextAnchor.MiddleCenter;
newsCloseStyle.hover.textColor = Color.white;
texNewsInfo = Solid(Hex(0x5a, 0xa0, 0xff));
texNewsWarning = Solid(Gold);
texNewsCritical = Solid(UiTheme.Danger);
stylesReady = true;
}