API 参考 / 事件系统
GhostHitEvent
暂停恢复的倒带重演窗口内,暂停前已判定的旧音符会被重新滚动出、允许再次击打,作为「幽灵」重演。幽灵击打只产生表现层反馈(打击特效 + 音效),不改变任何权威状态:不计分、不增连击、不改 MISS / 准确率 / HP,也不触发 NoteJudgedEvent。宿主仅在幽灵「视觉活跃」(τ 早于该音符的权威判定时刻)并真正给出反馈时投递本事件。
方法速览
| 方法 | 用途 |
|---|---|
lane() | 被击打的轨道 |
noteType() | 音符类型(打击特效口径) |
judgment() | 表现层反馈携带的判定等级,可能为 null |
musicTimeMs() | 本次击打的 τ |
note() | 被击打音符的只读视图,可能为 null |
lane()
java
public int lane();行为:返回被击打的轨道序号(从 0 起)。
noteType()
java
public HitEffectNoteType noteType();行为:返回音符类型(打击特效口径,如 TAP / HOLD_HEAD / HOLD_END)。
judgment()
java
public JudgmentKindDefinition judgment();行为:返回表现层反馈携带的判定等级定义,可能为 null。不要把它当作权威判定结果。
musicTimeMs()
java
public long musicTimeMs();行为:返回本次击打对应的音乐时间 τ(毫秒)。
note()
java
public NoteView note();行为:返回被击打音符的只读视图,可能为 null。
示例
java
ctx.eventBus().subscribe(GhostHitEvent.class, event -> {
// 只联动表现层:不计分、不写权威统计
spawnGhostSpark(event.lane(), event.musicTimeMs());
});完整签名
java
public class GhostHitEvent extends Event {
public GhostHitEvent(int lane, HitEffectNoteType noteType, JudgmentKindDefinition judgment,
long musicTimeMs, NoteView note);
public int lane();
public HitEffectNoteType noteType();
public JudgmentKindDefinition judgment();
public long musicTimeMs();
public NoteView note();
}行为核验:幽灵击打的音效走宿主静默播放路径,不经 SoundPlayEvent 广播(避免订阅方误以为发生了真实击打);正常(非幽灵)击打仍照常投递 SoundPlayEvent。表现层反馈已发生,本事件不可取消。
稳定性: 新增,2.x 内只增不破。