You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
933 B
34 lines
933 B
#nullable enable
|
|
using System;
|
|
using Babushka.scripts.CSharp.Common.Util;
|
|
using Godot;
|
|
namespace Babushka.scripts.CSharp.Common.Quest;
|
|
|
|
public partial class QuestListItemUi : Control
|
|
{
|
|
private Button TitleButton => GetNode<Button>("TitleButton");
|
|
private QuestResource? _questResource;
|
|
|
|
public void UpdateButton(QuestResource questResource)
|
|
{
|
|
_questResource = questResource;
|
|
ShowName(questResource.title);
|
|
TitleButton.Pressed += ClickedTitleButton;
|
|
}
|
|
|
|
private void ShowName(string questResourceTitle)
|
|
{
|
|
TitleButton.Text = questResourceTitle;
|
|
}
|
|
|
|
public void ClickedTitleButton()
|
|
{
|
|
var questLog = this.FindParentByType<QuestLog>();
|
|
if (_questResource == null)
|
|
{
|
|
throw new ArgumentNullException(nameof(_questResource), "QuestResource is null");
|
|
}
|
|
questLog.currentDetailQuest = _questResource;
|
|
}
|
|
}
|