@@ -33,13 +33,13 @@ namespace Ichni.RhythmGame
|
||||
|
||||
return EffectState.Error;
|
||||
}
|
||||
|
||||
|
||||
public override void UpdateEffect(float triggerTime)
|
||||
{
|
||||
EffectState state = CheckEffectState(triggerTime);
|
||||
float songTime = EditorManager.instance.songInformation.songTime;
|
||||
triggerTime -= generateTime;
|
||||
|
||||
|
||||
if (state == EffectState.Before && nowEffectState != EffectState.Before)
|
||||
{
|
||||
nowEffectState = EffectState.Before;
|
||||
@@ -52,31 +52,33 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
PreExecute();
|
||||
}
|
||||
|
||||
|
||||
nowEffectState = EffectState.Middle;
|
||||
effectProgressPercent = (songTime - triggerTime) / effectTime;
|
||||
Execute();
|
||||
}
|
||||
else if (state == EffectState.After && nowEffectState != EffectState.After)
|
||||
{
|
||||
if (nowEffectState != EffectState.Middle)
|
||||
PreExecute();
|
||||
nowEffectState = EffectState.After;
|
||||
effectProgressPercent = 1;
|
||||
Adjust();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
public abstract class NoteGenerateEffect_BM : NoteEffectBase_BM
|
||||
{
|
||||
public float generateTime;
|
||||
|
||||
|
||||
public NoteGenerateEffect_BM()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public NoteGenerateEffect_BM(float effectTime, float generateTime) : base(effectTime)
|
||||
{
|
||||
this.generateTime = generateTime;
|
||||
|
||||
@@ -157,7 +157,7 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public partial class Hold
|
||||
{
|
||||
protected override void Update()
|
||||
public override void Update()
|
||||
{
|
||||
if (Keyboard.current.hKey.wasPressedThisFrame)
|
||||
{
|
||||
@@ -168,44 +168,67 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
|
||||
|
||||
|
||||
float songTime = EditorManager.instance.songInformation.songTime;
|
||||
|
||||
// 边界检查
|
||||
if (holdEndTime < exactJudgeTime)
|
||||
{
|
||||
LogWindow.Log("Hold end time is earlier than exact judge time.", Color.red);
|
||||
return;
|
||||
}
|
||||
|
||||
float songTime = EditorManager.instance.songInformation.songTime;
|
||||
|
||||
// 1. 重置逻辑:当时间回退到判定时间之前
|
||||
if (isFirstJudged && songTime < exactJudgeTime)
|
||||
{
|
||||
isFirstJudged = false;
|
||||
isHolding = false;
|
||||
isFinalJudged = false;
|
||||
holdingTime = 0;
|
||||
noteAudioSubmodule.PlayHoldStartAudio();
|
||||
// 移除音频播放 - 重置时不应该播放任何音频
|
||||
}
|
||||
|
||||
// 2. 状态恢复:当时间从结束状态回退到hold区间内
|
||||
if (isFinalJudged && songTime >= exactJudgeTime && songTime <= holdEndTime)
|
||||
{
|
||||
isFirstJudged = true;
|
||||
isHolding = true;
|
||||
isFinalJudged = false;
|
||||
holdingTime = songTime - exactJudgeTime; // 修复:更新holdingTime
|
||||
}
|
||||
|
||||
// 3. 处理hold过程中的逻辑
|
||||
if (isHolding)
|
||||
{
|
||||
holdingTime = songTime - exactJudgeTime;
|
||||
if (songTime > holdEndTime)
|
||||
|
||||
// 检查hold是否结束
|
||||
if (songTime >= holdEndTime && !isFinalJudged)
|
||||
{
|
||||
isHolding = false;
|
||||
isFinalJudged = true;
|
||||
//noteAudioSubmodule?.PlayNoteJudgeAudios(EditorManager.instance.currentJudgeType);//有待商榷
|
||||
// 可以考虑在这里播放hold结束的音频
|
||||
// noteAudioSubmodule?.PlayHoldEndAudio();
|
||||
}
|
||||
}
|
||||
|
||||
// 4. 第一次判定:进入判定区间
|
||||
if (!isFirstJudged && songTime >= exactJudgeTime)
|
||||
{
|
||||
isFirstJudged = true;
|
||||
if (!isHolding && songTime < holdEndTime)
|
||||
|
||||
// 检查是否可以开始hold
|
||||
if (songTime <= holdEndTime)
|
||||
{
|
||||
// 播放开始判定的音频
|
||||
noteAudioSubmodule?.PlayNoteJudgeAudios(EditorManager.instance.currentJudgeType);
|
||||
// 如果需要,在这里播放hold开始音频
|
||||
// noteAudioSubmodule.PlayHoldStartAudio();
|
||||
|
||||
isHolding = true;
|
||||
holdingTime = songTime - exactJudgeTime;
|
||||
}
|
||||
}
|
||||
|
||||
if (noteJudgeSubmodule != null && !EditorManager.instance.cameraManager.isSceneCameraActive)
|
||||
{
|
||||
foreach (NoteJudgeUnit unit in noteJudgeSubmodule.judgeUnitList.Where(unit => unit.isShowingJudge))
|
||||
|
||||
@@ -36,9 +36,9 @@ namespace Ichni.RhythmGame
|
||||
public override void AfterInitialize()
|
||||
{
|
||||
base.AfterInitialize();
|
||||
|
||||
|
||||
float beyondTime = 0f;
|
||||
|
||||
|
||||
foreach (EffectBase effectBase in noteVisual.effectSubmodule.effectCollection["Generate"])
|
||||
{
|
||||
if (effectBase is NoteGenerateEffect ge)
|
||||
@@ -59,7 +59,7 @@ namespace Ichni.RhythmGame
|
||||
finishEffects.AddRange(noteVisual.effectSubmodule.effectCollection["Good"]);
|
||||
finishEffects.AddRange(noteVisual.effectSubmodule.effectCollection["Bad"]);
|
||||
finishEffects.AddRange(noteVisual.effectSubmodule.effectCollection["Miss"]);
|
||||
|
||||
|
||||
foreach (EffectBase effectBase in finishEffects)
|
||||
{
|
||||
finishTime = Mathf.Max(finishTime, effectBase.effectTime);
|
||||
@@ -68,7 +68,12 @@ namespace Ichni.RhythmGame
|
||||
if (exactJudgeTime - beyondTime - 0.5f > -EditorManager.instance.songInformation.delay)
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
EditorManager.instance.noteManager.RegisterNote(this, exactJudgeTime - beyondTime - 0.5f, exactJudgeTime + finishTime + 1.5f);
|
||||
if (this is Hold hold)
|
||||
{
|
||||
EditorManager.instance.noteManager.RegisterNote(hold, hold.exactJudgeTime - beyondTime - 0.5f, hold.holdEndTime + finishTime + 1.5f);
|
||||
|
||||
}
|
||||
else EditorManager.instance.noteManager.RegisterNote(this, exactJudgeTime - beyondTime - 0.5f, exactJudgeTime + finishTime + 1.5f);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -115,8 +120,8 @@ namespace Ichni.RhythmGame
|
||||
|
||||
foreach (SampleWindow i in SampleWindow.instances.Where(i => i.gameElement)) i.OnceSpawnNote();
|
||||
}
|
||||
|
||||
protected virtual void Update()
|
||||
|
||||
public virtual void Update()
|
||||
{
|
||||
var editor = EditorManager.instance;
|
||||
var cameraManager = editor.cameraManager;
|
||||
|
||||
Reference in New Issue
Block a user