Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Commit 363ca8b

Browse files
author
wanderer
committed
修复UI异步回收UITween的bug
1 parent 5aebc98 commit 363ca8b

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

‎GameFramework/Runtime/UI/UIManager.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ public void OnUpdate()
391391
//自动回收UITween
392392
for (int i = 0; i < _activeTweeners.Count; i++)
393393
{
394-
if (!_activeTweeners[i].HasAnims)
394+
if (_activeTweeners[i].CanRecycle)
395395
{
396396
UITweePool.Release(_activeTweeners[i]);
397397
_activeTweeners.RemoveAt(i);

‎GameFramework/Runtime/UI/UITween.cs‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,15 @@ internal class UITween : IUITween
3737
private Action<UIView, UIView> _onAnimComplete;
3838
private Action<IUIAnimation, IUIAnimation> _onAnimChanged;
3939
private List<IUIAnimation> _anims=new List<IUIAnimation>();
40-
//含有动画
41-
public bool HasAnims
40+
41+
/// <summary>
42+
/// 可以回收
43+
/// </summary>
44+
public bool CanRecycle
4245
{
4346
get
4447
{
45-
return _anims.Count >0;
48+
return _anims.Count ==0&&_onUITweenReadyAsync==null;
4649
}
4750
}
4851

@@ -150,6 +153,7 @@ public IUITween OnAnimationStart(Action<UIView, UIView> onAnimStart)
150153
public void SetUITweenReadyAsync()
151154
{
152155
_onUITweenReadyAsync?.Invoke(this, LastUIView, NextUIView);
156+
_onUITweenReadyAsync = null;
153157
}
154158

155159
public IUITween SetAnimation(IUIAnimation anim)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /