using Cysharp.Threading.Tasks; using UnityEngine.UIElements; namespace DanieleMarotta.RiversongCodeShowcase { [GameSystemGroup(typeof(UISystemGroup))] [InitializeAfter(typeof(UIInitializationSystem))] public abstract class UIControllerSystem : GameSystem, IInitializable { protected UIControllerSystem(IServiceLocator serviceLocator) : base(serviceLocator) { } [field: InjectService] protected UIService UIService { get; } protected IUIRoot UIRoot => UIService.UIRoot; public virtual UniTask InitializeAsync() { return UniTask.CompletedTask; } } [GameSystemGroup(typeof(UISystemGroup))] [InitializeAfter(typeof(UIInitializationSystem))] public abstract class UIControllerSystem : UIControllerSystem where T : UIView { private Button _closeButton; protected UIControllerSystem(IServiceLocator serviceLocator) : base(serviceLocator) { } protected abstract T View { get; } public override async UniTask InitializeAsync() { await base.InitializeAsync(); _closeButton = View.RootElement.Q