成就系统 巨大修改 新的ui 黑白效果 等一堆
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -7,6 +8,7 @@ public class JudgeManager : MonoBehaviour
|
||||
[Header("settlement go")]
|
||||
public GameObject settlement_go;
|
||||
public settlementController sc;
|
||||
public NoteSpawner ns;
|
||||
|
||||
public static JudgeManager Instance { get; private set; }
|
||||
|
||||
@@ -48,22 +50,49 @@ public class JudgeManager : MonoBehaviour
|
||||
/// </summary>
|
||||
public void OnAllNotesJudged()
|
||||
{
|
||||
// safe null checks and invocation
|
||||
if (settlement_go != null)
|
||||
if (settlement_go == null)
|
||||
{
|
||||
Debug.LogError("结算页面不存在!");
|
||||
return;
|
||||
}
|
||||
|
||||
// Activate settlement UI so components run their lifecycle, then call update next frame
|
||||
try
|
||||
{
|
||||
settlement_go.SetActive(true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogWarning($"[JudgeManager] Failed to activate settlement_go: {ex}");
|
||||
}
|
||||
|
||||
// Try to resolve settlementController reference if missing
|
||||
if (sc == null && settlement_go != null)
|
||||
{
|
||||
sc = settlement_go.GetComponent<settlementController>() ?? settlement_go.GetComponentInChildren<settlementController>(true);
|
||||
}
|
||||
|
||||
// Invoke the settlement update on next frame to ensure UI initialization finished
|
||||
StartCoroutine(InvokeSettlementUpdateNextFrame());
|
||||
}
|
||||
|
||||
private IEnumerator InvokeSettlementUpdateNextFrame()
|
||||
{
|
||||
yield return null; // wait one frame to allow Awake/Start/OnEnable
|
||||
if (sc != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
sc?.startSettlement_uiUpdate();
|
||||
sc.startSettlement_uiUpdate();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogWarning($"[JudgeManager] Exception calling startSettlement_uiUpdate: {ex}");
|
||||
}
|
||||
settlement_go.SetActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError("结算页面不存在!");
|
||||
Debug.LogWarning("[JudgeManager] settlementController (sc) not found on settlement_go; cannot call startSettlement_uiUpdate().");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user