客户端rsa,冗余清理,bug修复,安卓build问题
This commit is contained in:
@@ -89,7 +89,7 @@ public class NoteSpawner : MonoBehaviour
|
||||
|
||||
public NoteJudgeConfig judgeConfig; // Documentation text normalized.
|
||||
private Beatmap beatmap;
|
||||
private float startTime; // Documentation text normalized.
|
||||
private float startTime; // Absolute chart time anchor.
|
||||
private float bpm = 120f;
|
||||
private bool isSpawning = false;
|
||||
|
||||
@@ -247,7 +247,7 @@ public class NoteSpawner : MonoBehaviour
|
||||
JudgeManager.Instance?.SetTotalNotes(total);
|
||||
|
||||
bpm = beatmap.bpm;
|
||||
startTime = Time.time;
|
||||
startTime = GameplayClock.ChartStartSongTime;
|
||||
if (JudgeManager.IsDebugEnabled) Debug.Log($"歌曲开始时间: {startTime}");
|
||||
|
||||
// keep reference so we can stop spawning when doing immediate settlement
|
||||
@@ -305,14 +305,12 @@ public class NoteSpawner : MonoBehaviour
|
||||
|
||||
float travelTime = GetLaneTravelTimeSeconds(laneTravelTimes, note.trackIndex);
|
||||
float spawnTime = note.time - travelTime;
|
||||
float delay = spawnTime - (Time.time - startTime) + spawnOffset;
|
||||
float chartSpawnTime = startTime + spawnTime + spawnOffset;
|
||||
float delay = chartSpawnTime - GameplayClock.NowSongTime;
|
||||
|
||||
if (delay > 0)
|
||||
{
|
||||
// Use scaled-time wait so spawning is paused while Time.timeScale==0 (PauseManager pause)
|
||||
float target = Time.time + delay;
|
||||
// Wait using frames so this loop respects Time.timeScale (Time.time won't advance when paused)
|
||||
while (Time.time < target)
|
||||
while (GameplayClock.NowSongTime < chartSpawnTime)
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
@@ -390,8 +388,7 @@ public class NoteSpawner : MonoBehaviour
|
||||
Transform spawnPoint = spawnPoints[noteData.trackIndex];
|
||||
|
||||
// Calculate hit time (realtime when note should be judged)
|
||||
float rawHit = startTime + noteData.time + globalHitDelay;
|
||||
float realtimeHit = Mathf.Max(0f, rawHit);
|
||||
float chartHitTime = Mathf.Max(0f, startTime + noteData.time + globalHitDelay);
|
||||
|
||||
Vector3 initialPosition = spawnPoint.position;
|
||||
note.transform.position = initialPosition;
|
||||
@@ -403,12 +400,12 @@ public class NoteSpawner : MonoBehaviour
|
||||
if (noteScript != null)
|
||||
{
|
||||
// Setup note script with timing parameters
|
||||
noteScript.Setup(key, noteData.trackIndex, noteSpeed, realtimeHit, noteData.color, judgeConfig, noteData, isSync);
|
||||
noteScript.Setup(key, noteData.trackIndex, noteSpeed, chartHitTime, noteData.color, judgeConfig, noteData, isSync);
|
||||
|
||||
// Configure controller for absolute positioning (replaces relative Translate)
|
||||
if (noteController != null)
|
||||
{
|
||||
noteController.ConfigureAbsolutePositioning(initialPosition, realtimeHit, travelTime, 0f);
|
||||
noteController.ConfigureAbsolutePositioning(initialPosition, chartHitTime, travelTime, 0f);
|
||||
}
|
||||
|
||||
EnqueueNoteCalibration(noteController);
|
||||
@@ -447,15 +444,13 @@ public class NoteSpawner : MonoBehaviour
|
||||
|
||||
Transform spawnPoint = spawnPoints[noteData.trackIndex];
|
||||
// Documentation text normalized.
|
||||
float rawScheduledEnd = startTime + (noteData.time + noteData.length) + globalHitDelay;
|
||||
float scheduledEndTime = Mathf.Max(0f, rawScheduledEnd); // clamp to non-negative
|
||||
float scheduledEndTime = Mathf.Max(0f, startTime + (noteData.time + noteData.length) + globalHitDelay);
|
||||
|
||||
// Documentation text normalized.
|
||||
int holdNoteId = ++holdNoteIdCounter;
|
||||
|
||||
// base realtime for hits
|
||||
float rawBase = startTime + noteData.time + globalHitDelay;
|
||||
float baseHit = Mathf.Max(0f, rawBase);
|
||||
float baseHit = Mathf.Max(0f, startTime + noteData.time + globalHitDelay);
|
||||
|
||||
GameObject startObj = notePool.GetStartNote(noteData.color);
|
||||
if (startObj == null)
|
||||
@@ -759,7 +754,7 @@ public class NoteSpawner : MonoBehaviour
|
||||
|
||||
if (now >= job.nextTime)
|
||||
{
|
||||
Vector3 expected = job.controller.GetExpectedPosition(Time.time);
|
||||
Vector3 expected = job.controller.GetExpectedPosition(GameplayClock.NowSongTime);
|
||||
float distanceDeviation = Vector3.Distance(job.obj.transform.position, expected);
|
||||
if (distanceDeviation > calibrateTolerance)
|
||||
{
|
||||
@@ -847,10 +842,10 @@ public class NoteSpawner : MonoBehaviour
|
||||
if (JudgeManager.IsDebugEnabled)
|
||||
{
|
||||
Debug.Log($"[NoteSpawner] Settlement scheduled at chartEnd+{postChartDelay:F1}s " +
|
||||
$"(chartEnd={chartEndTime:F3}, startTime={startTime:F3}, now={Time.time:F3})");
|
||||
$"(chartEnd={chartEndTime:F3}, startTime={startTime:F3}, now={GameplayClock.NowSongTime:F3})");
|
||||
}
|
||||
|
||||
while (Time.time < settlementTime)
|
||||
while (GameplayClock.NowSongTime < settlementTime)
|
||||
yield return null;
|
||||
|
||||
ForceClearInputState(null);
|
||||
|
||||
Reference in New Issue
Block a user