using Cthangover.Core.UI; using Cthangover.Core.UI.Theming; using Godot; using Cthangover.Mods.Interface.Base.Lists; using Cthangover.Mods.Interface.View; namespace Cthangover.CardBattle.UI { /// /// Root of the card battle interface rebuilt from the mockup /// (mockups/card_battle). The whole layout lives in /// scenes/card_battle_screen.tscn and is composed of the mockup's /// parts: the HUD window, the enemy and party card panels, the "Действия" /// window, the battle journal, the turn banner and the end-turn button. /// This class is the single assembly point: it constructs every child widget /// once (mod widgets are not auto-constructed by Godot) and exposes them to /// the battle core and the input controller, so neither has to walk the /// scene tree by hand. /// public partial class CardBattleScreen : ModWidget { /// Top-left window with the phase badge, round and enemy count. public BattleHud Hud { get; private set; } /// Panel that manages the enemy card row(s); aligned right. public BattleCardPanel EnemyPanel { get; private set; } /// Panel that manages the party card row; aligned left. public BattleCardPanel PlayerPanel { get; private set; } /// Lower-right "Действия" window with the action card grid. public BattleActionsPanel ActionsPanel { get; private set; } /// Battle journal window that renders entries. public BattleLogPanel LogPanel { get; private set; } /// Centre-screen turn banner. public BattleBanner Banner { get; private set; } /// End-turn button in the top-right corner, next to the battle speed bar. public EndTurnButton EndTurnButton { get; private set; } /// Global input handler that drives selection and drag-and-drop. public CardController Controller { get; private set; } /// /// Canvas layer above the whole battle UI (layer 100). The dragged action /// card is temporarily reparented here, so it always renders over enemy /// and party cards regardless of their Z-index inside the panels. /// public CanvasLayer DragLayer { get; private set; } /// Assembles the full card-battle screen: panels, HUD, banner, log and drag layer. protected override void Construct() { CthangoverTheme.Apply(this); Hud = GetNode("Hud"); Hud.EnsureConstructed(); EnemyPanel = GetNode("EnemyPanel"); EnemyPanel.EnsureConstructed(); EnemyPanel.AlignType = "Right"; PlayerPanel = GetNode("PlayerPanel"); PlayerPanel.EnsureConstructed(); ActionsPanel = GetNode("ActionsPanel"); ActionsPanel.EnsureConstructed(); LogPanel = GetNode("LogPanel"); LogPanel.EnsureConstructed(); Banner = GetNode("Banner"); Banner.EnsureConstructed(); EndTurnButton = GetNode("EndTurnButton"); EndTurnButton.EnsureConstructed(); Controller = GetNode("CardController"); DragLayer = GetNode("DragLayer"); } /// /// Releases every widget when the battle scene is cleared: cards, action /// deck, journal rows, banner and the end-turn button. Called by the /// battle core on OnBattleCleared. /// public void Clear() { EnemyPanel.ClearAll(); PlayerPanel.ClearAll(); ActionsPanel.ClearBody(); ActionsPanel.ClearSubject(); LogPanel.Clear(); Banner.Clear(); EndTurnButton.SetVisible(false); } } }