Own main menu (game's Continue/New Game/Credits/Changelog/Quit hidden, QUIT in the launcher); new server profile layout; admin items: ratchet set, battery, shop items; session shows server player limit
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+79
-37
@@ -31,6 +31,8 @@ namespace MSCO
|
||||
static readonly Color Pending = Hex(0xf2, 0xc2, 0x1d);
|
||||
|
||||
Page page = Page.P2P;
|
||||
Vector2 profileScroll;
|
||||
bool quitConfirm;
|
||||
bool minimized;
|
||||
Vector2 playerScroll;
|
||||
Vector2 serverScroll;
|
||||
@@ -46,6 +48,7 @@ namespace MSCO
|
||||
Texture2D texBackground, texSidebar, texAccent, texOnline, texPending, texMuted, texRow;
|
||||
List<ServerListEntry> shownAll, shownServers; // Stand des letzten Layout-Durchgangs
|
||||
string layoutError;
|
||||
GUIStyle dangerStyle;
|
||||
GUIStyle windowBox, sidebarBox, rowBox, accentBox, pillStyle, pillMutedStyle, chipOnStyle, chipOffStyle;
|
||||
GUIStyle logoStyle, taglineStyle, navStyle, navActiveStyle, titleStyle, textStyle, captionStyle,
|
||||
fieldStyle, primaryStyle, secondaryStyle, statusStyle, tabStyle, headerCellStyle,
|
||||
@@ -112,6 +115,14 @@ namespace MSCO
|
||||
y += 44;
|
||||
if (NavButton(new Rect(r.x, y, r.width, 42), "Server Browser", page == Page.ServerBrowser)) page = Page.ServerBrowser;
|
||||
|
||||
// Eigenes Hauptmenü: Spiel beenden (die Knöpfe des Spiel-Menüs sind ausgeblendet)
|
||||
if (quitConfirm)
|
||||
{
|
||||
if (GUI.Button(new Rect(r.x + 16, r.yMax - 118, r.width - 32, 36), "QUIT GAME?", dangerStyle)) Application.Quit();
|
||||
if (GUI.Button(new Rect(r.x + 16, r.yMax - 76, r.width - 32, 30), "CANCEL", tabStyle)) quitConfirm = false;
|
||||
}
|
||||
else if (GUI.Button(new Rect(r.x + 16, r.yMax - 76, r.width - 32, 36), "QUIT", tabStyle)) quitConfirm = true;
|
||||
|
||||
GUI.Label(new Rect(r.x + 24, r.yMax - 30, r.width - 48, 20), "v" + MSCO.ModVersion, taglineStyle);
|
||||
}
|
||||
|
||||
@@ -295,7 +306,7 @@ namespace MSCO
|
||||
selectedServer = null;
|
||||
return;
|
||||
}
|
||||
GUILayout.Space(6);
|
||||
GUILayout.Space(8);
|
||||
|
||||
if (s == null)
|
||||
{
|
||||
@@ -304,64 +315,94 @@ namespace MSCO
|
||||
return;
|
||||
}
|
||||
|
||||
// Kopf: Name + Abzeichen links, JOIN (und ohne Steam das Namensfeld) rechts - immer sichtbar,
|
||||
// egal wie lang Beschreibung und Spielerliste darunter sind
|
||||
// Kopf: Name + Abzeichen links, JOIN rechts - immer sichtbar
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Label(s.Name, titleStyle);
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label(s.RequireSteam ? "STEAM" : "NON-STEAM", badgeStyle, GUILayout.ExpandWidth(false));
|
||||
if (s.IsLocal) { GUILayout.Space(10); GUILayout.Label("LOCAL", badgeStyle, GUILayout.ExpandWidth(false)); }
|
||||
GUILayout.FlexibleSpace();
|
||||
Rect badgeRow = GUILayoutUtility.GetRect(10, 20, GUILayout.ExpandWidth(true));
|
||||
float bx = badgeRow.x;
|
||||
bx += Pill(bx, badgeRow, s.RequireSteam ? "STEAM" : "NON-STEAM", s.RequireSteam ? pillStyle : pillMutedStyle);
|
||||
if (s.IsLocal) bx += Pill(bx, badgeRow, "LOCAL", pillStyle);
|
||||
if (s.Version != MSCO.ModVersion) Pill(bx, badgeRow, "v" + s.Version, pillStyle);
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.BeginVertical(GUILayout.Width(190));
|
||||
GUILayout.Space(12);
|
||||
GUI.enabled = CanJoin(mp, s);
|
||||
if (GUILayout.Button(s.Players >= s.MaxPlayers ? "SERVER FULL" : "JOIN SERVER", primaryStyle, GUILayout.Height(42), GUILayout.Width(190)))
|
||||
if (GUILayout.Button(s.Players >= s.MaxPlayers ? "SERVER FULL" : "JOIN SERVER", primaryStyle, GUILayout.Height(44), GUILayout.Width(180)))
|
||||
mp.JoinServer(s.Address, s.Port, s.Name, s.MaxPlayers);
|
||||
GUI.enabled = true;
|
||||
if (s.RequireSteam && !mp.SteamAvailable)
|
||||
GUILayout.Label("This server requires Steam.", textStyle);
|
||||
else if (!mp.SteamAvailable)
|
||||
{
|
||||
GUILayout.Space(4);
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.Label("NAME", captionStyle, GUILayout.Width(42));
|
||||
DrawNameField(mp, 140);
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.EndHorizontal();
|
||||
if (!string.IsNullOrEmpty(s.Description)) GUILayout.Label(s.Description, textStyle);
|
||||
GUILayout.Space(10);
|
||||
|
||||
// Ohne Steam: Name wählen (sauber in einem eigenen Kasten)
|
||||
if (s.RequireSteam && !mp.SteamAvailable)
|
||||
{
|
||||
GUILayout.BeginHorizontal(rowBox, GUILayout.Height(40));
|
||||
GUILayout.Label("This server requires Steam - start the game through Steam to join.", textStyle);
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
else if (!mp.SteamAvailable)
|
||||
{
|
||||
GUILayout.BeginHorizontal(rowBox, GUILayout.Height(44));
|
||||
GUILayout.Space(6);
|
||||
GUILayout.BeginVertical(GUILayout.Width(110));
|
||||
GUILayout.Space(4);
|
||||
GUILayout.Label("PLAYING AS", captionStyle);
|
||||
GUILayout.Label("no Steam", textStyle);
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.BeginVertical();
|
||||
GUILayout.Space(5);
|
||||
DrawNameField(mp, 220);
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.FlexibleSpace();
|
||||
GUILayout.EndHorizontal();
|
||||
GUILayout.Space(10);
|
||||
}
|
||||
|
||||
// Infos links, Spielerliste rechts
|
||||
bool versionOk = s.Version == MSCO.ModVersion;
|
||||
GUILayout.BeginHorizontal();
|
||||
GUILayout.BeginVertical(GUILayout.Width(250));
|
||||
InfoRow("HOSTED BY", string.IsNullOrEmpty(s.Owner) ? "unknown" : s.Owner, rowNameStyle);
|
||||
InfoRow("VERSION", "v" + s.Version + (versionOk ? "" : " (you: v" + MSCO.ModVersion + ")"), versionOk ? rowNameStyle : badgeStyle);
|
||||
InfoRow("STEAM", s.RequireSteam ? "Required" : "Not required", rowNameStyle);
|
||||
InfoRow("ONLINE FOR", s.UptimeSeconds >= 0 ? FormatUptime(s.UptimeSeconds) : "-", rowNameStyle);
|
||||
InfoLine("HOSTED BY", string.IsNullOrEmpty(s.Owner) ? "unknown" : s.Owner, rowNameStyle);
|
||||
InfoLine("VERSION", "v" + s.Version + (versionOk ? "" : " (you: v" + MSCO.ModVersion + ")"), versionOk ? rowNameStyle : badgeStyle);
|
||||
InfoLine("STEAM", s.RequireSteam ? "Required" : "Not required", rowNameStyle);
|
||||
InfoLine("ONLINE FOR", s.UptimeSeconds >= 0 ? FormatUptime(s.UptimeSeconds) : "-", rowNameStyle);
|
||||
InfoLine("PING", s.Ping < 0 ? "-" : s.Ping + " ms", rowNameStyle);
|
||||
InfoLine("ADDRESS", s.Address + ":" + s.Port, rowNameStyle);
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.BeginVertical();
|
||||
InfoRow("PLAYERS", s.Players + " / " + s.MaxPlayers, rowNameStyle);
|
||||
InfoRow("PING", s.Ping < 0 ? "-" : s.Ping + " ms", rowNameStyle);
|
||||
InfoRow("ADDRESS", s.Address + ":" + s.Port, rowNameStyle);
|
||||
GUILayout.Space(16);
|
||||
|
||||
GUILayout.BeginVertical(rowBox, GUILayout.ExpandWidth(true), GUILayout.MinHeight(150));
|
||||
GUILayout.Space(6);
|
||||
GUILayout.Label("PLAYERS " + s.Players + " / " + s.MaxPlayers, captionStyle);
|
||||
profileScroll = GUILayout.BeginScrollView(profileScroll, GUILayout.Height(130));
|
||||
if (s.PlayerNames == null || s.PlayerNames.Count == 0)
|
||||
GUILayout.Label("Nobody online right now.", textStyle);
|
||||
else
|
||||
foreach (string name in s.PlayerNames)
|
||||
{
|
||||
Rect line = GUILayoutUtility.GetRect(10, 24, GUILayout.ExpandWidth(true));
|
||||
GUI.DrawTexture(new Rect(line.x + 2, line.y + 8, 8, 8), texOnline);
|
||||
GUI.Label(new Rect(line.x + 18, line.y, line.width - 18, line.height), name, rowNameStyle);
|
||||
}
|
||||
GUILayout.EndScrollView();
|
||||
GUILayout.EndVertical();
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
// Spielerliste
|
||||
if (s.PlayerNames != null && s.PlayerNames.Count > 0)
|
||||
{
|
||||
GUILayout.Space(4);
|
||||
GUILayout.Label("ONLINE", captionStyle);
|
||||
GUILayout.Label(string.Join(", ", s.PlayerNames.ToArray()), textStyle);
|
||||
}
|
||||
|
||||
GUILayout.FlexibleSpace();
|
||||
}
|
||||
|
||||
/// <summary>Eine Info-Zeile: Bezeichnung links (grau), Wert rechts.</summary>
|
||||
void InfoLine(string caption, string value, GUIStyle valueStyle)
|
||||
{
|
||||
GUILayout.BeginHorizontal(GUILayout.Height(26));
|
||||
GUILayout.Label(caption, captionStyle, GUILayout.Width(100));
|
||||
GUILayout.Label(value, valueStyle);
|
||||
GUILayout.EndHorizontal();
|
||||
}
|
||||
|
||||
/// <summary>Kleines abgerundetes Abzeichen, so breit wie sein Text. Gibt die belegte Breite zurück.</summary>
|
||||
static float Pill(float x, Rect row, string text, GUIStyle style)
|
||||
{
|
||||
@@ -576,6 +617,7 @@ namespace MSCO
|
||||
navActiveStyle.padding = new RectOffset(26, 10, 0, 0);
|
||||
|
||||
primaryStyle = Button(Accent, AccentHover, Color.white, 14, FontStyle.Bold);
|
||||
dangerStyle = Button(UiTheme.Danger, UiTheme.DangerHover, Color.white, 13, FontStyle.Bold);
|
||||
secondaryStyle = Button(Secondary, SecondaryHover, Color.white, 14, FontStyle.Bold);
|
||||
tabStyle = Button(Sidebar, Secondary, Muted, 11, FontStyle.Bold);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user