ui基本完毕,修了一大把的bug
This commit is contained in:
@@ -100,6 +100,7 @@ public class NoteSpawner : MonoBehaviour
|
||||
private Dictionary<int, int> noteIndexToHoldId = new Dictionary<int, int>();
|
||||
|
||||
private const string NoteSpeedPrefKey = "noteSpeedMultiplier";
|
||||
private const float NoteSpeedDefault = 1f;
|
||||
private const float BaseTravelDistance = 10.75f;
|
||||
|
||||
private Coroutine spawnCoroutine;
|
||||
@@ -118,13 +119,25 @@ public class NoteSpawner : MonoBehaviour
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
EnsureDefaultNoteSpeedPreference();
|
||||
// Load saved visual speed multiplier before any spawning logic uses it
|
||||
float saved = PlayerPrefs.GetFloat(NoteSpeedPrefKey, speedMultiplier);
|
||||
float saved = PlayerPrefs.GetFloat(NoteSpeedPrefKey, NoteSpeedDefault);
|
||||
saved = Mathf.Clamp(saved, SpeedMultiplierMin, SpeedMultiplierMax);
|
||||
speedMultiplier = saved;
|
||||
if (JudgeManager.IsDebugEnabled) Debug.Log($"[NoteSpawner] Loaded speedMultiplier={speedMultiplier} from PlayerPrefs");
|
||||
}
|
||||
|
||||
private static void EnsureDefaultNoteSpeedPreference()
|
||||
{
|
||||
if (PlayerPrefs.HasKey(NoteSpeedPrefKey))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerPrefs.SetFloat(NoteSpeedPrefKey, NoteSpeedDefault);
|
||||
PlayerPrefs.Save();
|
||||
}
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
// Documentation text normalized.
|
||||
@@ -429,7 +442,7 @@ public class NoteSpawner : MonoBehaviour
|
||||
}
|
||||
|
||||
int segmentCount = Mathf.CeilToInt(noteData.length / segmentInterval);
|
||||
if (segmentCount < 1) segmentCount = 1; // Documentation text normalized.
|
||||
if (segmentCount < 2) segmentCount = 2; // Force at least one middle segment between start and end.
|
||||
float actualSegmentInterval = segmentCount > 0 ? noteData.length / segmentCount : segmentInterval;
|
||||
|
||||
Transform spawnPoint = spawnPoints[noteData.trackIndex];
|
||||
|
||||
Reference in New Issue
Block a user