#nullable enable using Godot; using System; using Babushka.scripts.CSharp.Common.Quest; public partial class QuestLog : Control { [Signal] public delegate void DetailQuestChangedEventHandler(QuestLog questLog); [Export] private Vector2 _closedPos; [Export] private Vector2 _openedPos; private bool _isClosed = true; private Tween? _closeOpenTween; public QuestResource? currentDetailQuest { get => QuestManager.Instance!.GetFollowQuest(); set { QuestManager.Instance!.SetFollowQuest(value); // TODO: fix setup EmitSignalDetailQuestChanged(this); } } public override void _EnterTree() { QuestManager.Instance!.QuestsChanged += () => EmitSignalDetailQuestChanged(this); } public override void _Input(InputEvent inputEvent) { if (inputEvent.IsActionPressed("ui_inventory_journal_open_close")) { if(_closeOpenTween != null) _closeOpenTween.Kill(); _isClosed = !_isClosed; _closeOpenTween = GetTree().CreateTween(); _closeOpenTween .TweenProperty(this, "position", _isClosed ? _closedPos : _openedPos, 0.5) .SetEase(Tween.EaseType.Out) .SetTrans(Tween.TransitionType.Cubic); } } //private QuestResource? _currentDetailQuestBacking; }