Made quest visuals
This commit is contained in:
@@ -7,6 +7,8 @@ namespace Babushka.scripts.CSharp.Common.Quest;
|
||||
public partial class QuestListItemUi : Control
|
||||
{
|
||||
private Button TitleButton => GetNode<Button>("TitleButton");
|
||||
private Label TitleLabel => GetNode<Label>("TitleButton/HBoxContainer/TitleText");
|
||||
private TextureRect CircleTexture => GetNode<TextureRect>("TitleButton/Circled");
|
||||
private QuestResource? _questResource;
|
||||
|
||||
public void UpdateButton(QuestResource questResource)
|
||||
@@ -22,13 +24,19 @@ public partial class QuestListItemUi : Control
|
||||
_ => ""
|
||||
};
|
||||
|
||||
UpdateCircled(questResource == QuestManager.Instance.GetFollowQuest());
|
||||
ShowName(name);
|
||||
TitleButton.Pressed += ClickedTitleButton;
|
||||
|
||||
}
|
||||
|
||||
private void UpdateCircled(bool value)
|
||||
{
|
||||
CircleTexture.Visible = value;
|
||||
}
|
||||
|
||||
private void ShowName(string questResourceTitle)
|
||||
{
|
||||
TitleButton.Text = questResourceTitle;
|
||||
TitleLabel.Text = questResourceTitle;
|
||||
}
|
||||
|
||||
public void ClickedTitleButton()
|
||||
|
||||
@@ -8,6 +8,15 @@ 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();
|
||||
@@ -23,5 +32,22 @@ public partial class QuestLog : Control
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -30,8 +30,6 @@ public partial class QuestMessagePopup : Control
|
||||
|
||||
private void NewActiveQuest()
|
||||
{
|
||||
GD.Print("NewActiveQuest");
|
||||
|
||||
var shownQuest = QuestManager.Instance!.GetFollowQuest();
|
||||
if (_currentlyShown == shownQuest)
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user