notebook实装功能,galgame继续,一些bug修复
This commit is contained in:
@@ -60,11 +60,6 @@ public class HoldNote : BaseNote
|
||||
[Range(1f, 2f)]
|
||||
public float holdWindowMultiplier = 1.3f;
|
||||
|
||||
[Header("Custom Animation")]
|
||||
public GameObject holdAnimationPrefab;
|
||||
private GameObject activeHoldAnimationInstance;
|
||||
private Coroutine delayedHoldAnimationCoroutine;
|
||||
|
||||
public float visualSpeedMultiplier = 1f; // injected from NoteSpawner to adapt windows when visual speed changes
|
||||
|
||||
// track when the hold actually started (real-time) so we can compute held fraction
|
||||
@@ -121,6 +116,7 @@ public class HoldNote : BaseNote
|
||||
int baseScore = 0;
|
||||
|
||||
var bmm = ally != null ? ally.bmm : null;
|
||||
if (bmm == null) bmm = BeatmapManager.Instance;
|
||||
if (bmm == null) bmm = GetBeatmapManagerCached();
|
||||
if (bmm != null) baseScore = Mathf.Max(0, bmm.perNoteScore);
|
||||
|
||||
@@ -322,58 +318,6 @@ public class HoldNote : BaseNote
|
||||
}
|
||||
}
|
||||
|
||||
private void StartHoldEffects()
|
||||
{
|
||||
StopHoldEffects(); // cleanup any existing
|
||||
if (gameObject.activeInHierarchy)
|
||||
{
|
||||
delayedHoldAnimationCoroutine = StartCoroutine(DelayedStartHoldEffects());
|
||||
}
|
||||
}
|
||||
|
||||
private void StopHoldEffects()
|
||||
{
|
||||
if (delayedHoldAnimationCoroutine != null)
|
||||
{
|
||||
StopCoroutine(delayedHoldAnimationCoroutine);
|
||||
delayedHoldAnimationCoroutine = null;
|
||||
}
|
||||
if (activeHoldAnimationInstance != null)
|
||||
{
|
||||
Destroy(activeHoldAnimationInstance);
|
||||
activeHoldAnimationInstance = null;
|
||||
}
|
||||
AnimationController.Global?.StopHoldParticles();
|
||||
}
|
||||
|
||||
private IEnumerator DelayedStartHoldEffects()
|
||||
{
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
|
||||
// Start standard particles
|
||||
AnimationController.Global?.StartHoldParticles(noteColor);
|
||||
|
||||
// Instantiate custom prefab if assigned
|
||||
if (holdAnimationPrefab != null)
|
||||
{
|
||||
// find spawn position: prefer the track effect position if available from AnimationController
|
||||
Vector3 spawnPos = transform.position;
|
||||
var ac = AnimationController.Global;
|
||||
if (ac != null)
|
||||
{
|
||||
// Logic to find slot position (simplified: use ac's position or the note's)
|
||||
// In AnimationController.PlayDestroyAnimation, it uses redEffect.transform.position etc.
|
||||
// We don't have direct access to those private fields, but we can assume
|
||||
// the note is at the judge line when this starts.
|
||||
}
|
||||
|
||||
activeHoldAnimationInstance = Instantiate(holdAnimationPrefab, spawnPos, Quaternion.identity);
|
||||
|
||||
// Optionally parent to the note or track
|
||||
// activeHoldAnimationInstance.transform.SetParent(this.transform, false);
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator DelayedDisableAnimation(GameObject animationObject, float delay)
|
||||
{
|
||||
// No-op: we used to disable the shared AnimationController here which stopped coroutines.
|
||||
@@ -393,6 +337,7 @@ public class HoldNote : BaseNote
|
||||
|
||||
this.trackIndex = trackIndex;
|
||||
// also set BaseNote.TrackIndex so other systems using TrackIndex property work consistently
|
||||
this.TrackIndex = trackIndex;
|
||||
this.speed = speed;
|
||||
this.startTime = time;
|
||||
this.delay = delay;
|
||||
@@ -497,7 +442,7 @@ public class HoldNote : BaseNote
|
||||
if (!isHoldActive && jm != null && jm.IsStartJudged(noteID) && !jm.HasNoteReleased(noteID) && keyHeld)
|
||||
{
|
||||
isHoldActive = true;
|
||||
StartHoldEffects();
|
||||
AnimationController.Global?.StartHoldParticles(noteColor);
|
||||
if (debugEnabled) Debug.Log($"[HoldNote] Start particles started for {noteID} color={noteColor} at time={now:F3}");
|
||||
}
|
||||
|
||||
@@ -531,7 +476,7 @@ public class HoldNote : BaseNote
|
||||
if (isHoldActive && keyUp)
|
||||
{
|
||||
isHoldActive = false;
|
||||
StopHoldEffects();
|
||||
AnimationController.Global?.StopHoldParticles();
|
||||
if (debugEnabled) Debug.Log($"[HoldNote] KeyUp {keyToPress} detected. NoteID: {noteID}, Segment: {segment}, Type: {type}");
|
||||
|
||||
if (!hasReleased)
|
||||
@@ -706,7 +651,7 @@ public class HoldNote : BaseNote
|
||||
JudgeManager.Instance.RegisterStartJudged(noteID, true);
|
||||
isHoldActive = true;
|
||||
PlayHitAnimation();
|
||||
StartHoldEffects();
|
||||
AnimationController.Global?.StartHoldParticles(noteColor);
|
||||
|
||||
holdStartTime = pressTime;
|
||||
HoldNoteJudgePool.RegisterStart(noteID, pressTime, hitTime, scheduledEndTime, noteColor, trackIndex, (object)noteData);
|
||||
@@ -762,7 +707,7 @@ public class HoldNote : BaseNote
|
||||
isJudged = true;
|
||||
// Terminate input - mark key as released
|
||||
isHoldActive = false;
|
||||
StopHoldEffects();
|
||||
AnimationController.Global?.StopHoldParticles();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -932,7 +877,7 @@ public class HoldNote : BaseNote
|
||||
JudgeManager.Instance.RegisterStartJudged(noteID, true);
|
||||
isHoldActive = true;
|
||||
PlayHitAnimation();
|
||||
StartHoldEffects();
|
||||
AnimationController.Global?.StartHoldParticles(noteColor);
|
||||
|
||||
// record when the hold started so we can compute held fraction later
|
||||
holdStartTime = pressTime;
|
||||
@@ -948,7 +893,7 @@ public class HoldNote : BaseNote
|
||||
JudgeManager.Instance.RegisterStartJudged(noteID, true);
|
||||
isHoldActive = true;
|
||||
PlayHitAnimation();
|
||||
StartHoldEffects();
|
||||
AnimationController.Global?.StartHoldParticles(noteColor);
|
||||
|
||||
holdStartTime = pressTime;
|
||||
|
||||
@@ -962,7 +907,7 @@ public class HoldNote : BaseNote
|
||||
JudgeManager.Instance.RegisterStartJudged(noteID, true);
|
||||
isHoldActive = true;
|
||||
PlayHitAnimation();
|
||||
StartHoldEffects();
|
||||
AnimationController.Global?.StartHoldParticles(noteColor);
|
||||
|
||||
holdStartTime = pressTime;
|
||||
|
||||
@@ -1250,7 +1195,7 @@ public class HoldNote : BaseNote
|
||||
if (JudgeManager.IsDebugEnabled) Debug.Log($"[HoldNote] Hold end NotifyNoteHit called: TrackIndex={TrackIndex} trackIndexField={trackIndex} result={result} triggeredHold={triggeredHold} triggeredTap={triggeredTap}");
|
||||
}
|
||||
|
||||
StopHoldEffects();
|
||||
AnimationController.Global?.StopHoldParticles();
|
||||
|
||||
// Release the track lock immediately after end evaluation so the next hold can start on time
|
||||
ReleaseTrackJudgeLockSafe();
|
||||
@@ -1372,9 +1317,6 @@ public class HoldNote : BaseNote
|
||||
// Restore materials before returning to pool/reusing
|
||||
RestoreOriginalMaterials();
|
||||
|
||||
// Stop any active hold animations or delayed starts
|
||||
StopHoldEffects();
|
||||
|
||||
hasReleased = false;
|
||||
segment = NoteSegment.None;
|
||||
keyToPress = KeyCode.None;
|
||||
|
||||
Reference in New Issue
Block a user