超大量的更新 修复很多问题,gameplay特效初步

This commit is contained in:
FloatGaming
2026-02-14 23:46:20 +08:00
parent ef8eb67259
commit 3a7a0b4669
360 changed files with 85670 additions and 4144 deletions
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using DG.Tweening;
using UnityEngine;
using UnityEngine.UI;
public class UI_SelectSong_EnterAnim : MonoBehaviour
{
@@ -20,6 +21,8 @@ public class UI_SelectSong_EnterAnim : MonoBehaviour
[SerializeField] float slideX = 180f;
[SerializeField] float slideY = 120f;
[SerializeField] float bgScaleFrom = 1.06f;
[SerializeField] bool useUnscaledTime = true;
[SerializeField] bool ensureVisibleOnComplete = true;
RectTransform root;
RectTransform bg;
@@ -83,7 +86,7 @@ public class UI_SelectSong_EnterAnim : MonoBehaviour
return;
}
bg = bg != null ? bg : FindRect(root, "BG");
bg = bg != null ? bg : FindPreferredSelectSceneBg();
leftDlc = leftDlc != null ? leftDlc : FindRect(root, "left_select_dlc");
songScroll = songScroll != null ? songScroll : FindRect(root, "SongScrollView");
rightInfos = rightInfos != null ? rightInfos : FindRect(root, "rightInfos");
@@ -130,6 +133,28 @@ public class UI_SelectSong_EnterAnim : MonoBehaviour
return null;
}
RectTransform FindPreferredSelectSceneBg()
{
// Prefer the scene root object named "bg" that owns a Canvas
// (the one shown in your hierarchy screenshot), not the legacy inactive "BG".
Transform[] all = Resources.FindObjectsOfTypeAll<Transform>();
for (int i = 0; i < all.Length; i++)
{
Transform t = all[i];
if (t == null) continue;
GameObject go = t.gameObject;
if (go == null || !go.scene.IsValid()) continue;
if (!string.Equals(t.name, "bg", System.StringComparison.OrdinalIgnoreCase)) continue;
if (go.GetComponent<Canvas>() == null) continue;
return t as RectTransform;
}
// Fallbacks for older scene hierarchy.
RectTransform fallback = FindRect(root, "BG");
if (fallback != null) return fallback;
return FindRect(root, "bg");
}
void CacheBase(RectTransform rect)
{
if (rect == null)
@@ -196,7 +221,7 @@ public class UI_SelectSong_EnterAnim : MonoBehaviour
void BuildSequence()
{
enterSeq = DOTween.Sequence();
enterSeq = DOTween.Sequence().SetUpdate(useUnscaledTime);
float t = delay;
if (bg != null && bg.gameObject.activeInHierarchy)
@@ -204,11 +229,11 @@ public class UI_SelectSong_EnterAnim : MonoBehaviour
CanvasGroup group = EnsureCanvasGroup(bg);
if (group != null)
{
enterSeq.Insert(t, group.DOFade(1f, panelTime).SetEase(ease));
enterSeq.Insert(t, group.DOFade(1f, panelTime).SetEase(ease).SetUpdate(useUnscaledTime));
}
if (baseScale.TryGetValue(bg, out Vector3 scale))
{
enterSeq.Insert(t, bg.DOScale(scale, panelTime).SetEase(ease));
enterSeq.Insert(t, bg.DOScale(scale, panelTime).SetEase(ease).SetUpdate(useUnscaledTime));
}
}
@@ -229,6 +254,11 @@ public class UI_SelectSong_EnterAnim : MonoBehaviour
InsertScale(enterDetail, t + 0.35f, buttonTime);
InsertScale(quickEnter, t + 0.38f, buttonTime);
if (ensureVisibleOnComplete)
{
enterSeq.OnComplete(SnapAllToVisibleFinalState);
}
}
void InsertSlide(RectTransform rect, float at, float time)
@@ -240,12 +270,12 @@ public class UI_SelectSong_EnterAnim : MonoBehaviour
CacheBase(rect);
if (basePos.TryGetValue(rect, out Vector2 pos))
{
enterSeq.Insert(at, rect.DOAnchorPos(pos, time).SetEase(ease));
enterSeq.Insert(at, rect.DOAnchorPos(pos, time).SetEase(ease).SetUpdate(useUnscaledTime));
}
CanvasGroup group = EnsureCanvasGroup(rect);
if (group != null)
{
enterSeq.Insert(at, group.DOFade(1f, time).SetEase(ease));
enterSeq.Insert(at, group.DOFade(1f, time).SetEase(ease).SetUpdate(useUnscaledTime));
}
}
@@ -258,12 +288,54 @@ public class UI_SelectSong_EnterAnim : MonoBehaviour
CacheBase(rect);
if (baseScale.TryGetValue(rect, out Vector3 scale))
{
enterSeq.Insert(at, rect.DOScale(scale, time).SetEase(ease));
enterSeq.Insert(at, rect.DOScale(scale, time).SetEase(ease).SetUpdate(useUnscaledTime));
}
CanvasGroup group = EnsureCanvasGroup(rect);
if (group != null)
{
enterSeq.Insert(at, group.DOFade(1f, time).SetEase(ease));
enterSeq.Insert(at, group.DOFade(1f, time).SetEase(ease).SetUpdate(useUnscaledTime));
}
}
void SnapAllToVisibleFinalState()
{
SnapVisible(bg, applyScale: true);
SnapVisible(leftDlc, applyScale: false);
SnapVisible(songScroll, applyScale: false);
SnapVisible(rightInfos, applyScale: false);
SnapVisible(songTitle, applyScale: false);
SnapVisible(dlcTitle, applyScale: false);
SnapVisible(quickEnter, applyScale: true);
SnapVisible(enterDetail, applyScale: true);
for (int i = 0; i < difficultyItems.Count; i++)
{
SnapVisible(difficultyItems[i], applyScale: false);
}
}
void SnapVisible(RectTransform rect, bool applyScale)
{
if (rect == null) return;
if (!rect.gameObject.activeSelf) rect.gameObject.SetActive(true);
CacheBase(rect);
if (basePos.TryGetValue(rect, out Vector2 pos))
{
rect.anchoredPosition = pos;
}
if (applyScale && baseScale.TryGetValue(rect, out Vector3 scale))
{
rect.localScale = scale;
}
CanvasGroup group = EnsureCanvasGroup(rect);
if (group != null)
{
group.alpha = 1f;
group.interactable = true;
group.blocksRaycasts = true;
}
}