refactor
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 01849df87c1948778a9155b635cb0a8f
|
||||
timeCreated: 1743252918
|
||||
@@ -1,9 +1,11 @@
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using System;
|
||||
using UnityEngine.UIElements;
|
||||
|
||||
namespace RebootKit.Engine.UI {
|
||||
public interface IView {
|
||||
UniTask Show(CancellationToken cancellationToken);
|
||||
UniTask Hide(CancellationToken cancellationToken);
|
||||
public interface IViewBuilder {
|
||||
VisualElement Build();
|
||||
}
|
||||
|
||||
public interface IView : IDisposable, IViewBuilder {
|
||||
}
|
||||
}
|
||||
@@ -84,7 +84,7 @@ namespace RebootKit.Engine.UI {
|
||||
label.AddToClassList(Classes.k_Label);
|
||||
return label;
|
||||
}
|
||||
|
||||
|
||||
public static LabelBuilder New(string text) => new(text);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
using System.Threading;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Profiling;
|
||||
using UnityEngine.UIElements;
|
||||
using Logger = RebootKit.Engine.Foundation.Logger;
|
||||
@@ -12,18 +10,9 @@ namespace RebootKit.Engine.UI {
|
||||
[SerializeField] UIDocument m_Document;
|
||||
|
||||
void OnEnable() {
|
||||
s_logger.Debug("START");
|
||||
Rebuild();
|
||||
}
|
||||
|
||||
public async UniTask Show(CancellationToken cancellationToken) {
|
||||
await UniTask.Yield(cancellationToken);
|
||||
}
|
||||
|
||||
public async UniTask Hide(CancellationToken cancellationToken) {
|
||||
await UniTask.Yield(cancellationToken);
|
||||
}
|
||||
|
||||
protected void Rebuild() {
|
||||
Profiler.BeginSample("UI Tree Build");
|
||||
VisualElement child = Build();
|
||||
@@ -34,5 +23,13 @@ namespace RebootKit.Engine.UI {
|
||||
}
|
||||
|
||||
public abstract VisualElement Build();
|
||||
public void Show() {
|
||||
}
|
||||
|
||||
public void Hide() {
|
||||
}
|
||||
|
||||
public void Dispose() {
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user