using Cthangover.Core.Audio; using Cthangover.Core.Mods; using Cthangover.Core.Mods.Resolvers; using Cthangover.Core.Scenes; using Cthangover.Core.Settings; using Cthangover.Core.UI.Base.Lists; using Cthangover.Core.Utils; using Godot; namespace Cthangover.TurnBattle { /// /// Defeat screen widget. Minimal compared to WingroundBehaviour — /// only sets the deadground background texture (resolved from mods) /// and offers a Main Menu button that clears BattleData and reloads /// the menu scene. No loot, no EXP. /// public partial class DeadgroundBehaviour : TransitionWidget { /// /// Clears battle data and switches to the main menu scene. /// Bound to the "Main Menu" button on the defeat screen. /// public void ToMainMenuClick() { var sceneService = GetNode("/root/GodotSceneService"); sceneService?.SwitchToMenu(); GameData.Instance.Runtime.BattleData = null; } /// /// Plays the defeat sound, resolves the deadground background /// texture from mods, and shows the transition widget. /// public override void Show() { GameLogger.Log("BATTLE", $"Deadground.Show() ENTER: Visible={Visible}, GodotVisible={base.Visible}", LogLevel.Debug); var audioService = GetNode("/root/AudioService"); audioService?.PlaySound("battle/deadground", SoundType.UI); var bg = GetNodeOrNull("TransitionBg"); GameLogger.Log("BATTLE", $"Deadground.Show: TransitionBg={(bg != null ? "found" : "NULL")}, texture={(bg?.Texture != null ? "has" : "null")}", LogLevel.Error); if (bg != null && bg.Texture == null) { var tex = Textures.Resolve("deadground"); GameLogger.Log("BATTLE", $"Deadground.Show: ResolveTexture('deadground') = {(tex != null ? "loaded" : "NULL")}", LogLevel.Error); bg.Texture = tex; } base.Show(); GameLogger.Log("BATTLE", $"Deadground.Show() EXIT: Visible={Visible}, GodotVisible={base.Visible}", LogLevel.Debug); } } }