From 8458c4ef1bdc86889e52e43d29e143e4a1d85b1b Mon Sep 17 00:00:00 2001 From: "GANONDORF\\CASPI" Date: Tue, 16 Sep 2025 13:29:36 -0400 Subject: [PATCH 1/5] Loads welcome window --- Source/Client/Settings/MpSettings.cs | 3 ++ Source/Client/UI/MainMenuAnimation.cs | 54 +++++++++++++++++++++++++-- 2 files changed, 54 insertions(+), 3 deletions(-) diff --git a/Source/Client/Settings/MpSettings.cs b/Source/Client/Settings/MpSettings.cs index 2e2e4173..e9b8ff5a 100644 --- a/Source/Client/Settings/MpSettings.cs +++ b/Source/Client/Settings/MpSettings.cs @@ -33,6 +33,7 @@ public class MpSettings : ModSettings public bool hideOtherPlayersInColonistBar = false; public bool hideOtherPlayersQuests = false; + public string mostRecentVersionWelcomed = ""; internal static readonly ColorRGBClient[] DefaultPlayerColors = { @@ -82,6 +83,8 @@ public override void ExposeData() Scribe_Deep.Look(ref serverSettingsClient, "serverSettings"); serverSettingsClient ??= new ServerSettingsClient(); + + Scribe_Values.Look(ref mostRecentVersionWelcomed, "playerWelcomedToThisVersion", ""); } } diff --git a/Source/Client/UI/MainMenuAnimation.cs b/Source/Client/UI/MainMenuAnimation.cs index c1810c71..45b1ca6b 100644 --- a/Source/Client/UI/MainMenuAnimation.cs +++ b/Source/Client/UI/MainMenuAnimation.cs @@ -1,9 +1,10 @@ -using System; -using System.Collections.Generic; -using System.Linq; using HarmonyLib; using Multiplayer.Client.Util; using RimWorld; +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; using UnityEngine; using Verse; using Random = System.Random; @@ -436,4 +437,51 @@ static void Postfix(ref bool __result) __result = false; } } + + [HarmonyPatch(typeof(UIRoot_Entry), nameof(UIRoot_Entry.Init))] + static class WelcomeScreenPatch + { + [HarmonyPostfix] + static void Postfix() + { + if (Multiplayer.settings.mostRecentVersionWelcomed == WelcomeMessage.version) return; + Find.WindowStack.Add(new Dialog_MessageBox(WelcomeMessage.Message(), title: WelcomeMessage.Title())); + Multiplayer.settings.mostRecentVersionWelcomed = WelcomeMessage.version; + } + } + + public static class WelcomeMessage + { + public static string version = "1.6"; + static string[] knownIssues = [ + "Some common mods are not compatible. (i.e. Vanilla Expanded Framework, Combat Extended)", + "Spamming the \"World\" button causes bullets to appear stuttery/laggy.", + "Loading a save where the camera is already in space throws an error.", + "Inconsistent results when aborting a gravship landing to an anchored map. (Resyncs fine.)", + "Multifaction: Players cannot start with differing scenarios.", + "Multifaction: Letters and incidents don’t always match.", + "Multifaction: Sometimes raids feel off.", + "Multifaction: The gravship is not complete." + ]; + + + public static string Title() + { + string title = "Welcome to Zetrith's Multiplayer Mod " + version + "!"; + return title; + } + public static TaggedString Message() + { + TaggedString message = "We are thrilled to release this BETA version to the Steam Workshop! Please note this build may still be unstable. A list of known issues is provided below:\n\n"; + foreach (var issue in knownIssues) + { + message += "- " + issue + "\n"; + } + message += "\n\nFor a more complete list please see our GitHub issues page."; + message += "\n\nFor the best experience please use the "+ ColoredText.Colorize("updated Prepatcher by jikulopo ", Color.cyan) +ColoredText.Colorize("INSTEAD OF HARMONY", Color.red)+". This allows ritual, birth, and gravship launch dialogs to sync."; + message += "\n\nIf you encounter any issues please report them on our Discord server "+ ColoredText.Colorize("with reproduction steps", Color.yellow)+" (this is important). Your feedback is crucial in helping us improve the mod."; + + return message; + } + } } From b3c39661444ffa4ac437fa50e6d2a503149e1a21 Mon Sep 17 00:00:00 2001 From: "GANONDORF\\CASPI" Date: Tue, 16 Sep 2025 13:41:44 -0400 Subject: [PATCH 2/5] Added 'never show again' button --- Source/Client/UI/MainMenuAnimation.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Source/Client/UI/MainMenuAnimation.cs b/Source/Client/UI/MainMenuAnimation.cs index 45b1ca6b..37cac128 100644 --- a/Source/Client/UI/MainMenuAnimation.cs +++ b/Source/Client/UI/MainMenuAnimation.cs @@ -445,8 +445,12 @@ static class WelcomeScreenPatch static void Postfix() { if (Multiplayer.settings.mostRecentVersionWelcomed == WelcomeMessage.version) return; - Find.WindowStack.Add(new Dialog_MessageBox(WelcomeMessage.Message(), title: WelcomeMessage.Title())); - Multiplayer.settings.mostRecentVersionWelcomed = WelcomeMessage.version; + Find.WindowStack.Add(new Dialog_MessageBox(WelcomeMessage.Message(), title: WelcomeMessage.Title(), buttonBAction: () => + { + Multiplayer.settings.mostRecentVersionWelcomed = WelcomeMessage.version; + Multiplayer.settings.Write(); + }, buttonBText: "Never show again")); + } } From c3fb6a9bce39d0d8164b22041595b18e8d5e25d5 Mon Sep 17 00:00:00 2001 From: "GANONDORF\\CASPI" Date: Tue, 16 Sep 2025 13:45:06 -0400 Subject: [PATCH 3/5] Changed a knownIssue[] description --- Source/Client/UI/MainMenuAnimation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Client/UI/MainMenuAnimation.cs b/Source/Client/UI/MainMenuAnimation.cs index 37cac128..0f44b368 100644 --- a/Source/Client/UI/MainMenuAnimation.cs +++ b/Source/Client/UI/MainMenuAnimation.cs @@ -462,7 +462,7 @@ public static class WelcomeMessage "Spamming the \"World\" button causes bullets to appear stuttery/laggy.", "Loading a save where the camera is already in space throws an error.", "Inconsistent results when aborting a gravship landing to an anchored map. (Resyncs fine.)", - "Multifaction: Players cannot start with differing scenarios.", + "Multifaction: Starting with different scenarios may not work correctly.", "Multifaction: Letters and incidents don’t always match.", "Multifaction: Sometimes raids feel off.", "Multifaction: The gravship is not complete." From 2aa858d75ac69a8aeacbac207695552a750b9038 Mon Sep 17 00:00:00 2001 From: "GANONDORF\\CASPI" Date: Tue, 16 Sep 2025 13:55:24 -0400 Subject: [PATCH 4/5] Move welcome dialog to server browser --- Source/Client/UI/MainMenuAnimation.cs | 51 +------------------------- Source/Client/Windows/ServerBrowser.cs | 50 +++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 50 deletions(-) diff --git a/Source/Client/UI/MainMenuAnimation.cs b/Source/Client/UI/MainMenuAnimation.cs index 0f44b368..13fa577d 100644 --- a/Source/Client/UI/MainMenuAnimation.cs +++ b/Source/Client/UI/MainMenuAnimation.cs @@ -438,54 +438,5 @@ static void Postfix(ref bool __result) } } - [HarmonyPatch(typeof(UIRoot_Entry), nameof(UIRoot_Entry.Init))] - static class WelcomeScreenPatch - { - [HarmonyPostfix] - static void Postfix() - { - if (Multiplayer.settings.mostRecentVersionWelcomed == WelcomeMessage.version) return; - Find.WindowStack.Add(new Dialog_MessageBox(WelcomeMessage.Message(), title: WelcomeMessage.Title(), buttonBAction: () => - { - Multiplayer.settings.mostRecentVersionWelcomed = WelcomeMessage.version; - Multiplayer.settings.Write(); - }, buttonBText: "Never show again")); - - } - } - - public static class WelcomeMessage - { - public static string version = "1.6"; - static string[] knownIssues = [ - "Some common mods are not compatible. (i.e. Vanilla Expanded Framework, Combat Extended)", - "Spamming the \"World\" button causes bullets to appear stuttery/laggy.", - "Loading a save where the camera is already in space throws an error.", - "Inconsistent results when aborting a gravship landing to an anchored map. (Resyncs fine.)", - "Multifaction: Starting with different scenarios may not work correctly.", - "Multifaction: Letters and incidents don’t always match.", - "Multifaction: Sometimes raids feel off.", - "Multifaction: The gravship is not complete." - ]; - - - public static string Title() - { - string title = "Welcome to Zetrith's Multiplayer Mod " + version + "!"; - return title; - } - public static TaggedString Message() - { - TaggedString message = "We are thrilled to release this BETA version to the Steam Workshop! Please note this build may still be unstable. A list of known issues is provided below:\n\n"; - foreach (var issue in knownIssues) - { - message += "- " + issue + "\n"; - } - message += "\n\nFor a more complete list please see our GitHub issues page."; - message += "\n\nFor the best experience please use the "+ ColoredText.Colorize("updated Prepatcher by jikulopo ", Color.cyan) +ColoredText.Colorize("INSTEAD OF HARMONY", Color.red)+". This allows ritual, birth, and gravship launch dialogs to sync."; - message += "\n\nIf you encounter any issues please report them on our Discord server "+ ColoredText.Colorize("with reproduction steps", Color.yellow)+" (this is important). Your feedback is crucial in helping us improve the mod."; - - return message; - } - } + } diff --git a/Source/Client/Windows/ServerBrowser.cs b/Source/Client/Windows/ServerBrowser.cs index 8ce3edbf..1d21f5fc 100644 --- a/Source/Client/Windows/ServerBrowser.cs +++ b/Source/Client/Windows/ServerBrowser.cs @@ -19,6 +19,43 @@ namespace Multiplayer.Client { + public static class WelcomeMessage + { + public static bool welcomedThisSession = false; + + public static string version = "1.6"; + static string[] knownIssues = [ + "Some common mods are not compatible. (i.e. Vanilla Expanded Framework, Combat Extended)", + "Spamming the \"World\" button causes bullets to appear stuttery/laggy.", + "Loading a save where the camera is already in space throws an error.", + "Inconsistent results when aborting a gravship landing to an anchored map. (Resyncs fine.)", + "Multifaction: Starting with different scenarios may not work correctly.", + "Multifaction: Letters and incidents don’t always match.", + "Multifaction: Sometimes raids feel off.", + "Multifaction: The gravship is not complete." + ]; + + + public static string Title() + { + string title = "Welcome to Zetrith's Multiplayer Mod " + version + "!"; + return title; + } + public static TaggedString Message() + { + TaggedString message = "We are thrilled to release this BETA version to the Steam Workshop! Please note this build may still be unstable. A list of known issues is provided below:\n\n"; + foreach (var issue in knownIssues) + { + message += "- " + issue + "\n"; + } + message += "\n\nFor a more complete list please see our GitHub issues page."; + message += "\n\nFor the best experience please use the " + ColoredText.Colorize("updated Prepatcher by jikulopo ", Color.cyan) + ColoredText.Colorize("INSTEAD OF HARMONY", Color.red) + ". This allows ritual, birth, and gravship launch dialogs to sync."; + message += "\n\nIf you encounter any issues please report them on our Discord server " + ColoredText.Colorize("with reproduction steps", Color.yellow) + " (this is important). Your feedback is crucial in helping us improve the mod."; + + return message; + } + } + public class ServerBrowser : Window { private LanListener lanListener; @@ -41,6 +78,19 @@ enum Tabs Lan, Direct, Steam, Host } + public override void PostOpen() + { + if ((Multiplayer.settings.mostRecentVersionWelcomed == WelcomeMessage.version && Multiplayer.settings.mostRecentVersionWelcomed != "testing" )|| WelcomeMessage.welcomedThisSession) return; + Find.WindowStack.Add(new Dialog_MessageBox(WelcomeMessage.Message(), title: WelcomeMessage.Title(), buttonBAction: () => + { + Multiplayer.settings.mostRecentVersionWelcomed = WelcomeMessage.version; + Multiplayer.settings.Write(); + }, buttonBText: "Never show again")); + WelcomeMessage.welcomedThisSession = true; + } + + + public override void DoWindowContents(Rect inRect) { DrawInfoButtons(); From 4004330cc7cc384f4ff1b37e5dcd590508dfbbda Mon Sep 17 00:00:00 2001 From: "GANONDORF\\CASPI" Date: Tue, 16 Sep 2025 22:06:24 -0400 Subject: [PATCH 5/5] Translatable window --- Languages | 2 +- Source/Client/Windows/ServerBrowser.cs | 35 ++++++++++++-------------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/Languages b/Languages index 50e1dc7c..b9e8d304 160000 --- a/Languages +++ b/Languages @@ -1 +1 @@ -Subproject commit 50e1dc7c995070232970cb5e54ca88598a0e74e2 +Subproject commit b9e8d304af3a60003bf18227b6798d94c7f81e91 diff --git a/Source/Client/Windows/ServerBrowser.cs b/Source/Client/Windows/ServerBrowser.cs index 1d21f5fc..ebc64868 100644 --- a/Source/Client/Windows/ServerBrowser.cs +++ b/Source/Client/Windows/ServerBrowser.cs @@ -23,34 +23,31 @@ public static class WelcomeMessage { public static bool welcomedThisSession = false; - public static string version = "1.6"; - static string[] knownIssues = [ - "Some common mods are not compatible. (i.e. Vanilla Expanded Framework, Combat Extended)", - "Spamming the \"World\" button causes bullets to appear stuttery/laggy.", - "Loading a save where the camera is already in space throws an error.", - "Inconsistent results when aborting a gravship landing to an anchored map. (Resyncs fine.)", - "Multifaction: Starting with different scenarios may not work correctly.", - "Multifaction: Letters and incidents don’t always match.", - "Multifaction: Sometimes raids feel off.", - "Multifaction: The gravship is not complete." - ]; + public static string version => "MpWelcomeVersion".Translate(); public static string Title() { - string title = "Welcome to Zetrith's Multiplayer Mod " + version + "!"; + string title = "MpWelcomeTitle".Translate(version) ; return title; } public static TaggedString Message() { - TaggedString message = "We are thrilled to release this BETA version to the Steam Workshop! Please note this build may still be unstable. A list of known issues is provided below:\n\n"; - foreach (var issue in knownIssues) + TaggedString message = "MpWelcomeMessage".Translate() + "\n\n"; + + int issueCount = 1; + string knownIssueKey = "MpKnownIssue"; + + //while (LanguageDatabase.activeLanguage.HaveTextForKey(knownIssueKey + issueCount)) + foreach (var thing in LanguageDatabase.activeLanguage.keyedReplacements.Where(kvp => kvp.Key.StartsWith(knownIssueKey))) { - message += "- " + issue + "\n"; + message += "- " + (thing.Key).Translate() + "\n"; + issueCount++; } - message += "\n\nFor a more complete list please see our GitHub issues page."; - message += "\n\nFor the best experience please use the " + ColoredText.Colorize("updated Prepatcher by jikulopo ", Color.cyan) + ColoredText.Colorize("INSTEAD OF HARMONY", Color.red) + ". This allows ritual, birth, and gravship launch dialogs to sync."; - message += "\n\nIf you encounter any issues please report them on our Discord server " + ColoredText.Colorize("with reproduction steps", Color.yellow) + " (this is important). Your feedback is crucial in helping us improve the mod."; + + message += "\n\n" + "MpWelcomeCompleteList".Translate(); + message += "\n\n" + "MpWelcomePrepatcher".Translate(); + message += "\n\n" + "MpWelcomeDiscord".Translate(); return message; } @@ -85,7 +82,7 @@ public override void PostOpen() { Multiplayer.settings.mostRecentVersionWelcomed = WelcomeMessage.version; Multiplayer.settings.Write(); - }, buttonBText: "Never show again")); + }, buttonBText: "MpWelcomeNeverShowButton".Translate())); WelcomeMessage.welcomedThisSession = true; }