技能主要更新,修复卡顿并加入动画,以及各种其他更新。
This commit is contained in:
@@ -210,6 +210,8 @@ public class BeatmapManager : MonoBehaviour
|
||||
|
||||
// ����ͳһ�ĵ��˴����������� HP ��������ã�
|
||||
SetupEnemiesAndHP();
|
||||
ApplyTrackScoreCaps(beatmap);
|
||||
ApplyTrackScoreCaps(beatmap);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -221,6 +223,7 @@ public class BeatmapManager : MonoBehaviour
|
||||
Debug.Log("�����Ѽ��أ����� Beatmap ����" + (beatmap != null ? beatmap.title : "null"));
|
||||
// No globalDelaySeconds available in this path. Call NoteSpawner directly.
|
||||
noteSpawner.LoadBeatmap(beatmap);
|
||||
ApplyTrackScoreCaps(beatmap);
|
||||
}
|
||||
|
||||
// ��ȡ�����ص�ǰ���浽���������������ã�
|
||||
@@ -299,7 +302,7 @@ public class BeatmapManager : MonoBehaviour
|
||||
Debug.LogWarning("BeatmapManager.Start: chart parsed from SongData, attempting to assign audio and pause system");
|
||||
|
||||
// try to assign audio to GameManager.musicSource
|
||||
var gm = FindObjectOfType<GameManager>();
|
||||
var gm = FindAnyObjectByType<GameManager>();
|
||||
if (gm != null && gm.musicSource != null)
|
||||
{
|
||||
if (assignedSongData != null && assignedSongData.audioFile != null)
|
||||
@@ -369,7 +372,7 @@ public class BeatmapManager : MonoBehaviour
|
||||
}
|
||||
|
||||
// Pause the system to show pause overlay (PauseManager will enable overlayRoot)
|
||||
var pauseMgr = PauseManager.Instance ?? FindObjectOfType<PauseManager>();
|
||||
var pauseMgr = PauseManager.Instance ?? FindAnyObjectByType<PauseManager>();
|
||||
if (pauseMgr != null)
|
||||
{
|
||||
pauseMgr.Pause(true);
|
||||
@@ -575,7 +578,7 @@ public class BeatmapManager : MonoBehaviour
|
||||
if (parsedNoteAmount <= 0)
|
||||
{
|
||||
parsedNoteAmount = parsed.notes.Length;
|
||||
if (GameConfig.verboseLogs) Debug.Log($"[BeatmapManager] Calculated missing noteAmount: {parsedNoteAmount}");
|
||||
if (JudgeManager.IsDebugEnabled) Debug.Log($"[BeatmapManager] Calculated missing noteAmount: {parsedNoteAmount}");
|
||||
}
|
||||
|
||||
// Ensure note statistics (counts by color) are populated
|
||||
@@ -596,10 +599,72 @@ public class BeatmapManager : MonoBehaviour
|
||||
{
|
||||
parsedNoteStatistics[i++] = new NoteStatistic { colorType = kvp.Key, count = kvp.Value };
|
||||
}
|
||||
if (GameConfig.verboseLogs) Debug.Log($"[BeatmapManager] Calculated missing noteStatistics for {counts.Count} colors");
|
||||
if (JudgeManager.IsDebugEnabled) Debug.Log($"[BeatmapManager] Calculated missing noteStatistics for {counts.Count} colors");
|
||||
}
|
||||
}
|
||||
|
||||
// Compute per-track note counts and apply max score caps to allies
|
||||
private void ApplyTrackScoreCaps(Beatmap parsed)
|
||||
{
|
||||
if (parsed == null || parsed.notes == null) return;
|
||||
|
||||
const int trackCount = 5;
|
||||
var counts = new int[trackCount];
|
||||
for (int i = 0; i < parsed.notes.Length; i++)
|
||||
{
|
||||
var n = parsed.notes[i];
|
||||
int idx = n != null ? n.trackIndex : -1;
|
||||
if (idx < 0 || idx >= trackCount) continue;
|
||||
counts[idx]++;
|
||||
}
|
||||
|
||||
int per = perNoteScore;
|
||||
if (per <= 0 && parsedNoteAmount > 0)
|
||||
per = totalChartScore / parsedNoteAmount;
|
||||
|
||||
var ui = teamUIController.Instance;
|
||||
for (int i = 0; i < trackCount; i++)
|
||||
{
|
||||
int maxScore = Mathf.Max(0, per * counts[i]);
|
||||
var ally = ResolveAllyCombatant(i, ui);
|
||||
if (ally != null)
|
||||
{
|
||||
ally.SetMaxTrackScore(maxScore, true);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Fallback: update UI text directly if combatant not found
|
||||
string value = $"0/{maxScore}";
|
||||
if (ui != null)
|
||||
{
|
||||
switch (i)
|
||||
{
|
||||
case 0: if (ui.teammate01_current_scoreText != null) ui.teammate01_current_scoreText.text = value; break;
|
||||
case 1: if (ui.teammate02_current_scoreText != null) ui.teammate02_current_scoreText.text = value; break;
|
||||
case 2: if (ui.teammate03_current_scoreText != null) ui.teammate03_current_scoreText.text = value; break;
|
||||
case 3: if (ui.teammate04_current_scoreText != null) ui.teammate04_current_scoreText.text = value; break;
|
||||
case 4: if (ui.teammate05_current_scoreText != null) ui.teammate05_current_scoreText.text = value; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private AllyCombatant ResolveAllyCombatant(int slotIndex, teamUIController ui)
|
||||
{
|
||||
GameObject go = null;
|
||||
if (ui != null)
|
||||
go = ui.GetAllyObjectBySlot(slotIndex);
|
||||
if (go == null)
|
||||
{
|
||||
var byName = GameObject.Find($"ally_0{slotIndex + 1}");
|
||||
if (byName != null) go = byName;
|
||||
}
|
||||
if (go == null) return null;
|
||||
var ally = go.GetComponent<AllyCombatant>();
|
||||
if (ally != null) return ally;
|
||||
return go.GetComponentInChildren<AllyCombatant>(true);
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
private class BeatmapExtra
|
||||
{
|
||||
@@ -633,4 +698,4 @@ public class BeatmapManager : MonoBehaviour
|
||||
public class TrackStates { public bool trackFading_active; public TrackState red; public TrackState green; public TrackState yellow; public TrackState purple; public TrackState blue; }
|
||||
[System.Serializable]
|
||||
public class TrackState { public bool isOn; public float fadeTime; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user