using System; using System.Collections; using System.Collections.Generic; using BITKit; using BITKit.Mod; using BITKit.StateMachine; using BITKit.UX; using Cysharp.Threading.Tasks; using UnityEngine; using UnityEngine.UIElements; namespace Net.Project.B.PDA { public abstract class PDAApp:StateAsync,IAppClass where T:IApp,new() { public Type AppType => typeof(T); public readonly T App = new T(); protected PDAApp() { Routes = new[] {$"/{GetType().Name}" }; } public IReadOnlyList Routes { get; } public virtual UniTask GetPage(string route) { RootVisualElement.Navigate(route); return UniTask.FromResult(RootVisualElement); } protected abstract string DocumentPath { get; } protected VisualElement RootVisualElement { get; private set; } public override async UniTask InitializeAsync() { var template = await ModService.LoadAsset(DocumentPath); RootVisualElement = template.CloneTree(); UXUtils.Inject(this,RootVisualElement); } } }