From a4da6694c5595f87802831dc602e447d91801d46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henri=20Hyyryl=C3=A4inen?= Date: Tue, 11 Nov 2025 11:44:00 +0200 Subject: [PATCH 01/11] Switched the main menu to only create the Thriveopedia when necessary to slightly cut on the time needed to create the main menu instance --- src/general/MainMenu.cs | 37 ++++++++++++++++++++++++++++++++----- src/general/MainMenu.tscn | 6 +----- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/src/general/MainMenu.cs b/src/general/MainMenu.cs index 0728b9fdb9..a9de4ffe2f 100644 --- a/src/general/MainMenu.cs +++ b/src/general/MainMenu.cs @@ -48,7 +48,8 @@ public partial class MainMenu : NodeWithInput private NewGameSettings newGameSettings = null!; private AnimationPlayer guiAnimations = null!; private SaveManagerGUI saves = null!; - private Thriveopedia thriveopedia = null!; + + private Thriveopedia? thriveopedia; [Export] private ModManager modManager = null!; @@ -139,6 +140,9 @@ public partial class MainMenu : NodeWithInput [Export] private CenterContainer menus = null!; + + [Export] + private PackedScene thriveopediaScene = null!; #pragma warning restore CA2213 private Array? menuArray; @@ -386,7 +390,7 @@ public bool OnEscapePressed() } /// - /// Setup the main menu. + /// Set up the main menu. /// private void RunMenuSetup() { @@ -406,7 +410,6 @@ private void RunMenuSetup() options = GetNode("OptionsMenu"); newGameSettings = GetNode("NewGameSettings"); saves = GetNode("SaveManagerGUI"); - thriveopedia = GetNode("Thriveopedia"); // Set initial menu SwitchMenu(); @@ -932,7 +935,9 @@ private void OnRedirectedToOptionsMenuFromNewGameSettings() private void OnReturnFromThriveopedia() { - thriveopedia.Visible = false; + if (thriveopedia != null) + thriveopedia.Visible = false; + SetCurrentMenu(0, false); } @@ -989,6 +994,21 @@ private void ThriveopediaPressed() // Hide all the other menus SetCurrentMenu(uint.MaxValue, false); + // Create the Thriveopedia if it doesn't exist yet + if (thriveopedia == null) + { + thriveopedia = thriveopediaScene.Instantiate(); + + // Thriveopedia needs to start off hidden to work correctly + thriveopedia.Visible = false; + + // Hook up the necessary signals + thriveopedia.Connect(Thriveopedia.SignalName.OnThriveopediaClosed, + new Callable(this, nameof(OnReturnFromThriveopedia))); + + AddChild(thriveopedia); + } + // Show the Thriveopedia thriveopedia.OpenFromMainMenu(); } @@ -1116,7 +1136,14 @@ private void OnNewGameIntroVideoStarted() private void OnThriveopediaOpened(string pageName) { - thriveopedia.OpenFromMainMenu(); + // Make sure Thriveopedia is created if missing + if (thriveopedia == null) + { + GD.Print("Creating Thriveopedia due to page open request"); + ThriveopediaPressed(); + } + + thriveopedia!.OpenFromMainMenu(); thriveopedia.ChangePage(pageName); } diff --git a/src/general/MainMenu.tscn b/src/general/MainMenu.tscn index 11c4d7fc76..78e530091f 100644 --- a/src/general/MainMenu.tscn +++ b/src/general/MainMenu.tscn @@ -160,6 +160,7 @@ modsInstalledButNotEnabledWarning = NodePath("ModsInstalledButNothingEnabledWarn lowPerformanceWarning = NodePath("LowPerformanceDialog") thanksDialog = NodePath("ThanksForBuyingDialog") menus = NodePath("MenuContainers/Menus") +thriveopediaScene = ExtResource("49") [node name="Background" type="TextureRect" parent="."] layout_mode = 1 @@ -846,10 +847,6 @@ grow_vertical = 2 visible = false layout_mode = 1 -[node name="Thriveopedia" parent="." instance=ExtResource("49")] -visible = false -layout_mode = 1 - [node name="LicensesDisplay" parent="." instance=ExtResource("12")] layout_mode = 1 @@ -1029,7 +1026,6 @@ ShowCloseButton = false [connection signal="OnNewGameSettingsClosed" from="NewGameSettings" to="." method="OnReturnFromNewGameSettings"] [connection signal="OnNewGameVideoStarted" from="NewGameSettings" to="." method="OnNewGameIntroVideoStarted"] [connection signal="OnWantToSwitchToOptionsMenu" from="NewGameSettings" to="." method="OnRedirectedToOptionsMenuFromNewGameSettings"] -[connection signal="OnThriveopediaClosed" from="Thriveopedia" to="." method="OnReturnFromThriveopedia"] [connection signal="hidden" from="LicensesDisplay" to="." method="OnReturnFromLicenses"] [connection signal="hidden" from="GalleryViewer" to="." method="OnReturnFromArtGallery"] [connection signal="OnFinishedSignal" from="CreditsView/CreditsScroll" to="." method="OnReturnFromCredits"] From a87608339dd26ed0ecffca9f13d4576db632646b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henri=20Hyyryl=C3=A4inen?= Date: Tue, 11 Nov 2025 11:48:23 +0200 Subject: [PATCH 02/11] Fixed unhandled errors GUI eating mouse clicks in the top right --- src/engine/UnHandledErrorsGUI.tscn | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/engine/UnHandledErrorsGUI.tscn b/src/engine/UnHandledErrorsGUI.tscn index df69dae5ff..b229d077df 100644 --- a/src/engine/UnHandledErrorsGUI.tscn +++ b/src/engine/UnHandledErrorsGUI.tscn @@ -14,6 +14,7 @@ anchor_right = 1.0 anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 +mouse_filter = 2 script = ExtResource("1_ca0xl") errorCount = NodePath("CanvasLayer/MarginContainer/VBoxContainer/ErrorCountLabel") errorPopup = NodePath("ErrorDialog") @@ -31,11 +32,13 @@ anchor_right = 1.0 offset_left = -40.0 offset_bottom = 40.0 grow_horizontal = 0 +mouse_filter = 2 theme_override_constants/margin_top = 8 theme_override_constants/margin_right = 10 [node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/MarginContainer"] layout_mode = 2 +mouse_filter = 2 [node name="ErrorCountLabel" type="Label" parent="CanvasLayer/MarginContainer/VBoxContainer"] visible = false From 78a6327989dbc3e1753ad18855d6b08a26c5dbf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henri=20Hyyryl=C3=A4inen?= Date: Tue, 11 Nov 2025 15:14:41 +0200 Subject: [PATCH 03/11] Don't allow scroll escape from Thriveopedia --- src/thriveopedia/Thriveopedia.tscn | 1 + 1 file changed, 1 insertion(+) diff --git a/src/thriveopedia/Thriveopedia.tscn b/src/thriveopedia/Thriveopedia.tscn index 8a8a9ad2ed..afa882c75c 100644 --- a/src/thriveopedia/Thriveopedia.tscn +++ b/src/thriveopedia/Thriveopedia.tscn @@ -176,6 +176,7 @@ homePage = NodePath("MarginContainer/VBoxContainer/HBoxContainer3/MarginContaine layout_mode = 0 anchor_right = 1.0 anchor_bottom = 1.0 +mouse_force_pass_scroll_events = false color = Color(0, 0, 0, 0.823529) [node name="MarginContainer" type="MarginContainer" parent="."] From ef3ebe1462f67cd2e2ace3869015d4acf244baba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henri=20Hyyryl=C3=A4inen?= Date: Wed, 12 Nov 2025 15:34:42 +0200 Subject: [PATCH 04/11] Made Thriveopedia museum page only load content when shown instead of immediately on Thriveopedia open --- .../pages/ThriveopediaMuseumPage.cs | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/thriveopedia/pages/ThriveopediaMuseumPage.cs b/src/thriveopedia/pages/ThriveopediaMuseumPage.cs index 3c411c4111..ac93d23d06 100644 --- a/src/thriveopedia/pages/ThriveopediaMuseumPage.cs +++ b/src/thriveopedia/pages/ThriveopediaMuseumPage.cs @@ -41,6 +41,8 @@ public partial class ThriveopediaMuseumPage : ThriveopediaPage, IThriveopediaPag private MuseumCard? cardToBeDeleted; #pragma warning restore CA2213 + private bool dirty = true; + public string PageName => "Museum"; public string TranslatedPageName => Localization.Translate("THRIVEOPEDIA_MUSEUM_PAGE_TITLE"); @@ -51,12 +53,38 @@ public override void _Ready() base._Ready(); museumCardScene = GD.Load("res://src/thriveopedia/fossilisation/MuseumCard.tscn"); + dirty = true; + } + + public override void _Notification(int what) + { + base._Notification(what); + + if (what == NotificationVisibilityChanged && Visible) + { + RefreshIfDirty(); + } } public override void OnThriveopediaOpened() + { + dirty = true; + + // Make sure this can't end up not being loaded if directly opening to this page in the Thriveopedia + Invoke.Instance.QueueForObject(() => + { + if (IsVisibleInTree() && dirty) + { + RefreshIfDirty(); + } + }, this); + } + + private void RefreshIfDirty() { // TODO: caching or something here would make this a lot more efficient as for people with a ton of fossils // the Thriveopedia likely will start to lag a lot + GD.Print("Refreshing the Thriveopedia museum page"); cardContainer.QueueFreeChildren(); foreach (var speciesName in FossilisedSpecies.CreateListOfFossils(true)) From a2db379d782777905ff90a2a699f77ef9386890e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henri=20Hyyryl=C3=A4inen?= Date: Wed, 12 Nov 2025 17:05:16 +0200 Subject: [PATCH 05/11] Started converting the pause menu to a singleton --- project.godot | 1 + src/general/MainMenu.cs | 6 +- src/general/PauseMenu.cs | 165 +++++++++++++++++++++++++--- src/general/PauseMenu.tscn | 72 +++++------- src/saving/InProgressLoad.cs | 2 + src/society_stage/SocietyStage.tscn | 13 +-- src/space_stage/SpaceStage.tscn | 13 +-- 7 files changed, 194 insertions(+), 78 deletions(-) diff --git a/project.godot b/project.godot index 163aaf4f00..82764d7004 100644 --- a/project.godot +++ b/project.godot @@ -54,6 +54,7 @@ DiskCache="*res://src/engine/caching/DiskCache.cs" ProceduralDataCache="*res://src/engine/ProceduralDataCache.cs" PhotoStudio="*res://src/engine/PhotoStudio.tscn" PauseManager="*res://src/engine/PauseManager.cs" +PauseMenu="*res://src/general/PauseMenu.tscn" GUIFocusSetter="*res://src/engine/GUIFocusSetter.cs" UnHandledErrorsGUI="*res://src/engine/UnHandledErrorsGUI.tscn" DebugDrawer="*res://src/engine/DebugDrawer.tscn" diff --git a/src/general/MainMenu.cs b/src/general/MainMenu.cs index a9de4ffe2f..a053f50c7f 100644 --- a/src/general/MainMenu.cs +++ b/src/general/MainMenu.cs @@ -193,6 +193,8 @@ public override void _Ready() // Unpause the game as the MainMenu should never be paused. PauseManager.Instance.ForceClear(); MouseCaptureManager.ForceDisableCapture(); + PauseMenu.Instance.ReportStageTransition(); + PauseMenu.Instance.ForgetCurrentlyOpenPage(); RunMenuSetup(); @@ -1144,7 +1146,9 @@ private void OnThriveopediaOpened(string pageName) } thriveopedia!.OpenFromMainMenu(); - thriveopedia.ChangePage(pageName); + + // TODO: does something already play a sound or not in this case? + thriveopedia.ChangePage(pageName, false); } private void ResetPerformanceTracking() diff --git a/src/general/PauseMenu.cs b/src/general/PauseMenu.cs index e5ecab330c..9bccc16552 100644 --- a/src/general/PauseMenu.cs +++ b/src/general/PauseMenu.cs @@ -1,12 +1,15 @@ using System; +using System.Diagnostics; using Godot; /// -/// Handles logic in the pause menu +/// This is a singleton pause menu shared by all the stages in the game. /// -public partial class PauseMenu : TopLevelContainer +public partial class PauseMenu : CanvasLayer { #pragma warning disable CA2213 + private static PauseMenu? instance; + [Export] private Control primaryMenu = null!; @@ -36,7 +39,7 @@ public partial class PauseMenu : TopLevelContainer private bool paused; /// - /// The assigned pending exit type, will be used to specify what kind of + /// The assigned pending exit type will be used to specify what kind of /// game exit will be performed on exit confirmation. /// private ExitType exitType; @@ -44,6 +47,7 @@ public partial class PauseMenu : TopLevelContainer private bool exiting; private int exitTries; + private bool mouseUnCaptureActive; [Signal] public delegate void OnResumedEventHandler(); @@ -82,13 +86,21 @@ private enum ActiveMenuType None, } + public static PauseMenu Instance => instance ?? throw new InstanceNotLoadedYetException(); + + /// + /// Main game state. Needs to be set by each stage once it is ready for the pause menu and unset once the stage + /// is exiting. + /// + public MainGameState GameState { get; private set; } = MainGameState.Invalid; + /// /// The GameProperties object holding settings and state for the current game session. /// public GameProperties? GameProperties { get => gameProperties; - set + private set { gameProperties = value; @@ -99,10 +111,13 @@ public GameProperties? GameProperties } } - public bool GameLoading { get; set; } + /// + /// True when the game is in a state that isn't properly in a stage + /// + public bool GameLoading => GameState == MainGameState.Invalid; /// - /// If true the user may not open the pause menu. + /// If true, the user may not open the pause menu. /// /// /// @@ -126,6 +141,27 @@ public bool IsPausingBlocked } } + public bool MouseUnCaptureActive + { + get => mouseUnCaptureActive; + private set + { + if (value == mouseUnCaptureActive) + return; + + mouseUnCaptureActive = value; + + if (mouseUnCaptureActive) + { + MouseCaptureManager.ReportOpenCapturePrevention(nameof(PauseMenu)); + } + else + { + MouseCaptureManager.ReportClosedCapturePrevention(nameof(PauseMenu)); + } + } + } + private ActiveMenuType ActiveMenu { get @@ -197,8 +233,19 @@ private bool Paused public override void _Ready() { - // We have our custom logic for this - PreventsMouseCaptureWhileOpen = false; + if (instance != null) + { + GD.PrintErr("Multiple PauseMenu singletons exist!"); + +#if DEBUG + if (Debugger.IsAttached) + Debugger.Break(); +#endif + return; + } + + // Pause menu starts off hidden + Visible = false; animationPlayer = GetNode("AnimationPlayer"); @@ -206,14 +253,14 @@ public override void _Ready() if (GameProperties != null) thriveopedia.CurrentGame = GameProperties; + + instance = this; } public override void _EnterTree() { InputManager.RegisterReceiver(this); - GetTree().AutoAcceptQuit = false; - ThriveopediaManager.Instance.OnPageOpenedHandler += OnThriveopediaOpened; base._EnterTree(); @@ -243,11 +290,26 @@ public override void _Notification(int notification) } } + public void ReportStageTransition() + { + GameState = MainGameState.Invalid; + ApplyGameState(); + } + + public void ReportEnterGameState(MainGameState gameState, GameProperties? gameProperties) + { + GameState = gameState; + GameProperties = gameProperties; + + ApplyGameState(); + } + [RunOnKeyDown("ui_cancel", Priority = Constants.PAUSE_MENU_CANCEL_PRIORITY)] public bool EscapeKeyPressed() { if (Visible) { + // TODO: should this force player back to the base of the menu? ActiveMenu = ActiveMenuType.Primary; Close(); @@ -256,6 +318,10 @@ public bool EscapeKeyPressed() return true; } + // If the pause menu is unused currently, ignore + if (GameLoading) + return false; + if (IsPausingBlocked) return false; @@ -268,13 +334,45 @@ public bool EscapeKeyPressed() [RunOnKeyDown("help")] public void OpenToHelp() { + if (GameLoading) + { + GD.Print("Can't open pause menu as not in a stage"); + return; + } + Open(); OpenThriveopediaPressed(); ThriveopediaManager.OpenPage("MechanicsRoot"); } + /// + /// Only show the pause menu with this and not by directly setting this visible! + /// + public void Open() + { + if (GameLoading) + { + GD.Print("Can't open pause menu as not in a stage"); + return; + } + + Show(); + OnOpen(); + } + + public void Close(bool playAnimation = true) + { + if (!Visible) + return; + + OnClose(playAnimation); + } + public void OpenToSpeciesPage(Species species) { + if (GameLoading) + return; + Open(); OpenThriveopediaPressed(); @@ -300,7 +398,15 @@ public void SetNewSaveNameFromSpeciesName() SetNewSaveName(GameProperties.GameWorld.PlayerSpecies.FormattedName.Replace(' ', '_')); } - protected override void OnOpen() + /// + /// When next opened, the pause menu opens to the root + /// + public void ForgetCurrentlyOpenPage() + { + ActiveMenu = ActiveMenuType.Primary; + } + + private void OnOpen() { // Godot being very silly: https://github.com/godotengine/godot/issues/73908 if (animationPlayer == null!) @@ -309,11 +415,21 @@ protected override void OnOpen() animationPlayer.Play("Open"); Paused = true; exiting = false; + + MouseUnCaptureActive = true; } - protected override void OnClose() + private void OnClose(bool playAnimation) { - animationPlayer.Play("Close"); + if (playAnimation) + { + animationPlayer.Play("Close"); + } + else + { + Visible = false; + } + Paused = false; // Uncapture the mouse while we are playing the close animation, this doesn't seem to actually uncapture the @@ -416,18 +532,27 @@ private void Quit() private void OnThriveopediaOpened(string pageName) { + // If the pause menu is unused currently, ignore + if (GameLoading) + return; + if (thriveopedia == null) throw new InvalidOperationException("Pause menu needs to be added to the scene first"); Open(); - OpenThriveopediaPressed(); - thriveopedia.ChangePage(pageName); + SwitchToThriveopedia(); + thriveopedia.ChangePage(pageName, false); } private void OpenThriveopediaPressed() { GUICommon.Instance.PlayButtonPressSound(); + SwitchToThriveopedia(); + } + private void SwitchToThriveopedia() + { + // Switch without the sound ActiveMenu = ActiveMenuType.Thriveopedia; } @@ -486,6 +611,7 @@ private void OnSceneChangedFromThriveopedia() { // Remove all pause locks before changing to the new game PauseManager.Instance.ForceClear(); + ReportStageTransition(); MouseUnCaptureActive = false; } @@ -514,10 +640,12 @@ private void ForwardSaveAction(string name) ActiveMenu = ActiveMenuType.Primary; // Close this first to get the menus out of the way to capture the save screenshot + // This skips the animation explicitly Hide(); EmitSignal(SignalName.OnResumed); EmitSignal(SignalName.MakeSave, name); Paused = false; + MouseUnCaptureActive = false; } /// @@ -526,6 +654,8 @@ private void ForwardSaveAction(string name) private void OnSwitchToMenu() { MouseUnCaptureActive = false; + ReportStageTransition(); + Close(false); SceneManager.Instance.ReturnToMenu(); } @@ -540,4 +670,9 @@ private void OnSaveLoaded(string saveName) Paused = false; MouseUnCaptureActive = false; } + + private void ApplyGameState() + { + GetTree().AutoAcceptQuit = GameLoading; + } } diff --git a/src/general/PauseMenu.tscn b/src/general/PauseMenu.tscn index 0a225b9505..4181000ba8 100644 --- a/src/general/PauseMenu.tscn +++ b/src/general/PauseMenu.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=15 format=3 uid="uid://devtugnggmuol"] +[gd_scene load_steps=14 format=3 uid="uid://devtugnggmuol"] [ext_resource type="Script" uid="uid://exlgkif2qbrm" path="res://src/general/PauseMenu.cs" id="1"] [ext_resource type="Theme" uid="uid://b4cx0o110g4b6" path="res://src/gui_common/thrive_theme.tres" id="2"] @@ -9,7 +9,6 @@ [ext_resource type="PackedScene" uid="uid://bt4wq0ddch84i" path="res://src/thriveopedia/Thriveopedia.tscn" id="8"] [ext_resource type="PackedScene" uid="uid://bgeijgq7runaw" path="res://src/gui_common/FocusGrabber.tscn" id="9"] [ext_resource type="PackedScene" uid="uid://bnjcexj3ob27" path="res://src/gui_common/menus/AchievementsView.tscn" id="9_rags2"] -[ext_resource type="PackedScene" uid="uid://cba187yaeukt3" path="res://src/gui_common/TopLevelContainer.tscn" id="10"] [sub_resource type="Animation" id="Animation_rnkue"] resource_name = "Close" @@ -173,14 +172,9 @@ _data = { &"RESET": SubResource("Animation_ih5uy") } -[node name="PauseMenu" node_paths=PackedStringArray("primaryMenu", "thriveopedia", "achievementsView", "loadMenu", "optionsMenu", "saveMenu", "unsavedProgressWarning") instance=ExtResource("10")] +[node name="PauseMenu" type="CanvasLayer" node_paths=PackedStringArray("primaryMenu", "thriveopedia", "achievementsView", "loadMenu", "optionsMenu", "saveMenu", "unsavedProgressWarning")] process_mode = 3 -visible = true -offset_right = 1280.0 -offset_bottom = 720.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 -theme = ExtResource("2") +layer = 2 script = ExtResource("1") primaryMenu = NodePath("CenterContainer/PrimaryMenu") thriveopedia = NodePath("Thriveopedia") @@ -189,144 +183,138 @@ loadMenu = NodePath("CenterContainer/LoadMenu") optionsMenu = NodePath("OptionsMenu") saveMenu = NodePath("CenterContainer/NewSaveMenu") unsavedProgressWarning = NodePath("UnsavedProgressWarning") -ExclusiveAllowCloseOnEscape = false -FullRect = true -[node name="Overlay" type="ColorRect" parent="." index="0"] -layout_mode = 0 +[node name="Overlay" type="ColorRect" parent="."] +anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 mouse_force_pass_scroll_events = false color = Color(0, 0, 0, 0.588235) -[node name="CenterContainer" type="CenterContainer" parent="." index="1"] -layout_mode = 0 +[node name="CenterContainer" type="CenterContainer" parent="."] +anchors_preset = 15 anchor_right = 1.0 anchor_bottom = 1.0 mouse_filter = 0 mouse_force_pass_scroll_events = false -[node name="PrimaryMenu" type="VBoxContainer" parent="CenterContainer" index="0"] +[node name="PrimaryMenu" type="VBoxContainer" parent="CenterContainer"] layout_mode = 2 theme = ExtResource("2") theme_override_constants/separation = 10 -[node name="Control" type="Control" parent="CenterContainer/PrimaryMenu" index="0"] +[node name="Control" type="Control" parent="CenterContainer/PrimaryMenu"] layout_mode = 2 -[node name="Resume" type="Button" parent="CenterContainer/PrimaryMenu" index="1"] +[node name="Resume" type="Button" parent="CenterContainer/PrimaryMenu"] custom_minimum_size = Vector2(250, 40) layout_mode = 2 tooltip_text = "PAUSE_MENU_RESUME_TOOLTIP" text = "RESUME" -[node name="SaveGame" type="Button" parent="CenterContainer/PrimaryMenu" index="2"] +[node name="SaveGame" type="Button" parent="CenterContainer/PrimaryMenu"] custom_minimum_size = Vector2(250, 40) layout_mode = 2 tooltip_text = "SAVE_GAME_BUTTON_TOOLTIP" text = "SAVE_GAME" -[node name="LoadGame" type="Button" parent="CenterContainer/PrimaryMenu" index="3"] +[node name="LoadGame" type="Button" parent="CenterContainer/PrimaryMenu"] custom_minimum_size = Vector2(250, 40) layout_mode = 2 tooltip_text = "LOAD_GAME_BUTTON_TOOLTIP" text = "LOAD_GAME" -[node name="Thriveopedia" type="Button" parent="CenterContainer/PrimaryMenu" index="4"] +[node name="Thriveopedia" type="Button" parent="CenterContainer/PrimaryMenu"] custom_minimum_size = Vector2(250, 40) layout_mode = 2 tooltip_text = "THRIVEOPEDIA_HINT_IN_GAME" text = "THRIVEOPEDIA" -[node name="Achievements" type="Button" parent="CenterContainer/PrimaryMenu" index="5"] +[node name="Achievements" type="Button" parent="CenterContainer/PrimaryMenu"] custom_minimum_size = Vector2(250, 40) layout_mode = 2 text = "ACHIEVEMENTS" -[node name="Help" type="Button" parent="CenterContainer/PrimaryMenu" index="6"] +[node name="Help" type="Button" parent="CenterContainer/PrimaryMenu"] custom_minimum_size = Vector2(250, 40) layout_mode = 2 tooltip_text = "HELP_BUTTON_TOOLTIP" text = "HELP" -[node name="ReportBug" type="Button" parent="CenterContainer/PrimaryMenu" index="7"] +[node name="ReportBug" type="Button" parent="CenterContainer/PrimaryMenu"] custom_minimum_size = Vector2(250, 40) layout_mode = 2 text = "REPORT_BUG" -[node name="Options" type="Button" parent="CenterContainer/PrimaryMenu" index="8"] +[node name="Options" type="Button" parent="CenterContainer/PrimaryMenu"] custom_minimum_size = Vector2(250, 40) layout_mode = 2 tooltip_text = "OPTIONS_BUTTON_TOOLTIP" text = "OPTIONS" -[node name="ReturnToMenu" type="Button" parent="CenterContainer/PrimaryMenu" index="9"] +[node name="ReturnToMenu" type="Button" parent="CenterContainer/PrimaryMenu"] custom_minimum_size = Vector2(250, 40) layout_mode = 2 tooltip_text = "RETURN_TO_MENU_TOOLTIP" text = "RETURN_TO_MENU" -[node name="Exit" type="Button" parent="CenterContainer/PrimaryMenu" index="10"] +[node name="Exit" type="Button" parent="CenterContainer/PrimaryMenu"] custom_minimum_size = Vector2(250, 40) layout_mode = 2 tooltip_text = "QUIT_BUTTON_TOOLTIP" text = "EXIT" -[node name="FocusGrabber" parent="CenterContainer/PrimaryMenu" index="11" instance=ExtResource("9")] +[node name="FocusGrabber" parent="CenterContainer/PrimaryMenu" instance=ExtResource("9")] layout_mode = 2 Priority = 1 NodeToGiveFocusTo = NodePath("../Resume") AlwaysOverrideFocus = true SkipOverridingFocusForElements = [NodePath("../../..")] -[node name="LoadMenu" type="VBoxContainer" parent="CenterContainer" index="1"] +[node name="LoadMenu" type="VBoxContainer" parent="CenterContainer"] visible = false custom_minimum_size = Vector2(1000, 600) layout_mode = 2 -[node name="SaveList" parent="CenterContainer/LoadMenu" index="0" instance=ExtResource("3")] +[node name="SaveList" parent="CenterContainer/LoadMenu" instance=ExtResource("3")] layout_mode = 2 size_flags_vertical = 3 AutoRefreshOnFirstVisible = false -[node name="Back" type="Button" parent="CenterContainer/LoadMenu" index="1"] +[node name="Back" type="Button" parent="CenterContainer/LoadMenu"] custom_minimum_size = Vector2(100, 37) layout_mode = 2 size_flags_horizontal = 4 theme = ExtResource("2") text = "BACK" -[node name="FocusGrabber" parent="CenterContainer/LoadMenu" index="2" instance=ExtResource("9")] +[node name="FocusGrabber" parent="CenterContainer/LoadMenu" instance=ExtResource("9")] layout_mode = 2 Priority = 2 NodeToGiveFocusTo = NodePath("../Back") AlwaysOverrideFocus = true SkipOverridingFocusForElements = [NodePath("..")] -[node name="NewSaveMenu" parent="CenterContainer" index="2" instance=ExtResource("5")] +[node name="NewSaveMenu" parent="CenterContainer" instance=ExtResource("5")] visible = false custom_minimum_size = Vector2(1000, 600) layout_mode = 2 -[node name="OptionsMenu" parent="." index="2" instance=ExtResource("6")] +[node name="OptionsMenu" parent="." instance=ExtResource("6")] visible = false -layout_mode = 1 -[node name="Thriveopedia" parent="." index="3" instance=ExtResource("8")] +[node name="Thriveopedia" parent="." instance=ExtResource("8")] visible = false -layout_mode = 1 -[node name="AchievementsView" parent="." index="4" instance=ExtResource("9_rags2")] +[node name="AchievementsView" parent="." instance=ExtResource("9_rags2")] visible = false -layout_mode = 1 -[node name="UnsavedProgressWarning" parent="." index="5" instance=ExtResource("7")] +[node name="UnsavedProgressWarning" parent="." instance=ExtResource("7")] custom_minimum_size = Vector2(391, 0) -layout_mode = 1 offset_right = 391.0 WindowTitle = "CONFIRM_EXIT" -[node name="AnimationPlayer" type="AnimationPlayer" parent="." index="6"] +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] libraries = { &"": SubResource("AnimationLibrary_y4xuc") } diff --git a/src/saving/InProgressLoad.cs b/src/saving/InProgressLoad.cs index 46c9d8d75e..4559601328 100644 --- a/src/saving/InProgressLoad.cs +++ b/src/saving/InProgressLoad.cs @@ -65,6 +65,8 @@ public void Start() IsLoading = true; SceneManager.Instance.DetachCurrentScene(); PauseManager.Instance.AddPause(nameof(InProgressLoad)); + PauseMenu.Instance.Close(false); + PauseMenu.Instance.ForgetCurrentlyOpenPage(); Invoke.Instance.Perform(Step); } diff --git a/src/society_stage/SocietyStage.tscn b/src/society_stage/SocietyStage.tscn index cbb1c3c916..b0942869bb 100644 --- a/src/society_stage/SocietyStage.tscn +++ b/src/society_stage/SocietyStage.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=17 format=3 uid="uid://njelpsugkine"] +[gd_scene load_steps=16 format=3 uid="uid://njelpsugkine"] [ext_resource type="Script" uid="uid://bi4uxx3fuf2uu" path="res://src/society_stage/SocietyStage.cs" id="1"] [ext_resource type="PackedScene" uid="uid://cd1w0b7mbdwcu" path="res://src/society_stage/StrategicCamera.tscn" id="2"] @@ -7,7 +7,6 @@ [ext_resource type="Texture2D" uid="uid://bd2vlm5yma24i" path="res://assets/textures/environment/Terrain_02_Normals.png" id="5"] [ext_resource type="Texture2D" uid="uid://c1sbymwyxg1jn" path="res://assets/textures/environment/Terrain_02_Albedo.png" id="6"] [ext_resource type="PackedScene" uid="uid://bs5shdurovke8" path="res://src/society_stage/gui/SocietyHUD.tscn" id="7"] -[ext_resource type="PackedScene" uid="uid://devtugnggmuol" path="res://src/general/PauseMenu.tscn" id="8"] [ext_resource type="PackedScene" uid="uid://borrsf8mdual2" path="res://src/awakening_stage/gui/SelectBuildingPopup.tscn" id="9"] [ext_resource type="PackedScene" uid="uid://c8sp5juqvmna3" path="res://src/society_stage/PlayerSocietyInput.tscn" id="10"] [ext_resource type="PackedScene" uid="uid://cl64wvnxs6ivs" path="res://src/gui_common/dialogs/CustomConfirmationDialog.tscn" id="11"] @@ -35,12 +34,11 @@ uv1_scale = Vector3(42, 42, 42) material = SubResource("4") size = Vector2(400, 400) -[node name="SocietyStage" type="Node" node_paths=PackedStringArray("selectBuildingPopup", "industrialStageConfirmPopup", "strategicCamera", "pauseMenu", "hudRoot")] +[node name="SocietyStage" type="Node" node_paths=PackedStringArray("selectBuildingPopup", "industrialStageConfirmPopup", "strategicCamera", "hudRoot")] script = ExtResource("1") selectBuildingPopup = NodePath("SelectBuildingPopup") industrialStageConfirmPopup = NodePath("ConfirmIndustrialStage") strategicCamera = NodePath("World/StrategicCamera") -pauseMenu = NodePath("PauseMenu") hudRoot = NodePath("SocietyHUD") [node name="World" type="Node" parent="."] @@ -71,8 +69,7 @@ mesh = SubResource("5") [node name="PlayerSocietyInput" parent="." instance=ExtResource("10")] -[node name="SocietyHUD" parent="." node_paths=PackedStringArray("menu") instance=ExtResource("7")] -menu = NodePath("../PauseMenu") +[node name="SocietyHUD" parent="." instance=ExtResource("7")] [node name="SelectBuildingPopup" parent="." instance=ExtResource("9")] @@ -83,11 +80,7 @@ offset_bottom = 0.0 DialogText = "CONFIRM_MOVE_TO_INDUSTRIAL_STAGE_EXPLANATION" WindowTitle = "CONFIRM_MOVE_TO_INDUSTRIAL_STAGE" -[node name="PauseMenu" parent="." instance=ExtResource("8")] - [connection signal="OnBuildingPlacingRequested" from="SocietyHUD" to="PlayerSocietyInput" method="OpenBuildMenu"] -[connection signal="OnOpenMenu" from="SocietyHUD" to="PauseMenu" method="Open"] -[connection signal="OnOpenMenuToHelp" from="SocietyHUD" to="PauseMenu" method="OpenToHelp"] [connection signal="OnStartResearching" from="SocietyHUD" to="." method="StartResearching"] [connection signal="Canceled" from="ConfirmIndustrialStage" to="." method="CancelStageAdvance"] [connection signal="Confirmed" from="ConfirmIndustrialStage" to="." method="ConfirmStageAdvance"] diff --git a/src/space_stage/SpaceStage.tscn b/src/space_stage/SpaceStage.tscn index 7914882e7f..a508321164 100644 --- a/src/space_stage/SpaceStage.tscn +++ b/src/space_stage/SpaceStage.tscn @@ -1,11 +1,10 @@ -[gd_scene load_steps=18 format=3 uid="uid://d2lgqc5cfta2m"] +[gd_scene load_steps=17 format=3 uid="uid://d2lgqc5cfta2m"] [ext_resource type="Script" uid="uid://fetj4ns7gr7h" path="res://src/space_stage/SpaceStage.cs" id="1"] [ext_resource type="PackedScene" uid="uid://cd1w0b7mbdwcu" path="res://src/society_stage/StrategicCamera.tscn" id="2"] [ext_resource type="PackedScene" uid="uid://c2h4vpmx0juq8" path="res://assets/models/menu_backgrounds/StarsMesh.tscn" id="3"] [ext_resource type="PackedScene" uid="uid://dokew8lhrri5" path="res://assets/models/menu_backgrounds/Comet.tscn" id="4_aqo7l"] [ext_resource type="PackedScene" uid="uid://i8evqpkyb68h" path="res://src/space_stage/gui/SpaceHUD.tscn" id="7"] -[ext_resource type="PackedScene" uid="uid://devtugnggmuol" path="res://src/general/PauseMenu.tscn" id="8"] [ext_resource type="PackedScene" uid="uid://iejv3lkw2njv" path="res://src/space_stage/PlayerSpaceInput.tscn" id="9"] [ext_resource type="PackedScene" uid="uid://ibkg658cekm3" path="res://src/industrial_stage/gui/StrategicEntityNameLabelSystem.tscn" id="10"] [ext_resource type="PackedScene" uid="uid://dx44coqov3ndt" path="res://src/ascension_stage/gui/AscensionCongratulationsPopup.tscn" id="15"] @@ -68,7 +67,7 @@ emission = Color(0.843137, 0.780392, 0.627451, 1) emission_energy_multiplier = 10.0 disable_receive_shadows = true -[node name="SpaceStage" type="Node" node_paths=PackedStringArray("nameLabelSystem", "ascensionMoveConfirmationPopup", "ascensionCongratulationsPopup", "descendConfirmationPopup", "godTools", "strategicCamera", "pauseMenu", "hudRoot")] +[node name="SpaceStage" type="Node" node_paths=PackedStringArray("nameLabelSystem", "ascensionMoveConfirmationPopup", "ascensionCongratulationsPopup", "descendConfirmationPopup", "godTools", "strategicCamera", "hudRoot")] script = ExtResource("1") nameLabelSystem = NodePath("StrategicEntityNameLabelSystem") ascensionMoveConfirmationPopup = NodePath("AscensionConfirmation") @@ -76,7 +75,6 @@ ascensionCongratulationsPopup = NodePath("AscensionCongratulationsPopup") descendConfirmationPopup = NodePath("DescendConfirmationDialog") godTools = NodePath("GodToolsPopup") strategicCamera = NodePath("World/StrategicCamera") -pauseMenu = NodePath("PauseMenu") hudRoot = NodePath("SpaceHUD") [node name="World" type="Node" parent="."] @@ -123,8 +121,7 @@ visible = false grow_horizontal = 2 grow_vertical = 2 -[node name="SpaceHUD" parent="." node_paths=PackedStringArray("menu") instance=ExtResource("7")] -menu = NodePath("../PauseMenu") +[node name="SpaceHUD" parent="." instance=ExtResource("7")] [node name="GodToolsPopup" parent="." instance=ExtResource("18")] offset_top = 0.0 @@ -142,11 +139,7 @@ offset_bottom = 300.0 [node name="DescendConfirmationDialog" parent="." instance=ExtResource("16")] offset_bottom = 500.0 -[node name="PauseMenu" parent="." instance=ExtResource("8")] - [connection signal="OnDescendPressed" from="SpaceHUD" to="." method="OnDescendButtonPressed"] -[connection signal="OnOpenMenu" from="SpaceHUD" to="PauseMenu" method="Open"] -[connection signal="OnOpenMenuToHelp" from="SpaceHUD" to="PauseMenu" method="OpenToHelp"] [connection signal="OnStartResearching" from="SpaceHUD" to="." method="StartResearching"] [connection signal="Canceled" from="AscensionConfirmation" to="." method="CancelMoveToAscension"] [connection signal="Confirmed" from="AscensionConfirmation" to="." method="OnConfirmMoveToAscension"] From 3a1bd19a9b30da787e6391cffb9587bd27ef3be1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henri=20Hyyryl=C3=A4inen?= Date: Wed, 12 Nov 2025 17:05:42 +0200 Subject: [PATCH 06/11] Fixed some duplicate sound playing for Thriveopedia --- src/thriveopedia/Thriveopedia.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/thriveopedia/Thriveopedia.cs b/src/thriveopedia/Thriveopedia.cs index fc28877835..42ec9dba08 100644 --- a/src/thriveopedia/Thriveopedia.cs +++ b/src/thriveopedia/Thriveopedia.cs @@ -236,10 +236,11 @@ public bool OnEscapePressed() /// Opens an existing Thriveopedia page and adds it to the page history. /// /// The name of the page - public void ChangePage(string pageName) + /// Plays a button press sound if true + public void ChangePage(string pageName, bool playSound = true) { // By default, assume we're navigating to this page normally - ChangePage(pageName, true, true); + ChangePage(pageName, true, true, playSound); } public Species? GetActiveSpeciesData(uint speciesId) @@ -500,9 +501,11 @@ private void OnPageSelectedFromPageTree() /// The name of the page /// Whether this page should be added to the history /// Whether this operation should clear the page future - private void ChangePage(string pageName, bool addToHistory, bool clearFuture) + /// If true, plays a sound for switching pages + private void ChangePage(string pageName, bool addToHistory, bool clearFuture, bool playSound = true) { - GUICommon.Instance.PlayButtonPressSound(); + if (playSound) + GUICommon.Instance.PlayButtonPressSound(); if (pageName == SelectedPage.PageName) return; From 0533326fa3e43e94f6765dc506c845a84c46e3a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henri=20Hyyryl=C3=A4inen?= Date: Wed, 12 Nov 2025 17:10:16 +0200 Subject: [PATCH 07/11] A few small changes related to singleton pause menu with hooking up new ways things are reported to it --- src/general/base_stage/CreatureStageBase.cs | 2 - src/general/base_stage/EditorBase.cs | 49 ++++++++----------- src/general/base_stage/HUDWithPausing.cs | 2 +- src/general/base_stage/StageBase.cs | 10 +--- src/macroscopic_stage/MacroscopicStage.cs | 7 ++- .../editor/MacroscopicEditor.cs | 4 +- src/microbe_stage/MicrobeStage.cs | 2 + src/microbe_stage/editor/MicrobeEditor.cs | 3 +- 8 files changed, 35 insertions(+), 44 deletions(-) diff --git a/src/general/base_stage/CreatureStageBase.cs b/src/general/base_stage/CreatureStageBase.cs index 29ce02c5c6..44b1e38e49 100644 --- a/src/general/base_stage/CreatureStageBase.cs +++ b/src/general/base_stage/CreatureStageBase.cs @@ -245,8 +245,6 @@ public virtual void OnReturnFromEditor() GD.Print("Suppressing auto save in prototypes"); wantsToSave = false; } - - pauseMenu.SetNewSaveNameFromSpeciesName(); } public virtual void MoveToEditor() diff --git a/src/general/base_stage/EditorBase.cs b/src/general/base_stage/EditorBase.cs index d93a8b5ffb..28ac6b6e1a 100644 --- a/src/general/base_stage/EditorBase.cs +++ b/src/general/base_stage/EditorBase.cs @@ -5,7 +5,6 @@ using System.Reflection; using AutoEvo; using Godot; -using Newtonsoft.Json; using SharedBase.Archive; /// @@ -44,9 +43,6 @@ public partial class EditorBase : NodeWithInput, IEditor, ILoad #pragma warning disable CA2213 protected Node world = null!; - [Export] - protected PauseMenu pauseMenu = null!; - [Export] protected MicrobeEditorTabButtons? editorTabSelector; #pragma warning restore CA2213 @@ -54,18 +50,14 @@ public partial class EditorBase : NodeWithInput, IEditor, ILoad /// /// Where all user actions will be registered /// - [JsonProperty] protected EditorActionHistory history = null!; protected bool ready; - [JsonProperty] protected RunResults? autoEvoResults; - [JsonProperty] protected LocalizedStringBuilder? autoEvoExternal; - [JsonProperty] protected EditorTab selectedEditorTab = EditorTab.Report; /// @@ -77,7 +69,6 @@ public partial class EditorBase : NodeWithInput, IEditor, ILoad /// /// This is protected only so that this is loaded from a save. No derived class should modify this /// - [JsonProperty] protected GameProperties? currentGame; #pragma warning disable CA2213 @@ -90,7 +81,6 @@ public partial class EditorBase : NodeWithInput, IEditor, ILoad /// /// The fraction of daylight the editor is previewing things at /// - [JsonProperty] private float dayLightFraction = 1.0f; protected EditorBase() @@ -104,10 +94,10 @@ protected EditorBase() /// public Node3D RootOfDynamicallySpawned { get; private set; } = null!; - [JsonIgnore] + public virtual MainGameState GameState => throw new GodotAbstractPropertyNotOverriddenException(); + public bool TransitionFinished { get; protected set; } - [JsonIgnore] public double MutationPoints { get => mutationPointsCache ?? CalculateMutationPointsLeft(); @@ -118,13 +108,10 @@ public double MutationPoints } } - [JsonProperty] public bool FreeBuilding { get; protected set; } - [JsonIgnore] public RunResults? PreviousAutoEvoResults => autoEvoResults; - [JsonIgnore] public GameProperties CurrentGame { get => currentGame ?? throw new InvalidOperationException("Editor not initialized with current game yet"); @@ -134,7 +121,6 @@ public GameProperties CurrentGame /// /// Accesses the current tutorial data /// - [JsonIgnore] public TutorialState TutorialState => CurrentGame.TutorialState ?? throw new InvalidOperationException("Editor doesn't have current game set yet"); @@ -142,7 +128,6 @@ public GameProperties CurrentGame /// If set the editor returns to this stage. The CurrentGame /// should be shared with this stage. If not set returns to a newly created instance of the stage /// - [JsonProperty] public TStage? ReturnToStage { get; set; } /// @@ -154,17 +139,14 @@ public GameProperties CurrentGame /// player was in the cell editor tab and saved. /// /// - [JsonProperty] public bool ShowHover { get; set; } - [JsonIgnore] public Node GameStateRoot => this; public bool IsLoadedFromSave { get; set; } public bool NodeReferencesResolved { get; private set; } - [JsonIgnore] public float DayLightFraction { get => dayLightFraction; @@ -179,18 +161,15 @@ public float DayLightFraction } } - [JsonProperty] public bool EditorReady { get => ready; set { ready = value; - pauseMenu.GameLoading = !value; } } - [JsonIgnore] public virtual bool CanCancelAction => throw new GodotAbstractPropertyNotOverriddenException(); public virtual Species EditedBaseSpecies => throw new GodotAbstractPropertyNotOverriddenException(); @@ -323,7 +302,10 @@ public void OnFinishLoading(Save save) GD.Print("Hiding loading screen for editor as we were loaded from a save"); TransitionManager.Instance.AddSequence(ScreenFade.FadeType.FadeOut, 0.5f, () => LoadingScreen.Instance.Hide(), false, false); - TransitionManager.Instance.AddSequence(ScreenFade.FadeType.FadeIn, 0.5f, null, false, false); + TransitionManager.Instance.AddSequence(ScreenFade.FadeType.FadeIn, 0.5f, () => + { + PauseMenu.Instance.ReportEnterGameState(GameState, CurrentGame); + }, false, false); } /// @@ -357,6 +339,7 @@ public virtual bool OnFinishEditing(List? overrides = null) if (EditedBaseSpecies == null) throw new InvalidOperationException("Editor not initialized, missing edited species"); + PauseMenu.Instance.ReportStageTransition(); TransitionManager.Instance.AddSequence(ScreenFade.FadeType.FadeOut, 0.3f, OnEditorExitTransitionFinished, false); @@ -657,7 +640,7 @@ public bool RequestFinishEditingWithOverride(List userOverri public void OpenSpeciesInfoFor(Species species) { - pauseMenu.OpenToSpeciesPage(species); + PauseMenu.Instance.OpenToSpeciesPage(species); } public double CalculateNextGenerationTimePoint() @@ -680,8 +663,6 @@ protected virtual void InitEditorGUI(bool fresh) protected virtual void InitEditor(bool fresh) { - pauseMenu.GameProperties = CurrentGame; - if (fresh) { // Auto save is wanted once possible @@ -751,7 +732,7 @@ protected virtual void InitEditor(bool fresh) if (EditedBaseSpecies == null) throw new Exception($"Editor setup which was just ran didn't setup {nameof(EditedBaseSpecies)}"); - pauseMenu.SetNewSaveNameFromSpeciesName(); + PauseMenu.Instance.SetNewSaveNameFromSpeciesName(); ApplyComponentLightLevels(); } @@ -854,6 +835,8 @@ protected virtual void OnEditorReady() EditorReady = true; LoadingScreen.Instance.Hide(); + PauseMenu.Instance.ReportEnterGameState(GameState, CurrentGame); + GD.Print("Elapsing time on editor entry"); ElapseEditorEntryTime(); UpdatePatchDetails(); @@ -1085,6 +1068,16 @@ protected virtual void OnCheatsUsed() ApplyCheatsUsedFlag(); } + protected void OnOpenPauseMenu() + { + PauseMenu.Instance.Open(); + } + + protected void OnOpenPauseMenuToHelp() + { + PauseMenu.Instance.OpenToHelp(); + } + private void MakeSureEditorReturnIsGood() { if (currentGame == null) diff --git a/src/general/base_stage/HUDWithPausing.cs b/src/general/base_stage/HUDWithPausing.cs index bb5708ac13..38d783ff4c 100644 --- a/src/general/base_stage/HUDWithPausing.cs +++ b/src/general/base_stage/HUDWithPausing.cs @@ -38,7 +38,7 @@ public override void _Ready() public virtual void PauseButtonPressed(bool buttonState) { - if (menu.Visible) + if (PauseMenu.Instance.Visible) { return; } diff --git a/src/general/base_stage/StageBase.cs b/src/general/base_stage/StageBase.cs index c29daf7465..c17a79c533 100644 --- a/src/general/base_stage/StageBase.cs +++ b/src/general/base_stage/StageBase.cs @@ -15,9 +15,6 @@ public partial class StageBase : NodeWithInput, IStageBase, IGodotEarlyNodeResol protected Node world = null!; protected Node rootOfDynamicallySpawned = null!; - [Export] - protected PauseMenu pauseMenu = null!; - [Export] protected Control hudRoot = null!; @@ -92,7 +89,6 @@ public bool TransitionFinished set { transitionFinished = value; - pauseMenu.GameLoading = !transitionFinished; } } @@ -244,6 +240,8 @@ public void GameOver() public virtual void OnFinishTransitioning() { TransitionFinished = true; + PauseMenu.Instance.ReportEnterGameState(GameState, CurrentGame ?? throw new Exception("Current game not set")); + PauseMenu.Instance.SetNewSaveNameFromSpeciesName(); } public virtual void OnFinishLoading(Save save) @@ -315,10 +313,6 @@ protected virtual void SetupStage() GD.Print(CurrentGame!.GameWorld.WorldSettings); - pauseMenu.GameProperties = CurrentGame ?? throw new InvalidOperationException("current game is not set"); - - pauseMenu.SetNewSaveNameFromSpeciesName(); - StartMusic(); OnStartLoading(); diff --git a/src/macroscopic_stage/MacroscopicStage.cs b/src/macroscopic_stage/MacroscopicStage.cs index 1d0a1cf816..b006a76c80 100644 --- a/src/macroscopic_stage/MacroscopicStage.cs +++ b/src/macroscopic_stage/MacroscopicStage.cs @@ -184,6 +184,7 @@ public override void _Process(double delta) // The fade is pretty long here to give some time after the camera stops moving before the fade out // is complete + PauseMenu.Instance.ReportStageTransition(); TransitionManager.Instance.AddSequence(ScreenFade.FadeType.FadeOut, 3.5f, SwitchToSocietyScene, false); MovingToEditor = true; movingToSocietyStage = false; @@ -269,6 +270,8 @@ public override void MoveToEditor() GiveReproductionPopulationBonus(); + PauseMenu.Instance.ReportStageTransition(); + // We don't free this here as the editor will return to this scene if (SceneManager.Instance.SwitchToScene(sceneInstance, true) != this) { @@ -534,7 +537,7 @@ public void PerformBuildOrOpenMenu() return; } - if (pauseMenu.Visible) + if (PauseMenu.Instance.Visible) return; selectBuildingPopup.OpenWithStructures(CurrentGame!.TechWeb.GetAvailableStructures(), Player, Player); @@ -565,7 +568,7 @@ public bool TogglePlayerInventory() return true; } - if (pauseMenu.Visible) + if (PauseMenu.Instance.Visible) return false; try diff --git a/src/macroscopic_stage/editor/MacroscopicEditor.cs b/src/macroscopic_stage/editor/MacroscopicEditor.cs index 218cc5dade..ec4339cd3b 100644 --- a/src/macroscopic_stage/editor/MacroscopicEditor.cs +++ b/src/macroscopic_stage/editor/MacroscopicEditor.cs @@ -8,7 +8,6 @@ /// /// Macroscopic main editor class /// -[JsonObject(IsReference = true)] [SceneLoadedClass("res://src/macroscopic_stage/editor/MacroscopicEditor.tscn", UsesEarlyResolve = false)] public partial class MacroscopicEditor : EditorBase, IEditorReportData, ICellEditorData @@ -96,9 +95,10 @@ public override bool CanCancelAction public ICellDefinition? EditedCellProperties => selectedCellTypeToEdit; // TODO: same as multicellular editor, might be needed in the future to support tolerances editing - [JsonIgnore] public IReadOnlyList? EditedCellOrganelles => null; + public override MainGameState GameState => MainGameState.MacroscopicEditor; + protected override string MusicCategory => "MacroscopicEditor"; protected override MainGameState ReturnToState => MainGameState.MacroscopicStage; diff --git a/src/microbe_stage/MicrobeStage.cs b/src/microbe_stage/MicrobeStage.cs index fe4abc8136..2face30809 100644 --- a/src/microbe_stage/MicrobeStage.cs +++ b/src/microbe_stage/MicrobeStage.cs @@ -681,6 +681,8 @@ public override void MoveToEditor() RecordPlayerReproduction(); + PauseMenu.Instance.ReportStageTransition(); + // We don't free this here as the editor will return to this scene if (SceneManager.Instance.SwitchToScene(sceneInstance, true) != this) { diff --git a/src/microbe_stage/editor/MicrobeEditor.cs b/src/microbe_stage/editor/MicrobeEditor.cs index bbf8a846d2..ba1276134b 100644 --- a/src/microbe_stage/editor/MicrobeEditor.cs +++ b/src/microbe_stage/editor/MicrobeEditor.cs @@ -52,6 +52,8 @@ public partial class MicrobeEditor : EditorBase, IEd public Patch? SelectedPatch => patchMapTab.SelectedPatch; + public override MainGameState GameState => MainGameState.MicrobeEditor; + public override ushort CurrentArchiveVersion => SERIALIZATION_VERSION; public override ArchiveObjectType ArchiveObjectType => (ArchiveObjectType)ThriveArchiveObjectType.MicrobeEditor; @@ -253,7 +255,6 @@ protected override void InitEditor(bool fresh) // Make tutorials run cellEditorTab.TutorialState = TutorialState; tutorialGUI.EventReceiver = TutorialState; - pauseMenu.GameProperties = CurrentGame; // Send highlighted controls to the tutorial system cellEditorTab.SendObjectsToTutorials(TutorialState, tutorialGUI); From e1d1642bf078c9d9881076d1b78e190a131b48ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henri=20Hyyryl=C3=A4inen?= Date: Wed, 12 Nov 2025 17:24:20 +0200 Subject: [PATCH 08/11] Fixed multiple Thriveopedia world page adds --- src/thriveopedia/Thriveopedia.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/thriveopedia/Thriveopedia.cs b/src/thriveopedia/Thriveopedia.cs index 42ec9dba08..bc7238f146 100644 --- a/src/thriveopedia/Thriveopedia.cs +++ b/src/thriveopedia/Thriveopedia.cs @@ -82,6 +82,11 @@ public partial class Thriveopedia : ControlWithInput, ISpeciesDataProvider /// private bool hasGeneratedWiki; + /// + /// As Thriveopedias are now persistent, we need to know once game property setup is done + /// + private bool currentGamePagesAdded; + /// /// The currently selected stage to view /// @@ -129,9 +134,15 @@ public GameProperties? CurrentGame // Add all pages associated with a game in progress if (currentGame != null) { - AddPage("CurrentWorld"); - AddPage("PatchMap"); - AddPage("EvolutionaryTree"); + if (!currentGamePagesAdded) + { + AddPage("CurrentWorld"); + AddPage("PatchMap"); + AddPage("EvolutionaryTree"); + currentGamePagesAdded = true; + } + + // Looks like refresh is automatic, so we don't need an else clause here } // Notify all pages of the new game properties From df36cd4f710f4e4ae3847d74efd6c91511ff1980 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henri=20Hyyryl=C3=A4inen?= Date: Wed, 12 Nov 2025 17:24:54 +0200 Subject: [PATCH 09/11] Open help menu directly from tutorial --- src/microbe_stage/MicrobeStage.tscn | 16 ++++------------ src/tutorial/microbe_stage/MicrobeTutorialGUI.cs | 7 +------ 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/src/microbe_stage/MicrobeStage.tscn b/src/microbe_stage/MicrobeStage.tscn index 2cce9d09de..13fdecbd40 100644 --- a/src/microbe_stage/MicrobeStage.tscn +++ b/src/microbe_stage/MicrobeStage.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=17 format=3 uid="uid://dva08tpqyn15k"] +[gd_scene load_steps=16 format=3 uid="uid://dva08tpqyn15k"] [ext_resource type="Script" uid="uid://di2y5gnlbsclr" path="res://src/microbe_stage/MicrobeStage.cs" id="1"] [ext_resource type="PackedScene" uid="uid://bako5jivv1dji" path="res://src/microbe_stage/MicrobeCamera.tscn" id="2"] @@ -9,7 +9,6 @@ [ext_resource type="Script" uid="uid://cksngbvpy82k0" path="res://src/microbe_stage/PlayerMicrobeInput.cs" id="7"] [ext_resource type="PackedScene" uid="uid://d1mwl825xlq0t" path="res://src/microbe_stage/HeatGradientPlane.tscn" id="8_7ghg3"] [ext_resource type="Script" uid="uid://c416h56by2myc" path="res://src/microbe_stage/CompoundCloudSystem.cs" id="10"] -[ext_resource type="PackedScene" uid="uid://devtugnggmuol" path="res://src/general/PauseMenu.tscn" id="11"] [ext_resource type="PackedScene" uid="uid://cjo7cvvdvljxm" path="res://src/microbe_stage/gui/MovementModeSelectionPopup.tscn" id="17_fltkg"] [ext_resource type="Script" uid="uid://bo5rh33xwe1u0" path="res://src/microbe_stage/MicrobeInspectInfo.cs" id="22"] [ext_resource type="PackedScene" uid="uid://b6pjvrbt518oj" path="res://src/engine/ChromaticFilter.tscn" id="67"] @@ -17,7 +16,7 @@ [ext_resource type="PackedScene" uid="uid://b5yuo8sj21lnf" path="res://src/engine/GuidanceLine.tscn" id="75"] [ext_resource type="PackedScene" uid="uid://dwkek50fju0fu" path="res://src/microbe_stage/PatchNameOverlay.tscn" id="85"] -[node name="MicrobeStage" type="Node" node_paths=PackedStringArray("heatViewOverlay", "fluidCurrentDisplay", "movementModeSelectionPopup", "guidanceLine", "microbeWorldEnvironment", "pauseMenu", "hudRoot")] +[node name="MicrobeStage" type="Node" node_paths=PackedStringArray("heatViewOverlay", "fluidCurrentDisplay", "movementModeSelectionPopup", "guidanceLine", "microbeWorldEnvironment", "hudRoot")] process_priority = -1 script = ExtResource("1") heatViewOverlay = NodePath("World/PrimaryCamera/HeatGradientPlane") @@ -25,7 +24,6 @@ fluidCurrentDisplay = NodePath("World/PrimaryCamera/FluidCurrentDisplay") movementModeSelectionPopup = NodePath("MovementModeSelectionPopup") guidanceLine = NodePath("World/GuidanceLine") microbeWorldEnvironment = NodePath("World/MicrobeWorldEnvironment") -pauseMenu = NodePath("PauseMenu") hudRoot = NodePath("MicrobeHUD") [node name="World" type="Node" parent="."] @@ -63,11 +61,10 @@ script = ExtResource("7") [node name="ChromaticFilter" parent="." instance=ExtResource("67")] -[node name="MicrobeHUD" parent="." node_paths=PackedStringArray("patchName", "fossilisationButtonLayer", "fossilisationDialog", "menu") instance=ExtResource("3")] +[node name="MicrobeHUD" parent="." node_paths=PackedStringArray("patchName", "fossilisationButtonLayer", "fossilisationDialog") instance=ExtResource("3")] patchName = NodePath("../PatchNameOverlay") fossilisationButtonLayer = NodePath("FossilisationButtonLayer") fossilisationDialog = NodePath("FossilisationDialog") -menu = NodePath("../PauseMenu") [node name="FossilisationButtonLayer" type="Control" parent="MicrobeHUD"] anchors_preset = 0 @@ -78,6 +75,7 @@ size_flags_vertical = 3 mouse_filter = 2 [node name="FossilisationDialog" parent="MicrobeHUD" instance=ExtResource("4")] +layout_mode = 0 offset_left = 458.0 offset_top = 120.0 offset_right = 822.0 @@ -104,15 +102,11 @@ size_flags_horizontal = 3 size_flags_vertical = 6 mouse_filter = 2 -[node name="PauseMenu" parent="." instance=ExtResource("11")] - [connection signal="OnAcceptRevertToEditor" from="MicrobeHUD" to="." method="OnLoadPreviousEditorSave"] [connection signal="OnDismissRevertToEditor" from="MicrobeHUD" to="." method="OnCancelLoadAdvice"] [connection signal="OnEjectEngulfedButtonPressed" from="MicrobeHUD" to="PlayerMicrobeInput" method="EjectAllEngulfed"] [connection signal="OnFireToxinButtonPressed" from="MicrobeHUD" to="PlayerMicrobeInput" method="EmitToxin"] [connection signal="OnMucocystButtonPressed" from="MicrobeHUD" to="PlayerMicrobeInput" method="ToggleMucocyst"] -[connection signal="OnOpenMenu" from="MicrobeHUD" to="PauseMenu" method="Open"] -[connection signal="OnOpenMenuToHelp" from="MicrobeHUD" to="PauseMenu" method="OpenToHelp"] [connection signal="OnSecreteSlimeButtonPressed" from="MicrobeHUD" to="PlayerMicrobeInput" method="SecreteSlime" binds= [1.0]] [connection signal="OnSiderophoreButtonPressed" from="MicrobeHUD" to="PlayerMicrobeInput" method="EmitSiderophore"] [connection signal="OnSprintButtonPressed" from="MicrobeHUD" to="PlayerMicrobeInput" method="ToggleSprint"] @@ -120,5 +114,3 @@ mouse_filter = 2 [connection signal="OnToggleEngulfButtonPressed" from="MicrobeHUD" to="PlayerMicrobeInput" method="ToggleEngulf"] [connection signal="OnUnbindAllButtonPressed" from="MicrobeHUD" to="PlayerMicrobeInput" method="UnbindAll"] [connection signal="OnSpeciesFossilised" from="MicrobeHUD/FossilisationDialog" to="MicrobeHUD" method="UpdateFossilisationButtonStates"] -[connection signal="OnHelpMenuOpenRequested" from="TutorialGUI" to="PauseMenu" method="OpenToHelp"] -[connection signal="MakeSave" from="PauseMenu" to="." method="SaveGame"] diff --git a/src/tutorial/microbe_stage/MicrobeTutorialGUI.cs b/src/tutorial/microbe_stage/MicrobeTutorialGUI.cs index e3f0189111..4ce09eef27 100644 --- a/src/tutorial/microbe_stage/MicrobeTutorialGUI.cs +++ b/src/tutorial/microbe_stage/MicrobeTutorialGUI.cs @@ -97,9 +97,6 @@ public partial class MicrobeTutorialGUI : Control, ITutorialGUI #pragma warning restore CA2213 - [Signal] - public delegate void OnHelpMenuOpenRequestedEventHandler(); - public ITutorialInput? EventReceiver { get; set; } public MainGameState AssociatedGameState => MainGameState.MicrobeStage; @@ -581,9 +578,7 @@ private void CheckHelpMenuPressed() { TutorialHelper.HandleCloseSpecificForGUI(this, CheckTheHelpMenu.TUTORIAL_NAME); - // Note that this opening while the tutorial box is still visible is a bit problematic due to: - // https://github.com/Revolutionary-Games/Thrive/issues/2326 - EmitSignal(SignalName.OnHelpMenuOpenRequested); + PauseMenu.Instance.OpenToHelp(); } private void DummyKeepInitialTextTranslations() From c3e4633b15dec78f957b12351db2212f777fe72a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henri=20Hyyryl=C3=A4inen?= Date: Wed, 12 Nov 2025 17:25:14 +0200 Subject: [PATCH 10/11] Random change Godot wanted to do --- src/microbe_stage/HeatGradientNoise.tres | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/microbe_stage/HeatGradientNoise.tres b/src/microbe_stage/HeatGradientNoise.tres index 93d95856a1..ea52cf91e2 100644 --- a/src/microbe_stage/HeatGradientNoise.tres +++ b/src/microbe_stage/HeatGradientNoise.tres @@ -8,5 +8,5 @@ frequency = 0.006 [resource] width = 1024 height = 1024 -seamless = true noise = SubResource("FastNoiseLite_miky1") +seamless = true From 31e5963d2c420d4c192bd707e67ee7ab21d22b38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henri=20Hyyryl=C3=A4inen?= Date: Wed, 12 Nov 2025 18:00:41 +0200 Subject: [PATCH 11/11] Singleton pause menu should now be working for all stages but I didn't super comprehensively test that the menu suppressions between prototypes work sensibly --- src/engine/LogInterceptor.cs | 3 + .../base_stage/CreatureStageHUDBase.cs | 29 +--------- src/general/base_stage/EditorBase.cs | 15 +++-- src/general/base_stage/HUDBase.cs | 3 - src/general/base_stage/StageBase.cs | 14 +++-- .../base_stage/StrategyStageHUDBase.cs | 22 ------- src/industrial_stage/IndustrialStage.cs | 1 + src/macroscopic_stage/MacroscopicHUD.tscn | 46 ++++++++------- src/macroscopic_stage/MacroscopicStage.cs | 14 ++--- src/macroscopic_stage/MacroscopicStage.tscn | 22 ++----- .../editor/MacroscopicEditor.tscn | 11 +--- src/microbe_stage/HUDBottomBar.cs | 17 ++---- src/microbe_stage/MicrobeHUD.tscn | 57 ++++++++++--------- src/microbe_stage/MicrobeStage.cs | 10 ++-- .../editor/EditorCommonBottomLeftButtons.cs | 12 ++-- src/microbe_stage/editor/MicrobeEditor.tscn | 12 +--- .../editor/MulticellularEditor.cs | 2 + .../editor/MulticellularEditor.tscn | 11 +--- src/society_stage/SocietyStage.cs | 1 + src/society_stage/gui/SocietyHUD.tscn | 17 +++--- src/space_stage/SpaceStage.cs | 3 + src/space_stage/gui/SpaceHUD.tscn | 2 + 22 files changed, 121 insertions(+), 203 deletions(-) diff --git a/src/engine/LogInterceptor.cs b/src/engine/LogInterceptor.cs index 94c2f5ca3a..174fa64fcd 100644 --- a/src/engine/LogInterceptor.cs +++ b/src/engine/LogInterceptor.cs @@ -81,6 +81,9 @@ public override void _LogError(string function, string file, int line, string co if (code.Contains("with non-equal opposite anchors")) return; + // We might want to ignore this somewhat intermittent error: Parent node is busy adding + // that sometimes happens on scene switch but doesn't seem to cause any problems + // Avoid recursion if (code.Contains("Unhandled Exception Log")) return; diff --git a/src/general/base_stage/CreatureStageHUDBase.cs b/src/general/base_stage/CreatureStageHUDBase.cs index b4727dbf2f..884804ab9f 100644 --- a/src/general/base_stage/CreatureStageHUDBase.cs +++ b/src/general/base_stage/CreatureStageHUDBase.cs @@ -184,12 +184,6 @@ public abstract partial class CreatureStageHUDBase : HUDWithPausing, ICr private bool strainIsRed; - [Signal] - public delegate void OnOpenMenuEventHandler(); - - [Signal] - public delegate void OnOpenMenuToHelpEventHandler(); - /// /// Gets and sets the text that appears at the upper HUD. /// @@ -601,7 +595,7 @@ public override void PauseButtonPressed(bool buttonState) bottomLeftBar.Paused = Paused; - if (menu.Visible) + if (PauseMenu.Instance.Visible) return; if (Paused) @@ -1160,16 +1154,6 @@ protected virtual void UpdateBarVisibility(Func isUseful) return stage.GameWorld.GetClosestRelatedSpecies(currentPlayer, true, mustBeSameStage); } - protected void OpenMenu() - { - EmitSignal(SignalName.OnOpenMenu); - } - - protected void OpenHelp() - { - EmitSignal(SignalName.OnOpenMenuToHelp); - } - protected void FlashHealthBar(Color colour, float delta) { healthBarFlashDuration -= delta; @@ -1249,17 +1233,6 @@ private void EnvironmentButtonPressed(bool pressed) environmentPanel.ShowPanel = pressed; } - private void HelpButtonPressed() - { - GUICommon.Instance.PlayButtonPressSound(); - menu.OpenToHelp(); - } - - private void StatisticsButtonPressed() - { - ThriveopediaManager.OpenPage("CurrentWorld"); - } - private void SpeedModeButtonPressed(bool pressed) { ApplySpeedMode(pressed); diff --git a/src/general/base_stage/EditorBase.cs b/src/general/base_stage/EditorBase.cs index 28ac6b6e1a..231545b674 100644 --- a/src/general/base_stage/EditorBase.cs +++ b/src/general/base_stage/EditorBase.cs @@ -164,10 +164,7 @@ public float DayLightFraction public bool EditorReady { get => ready; - set - { - ready = value; - } + set => ready = value; } public virtual bool CanCancelAction => throw new GodotAbstractPropertyNotOverriddenException(); @@ -227,6 +224,8 @@ public override void _EnterTree() base._EnterTree(); AchievementsManager.OnPlayerHasCheatedEvent += OnCheatsUsed; + + PauseMenu.Instance.Connect(PauseMenu.SignalName.MakeSave, new Callable(this, nameof(SaveGame))); } public override void _ExitTree() @@ -256,6 +255,8 @@ public override void _ExitTree() { GD.Print("Editor's return to stage is already disposed"); } + + PauseMenu.Instance.Disconnect(PauseMenu.SignalName.MakeSave, new Callable(this, nameof(SaveGame))); } public override void _Process(double delta) @@ -302,10 +303,8 @@ public void OnFinishLoading(Save save) GD.Print("Hiding loading screen for editor as we were loaded from a save"); TransitionManager.Instance.AddSequence(ScreenFade.FadeType.FadeOut, 0.5f, () => LoadingScreen.Instance.Hide(), false, false); - TransitionManager.Instance.AddSequence(ScreenFade.FadeType.FadeIn, 0.5f, () => - { - PauseMenu.Instance.ReportEnterGameState(GameState, CurrentGame); - }, false, false); + TransitionManager.Instance.AddSequence(ScreenFade.FadeType.FadeIn, 0.5f, + () => { PauseMenu.Instance.ReportEnterGameState(GameState, CurrentGame); }, false, false); } /// diff --git a/src/general/base_stage/HUDBase.cs b/src/general/base_stage/HUDBase.cs index 6608c974b5..be5a809f0e 100644 --- a/src/general/base_stage/HUDBase.cs +++ b/src/general/base_stage/HUDBase.cs @@ -8,9 +8,6 @@ public partial class HUDBase : Control, IStageHUD { #pragma warning disable CA2213 - [Export] - protected PauseMenu menu = null!; - private readonly TimeSpan minStageLoadingScreenDuration = TimeSpan.FromSeconds(1.0); [Export] diff --git a/src/general/base_stage/StageBase.cs b/src/general/base_stage/StageBase.cs index c17a79c533..f106f1e032 100644 --- a/src/general/base_stage/StageBase.cs +++ b/src/general/base_stage/StageBase.cs @@ -86,10 +86,7 @@ public enum LoadState public bool TransitionFinished { get => transitionFinished; - set - { - transitionFinished = value; - } + set => transitionFinished = value; } public bool CanBeReferencedInArchive => true; @@ -134,6 +131,8 @@ public override void _EnterTree() } AchievementsManager.OnPlayerHasCheatedEvent += OnCheatsUsed; + + PauseMenu.Instance.Connect(PauseMenu.SignalName.MakeSave, new Callable(this, nameof(SaveGame))); } public override void _ExitTree() @@ -141,6 +140,8 @@ public override void _ExitTree() base._ExitTree(); AchievementsManager.OnPlayerHasCheatedEvent -= OnCheatsUsed; + + PauseMenu.Instance.Disconnect(PauseMenu.SignalName.MakeSave, new Callable(this, nameof(SaveGame))); } public override void _Process(double delta) @@ -514,6 +515,11 @@ protected virtual void PerformQuickSave() throw new GodotAbstractMethodNotOverriddenException(); } + protected virtual void SaveGame(string name) + { + SaveHelper.ShowErrorAboutPrototypeSaving(this); + } + protected virtual void OnLightLevelUpdate() { throw new GodotAbstractMethodNotOverriddenException(); diff --git a/src/general/base_stage/StrategyStageHUDBase.cs b/src/general/base_stage/StrategyStageHUDBase.cs index 024ebcd600..ca87b57d0b 100644 --- a/src/general/base_stage/StrategyStageHUDBase.cs +++ b/src/general/base_stage/StrategyStageHUDBase.cs @@ -40,13 +40,6 @@ protected StrategyStageHUDBase() { } - // These signals need to be copied to inheriting classes for Godot editor to pick them up - [Signal] - public delegate void OnOpenMenuEventHandler(); - - [Signal] - public delegate void OnOpenMenuToHelpEventHandler(); - [Signal] public delegate void OnStartResearchingEventHandler(string technology); @@ -117,21 +110,6 @@ public override void PauseButtonPressed(bool buttonState) // } } - protected void OpenMenu() - { - EmitSignal(SignalName.OnOpenMenu); - } - - protected void OpenHelp() - { - EmitSignal(SignalName.OnOpenMenuToHelp); - } - - private void StatisticsButtonPressed() - { - ThriveopediaManager.OpenPage("CurrentWorld"); - } - private void ResearchScreenClosed() { // TODO: update the hot bar state diff --git a/src/industrial_stage/IndustrialStage.cs b/src/industrial_stage/IndustrialStage.cs index d83a5ea2f9..2bc56c8378 100644 --- a/src/industrial_stage/IndustrialStage.cs +++ b/src/industrial_stage/IndustrialStage.cs @@ -281,6 +281,7 @@ private void ConfirmMoveToNextStage() toSpaceAnimatedUnit.GlobalPosition = spaceCraftData.Value.City.GlobalPosition; HUD.CloseAllOpenWindows(); + PauseMenu.Instance.ReportStageTransition(); // Start the first phase of the stage move with a camera animation movingToSpaceStagePhase = StageMovePhase.ZoomingCamera; diff --git a/src/macroscopic_stage/MacroscopicHUD.tscn b/src/macroscopic_stage/MacroscopicHUD.tscn index f939dda052..e4085f941b 100644 --- a/src/macroscopic_stage/MacroscopicHUD.tscn +++ b/src/macroscopic_stage/MacroscopicHUD.tscn @@ -59,50 +59,50 @@ border_color = Color(0.533333, 0.745098, 0.815686, 0.392157) texture = ExtResource("26") region_rect = Rect2(0, 0, 86, 52) -[sub_resource type="StyleBoxFlat" id="33"] +[sub_resource type="StyleBoxFlat" id="34"] +bg_color = Color(0.168627, 0.0470588, 0.552941, 1) draw_center = false border_width_left = 2 border_width_top = 2 border_width_right = 2 border_width_bottom = 2 -border_color = Color(1, 1, 1, 0.784314) +border_color = Color(0.701961, 0.701961, 0.701961, 0.588235) corner_radius_top_left = 1 corner_radius_top_right = 1 corner_radius_bottom_right = 1 corner_radius_bottom_left = 1 -[sub_resource type="StyleBoxFlat" id="34"] -bg_color = Color(0.168627, 0.0470588, 0.552941, 1) +[sub_resource type="StyleBoxFlat" id="33"] draw_center = false border_width_left = 2 border_width_top = 2 border_width_right = 2 border_width_bottom = 2 -border_color = Color(0.701961, 0.701961, 0.701961, 0.588235) +border_color = Color(1, 1, 1, 0.784314) corner_radius_top_left = 1 corner_radius_top_right = 1 corner_radius_bottom_right = 1 corner_radius_bottom_left = 1 -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_0pur5"] +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_1ao1s"] draw_center = false border_width_left = 2 border_width_top = 2 border_width_right = 2 border_width_bottom = 2 -border_color = Color(1, 1, 1, 0.784314) +border_color = Color(0.701961, 0.701961, 0.701961, 0.588235) corner_radius_top_left = 1 corner_radius_top_right = 1 corner_radius_bottom_right = 1 corner_radius_bottom_left = 1 -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_1ao1s"] +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_0pur5"] draw_center = false border_width_left = 2 border_width_top = 2 border_width_right = 2 border_width_bottom = 2 -border_color = Color(0.701961, 0.701961, 0.701961, 0.588235) +border_color = Color(1, 1, 1, 0.784314) corner_radius_top_left = 1 corner_radius_top_right = 1 corner_radius_bottom_right = 1 @@ -407,6 +407,7 @@ grow_horizontal = 1 grow_vertical = 1 [node name="ProcessPanel" parent="." instance=ExtResource("13")] +layout_mode = 0 offset_left = 8.0 offset_top = 72.0 offset_right = 408.0 @@ -438,9 +439,9 @@ alignment = 1 visible = false layout_mode = 2 tooltip_text = "TOGGLE_ENGULF" -theme_override_styles/hover = SubResource("33") -theme_override_styles/pressed = SubResource("33") theme_override_styles/normal = SubResource("34") +theme_override_styles/pressed = SubResource("33") +theme_override_styles/hover = SubResource("33") ActionIcon = ExtResource("28") ActionName = "g_interact" @@ -462,9 +463,9 @@ ActionName = "g_build_structure" visible = false layout_mode = 2 tooltip_text = "TOGGLE_ENGULF" -theme_override_styles/hover = SubResource("33") -theme_override_styles/pressed = SubResource("33") theme_override_styles/normal = SubResource("34") +theme_override_styles/pressed = SubResource("33") +theme_override_styles/hover = SubResource("33") ActionIcon = ExtResource("71") ActionName = "g_toggle_engulf" @@ -478,9 +479,9 @@ ActionName = "g_fire_toxin" [node name="SignalingAgents" parent="ScrollContainer/HotBar" instance=ExtResource("78")] visible = false layout_mode = 2 -theme_override_styles/hover = SubResource("33") -theme_override_styles/pressed = SubResource("33") theme_override_styles/normal = SubResource("34") +theme_override_styles/pressed = SubResource("33") +theme_override_styles/hover = SubResource("33") toggle_mode = true ActionIcon = ExtResource("76") ActionName = "g_pack_commands" @@ -504,9 +505,9 @@ ActionName = "g_eject_engulfed" visible = false layout_mode = 2 tooltip_text = "SPRINT_ACTION_TOOLTIP" -theme_override_styles/hover = SubResource("StyleBoxFlat_0pur5") -theme_override_styles/pressed = SubResource("StyleBoxFlat_0pur5") theme_override_styles/normal = SubResource("StyleBoxFlat_1ao1s") +theme_override_styles/pressed = SubResource("StyleBoxFlat_0pur5") +theme_override_styles/hover = SubResource("StyleBoxFlat_0pur5") ActionIcon = ExtResource("30_isqlj") ActionName = "g_sprint" @@ -514,9 +515,9 @@ ActionName = "g_sprint" visible = false layout_mode = 2 tooltip_text = "MUCOCYST_ACTION_TOOLTIP" -theme_override_styles/hover = SubResource("33") -theme_override_styles/pressed = SubResource("33") theme_override_styles/normal = SubResource("34") +theme_override_styles/pressed = SubResource("33") +theme_override_styles/hover = SubResource("33") toggle_mode = true ActionIcon = ExtResource("31_pjbt3") ActionName = "g_toggle_mucocyst" @@ -551,6 +552,7 @@ offset_bottom = -101.0 offset_bottom = -24.0 [node name="InventoryScreen" parent="." instance=ExtResource("29")] +layout_mode = 0 anchors_preset = 0 anchor_right = 0.0 anchor_bottom = 0.0 @@ -575,14 +577,17 @@ grow_horizontal = 2 grow_vertical = 2 [node name="RadialPopup" parent="." instance=ExtResource("32")] +layout_mode = 0 [node name="MoveToLandConfirmation" parent="." instance=ExtResource("17")] custom_minimum_size = Vector2(450, 0) +layout_mode = 0 DialogText = "MOVING_TO_LAND_PROTOTYPE" WindowTitle = "MOVING_TO_LAND_PROTOTYPE_TITLE" [node name="MoveToAwakeningConfirm" parent="." instance=ExtResource("17")] custom_minimum_size = Vector2(450, 0) +layout_mode = 0 DialogText = "MOVING_TO_AWAKENING_PROTOTYPE" WindowTitle = "MOVING_TO_AWAKENING_PROTOTYPE_TITLE" @@ -613,11 +618,8 @@ show_percentage = false [connection signal="OnCompoundsToggled" from="BottomLeft/HUDBottomBar" to="." method="CompoundButtonPressed"] [connection signal="OnEnvironmentToggled" from="BottomLeft/HUDBottomBar" to="." method="EnvironmentButtonPressed"] [connection signal="OnHeatToggled" from="BottomLeft/HUDBottomBar" to="." method="HeatViewButtonPressed"] -[connection signal="OnHelpPressed" from="BottomLeft/HUDBottomBar" to="." method="OpenHelp"] -[connection signal="OnMenuPressed" from="BottomLeft/HUDBottomBar" to="." method="OpenMenu"] [connection signal="OnPausePressed" from="BottomLeft/HUDBottomBar" to="." method="PauseButtonPressed"] [connection signal="OnProcessesPressed" from="BottomLeft/HUDBottomBar" to="." method="ProcessPanelButtonPressed"] -[connection signal="OnStatisticsPressed" from="BottomLeft/HUDBottomBar" to="." method="StatisticsButtonPressed"] [connection signal="OnSuicidePressed" from="BottomLeft/HUDBottomBar" to="." method="OnSuicide"] [connection signal="pressed" from="BottomRight/VBoxContainer/ToLand" to="." method="OnMoveToLandPressed"] [connection signal="pressed" from="BottomRight/VBoxContainer/Control/Awaken" to="." method="OnAwakenPressed"] diff --git a/src/macroscopic_stage/MacroscopicStage.cs b/src/macroscopic_stage/MacroscopicStage.cs index b006a76c80..7a7d5d533e 100644 --- a/src/macroscopic_stage/MacroscopicStage.cs +++ b/src/macroscopic_stage/MacroscopicStage.cs @@ -830,6 +830,13 @@ protected override void PerformQuickSave() SaveHelper.ShowErrorAboutPrototypeSaving(this); } + protected override void SaveGame(string name) + { + // TODO: saving for this stage + _ = name; + SaveHelper.ShowErrorAboutPrototypeSaving(this); + } + protected override void Dispose(bool disposing) { if (disposing) @@ -843,13 +850,6 @@ protected override void Dispose(bool disposing) base.Dispose(disposing); } - private void SaveGame(string name) - { - // TODO: saving for this stage - _ = name; - SaveHelper.ShowErrorAboutPrototypeSaving(this); - } - private void OnFinishLoading() { } diff --git a/src/macroscopic_stage/MacroscopicStage.tscn b/src/macroscopic_stage/MacroscopicStage.tscn index 01019620fa..ee9ebbb145 100644 --- a/src/macroscopic_stage/MacroscopicStage.tscn +++ b/src/macroscopic_stage/MacroscopicStage.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=16 format=3 uid="uid://dbhby0wiqd6cd"] +[gd_scene load_steps=15 format=3 uid="uid://dbhby0wiqd6cd"] [ext_resource type="Script" uid="uid://c13jrgpo1cyvx" path="res://src/macroscopic_stage/MacroscopicStage.cs" id="1"] [ext_resource type="PackedScene" uid="uid://d2mf4tuokivmm" path="res://src/macroscopic_stage/MacroscopicCamera.tscn" id="2"] @@ -10,7 +10,6 @@ [ext_resource type="PackedScene" uid="uid://s7qy23vie22s" path="res://src/awakening_stage/InteractableSystem.tscn" id="7"] [ext_resource type="PackedScene" uid="uid://bo86k7ooatxyu" path="res://src/awakening_stage/gui/InteractablePopup.tscn" id="8"] [ext_resource type="PackedScene" uid="uid://borrsf8mdual2" path="res://src/awakening_stage/gui/SelectBuildingPopup.tscn" id="10"] -[ext_resource type="PackedScene" uid="uid://devtugnggmuol" path="res://src/general/PauseMenu.tscn" id="11"] [ext_resource type="PackedScene" uid="uid://b174h1qc4muj8" path="res://src/macroscopic_stage/ProgressBarSystem.tscn" id="12"] [sub_resource type="PanoramaSkyMaterial" id="PanoramaSkyMaterial_b7e0u"] @@ -27,7 +26,7 @@ background_mode = 2 sky = SubResource("1") ambient_light_color = Color(0.0313726, 0.443137, 0.482353, 1) -[node name="MacroscopicStage" type="Node" node_paths=PackedStringArray("interactableSystem", "interactionPopup", "progressBarSystem", "selectBuildingPopup", "worldEnvironmentNode", "worldLightNode", "pauseMenu", "hudRoot")] +[node name="MacroscopicStage" type="Node" node_paths=PackedStringArray("interactableSystem", "interactionPopup", "progressBarSystem", "selectBuildingPopup", "worldEnvironmentNode", "worldLightNode", "hudRoot")] process_priority = -1 script = ExtResource("1") interactableSystem = NodePath("InteractableSystem") @@ -36,7 +35,6 @@ progressBarSystem = NodePath("ProgressBarSystem") selectBuildingPopup = NodePath("SelectBuildingPopup") worldEnvironmentNode = NodePath("World/WorldEnvironment") worldLightNode = NodePath("World/WorldLight") -pauseMenu = NodePath("PauseMenu") hudRoot = NodePath("MacroscopicHUD") [node name="World" type="Node" parent="."] @@ -68,10 +66,9 @@ grow_vertical = 2 [node name="ProgressBarSystem" parent="." instance=ExtResource("12")] -[node name="MacroscopicHUD" parent="." node_paths=PackedStringArray("fossilisationButtonLayer", "fossilisationDialog", "menu") instance=ExtResource("3")] +[node name="MacroscopicHUD" parent="." node_paths=PackedStringArray("fossilisationButtonLayer", "fossilisationDialog") instance=ExtResource("3")] fossilisationButtonLayer = NodePath("FossilisationButtonLayer") fossilisationDialog = NodePath("FossilisationDialog") -menu = NodePath("../PauseMenu") [node name="FossilisationButtonLayer" type="Control" parent="MacroscopicHUD"] anchors_preset = 0 @@ -82,6 +79,7 @@ size_flags_vertical = 3 mouse_filter = 2 [node name="FossilisationDialog" parent="MacroscopicHUD" instance=ExtResource("5")] +layout_mode = 0 offset_left = 458.0 offset_top = 120.0 offset_right = 822.0 @@ -103,19 +101,7 @@ size_flags_horizontal = 3 size_flags_vertical = 6 mouse_filter = 2 -[node name="PauseMenu" parent="." instance=ExtResource("11")] -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -offset_right = 0.0 -offset_bottom = 0.0 -grow_horizontal = 2 -grow_vertical = 2 - [connection signal="OnInteractButtonPressed" from="MacroscopicHUD" to="PlayerMulticellularInput" method="InteractWithEnvironment"] [connection signal="OnOpenBuildPressed" from="MacroscopicHUD" to="PlayerMulticellularInput" method="OpenBuildMenu"] [connection signal="OnOpenInventoryPressed" from="MacroscopicHUD" to="PlayerMulticellularInput" method="OpenInventory"] -[connection signal="OnOpenMenu" from="MacroscopicHUD" to="PauseMenu" method="Open"] -[connection signal="OnOpenMenuToHelp" from="MacroscopicHUD" to="PauseMenu" method="OpenToHelp"] [connection signal="OnSpeciesFossilised" from="MacroscopicHUD/FossilisationDialog" to="MacroscopicHUD" method="UpdateFossilisationButtonStates"] -[connection signal="MakeSave" from="PauseMenu" to="." method="SaveGame"] diff --git a/src/macroscopic_stage/editor/MacroscopicEditor.tscn b/src/macroscopic_stage/editor/MacroscopicEditor.tscn index d41b88d094..6b72899dc6 100644 --- a/src/macroscopic_stage/editor/MacroscopicEditor.tscn +++ b/src/macroscopic_stage/editor/MacroscopicEditor.tscn @@ -1,7 +1,6 @@ -[gd_scene load_steps=16 format=3 uid="uid://d0tsec3q07lee"] +[gd_scene load_steps=15 format=3 uid="uid://d0tsec3q07lee"] [ext_resource type="Theme" uid="uid://b4cx0o110g4b6" path="res://src/gui_common/thrive_theme.tres" id="1"] -[ext_resource type="PackedScene" uid="uid://devtugnggmuol" path="res://src/general/PauseMenu.tscn" id="2"] [ext_resource type="PackedScene" uid="uid://d0qfhc2op1auc" path="res://src/microbe_stage/editor/MicrobeEditorTabButtons.tscn" id="3"] [ext_resource type="Texture2D" uid="uid://dqiv4qrlqv425" path="res://assets/textures/background/panoramas/HydrothermalVents.png" id="3_6y4d0"] [ext_resource type="PackedScene" uid="uid://de2sohb3fjvc1" path="res://src/microbe_stage/editor/EditorCommonBottomLeftButtons.tscn" id="4"] @@ -27,7 +26,7 @@ background_mode = 2 sky = SubResource("Sky_3aerp") ambient_light_color = Color(1, 1, 1, 1) -[node name="MacroscopicEditor" type="Node" node_paths=PackedStringArray("reportTab", "patchMapTab", "bodyPlanEditorTab", "cellEditorTab", "cellEditorCamera", "cellEditorLight", "body3DEditorCamera", "bodyEditorLight", "worldEnvironmentNode", "noCellTypeSelected", "pauseMenu", "editorTabSelector", "editorGUIBaseNode")] +[node name="MacroscopicEditor" type="Node" node_paths=PackedStringArray("reportTab", "patchMapTab", "bodyPlanEditorTab", "cellEditorTab", "cellEditorCamera", "cellEditorLight", "body3DEditorCamera", "bodyEditorLight", "worldEnvironmentNode", "noCellTypeSelected", "editorTabSelector", "editorGUIBaseNode")] script = ExtResource("5") reportTab = NodePath("MacroscopicEditorGUI/Report") patchMapTab = NodePath("MacroscopicEditorGUI/PatchMap") @@ -39,7 +38,6 @@ body3DEditorCamera = NodePath("EditorWorld/PrimaryCamera") bodyEditorLight = NodePath("EditorWorld/EditorLight") worldEnvironmentNode = NodePath("EditorWorld/WorldEnvironment") noCellTypeSelected = NodePath("MacroscopicEditorGUI/NoCellSelected") -pauseMenu = NodePath("PauseMenu") editorTabSelector = NodePath("MacroscopicEditorGUI/MicrobeEditorTabButtons") editorGUIBaseNode = NodePath("MacroscopicEditorGUI") @@ -114,13 +112,8 @@ layout_mode = 2 text = "SELECT_TISSUE_TYPE_FROM_EDITOR" horizontal_alignment = 1 -[node name="PauseMenu" parent="." instance=ExtResource("2")] - [connection signal="OnCellTypeToEditSelected" from="MacroscopicEditorGUI/MetaballBodyEditorComponent" to="." method="OnStartEditingCellType"] [connection signal="OnTabSelected" from="MacroscopicEditorGUI/MicrobeEditorTabButtons" to="." method="SetEditorTab"] -[connection signal="OnOpenHelp" from="MacroscopicEditorGUI/EditorCommonBottomLeftButtons" to="PauseMenu" method="OpenToHelp"] -[connection signal="OnOpenMenu" from="MacroscopicEditorGUI/EditorCommonBottomLeftButtons" to="PauseMenu" method="Open"] -[connection signal="MakeSave" from="PauseMenu" to="." method="SaveGame"] [editable path="EditorWorld"] [editable path="MicrobeEditorWorld"] diff --git a/src/microbe_stage/HUDBottomBar.cs b/src/microbe_stage/HUDBottomBar.cs index c3aebc98ca..e0e62b0191 100644 --- a/src/microbe_stage/HUDBottomBar.cs +++ b/src/microbe_stage/HUDBottomBar.cs @@ -53,9 +53,6 @@ public partial class HUDBottomBar : HBoxContainer private bool speedModePressed; private bool speedModeAvailable = true; - [Signal] - public delegate void OnMenuPressedEventHandler(); - [Signal] public delegate void OnPausePressedEventHandler(bool paused); @@ -71,12 +68,6 @@ public partial class HUDBottomBar : HBoxContainer [Signal] public delegate void OnSuicidePressedEventHandler(); - [Signal] - public delegate void OnHelpPressedEventHandler(); - - [Signal] - public delegate void OnStatisticsPressedEventHandler(); - [Signal] public delegate void OnHeatToggledEventHandler(bool expanded); @@ -182,7 +173,7 @@ public override void _Ready() private void MenuPressed() { GUICommon.Instance.PlayButtonPressSound(); - EmitSignal(SignalName.OnMenuPressed); + PauseMenu.Instance.Open(); } private void TogglePause() @@ -221,13 +212,13 @@ private void SuicideButtonPressed() private void HelpButtonPressed() { GUICommon.Instance.PlayButtonPressSound(); - EmitSignal(SignalName.OnHelpPressed); + PauseMenu.Instance.OpenToHelp(); } private void StatisticsButtonPressed() { - // No need to play a sound as changing Thriveopedia page does it anyway - EmitSignal(SignalName.OnStatisticsPressed); + GUICommon.Instance.PlayButtonPressSound(); + ThriveopediaManager.OpenPage("CurrentWorld"); } private void PausePressed(bool paused) diff --git a/src/microbe_stage/MicrobeHUD.tscn b/src/microbe_stage/MicrobeHUD.tscn index 160316b05b..6cc72e8069 100644 --- a/src/microbe_stage/MicrobeHUD.tscn +++ b/src/microbe_stage/MicrobeHUD.tscn @@ -233,13 +233,13 @@ border_color = Color(0.533333, 0.745098, 0.815686, 0.392157) texture = ExtResource("44") region_rect = Rect2(0, 0, 86, 52) -[sub_resource type="StyleBoxFlat" id="43"] +[sub_resource type="StyleBoxFlat" id="46"] draw_center = false border_width_left = 2 border_width_top = 2 border_width_right = 2 border_width_bottom = 2 -border_color = Color(0.709804, 0.188235, 0.188235, 1) +border_color = Color(0.701961, 0.701961, 0.701961, 0.588235) corner_radius_top_left = 1 corner_radius_top_right = 1 corner_radius_bottom_right = 1 @@ -257,13 +257,13 @@ corner_radius_top_right = 1 corner_radius_bottom_right = 1 corner_radius_bottom_left = 1 -[sub_resource type="StyleBoxFlat" id="46"] +[sub_resource type="StyleBoxFlat" id="43"] draw_center = false border_width_left = 2 border_width_top = 2 border_width_right = 2 border_width_bottom = 2 -border_color = Color(0.701961, 0.701961, 0.701961, 0.588235) +border_color = Color(0.709804, 0.188235, 0.188235, 1) corner_radius_top_left = 1 corner_radius_top_right = 1 corner_radius_bottom_right = 1 @@ -579,12 +579,14 @@ grow_horizontal = 2 grow_vertical = 2 [node name="ProcessPanel" parent="." instance=ExtResource("61")] +layout_mode = 0 offset_left = 2.0 offset_top = 71.0 offset_right = 402.0 offset_bottom = 671.0 [node name="MicrobeCheatMenu" parent="." instance=ExtResource("55")] +layout_mode = 0 offset_left = 10.0 offset_top = 30.0 offset_right = 207.0 @@ -671,10 +673,10 @@ alignment = 1 visible = false layout_mode = 2 tooltip_text = "TOGGLE_ENGULF_TOOLTIP" -theme_override_styles/disabled = SubResource("43") -theme_override_styles/hover = SubResource("1") -theme_override_styles/pressed = SubResource("1") theme_override_styles/normal = SubResource("46") +theme_override_styles/pressed = SubResource("1") +theme_override_styles/hover = SubResource("1") +theme_override_styles/disabled = SubResource("43") toggle_mode = true ActionIcon = ExtResource("9") ActionName = "g_toggle_engulf" @@ -683,9 +685,9 @@ ActionName = "g_toggle_engulf" visible = false layout_mode = 2 tooltip_text = "EJECT_ENGULFED_TOOLTIP" -theme_override_styles/hover = SubResource("1") -theme_override_styles/pressed = SubResource("1") theme_override_styles/normal = SubResource("46") +theme_override_styles/pressed = SubResource("1") +theme_override_styles/hover = SubResource("1") ActionIcon = ExtResource("7") ActionName = "g_eject_engulfed" @@ -693,9 +695,9 @@ ActionName = "g_eject_engulfed" visible = false layout_mode = 2 tooltip_text = "FIRE_TOXIN_TOOLTIP" -theme_override_styles/hover = SubResource("1") -theme_override_styles/pressed = SubResource("1") theme_override_styles/normal = SubResource("46") +theme_override_styles/pressed = SubResource("1") +theme_override_styles/hover = SubResource("1") ActionIcon = ExtResource("10") ActionName = "g_fire_toxin" @@ -703,9 +705,9 @@ ActionName = "g_fire_toxin" visible = false layout_mode = 2 tooltip_text = "TOGGLE_BINDING_TOOLTIP" -theme_override_styles/hover = SubResource("1") -theme_override_styles/pressed = SubResource("1") theme_override_styles/normal = SubResource("46") +theme_override_styles/pressed = SubResource("1") +theme_override_styles/hover = SubResource("1") toggle_mode = true ActionIcon = ExtResource("72") ActionName = "g_toggle_binding" @@ -714,9 +716,9 @@ ActionName = "g_toggle_binding" visible = false layout_mode = 2 tooltip_text = "UNBIND_ALL_TOOLTIP" -theme_override_styles/hover = SubResource("1") -theme_override_styles/pressed = SubResource("1") theme_override_styles/normal = SubResource("46") +theme_override_styles/pressed = SubResource("1") +theme_override_styles/hover = SubResource("1") ActionIcon = ExtResource("70") ActionName = "g_unbind_all" @@ -724,9 +726,9 @@ ActionName = "g_unbind_all" visible = false layout_mode = 2 tooltip_text = "SIGNALING_AGENTS_ACTION_TOOLTIP" -theme_override_styles/hover = SubResource("1") -theme_override_styles/pressed = SubResource("1") theme_override_styles/normal = SubResource("46") +theme_override_styles/pressed = SubResource("1") +theme_override_styles/hover = SubResource("1") toggle_mode = true ActionIcon = ExtResource("68") ActionName = "g_pack_commands" @@ -735,9 +737,9 @@ ActionName = "g_pack_commands" visible = false layout_mode = 2 tooltip_text = "SECRETE_SLIME_TOOLTIP" -theme_override_styles/hover = SubResource("1") -theme_override_styles/pressed = SubResource("1") theme_override_styles/normal = SubResource("46") +theme_override_styles/pressed = SubResource("1") +theme_override_styles/hover = SubResource("1") ActionIcon = ExtResource("21") ActionName = "g_secrete_slime" @@ -745,9 +747,9 @@ ActionName = "g_secrete_slime" visible = false layout_mode = 2 tooltip_text = "SPRINT_ACTION_TOOLTIP" -theme_override_styles/hover = SubResource("1") -theme_override_styles/pressed = SubResource("1") theme_override_styles/normal = SubResource("46") +theme_override_styles/pressed = SubResource("1") +theme_override_styles/hover = SubResource("1") toggle_mode = true ActionIcon = ExtResource("32_qhyce") ActionName = "g_sprint" @@ -756,9 +758,9 @@ ActionName = "g_sprint" visible = false layout_mode = 2 tooltip_text = "MUCOCYST_ACTION_TOOLTIP" -theme_override_styles/hover = SubResource("1") -theme_override_styles/pressed = SubResource("1") theme_override_styles/normal = SubResource("46") +theme_override_styles/pressed = SubResource("1") +theme_override_styles/hover = SubResource("1") toggle_mode = true ActionIcon = ExtResource("33_qrk4q") ActionName = "g_toggle_mucocyst" @@ -767,9 +769,9 @@ ActionName = "g_toggle_mucocyst" visible = false layout_mode = 2 tooltip_text = "SIDEROPHORE_ACTION_TOOLTIP" -theme_override_styles/hover = SubResource("1") -theme_override_styles/pressed = SubResource("1") theme_override_styles/normal = SubResource("46") +theme_override_styles/pressed = SubResource("1") +theme_override_styles/hover = SubResource("1") ActionIcon = ExtResource("34_bs2fk") ActionName = "g_fire_siderophore" @@ -785,9 +787,11 @@ horizontal_alignment = 1 autowrap_mode = 3 [node name="RadialPopup" parent="." instance=ExtResource("1")] +layout_mode = 0 [node name="StagePrototypeConfirm" parent="." instance=ExtResource("64")] custom_minimum_size = Vector2(450, 0) +layout_mode = 0 offset_right = 300.0 offset_bottom = 97.0 @@ -831,12 +835,9 @@ show_percentage = false [connection signal="OnCompoundsToggled" from="BottomLeft/HUDBottomBar" to="." method="CompoundButtonPressed"] [connection signal="OnEnvironmentToggled" from="BottomLeft/HUDBottomBar" to="." method="EnvironmentButtonPressed"] [connection signal="OnHeatToggled" from="BottomLeft/HUDBottomBar" to="." method="HeatViewButtonPressed"] -[connection signal="OnHelpPressed" from="BottomLeft/HUDBottomBar" to="." method="OpenHelp"] -[connection signal="OnMenuPressed" from="BottomLeft/HUDBottomBar" to="." method="OpenMenu"] [connection signal="OnPausePressed" from="BottomLeft/HUDBottomBar" to="." method="PauseButtonPressed"] [connection signal="OnProcessesPressed" from="BottomLeft/HUDBottomBar" to="." method="ProcessPanelButtonPressed"] [connection signal="OnSpeedModeToggled" from="BottomLeft/HUDBottomBar" to="." method="SpeedModeButtonPressed"] -[connection signal="OnStatisticsPressed" from="BottomLeft/HUDBottomBar" to="." method="StatisticsButtonPressed"] [connection signal="OnSuicidePressed" from="BottomLeft/HUDBottomBar" to="." method="OnSuicide"] [connection signal="pressed" from="BottomRight/VBoxContainer/Control/Multicellular" to="." method="OnBecomeMulticellularPressed"] [connection signal="pressed" from="BottomRight/VBoxContainer/Control/Macroscopic" to="." method="OnBecomeMacroscopicPressed"] diff --git a/src/microbe_stage/MicrobeStage.cs b/src/microbe_stage/MicrobeStage.cs index 2face30809..f27cb2cec0 100644 --- a/src/microbe_stage/MicrobeStage.cs +++ b/src/microbe_stage/MicrobeStage.cs @@ -1516,6 +1516,11 @@ protected override void OnLightLevelUpdate() } } + protected override void SaveGame(string name) + { + SaveHelper.Save(name, this); + } + private void UpdateZoomLevels(bool isMulticellular) { if (isMulticellular) @@ -1568,11 +1573,6 @@ private void UpdatePatchLightLevelSettings() .GetCompound(Compound.Sunlight, CompoundAmountType.Biome).Ambient; } - private void SaveGame(string name) - { - SaveHelper.Save(name, this); - } - private void OnFinishLoading() { // TODO: re-read the player entity from the simulation as it is not currently saved (there should be a TODO diff --git a/src/microbe_stage/editor/EditorCommonBottomLeftButtons.cs b/src/microbe_stage/editor/EditorCommonBottomLeftButtons.cs index c2b6e496af..611801250c 100644 --- a/src/microbe_stage/editor/EditorCommonBottomLeftButtons.cs +++ b/src/microbe_stage/editor/EditorCommonBottomLeftButtons.cs @@ -14,12 +14,6 @@ public partial class EditorCommonBottomLeftButtons : MarginContainer private TextureButton helpButton = null!; #pragma warning restore CA2213 - [Signal] - public delegate void OnOpenMenuEventHandler(); - - [Signal] - public delegate void OnOpenHelpEventHandler(); - public override void _Ready() { base._Ready(); @@ -31,17 +25,19 @@ public override void _Ready() private void OnMenuButtonPressed() { GUICommon.Instance.PlayButtonPressSound(); - EmitSignal(SignalName.OnOpenMenu); + PauseMenu.Instance.Open(); } private void OnHelpButtonPressed() { GUICommon.Instance.PlayButtonPressSound(); - EmitSignal(SignalName.OnOpenHelp); + PauseMenu.Instance.OpenToHelp(); } private void OnStatisticsButtonPressed() { + // Bug is fixed in Thriveopedia about duplicate sound playing, so now we play sound here + GUICommon.Instance.PlayButtonPressSound(); ThriveopediaManager.OpenPage("CurrentWorld"); } } diff --git a/src/microbe_stage/editor/MicrobeEditor.tscn b/src/microbe_stage/editor/MicrobeEditor.tscn index c304061890..5cc494c3ed 100644 --- a/src/microbe_stage/editor/MicrobeEditor.tscn +++ b/src/microbe_stage/editor/MicrobeEditor.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=12 format=3 uid="uid://c5rgjinnhip87"] +[gd_scene load_steps=11 format=3 uid="uid://c5rgjinnhip87"] [ext_resource type="PackedScene" uid="uid://hxrn73ihp8r4" path="res://src/microbe_stage/editor/MicrobeEditorWorld.tscn" id="1"] [ext_resource type="Script" uid="uid://bk820nus624i3" path="res://src/microbe_stage/editor/MicrobeEditor.cs" id="2"] @@ -8,17 +8,15 @@ [ext_resource type="PackedScene" uid="uid://qdqcbnri7vsw" path="res://src/microbe_stage/editor/MicrobeEditorReportComponent.tscn" id="6"] [ext_resource type="PackedScene" uid="uid://r0oqu6luui0h" path="res://src/microbe_stage/editor/MicrobeEditorPatchMap.tscn" id="7"] [ext_resource type="PackedScene" uid="uid://cbthqg63bqkhx" path="res://src/microbe_stage/editor/MicrobeEditorCheatMenu.tscn" id="39"] -[ext_resource type="PackedScene" uid="uid://devtugnggmuol" path="res://src/general/PauseMenu.tscn" id="52"] [ext_resource type="Theme" uid="uid://b4cx0o110g4b6" path="res://src/gui_common/thrive_theme.tres" id="53"] [ext_resource type="PackedScene" uid="uid://cahegn58i768h" path="res://src/tutorial/microbe_editor/MicrobeEditorTutorialGUI.tscn" id="85"] -[node name="MicrobeEditor" type="Node" node_paths=PackedStringArray("reportTab", "patchMapTab", "cellEditorTab", "pauseMenu", "editorTabSelector", "editorGUIBaseNode")] +[node name="MicrobeEditor" type="Node" node_paths=PackedStringArray("reportTab", "patchMapTab", "cellEditorTab", "editorTabSelector", "editorGUIBaseNode")] process_priority = -1 script = ExtResource("2") reportTab = NodePath("MicrobeEditorGUI/Report") patchMapTab = NodePath("MicrobeEditorGUI/PatchMap") cellEditorTab = NodePath("MicrobeEditorGUI/CellEditor") -pauseMenu = NodePath("PauseMenu") editorTabSelector = NodePath("MicrobeEditorGUI/MicrobeEditorTabButtons") editorGUIBaseNode = NodePath("MicrobeEditorGUI") @@ -67,17 +65,13 @@ offset_right = 154.0 grow_vertical = 0 [node name="MicrobeEditorCheatMenu" parent="MicrobeEditorGUI" instance=ExtResource("39")] +layout_mode = 0 offset_left = 10.0 offset_top = 30.0 [node name="TutorialGUI" parent="." instance=ExtResource("85")] visible = false -[node name="PauseMenu" parent="." instance=ExtResource("52")] - [connection signal="OnTabSelected" from="MicrobeEditorGUI/MicrobeEditorTabButtons" to="." method="SetEditorTab"] -[connection signal="OnOpenHelp" from="MicrobeEditorGUI/EditorCommonBottomLeftButtons" to="PauseMenu" method="OpenToHelp"] -[connection signal="OnOpenMenu" from="MicrobeEditorGUI/EditorCommonBottomLeftButtons" to="PauseMenu" method="Open"] -[connection signal="MakeSave" from="PauseMenu" to="." method="SaveGame"] [editable path="EditorWorld"] diff --git a/src/multicellular_stage/editor/MulticellularEditor.cs b/src/multicellular_stage/editor/MulticellularEditor.cs index 9c78aaf85b..4b9c40783d 100644 --- a/src/multicellular_stage/editor/MulticellularEditor.cs +++ b/src/multicellular_stage/editor/MulticellularEditor.cs @@ -65,6 +65,8 @@ public override bool CanCancelAction // tolerances implementation) public IReadOnlyList? EditedCellOrganelles => null; + public override MainGameState GameState => MainGameState.MulticellularEditor; + public override ushort CurrentArchiveVersion => SERIALIZATION_VERSION; public override ArchiveObjectType ArchiveObjectType => diff --git a/src/multicellular_stage/editor/MulticellularEditor.tscn b/src/multicellular_stage/editor/MulticellularEditor.tscn index 322f0cae25..f365e53fcf 100644 --- a/src/multicellular_stage/editor/MulticellularEditor.tscn +++ b/src/multicellular_stage/editor/MulticellularEditor.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=11 format=3 uid="uid://80exn4x2sdv7"] +[gd_scene load_steps=10 format=3 uid="uid://80exn4x2sdv7"] [ext_resource type="Script" uid="uid://03l7xhf0xnm4" path="res://src/multicellular_stage/editor/MulticellularEditor.cs" id="1_kpf0e"] [ext_resource type="PackedScene" uid="uid://hxrn73ihp8r4" path="res://src/microbe_stage/editor/MicrobeEditorWorld.tscn" id="2_aqkc2"] @@ -9,16 +9,14 @@ [ext_resource type="PackedScene" uid="uid://r0oqu6luui0h" path="res://src/microbe_stage/editor/MicrobeEditorPatchMap.tscn" id="7_7emny"] [ext_resource type="PackedScene" uid="uid://d0qfhc2op1auc" path="res://src/microbe_stage/editor/MicrobeEditorTabButtons.tscn" id="8_ed1b2"] [ext_resource type="PackedScene" uid="uid://de2sohb3fjvc1" path="res://src/microbe_stage/editor/EditorCommonBottomLeftButtons.tscn" id="9_v3ojp"] -[ext_resource type="PackedScene" uid="uid://devtugnggmuol" path="res://src/general/PauseMenu.tscn" id="10_vh50g"] -[node name="MulticellularEditor" type="Node" node_paths=PackedStringArray("reportTab", "patchMapTab", "bodyPlanEditorTab", "cellEditorTab", "noCellTypeSelected", "pauseMenu", "editorTabSelector", "editorGUIBaseNode")] +[node name="MulticellularEditor" type="Node" node_paths=PackedStringArray("reportTab", "patchMapTab", "bodyPlanEditorTab", "cellEditorTab", "noCellTypeSelected", "editorTabSelector", "editorGUIBaseNode")] script = ExtResource("1_kpf0e") reportTab = NodePath("EarlyMulticellularEditorGUI/Report") patchMapTab = NodePath("EarlyMulticellularEditorGUI/PatchMap") bodyPlanEditorTab = NodePath("EarlyMulticellularEditorGUI/CellBodyPlanEditorComponent") cellEditorTab = NodePath("EarlyMulticellularEditorGUI/CellEditor") noCellTypeSelected = NodePath("EarlyMulticellularEditorGUI/NoCellSelected") -pauseMenu = NodePath("PauseMenu") editorTabSelector = NodePath("EarlyMulticellularEditorGUI/MicrobeEditorTabButtons") editorGUIBaseNode = NodePath("EarlyMulticellularEditorGUI") @@ -82,12 +80,7 @@ layout_mode = 2 text = "SELECT_CELL_TYPE_FROM_EDITOR" horizontal_alignment = 1 -[node name="PauseMenu" parent="." instance=ExtResource("10_vh50g")] - [connection signal="OnCellTypeToEditSelected" from="EarlyMulticellularEditorGUI/CellBodyPlanEditorComponent" to="." method="OnStartEditingCellType"] [connection signal="OnTabSelected" from="EarlyMulticellularEditorGUI/MicrobeEditorTabButtons" to="." method="SetEditorTab"] -[connection signal="OnOpenHelp" from="EarlyMulticellularEditorGUI/EditorCommonBottomLeftButtons" to="PauseMenu" method="OpenToHelp"] -[connection signal="OnOpenMenu" from="EarlyMulticellularEditorGUI/EditorCommonBottomLeftButtons" to="PauseMenu" method="Open"] -[connection signal="MakeSave" from="PauseMenu" to="." method="SaveGame"] [editable path="EditorWorld"] diff --git a/src/society_stage/SocietyStage.cs b/src/society_stage/SocietyStage.cs index a55bb47233..22dbb0468d 100644 --- a/src/society_stage/SocietyStage.cs +++ b/src/society_stage/SocietyStage.cs @@ -119,6 +119,7 @@ public override void _Process(double delta) HUD.EnsureGameIsUnpausedForEditor(); GD.Print("Starting fade out to industrial stage"); + PauseMenu.Instance.ReportStageTransition(); // The fade is pretty long here to give some time after the camera stops moving before the fade out // is complete diff --git a/src/society_stage/gui/SocietyHUD.tscn b/src/society_stage/gui/SocietyHUD.tscn index 3434c98ad1..0ed8a4add6 100644 --- a/src/society_stage/gui/SocietyHUD.tscn +++ b/src/society_stage/gui/SocietyHUD.tscn @@ -17,26 +17,26 @@ [ext_resource type="LabelSettings" uid="uid://cns7wsfktfld4" path="res://src/gui_common/fonts/Title-SemiBold-Bigger.tres" id="12_3r5as"] [ext_resource type="PackedScene" uid="uid://bdwkyuskd3u3r" path="res://src/microbe_stage/HUDBottomBar.tscn" id="16"] -[sub_resource type="StyleBoxFlat" id="2"] +[sub_resource type="StyleBoxFlat" id="3"] +bg_color = Color(0.168627, 0.0470588, 0.552941, 1) draw_center = false border_width_left = 2 border_width_top = 2 border_width_right = 2 border_width_bottom = 2 -border_color = Color(1, 1, 1, 0.784314) +border_color = Color(0.701961, 0.701961, 0.701961, 0.588235) corner_radius_top_left = 1 corner_radius_top_right = 1 corner_radius_bottom_right = 1 corner_radius_bottom_left = 1 -[sub_resource type="StyleBoxFlat" id="3"] -bg_color = Color(0.168627, 0.0470588, 0.552941, 1) +[sub_resource type="StyleBoxFlat" id="2"] draw_center = false border_width_left = 2 border_width_top = 2 border_width_right = 2 border_width_bottom = 2 -border_color = Color(0.701961, 0.701961, 0.701961, 0.588235) +border_color = Color(1, 1, 1, 0.784314) corner_radius_top_left = 1 corner_radius_top_right = 1 corner_radius_bottom_right = 1 @@ -140,9 +140,9 @@ ActionName = "g_science" layout_mode = 2 tooltip_text = "Possess a member of your species for direct control (as this is a very complex feature this will be the last thing to be added once the strategy stages are complete)" -theme_override_styles/hover = SubResource("2") -theme_override_styles/pressed = SubResource("2") theme_override_styles/normal = SubResource("3") +theme_override_styles/pressed = SubResource("2") +theme_override_styles/hover = SubResource("2") disabled = true ActionIcon = ExtResource("3") ActionName = "g_toggle_engulf" @@ -219,11 +219,8 @@ vertical_alignment = 1 custom_minimum_size = Vector2(8, 5) layout_mode = 2 -[connection signal="OnHelpPressed" from="HUDBottomBar" to="." method="OpenHelp"] -[connection signal="OnMenuPressed" from="HUDBottomBar" to="." method="OpenMenu"] [connection signal="OnPausePressed" from="HUDBottomBar" to="." method="PauseButtonPressed"] [connection signal="OnProcessesPressed" from="HUDBottomBar" to="." method="OpenResearchScreen"] -[connection signal="OnStatisticsPressed" from="HUDBottomBar" to="." method="StatisticsButtonPressed"] [connection signal="pressed" from="ScrollContainer/HotBar/Build" to="." method="ForwardBuildingPlacingRequest"] [connection signal="pressed" from="ScrollContainer/HotBar/Research" to="." method="OpenResearchScreen"] [connection signal="Closed" from="ResearchScreen" to="." method="ResearchScreenClosed"] diff --git a/src/space_stage/SpaceStage.cs b/src/space_stage/SpaceStage.cs index d3c8284fec..7d3031488b 100644 --- a/src/space_stage/SpaceStage.cs +++ b/src/space_stage/SpaceStage.cs @@ -444,6 +444,8 @@ public void OnReturnedFromAscension() // Show the congratulations popup for being ascended (once we are back in the stage) showAscensionCongratulations = true; + + PauseMenu.Instance.ReportEnterGameState(GameState, CurrentGame); } public void OnBecomeAscended() @@ -592,6 +594,7 @@ private void OnConfirmMoveToAscension() strategicCamera.AllowPlayerInput = false; HUD.CloseAllOpenWindows(); + PauseMenu.Instance.ReportStageTransition(); PauseManager.Instance.Resume(nameof(ascensionMoveConfirmationPopup)); } diff --git a/src/space_stage/gui/SpaceHUD.tscn b/src/space_stage/gui/SpaceHUD.tscn index 1ee4f83844..d27114875f 100644 --- a/src/space_stage/gui/SpaceHUD.tscn +++ b/src/space_stage/gui/SpaceHUD.tscn @@ -17,6 +17,7 @@ structurePopup = NodePath("SpaceStructureInfoPopup") descendButton = NodePath("Descend") [node name="AddWindowReorderingSupportToSiblings" parent="." index="0" instance=ExtResource("5")] +layout_mode = 0 [node name="BottomRight" parent="." index="1"] visible = false @@ -69,6 +70,7 @@ offset_bottom = 34.5 grow_vertical = 2 [node name="SpaceConstructionPopup" parent="." index="12" instance=ExtResource("6")] +layout_mode = 0 anchors_preset = 0 anchor_right = 0.0 anchor_bottom = 0.0