Show why you were disconnected in the main menu; reset-world / reload-save make all players reconnect automatically

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-27 10:46:34 +02:00
co-authored by Claude Opus 5.5
parent bba20cf991
commit 0ae4dae28d
4 changed files with 102 additions and 4 deletions
+30 -2
View File
@@ -72,7 +72,8 @@ namespace MSCO
EnsureStyles();
bool pendingJoin = mp.PendingJoinHost != null && !mp.IsInSession;
bool versionWarning = mp.PendingVersionWarning != null && !mp.IsInSession;
if (pendingJoin || versionWarning) minimized = false; // JOIN-Link / Warnung: Fenster zeigen
bool disconnected = mp.DisconnectNotice != null && !mp.IsInSession;
if (pendingJoin || versionWarning || disconnected) minimized = false; // JOIN-Link / Warnung / Trennung: Fenster zeigen
if (minimized) { DrawMinimized(mp); return; }
var window = new Rect((Screen.width - Width) / 2f, (Screen.height - Height) / 2f, Width, Height);
@@ -84,8 +85,10 @@ namespace MSCO
var content = new Rect(window.x + SidebarWidth + 32, window.y + 28,
Width - SidebarWidth - 64, Height - StatusHeight - 52);
GUILayout.BeginArea(content);
if (versionWarning) DrawVersionWarning(mp);
if (disconnected) DrawDisconnectNotice(mp);
else if (versionWarning) DrawVersionWarning(mp);
else if (pendingJoin) DrawJoinConfirm(mp);
else if (mp.IsReconnecting) DrawReconnecting(mp);
else if (mp.IsInSession) DrawSession(mp);
else if (page == Page.P2P) DrawP2P(mp);
else DrawServerBrowser(mp);
@@ -483,6 +486,31 @@ namespace MSCO
GUILayout.EndHorizontal();
}
/// <summary>Nach dem Trennen (Kick, Ban, Shutdown, Timeout ...): Grund anzeigen.</summary>
void DrawDisconnectNotice(MultiplayerManager mp)
{
GUILayout.Label("Disconnected", titleStyle);
GUILayout.Space(8);
GUILayout.BeginVertical(rowBox);
GUILayout.Space(6);
GUILayout.Label("REASON", captionStyle);
GUILayout.Label(mp.DisconnectNotice, rowNameStyle);
GUILayout.Space(6);
GUILayout.EndVertical();
GUILayout.Space(8);
GUILayout.Label("Your own save game has been restored.", textStyle);
GUILayout.FlexibleSpace();
if (GUILayout.Button("OK", primaryStyle, GUILayout.Height(42), GUILayout.Width(170))) mp.ClearDisconnectNotice();
}
void DrawReconnecting(MultiplayerManager mp)
{
GUILayout.Label("Reconnecting", titleStyle);
GUILayout.Space(8);
GUILayout.Label(mp.ReconnectMessage, rowNameStyle);
GUILayout.Label("You will be connected to the server again in a moment.", textStyle);
}
void DrawSession(MultiplayerManager mp)
{
GUILayout.Label(mp.IsHost ? "Hosting" : "Connected", titleStyle);