Less garbage, fewer GC hitches: no Joint array per part every 0.5 s, cheap aim check after clicks, cached FPS/ping/chat labels; perf report measures object sync, vehicle fx and part/bolt sync correctly
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
fe08fa5213
commit
d567d5992a
+15
-4
@@ -30,8 +30,13 @@ namespace MSCO
|
||||
public string Name, Text;
|
||||
public bool System;
|
||||
public float Time;
|
||||
// "Name:" und seine Breite - einmal berechnet statt bei jedem OnGUI-Durchlauf (2-3x pro Bild)
|
||||
public string NameLabel;
|
||||
public float NameWidth = -1f;
|
||||
}
|
||||
|
||||
readonly List<ChatLine> visibleChat = new List<ChatLine>();
|
||||
|
||||
// Konsole
|
||||
public bool ConsoleOpen { get; private set; }
|
||||
readonly List<string> consoleLines = new List<string>();
|
||||
@@ -211,7 +216,8 @@ namespace MSCO
|
||||
int maxLines = ChatOpen ? 12 : 6;
|
||||
|
||||
// Sichtbare Zeilen: offen = die letzten, geschlossen = nur neue (blenden aus)
|
||||
var visible = new List<ChatLine>();
|
||||
var visible = visibleChat;
|
||||
visible.Clear();
|
||||
for (int i = chat.Count - 1; i >= 0 && visible.Count < maxLines; i--)
|
||||
if (ChatOpen || now - chat[i].Time < ChatFadeSeconds) visible.Insert(0, chat[i]);
|
||||
|
||||
@@ -233,9 +239,14 @@ namespace MSCO
|
||||
}
|
||||
else
|
||||
{
|
||||
Vector2 size = chatName.CalcSize(new GUIContent(line.Name + ":"));
|
||||
GUI.Label(new Rect(rect.x + 12, y, size.x, lineHeight), line.Name + ":", chatName);
|
||||
GUI.Label(new Rect(rect.x + 16 + size.x, y, width - 28 - size.x, lineHeight), line.Text, chatText);
|
||||
if (line.NameWidth < 0f)
|
||||
{
|
||||
line.NameLabel = line.Name + ":";
|
||||
line.NameWidth = chatName.CalcSize(new GUIContent(line.NameLabel)).x;
|
||||
}
|
||||
float nameWidth = line.NameWidth;
|
||||
GUI.Label(new Rect(rect.x + 12, y, nameWidth, lineHeight), line.NameLabel, chatName);
|
||||
GUI.Label(new Rect(rect.x + 16 + nameWidth, y, width - 28 - nameWidth, lineHeight), line.Text, chatText);
|
||||
}
|
||||
y += lineHeight;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user