Made basic quest setup
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using Babushka.scripts.CSharp.Common.Quest;
|
||||
|
||||
public partial class QuestListUi : VBoxContainer
|
||||
{
|
||||
[Export]
|
||||
private PackedScene _questListItemPrefab;
|
||||
|
||||
public override void _EnterTree()
|
||||
{
|
||||
UpdateList();
|
||||
}
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
UpdateList();
|
||||
}
|
||||
|
||||
public void UpdateList()
|
||||
{
|
||||
// delete children
|
||||
foreach (Node child in GetChildren())
|
||||
{
|
||||
RemoveChild(child);
|
||||
child.QueueFree();
|
||||
}
|
||||
|
||||
// recreate children
|
||||
var activeQuests = QuestManager.Instance.GetActiveQuests();
|
||||
|
||||
foreach (var questPair in activeQuests)
|
||||
{
|
||||
var questResource = questPair.Key;
|
||||
var questStatus = questPair.Value;
|
||||
|
||||
var questListItem = _questListItemPrefab.Instantiate<QuestListItemUi>();
|
||||
questListItem.UpdateButton(questResource);
|
||||
AddChild(questListItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user