This commit is contained in:
CortexCore
2024-08-02 14:34:53 +08:00
parent d48a4abe1a
commit a256dc33ed
4 changed files with 8 additions and 1 deletions

View File

@@ -59,6 +59,7 @@ namespace BITKit
public static async UniTask UniTaskFunc<T0,T1,T2>(this Func<T0,T1,T2,UniTask> self,T0 arg0,T1 arg1,T2 arg2) public static async UniTask UniTaskFunc<T0,T1,T2>(this Func<T0,T1,T2,UniTask> self,T0 arg0,T1 arg1,T2 arg2)
{ {
if(self is null)return;
List<UniTask> tasks = new List<UniTask>(); List<UniTask> tasks = new List<UniTask>();
foreach (var func in self.CastAsFunc()) foreach (var func in self.CastAsFunc())
{ {

View File

@@ -100,6 +100,10 @@ namespace BITKit
{ {
return; return;
} }
catch (Exception e)
{
BIT4Log.LogException(e);
}
currentElement.IsEntered = false; currentElement.IsEntered = false;
OnExit?.Invoke(currentElement); OnExit?.Invoke(currentElement);
} }

View File

@@ -149,12 +149,13 @@ namespace BITKit.UX
} }
isActive = true; isActive = true;
} }
async UniTask IEntryElement.EntryAsync() public virtual async UniTask EntryAsync()
{ {
if (entryDuration.Allow is false) return; if (entryDuration.Allow is false) return;
while (CurrentOpacity < 1 && TargetOpacity is 1) while (CurrentOpacity < 1 && TargetOpacity is 1)
{ {
await UniTask.NextFrame(cancellationToken); await UniTask.NextFrame(cancellationToken);
if(destroyCancellationToken.IsCancellationRequested)return;
} }
} }
void IEntryElement.Entered() void IEntryElement.Entered()

View File

@@ -603,6 +603,7 @@ namespace BITKit
self.SetActive(visibleOnEmpty || result); self.SetActive(visibleOnEmpty || result);
return result; return result;
} }
public static T Get<T>(this VisualElement self ,int index = 0) where T : VisualElement => self.Q<T>($"{typeof(T).Name}--{index}");
public static T Create<T>(this VisualElement self, string name = Constant.EmetyString) where T : VisualElement, new() public static T Create<T>(this VisualElement self, string name = Constant.EmetyString) where T : VisualElement, new()
{ {
var element = new T(); var element = new T();