UI相关优化补充
This commit is contained in:
@@ -131,21 +131,11 @@ namespace BaseGames.UI
|
||||
// ── 动画协程 ──────────────────────────────────────────────────────────
|
||||
|
||||
private IEnumerator SlideTo(Vector2 target)
|
||||
{
|
||||
Vector2 start = _rect.anchoredPosition;
|
||||
float t = 0;
|
||||
while (t < _slideDuration)
|
||||
{
|
||||
_rect.anchoredPosition = Vector2.Lerp(start, target, t / _slideDuration);
|
||||
t += Time.unscaledDeltaTime;
|
||||
yield return null;
|
||||
}
|
||||
_rect.anchoredPosition = target;
|
||||
}
|
||||
=> UITween.MoveAnchored(_rect, target, _slideDuration);
|
||||
|
||||
private IEnumerator SlideOut()
|
||||
{
|
||||
yield return SlideTo(_hiddenPos);
|
||||
yield return UITween.MoveAnchored(_rect, _hiddenPos, _slideDuration);
|
||||
gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user