Launcher can be minimized to a small bar in the start menu
A '-' button collapses the fullscreen launcher into a small MSCO bar at the top; the game's start menu is visible and clickable again and its music is unmuted. Clicking the bar opens the launcher; prompts (disconnected, reconnecting, join confirmation, version warning) open it automatically. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+38
-2
@@ -79,8 +79,14 @@ namespace MSCO
|
||||
/// <summary>Fläche, die das Fenster gerade belegt (GUI-Koordinaten, oben = 0).</summary>
|
||||
public Rect ScreenRect { get; private set; }
|
||||
|
||||
/// <summary>Der Launcher füllt im Hauptmenü immer den ganzen Bildschirm - das Spielmenü dahinter ist gesperrt.</summary>
|
||||
public bool IsOpen { get { return true; } }
|
||||
/// <summary>
|
||||
/// Eingeklappt: nur eine kleine MSCO-Leiste oben, das Startmenü des Spiels (Optionen, Farbe, Musik ...) ist wieder
|
||||
/// sichtbar und bedienbar. Bei Meldungen (getrennt, neu verbinden, beitreten ...) klappt der Launcher von selbst auf.
|
||||
/// </summary>
|
||||
public bool Minimized { get; set; }
|
||||
|
||||
/// <summary>Aufgeklappt füllt der Launcher den ganzen Bildschirm - das Spielmenü dahinter ist dann gesperrt.</summary>
|
||||
public bool IsOpen { get { return !Minimized; } }
|
||||
|
||||
/// <summary>Ist die Maus gerade über dem Fenster bzw. der eingeklappten Leiste?</summary>
|
||||
public bool ContainsMouse()
|
||||
@@ -95,6 +101,11 @@ namespace MSCO
|
||||
EnsureStyles(); // baut die Stile neu, wenn sich die Skalierung ändert (Auflösung gewechselt)
|
||||
vw = Screen.width;
|
||||
vh = Screen.height;
|
||||
// Wichtige Meldungen nie hinter der eingeklappten Leiste verstecken
|
||||
if (Minimized && !mp.IsInSession && (mp.DisconnectNotice != null || mp.PendingJoinHost != null || mp.PendingVersionWarning != null))
|
||||
Minimized = false;
|
||||
if (Minimized && mp.IsReconnecting) Minimized = false;
|
||||
if (Minimized) { DrawMinimized(mp); return; }
|
||||
ScreenRect = new Rect(0, 0, Screen.width, Screen.height);
|
||||
DrawScaled(mp);
|
||||
}
|
||||
@@ -130,6 +141,31 @@ namespace MSCO
|
||||
GUILayout.EndArea();
|
||||
|
||||
DrawStatusBar(mp, new Rect(0, vh - S(StatusHeight), vw, S(StatusHeight)));
|
||||
|
||||
// Einklappen (oben rechts): das Startmenü des Spiels wird wieder sichtbar
|
||||
var minimize = new Rect(vw - S(54), S(12), S(40), S(32));
|
||||
if (GUI.Button(minimize, new GUIContent("–", "Minimize - show the game's start menu"), secondaryStyle)) Minimized = true;
|
||||
}
|
||||
|
||||
/// <summary>Eingeklappt: kleine Leiste oben in der Mitte mit Verbindungsstand - Klick öffnet den Launcher wieder.</summary>
|
||||
void DrawMinimized(MultiplayerManager mp)
|
||||
{
|
||||
float w = S(300), h = S(40);
|
||||
var bar = new Rect(Mathf.Round((vw - w) / 2f), S(10), w, h);
|
||||
ScreenRect = bar;
|
||||
GUI.Box(bar, GUIContent.none, sidebarBox);
|
||||
Texture2D logo = Branding.LogoTexture;
|
||||
float x = bar.x + S(10);
|
||||
if (logo != null)
|
||||
{
|
||||
GUI.DrawTexture(new Rect(x, bar.y + S(6), S(28), S(28)), logo);
|
||||
x += S(36);
|
||||
}
|
||||
Texture2D dot = mp.IsFullyConnected ? texOnline : mp.IsInSession || mp.IsReconnecting ? texPending : texMuted;
|
||||
GUI.DrawTexture(new Rect(x, bar.y + (h - S(8)) / 2f, S(8), S(8)), dot);
|
||||
string text = mp.IsInSession ? "MSCO · " + mp.Players.Count + " player(s) · open" : "MSCO · open multiplayer";
|
||||
GUI.Label(new Rect(x + S(16), bar.y, bar.xMax - x - S(24), h), text, statusStyle);
|
||||
if (GUI.Button(bar, new GUIContent("", "Open the MSCO launcher"), GUIStyle.none)) Minimized = false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------- Bereiche
|
||||
|
||||
Reference in New Issue
Block a user