using Godot; using System; using System.Diagnostics; using System.IO; using System.Linq; using System.Linq.Expressions; using System.Threading; using BITKit; using BITKit.IO; using Microsoft.Extensions.DependencyInjection; using Cysharp.Threading.Tasks; namespace BITKit.UX; public partial class PlaybackService : UXPanel { [Export] private string path; [Export] private Node root; [Export] private Label label; [Export] private PackedScene template; [Export] private PackedScene labelTemplate; [Export] private DataPlayer dataPlayer; private CancellationTokenSource cancellationTokenSource; public PlaybackService() { BITApp.ServiceCollection.AddSingleton(this); } public override void _Ready() { cancellationTokenSource = new CancellationTokenSource(); //OnExit(); } public override void _ExitTree() { cancellationTokenSource.Cancel(); } private void NoEntry() //public override void OnEntry() { cancellationTokenSource.Token.ThrowIfCancellationRequested(); var files = new DirectoryInfo(PathHelper.GetFolderPath("Demos", GetTree().CurrentScene.Name)) .GetFiles() .Where(x => x.Extension is ".demo"); ; foreach (var x in files) { var playableInfo = BITAssets.ReadAs(x.FullName); var instance = template.Instantiate