29 lines
697 B
C#
29 lines
697 B
C#
|
using Godot;
|
||
|
using System;
|
||
|
using System.Text;
|
||
|
using BITKit.Core.Entites;
|
||
|
namespace BITKit;
|
||
|
|
||
|
[Tool]
|
||
|
public partial class QuestService : Node
|
||
|
{
|
||
|
private static IEntitiesService entitiesService => DI.Get<IEntitiesService>();
|
||
|
|
||
|
[Export]
|
||
|
[ReadOnly]
|
||
|
public string quests;
|
||
|
|
||
|
public override void _Process(double delta)
|
||
|
{
|
||
|
if (Engine.IsEditorHint()) return;
|
||
|
var stringBuilder= new StringBuilder();
|
||
|
foreach (var (quest, condition) in entitiesService.QueryComponents<QuestComponent, ConditionComponent>())
|
||
|
{
|
||
|
quest.QuestCompleted = condition.OnCheck();
|
||
|
//stringBuilder.AppendLine($"{quest.Name}:{quest.QuestCompleted?"已完成":"未完成"}");
|
||
|
}
|
||
|
|
||
|
quests = stringBuilder.ToString();
|
||
|
}
|
||
|
}
|