改动与优化
This commit is contained in:
@@ -642,18 +642,7 @@ public class GameManager : MonoBehaviour
|
||||
// btm fade out at last
|
||||
yield return StartCoroutine(FadeCanvasGroupAlpha(startup_btmCg, 1f, 0f, startCanvasBtmFadeOut, false));
|
||||
|
||||
cg_startCanvas.alpha = 0f;
|
||||
cg_startCanvas.interactable = false;
|
||||
cg_startCanvas.blocksRaycasts = false;
|
||||
startCanvas.SetActive(false);
|
||||
|
||||
if (extraStartCG != null)
|
||||
{
|
||||
extraStartCG.alpha = 0f;
|
||||
extraStartCG.interactable = false;
|
||||
extraStartCG.blocksRaycasts = false;
|
||||
if (extraStartObject != null) extraStartObject.SetActive(false);
|
||||
}
|
||||
ApplyStartCanvasExitFinalState();
|
||||
|
||||
fade_canvasGroup = null;
|
||||
yield break;
|
||||
@@ -680,18 +669,7 @@ public class GameManager : MonoBehaviour
|
||||
yield return null;
|
||||
}
|
||||
|
||||
cg_startCanvas.alpha = 0f;
|
||||
cg_startCanvas.interactable = false;
|
||||
cg_startCanvas.blocksRaycasts = false;
|
||||
startCanvas.SetActive(false);
|
||||
|
||||
if (extraStartCG != null)
|
||||
{
|
||||
extraStartCG.alpha = 0f;
|
||||
extraStartCG.interactable = false;
|
||||
extraStartCG.blocksRaycasts = false;
|
||||
if (extraStartObject != null) extraStartObject.SetActive(false);
|
||||
}
|
||||
ApplyStartCanvasExitFinalState();
|
||||
|
||||
fade_canvasGroup = null;
|
||||
}
|
||||
@@ -745,6 +723,7 @@ public class GameManager : MonoBehaviour
|
||||
yield return WaitRealtime(startCanvasMoveStagger);
|
||||
yield return StartCoroutine(AnimateMoveAndFade(startup_escape, startup_escapeCg, escapeFrom, startup_escapeBasePos, 0f, 1f, startCanvasMoveInDuration, true));
|
||||
|
||||
ApplyStartCanvasEntryFinalState();
|
||||
startCanvasIntroCompleted = true;
|
||||
SetStartButtonsInteractable(true);
|
||||
startCanvasIntroRoutine = null;
|
||||
@@ -863,6 +842,42 @@ public class GameManager : MonoBehaviour
|
||||
SetCanvasGroupAlpha(startup_uiBackCg, 1f, false);
|
||||
}
|
||||
|
||||
private void ApplyStartCanvasExitFinalState()
|
||||
{
|
||||
if (startup_text != null) startup_text.anchoredPosition = startup_textBasePos + new Vector2(0f, -startCanvasMoveOffsetY);
|
||||
if (startup_start != null) startup_start.anchoredPosition = startup_startBasePos + new Vector2(0f, -startCanvasMoveOffsetY);
|
||||
if (startup_escape != null) startup_escape.anchoredPosition = startup_escapeBasePos + new Vector2(0f, -startCanvasMoveOffsetY);
|
||||
if (startup_boarder != null) startup_boarder.anchoredPosition = startup_boarderBasePos + new Vector2(0f, -startCanvasPanelExitOffsetY);
|
||||
if (startup_image != null) startup_image.anchoredPosition = startup_imageBasePos + new Vector2(0f, -startCanvasPanelExitOffsetY);
|
||||
|
||||
SetCanvasGroupAlpha(startup_btmCg, 0f, false);
|
||||
SetCanvasGroupAlpha(startup_boarderCg, 0f, false);
|
||||
SetCanvasGroupAlpha(startup_imageCg, 0f, false);
|
||||
SetCanvasGroupAlpha(startup_textCg, 0f, false);
|
||||
SetCanvasGroupAlpha(startup_startCg, 0f, false);
|
||||
SetCanvasGroupAlpha(startup_escapeCg, 0f, false);
|
||||
SetCanvasGroupAlpha(startup_tipsCg, 0f, false);
|
||||
SetCanvasGroupAlpha(startup_uiBackCg, 0f, false);
|
||||
|
||||
if (cg_startCanvas != null)
|
||||
{
|
||||
cg_startCanvas.alpha = 0f;
|
||||
cg_startCanvas.interactable = false;
|
||||
cg_startCanvas.blocksRaycasts = false;
|
||||
}
|
||||
|
||||
if (startCanvas != null) startCanvas.SetActive(false);
|
||||
|
||||
if (extraStartCG != null)
|
||||
{
|
||||
extraStartCG.alpha = 0f;
|
||||
extraStartCG.interactable = false;
|
||||
extraStartCG.blocksRaycasts = false;
|
||||
}
|
||||
|
||||
if (extraStartObject != null) extraStartObject.SetActive(false);
|
||||
}
|
||||
|
||||
private void SetStartButtonsInteractable(bool interactable)
|
||||
{
|
||||
if (startGame != null) startGame.interactable = interactable;
|
||||
|
||||
@@ -41,6 +41,20 @@ public class GameplayTrackStartIntroAnimator : MonoBehaviour
|
||||
[SerializeField] private bool allyUsePseudoYTurnForUI = true;
|
||||
[SerializeField] private float allyPseudoStartScaleX = 0.68f;
|
||||
|
||||
[Header("Additional HUD")]
|
||||
[SerializeField] private bool animateAdditionalHudRoots = true;
|
||||
[SerializeField] private float additionalHudStartYOffset = -35f;
|
||||
[SerializeField] private float additionalHudMoveDuration = 0.24f;
|
||||
[SerializeField] private float additionalHudStagger = 0.035f;
|
||||
[SerializeField]
|
||||
private string[] additionalHudRootNames =
|
||||
{
|
||||
"healthSys",
|
||||
"manaSys",
|
||||
"progressLineBottom",
|
||||
"progressLineColor"
|
||||
};
|
||||
|
||||
private bool playedOnce;
|
||||
private bool refsCached;
|
||||
private bool preStartPrepared;
|
||||
@@ -64,12 +78,15 @@ public class GameplayTrackStartIntroAnimator : MonoBehaviour
|
||||
private readonly List<Transform> gameObjectRects = new List<Transform>();
|
||||
private readonly List<Transform> colorRects = new List<Transform>();
|
||||
private readonly List<Transform> allies = new List<Transform>();
|
||||
private readonly List<Transform> additionalHudRoots = new List<Transform>();
|
||||
private readonly List<Transform> explicitKeyDownRects = new List<Transform>(5);
|
||||
|
||||
private readonly Dictionary<Graphic, float> baseGraphicAlpha = new Dictionary<Graphic, float>();
|
||||
private readonly Dictionary<SpriteRenderer, float> baseSpriteAlpha = new Dictionary<SpriteRenderer, float>();
|
||||
private readonly Dictionary<CanvasGroup, float> baseCanvasGroupAlpha = new Dictionary<CanvasGroup, float>();
|
||||
private readonly Dictionary<Transform, Vector3> baseLocalScale = new Dictionary<Transform, Vector3>();
|
||||
private readonly Dictionary<Transform, Vector3> baseLocalPosition = new Dictionary<Transform, Vector3>();
|
||||
private readonly Dictionary<Transform, float> rootCanvasBaseAlpha = new Dictionary<Transform, float>();
|
||||
private readonly Dictionary<Transform, CanvasGroup> rootCanvasGroups = new Dictionary<Transform, CanvasGroup>();
|
||||
|
||||
private void Awake()
|
||||
@@ -85,6 +102,17 @@ public class GameplayTrackStartIntroAnimator : MonoBehaviour
|
||||
StartCoroutine(PreparePreStartStateNextFrame());
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
if (playRoutine == null) return;
|
||||
|
||||
// If the object is disabled during the intro, keep HUD from being stranded mid-animation.
|
||||
StopCoroutine(playRoutine);
|
||||
ApplyIntroFinalState();
|
||||
playedOnce = true;
|
||||
playRoutine = null;
|
||||
}
|
||||
|
||||
private void LateUpdate()
|
||||
{
|
||||
if (!keepHiddenBeforeStart) return;
|
||||
@@ -206,6 +234,12 @@ public class GameplayTrackStartIntroAnimator : MonoBehaviour
|
||||
}
|
||||
allies.Sort((a, b) => a.name.CompareTo(b.name));
|
||||
|
||||
additionalHudRoots.Clear();
|
||||
if (animateAdditionalHudRoots)
|
||||
{
|
||||
additionalHudRoots.AddRange(CollectAdditionalHudRoots());
|
||||
}
|
||||
|
||||
refsCached = true;
|
||||
}
|
||||
|
||||
@@ -265,6 +299,14 @@ public class GameplayTrackStartIntroAnimator : MonoBehaviour
|
||||
if (totalEnemyTop != null) SetScaleY(totalEnemyTop, 0f);
|
||||
if (totalEnemyFade != null) SetScaleY(totalEnemyFade, 0f);
|
||||
|
||||
for (int i = 0; i < additionalHudRoots.Count; i++)
|
||||
{
|
||||
Transform hud = additionalHudRoots[i];
|
||||
if (hud == null) continue;
|
||||
SetRootCanvasAlphaNormalized(hud, 0f);
|
||||
SetLocalPosition(hud, GetBaseLocalPosition(hud) + new Vector3(0f, additionalHudStartYOffset, 0f));
|
||||
}
|
||||
|
||||
preStartPrepared = true;
|
||||
}
|
||||
|
||||
@@ -306,16 +348,74 @@ public class GameplayTrackStartIntroAnimator : MonoBehaviour
|
||||
Coroutine enemyStep = StartCoroutine(PlayEnemyStep(enemyRoot, enemyListBall, enemyStatics, enemySpineSystem, totalEnemyTop, totalEnemyFade));
|
||||
Coroutine progressStep = StartCoroutine(FlashIn(progressLine, flashTimes, flashDuration, true));
|
||||
Coroutine alliesStep = StartCoroutine(PlayAlliesAndHudStep(allies, score, pause));
|
||||
Coroutine additionalHudStep = StartCoroutine(PlayAdditionalHudStep(additionalHudRoots));
|
||||
|
||||
if (colorStep != null) yield return colorStep;
|
||||
if (enemyStep != null) yield return enemyStep;
|
||||
if (progressStep != null) yield return progressStep;
|
||||
if (alliesStep != null) yield return alliesStep;
|
||||
if (additionalHudStep != null) yield return additionalHudStep;
|
||||
|
||||
ApplyIntroFinalState();
|
||||
playedOnce = true;
|
||||
playRoutine = null;
|
||||
}
|
||||
|
||||
private void ApplyIntroFinalState()
|
||||
{
|
||||
if (bgReplace != null) SetAlphaNormalized(bgReplace, 1f, true);
|
||||
if (colorLineStatic != null) SetAlphaNormalized(colorLineStatic, 1f, true);
|
||||
if (enemyRoot != null) SetAlphaNormalized(enemyRoot, 1f, true);
|
||||
if (enemyListBall != null) SetAlphaNormalized(enemyListBall, 1f, true);
|
||||
if (enemyStatics != null) SetAlphaNormalized(enemyStatics, 1f, true);
|
||||
if (enemySpineSystem != null) enemySpineSystem.gameObject.SetActive(true);
|
||||
if (progressLine != null) SetAlphaNormalized(progressLine, 1f, true);
|
||||
if (score != null) SetAlphaNormalized(score, 1f, true);
|
||||
if (pause != null) SetAlphaNormalized(pause, 1f, true);
|
||||
|
||||
for (int i = 0; i < colorRects.Count; i++)
|
||||
{
|
||||
if (colorRects[i] != null) SetAlphaNormalized(colorRects[i], 1f, true);
|
||||
}
|
||||
|
||||
for (int i = 0; i < keyDownRects.Count; i++)
|
||||
{
|
||||
Transform t = keyDownRects[i];
|
||||
if (t == null) continue;
|
||||
SetAlphaNormalized(t, 1f, true);
|
||||
SetLocalY(t, keyDownTargetY);
|
||||
SetLocalRotY(t, keyDownTargetRotY);
|
||||
}
|
||||
|
||||
for (int i = 0; i < gameObjectRects.Count; i++)
|
||||
{
|
||||
Transform t = gameObjectRects[i];
|
||||
if (t == null) continue;
|
||||
SetAlphaNormalized(t, 1f, true);
|
||||
SetLocalY(t, gameObjectTargetY);
|
||||
}
|
||||
|
||||
for (int i = 0; i < allies.Count; i++)
|
||||
{
|
||||
Transform ally = allies[i];
|
||||
if (ally == null) continue;
|
||||
SetRootCanvasAlpha(ally, 1f);
|
||||
SetPseudoTurnScaleX(ally, 1f);
|
||||
SetLocalRotY(ally, allyTargetRotY);
|
||||
}
|
||||
|
||||
if (totalEnemyTop != null) SetScaleY(totalEnemyTop, 1f);
|
||||
if (totalEnemyFade != null) SetScaleY(totalEnemyFade, 1f);
|
||||
|
||||
for (int i = 0; i < additionalHudRoots.Count; i++)
|
||||
{
|
||||
Transform hud = additionalHudRoots[i];
|
||||
if (hud == null) continue;
|
||||
SetRootCanvasAlphaNormalized(hud, 1f);
|
||||
SetLocalPosition(hud, GetBaseLocalPosition(hud));
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator PlayEnemyStep(
|
||||
Transform enemyRootTr,
|
||||
Transform enemyListBallTr,
|
||||
@@ -379,6 +479,48 @@ public class GameplayTrackStartIntroAnimator : MonoBehaviour
|
||||
yield return StartCoroutine(FlashIn(pauseTr, flashTimes, hudFlashDuration, true));
|
||||
}
|
||||
|
||||
private IEnumerator PlayAdditionalHudStep(List<Transform> hudList)
|
||||
{
|
||||
if (hudList == null || hudList.Count == 0) yield break;
|
||||
|
||||
for (int i = 0; i < hudList.Count; i++)
|
||||
{
|
||||
Transform hud = hudList[i];
|
||||
if (hud == null) continue;
|
||||
|
||||
StartCoroutine(AnimateAdditionalHudRoot(hud));
|
||||
if (i < hudList.Count - 1 && additionalHudStagger > 0f)
|
||||
yield return WaitRealtime(additionalHudStagger);
|
||||
}
|
||||
|
||||
yield return WaitRealtime(additionalHudMoveDuration);
|
||||
}
|
||||
|
||||
private IEnumerator AnimateAdditionalHudRoot(Transform hud)
|
||||
{
|
||||
if (hud == null) yield break;
|
||||
|
||||
Vector3 basePos = GetBaseLocalPosition(hud);
|
||||
Vector3 from = basePos + new Vector3(0f, additionalHudStartYOffset, 0f);
|
||||
float elapsed = 0f;
|
||||
float dur = Mathf.Max(0.01f, additionalHudMoveDuration);
|
||||
|
||||
SetLocalPosition(hud, from);
|
||||
SetRootCanvasAlphaNormalized(hud, 0f);
|
||||
|
||||
while (elapsed < dur)
|
||||
{
|
||||
elapsed += Time.unscaledDeltaTime;
|
||||
float k = EaseOutCubic(Mathf.Clamp01(elapsed / dur));
|
||||
SetLocalPosition(hud, Vector3.LerpUnclamped(from, basePos, k));
|
||||
SetRootCanvasAlphaNormalized(hud, k);
|
||||
yield return null;
|
||||
}
|
||||
|
||||
SetLocalPosition(hud, basePos);
|
||||
SetRootCanvasAlphaNormalized(hud, 1f);
|
||||
}
|
||||
|
||||
private IEnumerator FlashInSequence(List<Transform> list, int flashes, float duration, float stagger)
|
||||
{
|
||||
if (list == null || list.Count == 0) yield break;
|
||||
@@ -624,6 +766,23 @@ public class GameplayTrackStartIntroAnimator : MonoBehaviour
|
||||
return s;
|
||||
}
|
||||
|
||||
private Vector3 GetBaseLocalPosition(Transform t)
|
||||
{
|
||||
if (t == null) return Vector3.zero;
|
||||
if (!baseLocalPosition.TryGetValue(t, out Vector3 p))
|
||||
{
|
||||
p = t.localPosition;
|
||||
baseLocalPosition[t] = p;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
private static void SetLocalPosition(Transform t, Vector3 localPosition)
|
||||
{
|
||||
if (t == null) return;
|
||||
t.localPosition = localPosition;
|
||||
}
|
||||
|
||||
private static void SetScaleY(Transform t, float y)
|
||||
{
|
||||
if (t == null) return;
|
||||
@@ -748,6 +907,21 @@ public class GameplayTrackStartIntroAnimator : MonoBehaviour
|
||||
cg.alpha = n;
|
||||
}
|
||||
|
||||
private void SetRootCanvasAlphaNormalized(Transform root, float normalized)
|
||||
{
|
||||
if (root == null) return;
|
||||
CanvasGroup cg = GetOrAddRootCanvasGroup(root);
|
||||
if (cg == null) return;
|
||||
|
||||
if (!rootCanvasBaseAlpha.TryGetValue(root, out float baseAlpha))
|
||||
{
|
||||
baseAlpha = cg.alpha;
|
||||
rootCanvasBaseAlpha[root] = baseAlpha;
|
||||
}
|
||||
|
||||
cg.alpha = baseAlpha * Mathf.Clamp01(normalized);
|
||||
}
|
||||
|
||||
private IEnumerator FlashInCanvasGroup(Transform root, int flashes, float duration)
|
||||
{
|
||||
if (root == null) yield break;
|
||||
@@ -812,6 +986,78 @@ public class GameplayTrackStartIntroAnimator : MonoBehaviour
|
||||
return list;
|
||||
}
|
||||
|
||||
private List<Transform> CollectAdditionalHudRoots()
|
||||
{
|
||||
List<Transform> list = new List<Transform>();
|
||||
if (additionalHudRootNames == null || additionalHudRootNames.Length == 0) return list;
|
||||
|
||||
HashSet<int> seen = new HashSet<int>();
|
||||
Transform[] all = GetAllSceneTransforms();
|
||||
for (int i = 0; i < all.Length; i++)
|
||||
{
|
||||
Transform t = all[i];
|
||||
if (t == null || string.IsNullOrEmpty(t.name)) continue;
|
||||
if (!IsAdditionalHudName(t.name)) continue;
|
||||
if (IsAlreadyHandledByMainIntro(t)) continue;
|
||||
if (!seen.Add(t.GetInstanceID())) continue;
|
||||
list.Add(t);
|
||||
}
|
||||
|
||||
list.Sort((a, b) =>
|
||||
{
|
||||
int ay = a != null ? Mathf.RoundToInt(-a.position.y * 1000f) : 0;
|
||||
int by = b != null ? Mathf.RoundToInt(-b.position.y * 1000f) : 0;
|
||||
int yCmp = ay.CompareTo(by);
|
||||
if (yCmp != 0) return yCmp;
|
||||
return (a != null ? a.GetSiblingIndex() : 0).CompareTo(b != null ? b.GetSiblingIndex() : 0);
|
||||
});
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private bool IsAdditionalHudName(string candidateName)
|
||||
{
|
||||
for (int i = 0; i < additionalHudRootNames.Length; i++)
|
||||
{
|
||||
string targetName = additionalHudRootNames[i];
|
||||
if (string.IsNullOrEmpty(targetName)) continue;
|
||||
if (string.Equals(candidateName, targetName, System.StringComparison.OrdinalIgnoreCase))
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private bool IsAlreadyHandledByMainIntro(Transform t)
|
||||
{
|
||||
if (t == null) return true;
|
||||
if (IsSelfOrChildOf(t, keyDown) ||
|
||||
IsSelfOrChildOf(t, colorLineStatic) ||
|
||||
IsSelfOrChildOf(t, enemyRoot) ||
|
||||
IsSelfOrChildOf(t, progressLine) ||
|
||||
IsSelfOrChildOf(t, score) ||
|
||||
IsSelfOrChildOf(t, pause) ||
|
||||
IsSelfOrChildOf(t, bgReplace))
|
||||
return true;
|
||||
|
||||
for (int i = 0; i < keyDownRects.Count; i++)
|
||||
if (IsSelfOrChildOf(t, keyDownRects[i])) return true;
|
||||
for (int i = 0; i < gameObjectRects.Count; i++)
|
||||
if (IsSelfOrChildOf(t, gameObjectRects[i])) return true;
|
||||
for (int i = 0; i < colorRects.Count; i++)
|
||||
if (IsSelfOrChildOf(t, colorRects[i])) return true;
|
||||
for (int i = 0; i < allies.Count; i++)
|
||||
if (IsSelfOrChildOf(t, allies[i])) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private static bool IsSelfOrChildOf(Transform candidate, Transform root)
|
||||
{
|
||||
if (candidate == null || root == null) return false;
|
||||
return candidate == root || candidate.IsChildOf(root);
|
||||
}
|
||||
|
||||
private List<Transform> CollectGameObjectSdw3Excluding(Transform keyDownRoot)
|
||||
{
|
||||
List<Transform> list = new List<Transform>();
|
||||
|
||||
@@ -19,6 +19,10 @@ public class rankingList : MonoBehaviour
|
||||
if (currentInstance == null)
|
||||
{
|
||||
currentInstance = Instantiate(rkl_prefab, rkl_parent);
|
||||
if (currentInstance.GetComponent<UI_PanelPopupTween>() == null)
|
||||
{
|
||||
currentInstance.AddComponent<UI_PanelPopupTween>();
|
||||
}
|
||||
}
|
||||
|
||||
var listPrefab = currentInstance.GetComponent<rankingListPrefab>();
|
||||
|
||||
@@ -163,6 +163,8 @@ public class rankingListPrefab : MonoBehaviour
|
||||
{
|
||||
row.Bind(entry, ResolveRankSprite(entry.rank), formattedSubmitTime);
|
||||
}
|
||||
|
||||
UI_OrderedEntryAnimator.PlayFadeOnly(rowObj, i, 0.16f, 0.01f, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -134,6 +134,8 @@ public class settlementController : MonoBehaviour
|
||||
[SerializeField] private float introMoveDuration = 0.42f;
|
||||
[SerializeField] private float introNumberDuration = 0.48f;
|
||||
[SerializeField] private float introStepGap = 0.06f;
|
||||
[SerializeField] private float introStaticElementDuration = 0.22f;
|
||||
[SerializeField] private float introBarFillDuration = 0.36f;
|
||||
[SerializeField] private float introMvpEnterYOffset = 120f;
|
||||
[SerializeField] private float introMvpEnterDuration = 0.42f;
|
||||
[SerializeField] private Ease introMvpEnterEase = Ease.OutCubic;
|
||||
@@ -142,6 +144,7 @@ public class settlementController : MonoBehaviour
|
||||
[Header("Settle Rewards")]
|
||||
public GameObject rewardPrefab;
|
||||
public Transform rewardParent;
|
||||
private Coroutine settlementRewardLayoutRefreshRoutine;
|
||||
|
||||
private int targetPmScore;
|
||||
private int targetIdolScore;
|
||||
@@ -157,6 +160,11 @@ public class settlementController : MonoBehaviour
|
||||
private float targetGreatPercent;
|
||||
private float targetGoodPercent;
|
||||
private float targetMissPercent;
|
||||
private int targetEarlyCount;
|
||||
private int targetLateCount;
|
||||
private float targetAvgOffsetMs;
|
||||
private string targetGameNoteRateText = string.Empty;
|
||||
private string targetPersonalRecordText = string.Empty;
|
||||
private Tween mvpEntryTween;
|
||||
private bool skipIntroRequested;
|
||||
private Transform cachedIntroMvpTransform;
|
||||
@@ -647,20 +655,25 @@ public class settlementController : MonoBehaviour
|
||||
accuracy_Text.text = targetAccuracyPercent.ToString("F1") + "%";
|
||||
|
||||
// Timing Statistics
|
||||
if (earlyHitCount_Text != null) earlyHitCount_Text.text = sm.countEarly.ToString();
|
||||
if (lateHitCount_Text != null) lateHitCount_Text.text = sm.countLate.ToString();
|
||||
targetEarlyCount = sm.countEarly;
|
||||
targetLateCount = sm.countLate;
|
||||
if (earlyHitCount_Text != null) earlyHitCount_Text.text = targetEarlyCount.ToString();
|
||||
if (lateHitCount_Text != null) lateHitCount_Text.text = targetLateCount.ToString();
|
||||
if (avgOffset_Text != null)
|
||||
{
|
||||
float avg = sm.offsetCount > 0 ? sm.totalOffsetMs / sm.offsetCount : 0f;
|
||||
avgOffset_Text.text = avg.ToString("F2") + " ms";
|
||||
targetAvgOffsetMs = avg;
|
||||
avgOffset_Text.text = targetAvgOffsetMs.ToString("F2") + " ms";
|
||||
}
|
||||
|
||||
targetGameNoteRateText = gameNote_rate != null ? gameNote_rate.text : string.Empty;
|
||||
|
||||
TrySubmitArenaRoomScore();
|
||||
}
|
||||
else Debug.LogError("score manager is null");
|
||||
|
||||
// --- Achievement System: Load and display achievements ---
|
||||
if (InGamePerformanceManager.Instance != null && !GameConfig.autoPlayEnabled)
|
||||
if (InGamePerformanceManager.Instance != null)
|
||||
{
|
||||
// Calculate total cure, damage and mana from teamUIController
|
||||
float totalCure = 0;
|
||||
@@ -723,7 +736,8 @@ public class settlementController : MonoBehaviour
|
||||
if (personalRecord_Text != null)
|
||||
{
|
||||
int currentRecord = thisSong_so.personalRecord;
|
||||
personalRecord_Text.text = currentRecord.ToString();
|
||||
targetPersonalRecordText = currentRecord.ToString();
|
||||
personalRecord_Text.text = targetPersonalRecordText;
|
||||
|
||||
// If current total score broke the overall personal record (all difficulties)
|
||||
// and we are NOT in autoplay (since we didn't save the result in autoplay)
|
||||
@@ -846,6 +860,7 @@ public class settlementController : MonoBehaviour
|
||||
SpawnSettlementReward(global::rewardPrefab.RewardVisualType.Coins, coinReward);
|
||||
SpawnSettlementReward(global::rewardPrefab.RewardVisualType.Material, materialReward);
|
||||
SpawnSettlementReward(global::rewardPrefab.RewardVisualType.PlayerExp, playerExpReward);
|
||||
RequestSettlementRewardLayoutRebuild();
|
||||
}
|
||||
|
||||
private void SpawnSettlementReward(global::rewardPrefab.RewardVisualType rewardType, int amount)
|
||||
@@ -861,6 +876,50 @@ public class settlementController : MonoBehaviour
|
||||
{
|
||||
prefab.Bind(rewardType, amount);
|
||||
}
|
||||
|
||||
UI_OrderedEntryAnimator.PlayFadeOnly(go, rewardParent != null ? rewardParent.childCount - 1 : 0, 0.2f, 0.035f, false);
|
||||
}
|
||||
|
||||
private void RequestSettlementRewardLayoutRebuild()
|
||||
{
|
||||
if (rewardParent == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (settlementRewardLayoutRefreshRoutine != null)
|
||||
{
|
||||
StopCoroutine(settlementRewardLayoutRefreshRoutine);
|
||||
settlementRewardLayoutRefreshRoutine = null;
|
||||
}
|
||||
|
||||
if (isActiveAndEnabled)
|
||||
{
|
||||
settlementRewardLayoutRefreshRoutine = StartCoroutine(RebuildSettlementRewardLayoutNextFrame());
|
||||
return;
|
||||
}
|
||||
|
||||
RebuildSettlementRewardLayoutNow();
|
||||
}
|
||||
|
||||
private IEnumerator RebuildSettlementRewardLayoutNextFrame()
|
||||
{
|
||||
yield return null;
|
||||
RebuildSettlementRewardLayoutNow();
|
||||
settlementRewardLayoutRefreshRoutine = null;
|
||||
}
|
||||
|
||||
private void RebuildSettlementRewardLayoutNow()
|
||||
{
|
||||
RectTransform rect = rewardParent as RectTransform;
|
||||
if (rect == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Canvas.ForceUpdateCanvases();
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(rect);
|
||||
Canvas.ForceUpdateCanvases();
|
||||
}
|
||||
|
||||
private static Player_SO LoadDefaultPlayerSo()
|
||||
@@ -1164,6 +1223,20 @@ public class settlementController : MonoBehaviour
|
||||
if (orderedGroups[i] != null) SetCanvasAlpha(orderedGroups[i], 0f);
|
||||
}
|
||||
|
||||
PrepareStaticSettlementElement(thisSong_backPic != null ? thisSong_backPic.transform : null);
|
||||
PrepareStaticSettlementElement(songName_Text != null ? songName_Text.transform : null);
|
||||
PrepareStaticSettlementElement(finalLevel_img != null ? finalLevel_img.transform : null);
|
||||
PrepareStaticSettlementElement(personalRecord_Text != null ? personalRecord_Text.transform : null);
|
||||
PrepareStaticSettlementElement(gameNote_rate != null ? gameNote_rate.transform : null);
|
||||
PrepareStaticSettlementElement(earlyHitCount_Text != null ? earlyHitCount_Text.transform : null);
|
||||
PrepareStaticSettlementElement(lateHitCount_Text != null ? lateHitCount_Text.transform : null);
|
||||
PrepareStaticSettlementElement(avgOffset_Text != null ? avgOffset_Text.transform : null);
|
||||
PrepareImageFill(thisLevel_progressBar_Image);
|
||||
PrepareImageFill(perfect_barFill_Image);
|
||||
PrepareImageFill(great_barFill_Image);
|
||||
PrepareImageFill(good_barFill_Image);
|
||||
PrepareImageFill(miss_barFill_Image);
|
||||
|
||||
PrepareTextForCountUp(pmScoreSum_Text, false, 0);
|
||||
PrepareTextForCountUp(idolScoreSum_Text, false, 0);
|
||||
PrepareTextForCountUp(accuracy_Text, true, 0f, "F1");
|
||||
@@ -1188,6 +1261,8 @@ public class settlementController : MonoBehaviour
|
||||
// left/pics/quhuiImage flash
|
||||
if (quhuiImageTr != null)
|
||||
yield return StartCoroutine(FlashInTransform(quhuiImageTr, introFlashCount, introFlashDuration));
|
||||
yield return StartCoroutine(FlashInTransform(thisSong_backPic != null ? thisSong_backPic.transform : null, 1, introStaticElementDuration));
|
||||
yield return StartCoroutine(FlashInTransform(songName_Text != null ? songName_Text.transform : null, 1, introStaticElementDuration));
|
||||
|
||||
// score_bottom + shenstars move in together
|
||||
Coroutine scoreBottomIn = null;
|
||||
@@ -1215,12 +1290,21 @@ public class settlementController : MonoBehaviour
|
||||
yield return WaitRealtime(introNumberDuration + 0.02f);
|
||||
yield return StartCoroutine(FlashInTransform(finalScore_Text != null ? finalScore_Text.transform : null, introFlashCount, introFlashDuration * 0.9f));
|
||||
yield return StartCoroutine(FlashInTransform(thisLevel_currentPercentage_Text != null ? thisLevel_currentPercentage_Text.transform : null, introFlashCount, introFlashDuration * 0.9f));
|
||||
yield return StartCoroutine(AnimateImageFill(thisLevel_progressBar_Image, (float)targetTotalScore / Mathf.Max(1, _1000000), introBarFillDuration));
|
||||
yield return StartCoroutine(FlashInTransform(finalLevel_img != null ? finalLevel_img.transform : null, 1, introStaticElementDuration));
|
||||
yield return StartCoroutine(FlashInTransform(personalRecord_Text != null ? personalRecord_Text.transform : null, 1, introStaticElementDuration));
|
||||
yield return StartCoroutine(FlashInTransform(gameNote_rate != null ? gameNote_rate.transform : null, 1, introStaticElementDuration));
|
||||
|
||||
// hitStatus/status groups: flash in and count up numbers
|
||||
yield return StartCoroutine(PlayStatusGroupIn(perfectGroup, perfectHitCount_Text, targetPerfectCount, perfectHitPercent_Text, targetPerfectPercent));
|
||||
yield return StartCoroutine(PlayStatusGroupIn(greatGroup, greatHitCount_Text, targetGreatCount, greatHitPercent_Text, targetGreatPercent));
|
||||
yield return StartCoroutine(PlayStatusGroupIn(goodGroup, goodHitCount_Text, targetGoodCount, goodHitPercent_Text, targetGoodPercent));
|
||||
yield return StartCoroutine(PlayStatusGroupIn(missGroup, missHitCount_Text, targetMissCount, missHitPercent_Text, targetMissPercent));
|
||||
int noteCountForBars = Mathf.Max(1, targetPerfectCount + targetGreatCount + targetGoodCount + targetMissCount);
|
||||
yield return StartCoroutine(PlayStatusGroupIn(perfectGroup, perfectHitCount_Text, targetPerfectCount, perfectHitPercent_Text, targetPerfectPercent, perfect_barFill_Image, (float)targetPerfectCount / noteCountForBars));
|
||||
yield return StartCoroutine(PlayStatusGroupIn(greatGroup, greatHitCount_Text, targetGreatCount, greatHitPercent_Text, targetGreatPercent, great_barFill_Image, (float)targetGreatCount / noteCountForBars));
|
||||
yield return StartCoroutine(PlayStatusGroupIn(goodGroup, goodHitCount_Text, targetGoodCount, goodHitPercent_Text, targetGoodPercent, good_barFill_Image, (float)targetGoodCount / noteCountForBars));
|
||||
yield return StartCoroutine(PlayStatusGroupIn(missGroup, missHitCount_Text, targetMissCount, missHitPercent_Text, targetMissPercent, miss_barFill_Image, (float)targetMissCount / noteCountForBars));
|
||||
|
||||
yield return StartCoroutine(AnimateIntText(earlyHitCount_Text, targetEarlyCount, introNumberDuration * 0.7f));
|
||||
yield return StartCoroutine(AnimateIntText(lateHitCount_Text, targetLateCount, introNumberDuration * 0.7f));
|
||||
yield return StartCoroutine(AnimateOffsetText(avgOffset_Text, targetAvgOffsetMs, introNumberDuration * 0.7f));
|
||||
|
||||
// ally cards enter before MASK.
|
||||
if (hasAllyCardEntry)
|
||||
@@ -1247,6 +1331,7 @@ public class settlementController : MonoBehaviour
|
||||
yield return WaitRealtime(introStepGap);
|
||||
}
|
||||
|
||||
ApplySettlementIntroFinalState();
|
||||
settlementCanvasGroup.alpha = 1f;
|
||||
settlementCanvasGroup.interactable = true;
|
||||
settlementCanvasGroup.blocksRaycasts = true;
|
||||
@@ -1356,6 +1441,23 @@ public class settlementController : MonoBehaviour
|
||||
if (good_barFill_Image != null) good_barFill_Image.fillAmount = (float)targetGoodCount / noteCountSum;
|
||||
if (miss_barFill_Image != null) miss_barFill_Image.fillAmount = (float)targetMissCount / noteCountSum;
|
||||
|
||||
if (thisSong_backPic != null) SetCanvasAlpha(thisSong_backPic.transform, 1f);
|
||||
if (songName_Text != null) SetCanvasAlpha(songName_Text.transform, 1f);
|
||||
if (finalLevel_img != null) SetCanvasAlpha(finalLevel_img.transform, 1f);
|
||||
if (personalRecord_Text != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(targetPersonalRecordText)) personalRecord_Text.text = targetPersonalRecordText;
|
||||
SetCanvasAlpha(personalRecord_Text.transform, 1f);
|
||||
}
|
||||
if (gameNote_rate != null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(targetGameNoteRateText)) gameNote_rate.text = targetGameNoteRateText;
|
||||
SetCanvasAlpha(gameNote_rate.transform, 1f);
|
||||
}
|
||||
if (earlyHitCount_Text != null) { earlyHitCount_Text.text = targetEarlyCount.ToString(); SetCanvasAlpha(earlyHitCount_Text.transform, 1f); }
|
||||
if (lateHitCount_Text != null) { lateHitCount_Text.text = targetLateCount.ToString(); SetCanvasAlpha(lateHitCount_Text.transform, 1f); }
|
||||
if (avgOffset_Text != null) { avgOffset_Text.text = targetAvgOffsetMs.ToString("F2") + " ms"; SetCanvasAlpha(avgOffset_Text.transform, 1f); }
|
||||
|
||||
if (mvpTr != null && mvpTr.gameObject.activeInHierarchy)
|
||||
{
|
||||
Vector3 targetPos;
|
||||
@@ -1585,16 +1687,23 @@ public class settlementController : MonoBehaviour
|
||||
}
|
||||
|
||||
private IEnumerator PlayStatusGroupIn(Transform groupRoot, Text countText, int countTarget, Text percentText, float percentTarget)
|
||||
{
|
||||
yield return StartCoroutine(PlayStatusGroupIn(groupRoot, countText, countTarget, percentText, percentTarget, null, 0f));
|
||||
}
|
||||
|
||||
private IEnumerator PlayStatusGroupIn(Transform groupRoot, Text countText, int countTarget, Text percentText, float percentTarget, Image fillImage, float fillTarget)
|
||||
{
|
||||
if (groupRoot != null)
|
||||
yield return StartCoroutine(FlashInTransform(groupRoot, introFlashCount, introFlashDuration));
|
||||
|
||||
Coroutine c1 = null;
|
||||
Coroutine c2 = null;
|
||||
Coroutine c3 = null;
|
||||
if (countText != null) c1 = StartCoroutine(AnimateIntText(countText, countTarget, introNumberDuration));
|
||||
if (percentText != null) c2 = StartCoroutine(AnimateFloatPercentText(percentText, percentTarget, introNumberDuration, "F1"));
|
||||
if (fillImage != null) c3 = StartCoroutine(AnimateImageFill(fillImage, fillTarget, introBarFillDuration));
|
||||
|
||||
if (c1 != null || c2 != null)
|
||||
if (c1 != null || c2 != null || c3 != null)
|
||||
yield return WaitRealtime(introNumberDuration + 0.02f);
|
||||
}
|
||||
|
||||
@@ -1666,6 +1775,48 @@ public class settlementController : MonoBehaviour
|
||||
target.text = toValue.ToString(format) + "%";
|
||||
}
|
||||
|
||||
private IEnumerator AnimateOffsetText(Text target, float toValue, float duration)
|
||||
{
|
||||
if (target == null) yield break;
|
||||
SetCanvasAlpha(target.transform, 1f);
|
||||
|
||||
float elapsed = 0f;
|
||||
float dur = Mathf.Max(0.01f, duration);
|
||||
|
||||
while (elapsed < dur)
|
||||
{
|
||||
if (skipIntroRequested) break;
|
||||
elapsed += Time.unscaledDeltaTime;
|
||||
float t = EaseOutCubic(Mathf.Clamp01(elapsed / dur));
|
||||
float value = Mathf.Lerp(0f, toValue, t);
|
||||
target.text = value.ToString("F2") + " ms";
|
||||
yield return null;
|
||||
}
|
||||
|
||||
target.text = toValue.ToString("F2") + " ms";
|
||||
}
|
||||
|
||||
private IEnumerator AnimateImageFill(Image target, float toValue, float duration)
|
||||
{
|
||||
if (target == null) yield break;
|
||||
|
||||
target.fillAmount = 0f;
|
||||
float elapsed = 0f;
|
||||
float dur = Mathf.Max(0.01f, duration);
|
||||
float targetValue = Mathf.Clamp01(toValue);
|
||||
|
||||
while (elapsed < dur)
|
||||
{
|
||||
if (skipIntroRequested) break;
|
||||
elapsed += Time.unscaledDeltaTime;
|
||||
float t = EaseOutCubic(Mathf.Clamp01(elapsed / dur));
|
||||
target.fillAmount = Mathf.Lerp(0f, targetValue, t);
|
||||
yield return null;
|
||||
}
|
||||
|
||||
target.fillAmount = targetValue;
|
||||
}
|
||||
|
||||
private IEnumerator AnimateAnchoredXAndFade(RectTransform rt, float fromX, float toX, float duration, bool fadeIn)
|
||||
{
|
||||
if (rt == null) yield break;
|
||||
@@ -1776,6 +1927,18 @@ public class settlementController : MonoBehaviour
|
||||
SetCanvasAlpha(target, 1f);
|
||||
}
|
||||
|
||||
private void PrepareStaticSettlementElement(Transform target)
|
||||
{
|
||||
if (target == null) return;
|
||||
SetCanvasAlpha(target, 0f);
|
||||
}
|
||||
|
||||
private void PrepareImageFill(Image target)
|
||||
{
|
||||
if (target == null) return;
|
||||
target.fillAmount = 0f;
|
||||
}
|
||||
|
||||
private void PrepareTextForCountUp(Text t, bool isPercent, float initialValue, string format = "F1")
|
||||
{
|
||||
if (t == null) return;
|
||||
|
||||
Reference in New Issue
Block a user