改动与优化
This commit is contained in:
@@ -37,6 +37,7 @@ public class UI_SongsSelect_EnterAnim : MonoBehaviour
|
||||
public CanvasGroup canvasGroup;
|
||||
public float baseAlpha;
|
||||
public bool createdCanvasGroup;
|
||||
public bool restoreTransform;
|
||||
}
|
||||
|
||||
private class SelectableState
|
||||
@@ -114,6 +115,7 @@ public class UI_SongsSelect_EnterAnim : MonoBehaviour
|
||||
|
||||
Vector2 basePos = rt.anchoredPosition;
|
||||
float baseAlpha = group.alpha <= 0f ? 1f : group.alpha;
|
||||
bool layoutSensitive = UI_OrderedEntryAnimator.IsLayoutSensitive(rt);
|
||||
|
||||
nodeStates.Add(new NodeState
|
||||
{
|
||||
@@ -121,20 +123,27 @@ public class UI_SongsSelect_EnterAnim : MonoBehaviour
|
||||
basePos = basePos,
|
||||
canvasGroup = group,
|
||||
baseAlpha = baseAlpha,
|
||||
createdCanvasGroup = created
|
||||
createdCanvasGroup = created,
|
||||
restoreTransform = !layoutSensitive
|
||||
});
|
||||
|
||||
rt.DOKill();
|
||||
group.DOKill();
|
||||
|
||||
rt.anchoredPosition = basePos - new Vector2(0f, Mathf.Abs(fromOffsetY));
|
||||
if (!layoutSensitive)
|
||||
{
|
||||
rt.anchoredPosition = basePos - new Vector2(0f, Mathf.Abs(fromOffsetY));
|
||||
}
|
||||
group.alpha = 0f;
|
||||
|
||||
float start = i * Mathf.Max(0f, itemStagger);
|
||||
enterSequence.Insert(start,
|
||||
rt.DOAnchorPos(basePos, Mathf.Max(0.01f, itemDuration))
|
||||
.SetEase(moveEase)
|
||||
.SetUpdate(useUnscaledTime));
|
||||
if (!layoutSensitive)
|
||||
{
|
||||
enterSequence.Insert(start,
|
||||
rt.DOAnchorPos(basePos, Mathf.Max(0.01f, itemDuration))
|
||||
.SetEase(moveEase)
|
||||
.SetUpdate(useUnscaledTime));
|
||||
}
|
||||
enterSequence.Insert(start,
|
||||
group.DOFade(baseAlpha, Mathf.Max(0.01f, itemDuration))
|
||||
.SetEase(fadeEase)
|
||||
@@ -292,7 +301,10 @@ public class UI_SongsSelect_EnterAnim : MonoBehaviour
|
||||
if (st.canvasGroup != null)
|
||||
st.canvasGroup.DOKill();
|
||||
|
||||
st.rect.anchoredPosition = st.basePos;
|
||||
if (st.restoreTransform)
|
||||
{
|
||||
st.rect.anchoredPosition = st.basePos;
|
||||
}
|
||||
if (st.canvasGroup != null)
|
||||
st.canvasGroup.alpha = st.baseAlpha;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user