using System.Collections.Generic; using Cthangover.Core.Audio; using Cthangover.Core.Mods; using Cthangover.Core.Mods.Resolvers; using Cthangover.Mods.Dialog.Action; using Cthangover.Mods.Dialog.Action.Impls; using Cthangover.Mods.Dialog.Executable; using Cthangover.Core.Utils; using Godot; using Cthangover.Core.UI; using Cthangover.Mods.Interface.Base.Lists; using Cthangover.Core.UI.Dialog; using Cthangover.Core.UI.Event; using Cthangover.Core.UI.Executable; using Cthangover.Core.Scenarios; using Cthangover.Core.Scenes; using Cthangover.Core.Interactive; namespace Cthangover.Mods.Dialog { /// /// The visible dialog UI: dual avatars with shader-based hide-color mode, /// answer box spawning, and click/keyboard advance. Validates that no existing /// dialog locker is running before accepting a new queue, ensuring only one /// dialog can occupy the box at a time. Integrates with the audio /// system for skip sounds on mouse click. Uses the same Widget lifecycle but /// overrides HideDestruct to reset avatar textures and release the locker. /// The shader material for avatars is resolved through the mod system on _Ready, /// supporting mod-provided avatar effects. /// public partial class DialogBox : Widget, IDialogBox { [Export] private PackedScene answerBoxScene; [Export] private Label textField; [Export] private Label titleField; [Export] private Control titleBody; [Export] private TextureRect firstAvatar; [Export] private TextureRect secondAvatar; [Export] private Texture2D emptyAvatar; private IAudioService audioService; private AnswerBox answerBox; private SceneTreeTimer waitTimer; /// Resolves the body, text and title labels, avatars and the audio service, and applies the mod-provided avatar shader. protected override void OnReady() { MouseFilter = MouseFilterEnum.Ignore; if (Body == null) { var found = FindChild("DialogBody", true, false); if (found != null) Set("body", found); } audioService = GetNodeOrNull("/root/AudioService") as IAudioService; textField ??= GetNode