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:
+26
-3
@@ -179,9 +179,26 @@ namespace MSCO
|
||||
catch (Exception e) { Bootstrap.Log("FSM dump failed: " + e); }
|
||||
}
|
||||
|
||||
readonly System.Diagnostics.Stopwatch modWatch = new System.Diagnostics.Stopwatch();
|
||||
|
||||
/// <summary>Zeit der Mods messen (PERF-Bericht, Konsole "perf").</summary>
|
||||
void MeasureMods(string part, Action call)
|
||||
{
|
||||
modWatch.Reset();
|
||||
modWatch.Start();
|
||||
try { call(); }
|
||||
finally
|
||||
{
|
||||
modWatch.Stop();
|
||||
PerfStats.Add(part, modWatch.Elapsed.TotalMilliseconds);
|
||||
}
|
||||
}
|
||||
|
||||
static readonly Action modFixedUpdate = ModLoader.FixedUpdate, modUpdate = ModLoader.Update, modOnGui = ModLoader.OnGUI;
|
||||
|
||||
void FixedUpdate()
|
||||
{
|
||||
ModLoader.FixedUpdate();
|
||||
MeasureMods("mods (physics)", modFixedUpdate);
|
||||
}
|
||||
|
||||
bool skipping, loadingScreen;
|
||||
@@ -191,7 +208,7 @@ namespace MSCO
|
||||
|
||||
void Update()
|
||||
{
|
||||
ModLoader.Update();
|
||||
MeasureMods("mods", modUpdate);
|
||||
if (!skipping || Time.frameCount < skipFrame + 2) return;
|
||||
skipping = false;
|
||||
loadingScreen = true;
|
||||
@@ -202,7 +219,13 @@ namespace MSCO
|
||||
{
|
||||
if (!skipping && !loadingScreen)
|
||||
{
|
||||
ModLoader.OnGUI();
|
||||
// Mods zeichnen mit der dynamischen Schrift: Schriftgröße/Fett gehen sonst nicht, und Unity schreibt bei jedem
|
||||
// Zeichnen eine Warnung samt Stacktrace ins Log (z.B. Show Bolt Size: hunderte pro Minute, kostet FPS)
|
||||
GUISkin skin = GUI.skin;
|
||||
Font previous = skin.font, font = UiTheme.DynamicFont;
|
||||
if (font != null) skin.font = font;
|
||||
try { MeasureMods("mods (interface)", modOnGui); }
|
||||
finally { skin.font = previous; }
|
||||
return;
|
||||
}
|
||||
GUI.depth = -10000;
|
||||
|
||||
Reference in New Issue
Block a user