2025-06-03 02:42:28 -04:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using Dreamteck.Splines;
|
|
|
|
|
|
using Sirenix.OdinInspector;
|
2025-07-26 04:20:25 -04:00
|
|
|
|
using TMPro;
|
2025-06-03 02:42:28 -04:00
|
|
|
|
using UniRx;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.Serialization;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Ichni.RhythmGame
|
|
|
|
|
|
{
|
2025-07-21 05:42:20 -04:00
|
|
|
|
public abstract partial class NoteBase : GameElement, IHaveTimeDurationSubmodule, IComparable<NoteBase>
|
2025-06-03 02:42:28 -04:00
|
|
|
|
{
|
|
|
|
|
|
[Title("Basic Info")]
|
|
|
|
|
|
public float exactJudgeTime;
|
|
|
|
|
|
public NoteJudgeIntervals judgeIntervals;
|
|
|
|
|
|
|
|
|
|
|
|
[Title("Track Info")]
|
|
|
|
|
|
public bool isOnTrack;
|
|
|
|
|
|
public Track track;
|
|
|
|
|
|
public SplinePositioner trackPositioner;
|
2025-07-08 14:28:40 -04:00
|
|
|
|
|
|
|
|
|
|
[Title("Audio")]
|
|
|
|
|
|
public AudioContainer audioContainer;
|
2025-06-03 02:42:28 -04:00
|
|
|
|
|
|
|
|
|
|
[Title("NoteVisual")]
|
|
|
|
|
|
public NoteVisualBase noteVisual;
|
|
|
|
|
|
|
|
|
|
|
|
[Title("Submodules")]
|
|
|
|
|
|
public TimeDurationSubmodule timeDurationSubmodule { get; set; }
|
|
|
|
|
|
public NoteJudgeSubmodule noteJudgeSubmodule { get; set; }
|
|
|
|
|
|
public NoteAudioSubmodule noteAudioSubmodule { get; set; }
|
|
|
|
|
|
|
2025-07-21 05:42:20 -04:00
|
|
|
|
[Title("In-Game Info")]
|
|
|
|
|
|
public bool isDuringJudging;
|
2025-07-08 14:28:40 -04:00
|
|
|
|
public Vector2 noteScreenPosition;
|
2025-08-27 21:45:18 -04:00
|
|
|
|
public Vector2 perfectNoteScreenPosition;
|
2025-07-08 14:28:40 -04:00
|
|
|
|
public bool isFirstJudged;
|
|
|
|
|
|
public bool isFinalJudged;
|
2025-06-03 02:42:28 -04:00
|
|
|
|
public override int HierarchyPriority => -10;
|
|
|
|
|
|
|
2025-07-26 04:20:25 -04:00
|
|
|
|
[Title("Debug")] public TMP_Text judgeRankHint;
|
|
|
|
|
|
|
2025-06-03 02:42:28 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 在MovableTrack上更新Note的位置,注意HoldNote需要重写这个方法
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public virtual void UpdateNoteInMovableTrack()
|
|
|
|
|
|
{
|
|
|
|
|
|
TrackTimeSubmoduleMovable trackTimeSubmoduleMovable = track.trackTimeSubmodule as TrackTimeSubmoduleMovable;
|
|
|
|
|
|
trackPositioner.SetPercent(trackTimeSubmoduleMovable.GetTrackPercent(exactJudgeTime));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 在StaticTrack上更新Note的位置,注意HoldNote需要重写这个方法
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public virtual void UpdateNoteInStaticTrack()
|
|
|
|
|
|
{
|
|
|
|
|
|
float songTime = GameManager.instance.songTime;
|
|
|
|
|
|
TrackTimeSubmoduleStatic trackTimeSubmoduleStatic = track.trackTimeSubmodule as TrackTimeSubmoduleStatic;
|
|
|
|
|
|
|
|
|
|
|
|
float startMove = exactJudgeTime - trackTimeSubmoduleStatic.trackTotalTime;
|
|
|
|
|
|
float percent = AnimationCurveEvaluator.Evaluate(trackTimeSubmoduleStatic.animationCurveType, (songTime - startMove) / trackTimeSubmoduleStatic.trackTotalTime);
|
|
|
|
|
|
|
|
|
|
|
|
percent = Mathf.Max(percent, 0);
|
|
|
|
|
|
percent = Mathf.Min(percent, 1);
|
|
|
|
|
|
|
|
|
|
|
|
trackPositioner.SetPercent(1 - percent);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void SetDefaultSubmodules()
|
|
|
|
|
|
{
|
|
|
|
|
|
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
|
|
|
|
|
noteJudgeSubmodule = new NoteJudgeSubmodule(this);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void AfterInitialize()
|
|
|
|
|
|
{
|
2025-08-27 21:45:18 -04:00
|
|
|
|
perfectNoteScreenPosition = -Vector2.one;
|
|
|
|
|
|
|
2025-07-21 05:42:20 -04:00
|
|
|
|
float beyondTime = 0f;
|
2025-08-27 21:45:18 -04:00
|
|
|
|
|
2025-08-11 14:04:06 -04:00
|
|
|
|
foreach (EffectBase effectBase in noteVisual.effectSubmodule.effectCollection["Generate"])
|
2025-07-21 05:42:20 -04:00
|
|
|
|
{
|
2025-08-11 14:04:06 -04:00
|
|
|
|
if (effectBase is NoteGenerateEffect ge)
|
|
|
|
|
|
{
|
|
|
|
|
|
ge.Recover();
|
|
|
|
|
|
beyondTime = Mathf.Max(beyondTime, ge.generateTime);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
effectBase.Recover();
|
|
|
|
|
|
}
|
2025-07-21 05:42:20 -04:00
|
|
|
|
}
|
2025-08-11 14:04:06 -04:00
|
|
|
|
|
2025-07-21 05:42:20 -04:00
|
|
|
|
if (exactJudgeTime - beyondTime - 0.5f > -GameManager.instance.songInformation.delay)
|
|
|
|
|
|
{
|
|
|
|
|
|
gameObject.SetActive(false);
|
|
|
|
|
|
GameManager.instance.noteManager.RegisterNote(this, exactJudgeTime - beyondTime - 0.5f);
|
|
|
|
|
|
}
|
2025-07-26 04:20:25 -04:00
|
|
|
|
|
|
|
|
|
|
//judgeRankHint = Instantiate(GameManager.instance.basePrefabs.judgeRankHint, noteVisual.transform).GetComponent<TMP_Text>();
|
2025-06-03 02:42:28 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected virtual void Update()
|
|
|
|
|
|
{
|
2025-07-21 05:42:20 -04:00
|
|
|
|
if (!GameManager.instance.audioManager.isUpdating || isFinalJudged)
|
2025-07-08 14:28:40 -04:00
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-06-03 02:42:28 -04:00
|
|
|
|
if (isOnTrack)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (track.trackTimeSubmodule is TrackTimeSubmoduleStatic)
|
|
|
|
|
|
{
|
|
|
|
|
|
UpdateNoteInStaticTrack();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-07-21 05:42:20 -04:00
|
|
|
|
|
2025-08-27 21:45:18 -04:00
|
|
|
|
if (perfectNoteScreenPosition == -Vector2.one) // -Vector2.one是一个不可能的屏幕位置,用来标记perfectNoteScreenPosition还没有被赋值
|
2025-06-03 02:42:28 -04:00
|
|
|
|
{
|
2025-08-27 21:45:18 -04:00
|
|
|
|
if (isDuringJudging)
|
|
|
|
|
|
{
|
|
|
|
|
|
noteScreenPosition = GetScreenPosition();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (exactJudgeTime <= GameManager.instance.songTime)
|
|
|
|
|
|
{
|
|
|
|
|
|
perfectNoteScreenPosition = noteScreenPosition;
|
|
|
|
|
|
}
|
2025-06-03 02:42:28 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-27 21:45:18 -04:00
|
|
|
|
/*if (!isFirstJudged && exactJudgeTime <= GameManager.instance.songTime)
|
|
|
|
|
|
{
|
|
|
|
|
|
SlowOffsetAfterExactJudgeTime();
|
|
|
|
|
|
}*/
|
|
|
|
|
|
|
2025-07-26 04:20:25 -04:00
|
|
|
|
SetJudgeArea();
|
|
|
|
|
|
|
|
|
|
|
|
//SetJudgeRankText();
|
2025-08-11 14:04:06 -04:00
|
|
|
|
|
2025-07-21 05:42:20 -04:00
|
|
|
|
foreach (EffectBase e in noteVisual.effectSubmodule.effectCollection["Generate"])
|
2025-06-03 02:42:28 -04:00
|
|
|
|
{
|
2025-07-21 05:42:20 -04:00
|
|
|
|
e.UpdateEffect(exactJudgeTime);
|
2025-06-03 02:42:28 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-21 05:42:20 -04:00
|
|
|
|
if (!isFirstJudged && GameManager.instance.songTime > exactJudgeTime + judgeIntervals.afterMiss)
|
2025-06-03 02:42:28 -04:00
|
|
|
|
{
|
2025-07-21 05:42:20 -04:00
|
|
|
|
Miss(exactJudgeTime + judgeIntervals.afterMiss);
|
2025-08-11 14:04:06 -04:00
|
|
|
|
GameManager.instance.playingRecorder.resultData.Add(judgeIntervals.afterMiss);
|
2025-06-03 02:42:28 -04:00
|
|
|
|
isFirstJudged = true;
|
2025-07-08 14:28:40 -04:00
|
|
|
|
isFinalJudged = true;
|
2025-07-21 05:42:20 -04:00
|
|
|
|
RemoveFromCheckingList();
|
2025-06-03 02:42:28 -04:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-21 05:42:20 -04:00
|
|
|
|
protected virtual NoteJudgeType GetStartJudgeType(float timeDifference)
|
2025-06-03 02:42:28 -04:00
|
|
|
|
{
|
|
|
|
|
|
return judgeIntervals.GetNoteJudgeType(timeDifference);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-21 05:42:20 -04:00
|
|
|
|
protected virtual void RemoveFromCheckingList()
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-06-03 02:42:28 -04:00
|
|
|
|
public virtual void ExecuteStartJudge()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void UpdateNoteInTrack()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (isOnTrack && track.trackTimeSubmodule != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (track.trackTimeSubmodule is TrackTimeSubmoduleMovable)
|
|
|
|
|
|
{
|
|
|
|
|
|
UpdateNoteInMovableTrack();
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (track.trackTimeSubmodule is TrackTimeSubmoduleStatic)
|
|
|
|
|
|
{
|
|
|
|
|
|
UpdateNoteInStaticTrack();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public virtual void Perfect(float triggerTime)
|
|
|
|
|
|
{
|
2025-07-21 05:42:20 -04:00
|
|
|
|
isDuringJudging = false;
|
2025-06-03 02:42:28 -04:00
|
|
|
|
GameManager.instance.playingRecorder.AddPerfect();
|
2025-07-08 14:28:40 -04:00
|
|
|
|
noteAudioSubmodule.PlayNoteJudgeAudios(NoteJudgeType.Perfect);
|
2025-06-03 02:42:28 -04:00
|
|
|
|
Observable.EveryUpdate().Subscribe(_ =>
|
|
|
|
|
|
{
|
|
|
|
|
|
noteVisual.effectSubmodule.effectCollection["GeneralJudge"].ForEach(e => e.UpdateEffect(triggerTime));
|
2025-08-22 14:54:40 -04:00
|
|
|
|
|
|
|
|
|
|
foreach (var e in noteVisual.effectSubmodule.effectCollection["Perfect"])
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!e.IsPost)
|
|
|
|
|
|
{
|
|
|
|
|
|
e.UpdateEffect(triggerTime);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var e in noteVisual.effectSubmodule.effectCollection["Perfect"])
|
|
|
|
|
|
{
|
|
|
|
|
|
if (e.IsPost)
|
|
|
|
|
|
{
|
|
|
|
|
|
e.UpdateEffect(triggerTime);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-06-03 02:42:28 -04:00
|
|
|
|
noteVisual.effectSubmodule.effectCollection["AfterJudge"].ForEach(e => e.UpdateEffect(exactJudgeTime));
|
|
|
|
|
|
}).AddTo(gameObject);
|
2025-07-21 05:42:20 -04:00
|
|
|
|
|
|
|
|
|
|
if (isOnTrack) track.childElementList.Remove(this);
|
2025-07-26 04:20:25 -04:00
|
|
|
|
|
|
|
|
|
|
foreach (NoteJudgeUnit unit in noteJudgeSubmodule.judgeUnitList.Where(unit => unit.isShowingJudge))
|
|
|
|
|
|
{
|
|
|
|
|
|
unit.SetShowingJudge(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-21 05:42:20 -04:00
|
|
|
|
Destroy(gameObject, 1.2f); //注意所有特效时间不得超过1.2秒
|
2025-06-03 02:42:28 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public virtual void Good(float triggerTime)
|
|
|
|
|
|
{
|
2025-07-21 05:42:20 -04:00
|
|
|
|
isDuringJudging = false;
|
2025-06-03 02:42:28 -04:00
|
|
|
|
GameManager.instance.playingRecorder.AddGood();
|
2025-07-08 14:28:40 -04:00
|
|
|
|
noteAudioSubmodule.PlayNoteJudgeAudios(NoteJudgeType.Good);
|
2025-06-03 02:42:28 -04:00
|
|
|
|
Observable.EveryUpdate().Subscribe(_ =>
|
|
|
|
|
|
{
|
|
|
|
|
|
noteVisual.effectSubmodule.effectCollection["GeneralJudge"].ForEach(e => e.UpdateEffect(triggerTime));
|
|
|
|
|
|
noteVisual.effectSubmodule.effectCollection["Good"].ForEach(e => e.UpdateEffect(triggerTime));
|
|
|
|
|
|
noteVisual.effectSubmodule.effectCollection["AfterJudge"].ForEach(e => e.UpdateEffect(exactJudgeTime));
|
|
|
|
|
|
}).AddTo(gameObject);
|
2025-07-21 05:42:20 -04:00
|
|
|
|
|
|
|
|
|
|
if (isOnTrack) track.childElementList.Remove(this);
|
2025-07-26 04:20:25 -04:00
|
|
|
|
|
|
|
|
|
|
foreach (NoteJudgeUnit unit in noteJudgeSubmodule.judgeUnitList.Where(unit => unit.isShowingJudge))
|
|
|
|
|
|
{
|
|
|
|
|
|
unit.SetShowingJudge(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-21 05:42:20 -04:00
|
|
|
|
Destroy(gameObject, 1.2f);
|
2025-06-03 02:42:28 -04:00
|
|
|
|
}
|
|
|
|
|
|
public virtual void Bad(float triggerTime){
|
|
|
|
|
|
{
|
2025-07-21 05:42:20 -04:00
|
|
|
|
isDuringJudging = false;
|
2025-06-03 02:42:28 -04:00
|
|
|
|
GameManager.instance.playingRecorder.AddBad();
|
2025-07-08 14:28:40 -04:00
|
|
|
|
noteAudioSubmodule.PlayNoteJudgeAudios(NoteJudgeType.Bad);
|
2025-06-03 02:42:28 -04:00
|
|
|
|
Observable.EveryUpdate().Subscribe(_ =>
|
|
|
|
|
|
{
|
|
|
|
|
|
noteVisual.effectSubmodule.effectCollection["GeneralJudge"].ForEach(e => e.UpdateEffect(triggerTime));
|
|
|
|
|
|
noteVisual.effectSubmodule.effectCollection["Bad"].ForEach(e => e.UpdateEffect(triggerTime));
|
|
|
|
|
|
noteVisual.effectSubmodule.effectCollection["AfterJudge"].ForEach(e => e.UpdateEffect(exactJudgeTime));
|
|
|
|
|
|
}).AddTo(gameObject);
|
2025-07-21 05:42:20 -04:00
|
|
|
|
|
|
|
|
|
|
if (isOnTrack) track.childElementList.Remove(this);
|
2025-07-26 04:20:25 -04:00
|
|
|
|
|
|
|
|
|
|
foreach (NoteJudgeUnit unit in noteJudgeSubmodule.judgeUnitList.Where(unit => unit.isShowingJudge))
|
|
|
|
|
|
{
|
|
|
|
|
|
unit.SetShowingJudge(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-21 05:42:20 -04:00
|
|
|
|
Destroy(gameObject, 1.2f);
|
2025-06-03 02:42:28 -04:00
|
|
|
|
}}
|
|
|
|
|
|
|
|
|
|
|
|
public virtual void Miss(float triggerTime)
|
|
|
|
|
|
{
|
2025-07-21 05:42:20 -04:00
|
|
|
|
isDuringJudging = false;
|
2025-06-03 02:42:28 -04:00
|
|
|
|
GameManager.instance.playingRecorder.AddMiss();
|
2025-07-08 14:28:40 -04:00
|
|
|
|
noteAudioSubmodule.PlayNoteJudgeAudios(NoteJudgeType.Miss);
|
2025-06-03 02:42:28 -04:00
|
|
|
|
Observable.EveryUpdate().Subscribe(_ =>
|
|
|
|
|
|
{
|
|
|
|
|
|
noteVisual.effectSubmodule.effectCollection["Miss"].ForEach(e => e.UpdateEffect(triggerTime));
|
|
|
|
|
|
noteVisual.effectSubmodule.effectCollection["AfterJudge"].ForEach(e => e.UpdateEffect(exactJudgeTime));
|
|
|
|
|
|
}).AddTo(gameObject);
|
2025-07-21 05:42:20 -04:00
|
|
|
|
|
|
|
|
|
|
if (isOnTrack) track.childElementList.Remove(this);
|
2025-07-26 04:20:25 -04:00
|
|
|
|
|
|
|
|
|
|
foreach (NoteJudgeUnit unit in noteJudgeSubmodule.judgeUnitList.Where(unit => unit.isShowingJudge))
|
|
|
|
|
|
{
|
|
|
|
|
|
unit.SetShowingJudge(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-21 05:42:20 -04:00
|
|
|
|
Destroy(gameObject, 1.2f);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public abstract partial class NoteBase
|
|
|
|
|
|
{
|
2025-08-11 14:04:06 -04:00
|
|
|
|
public Vector2 GetScreenPosition()
|
|
|
|
|
|
{
|
2025-09-05 10:14:45 -04:00
|
|
|
|
return GameManager.instance.cameraManager.gameCamera.cam.WorldToScreenPoint(noteVisual.noteVisualPosition);
|
2025-08-11 14:04:06 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-26 04:20:25 -04:00
|
|
|
|
protected virtual void SetJudgeArea()
|
2025-07-21 05:42:20 -04:00
|
|
|
|
{
|
2025-08-11 14:04:06 -04:00
|
|
|
|
if (!SettingsManager.instance.gameSettings.debugMode)
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-07-21 05:42:20 -04:00
|
|
|
|
if (noteJudgeSubmodule != null)
|
|
|
|
|
|
{
|
2025-08-11 14:04:06 -04:00
|
|
|
|
if (isDuringJudging && !isFirstJudged)
|
2025-07-21 05:42:20 -04:00
|
|
|
|
{
|
|
|
|
|
|
foreach (NoteJudgeUnit unit in noteJudgeSubmodule.judgeUnitList.Where(unit => !unit.isShowingJudge))
|
|
|
|
|
|
{
|
|
|
|
|
|
unit.SetShowingJudge(true);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (NoteJudgeUnit unit in noteJudgeSubmodule.judgeUnitList.Where(unit => unit.isShowingJudge))
|
|
|
|
|
|
{
|
|
|
|
|
|
unit.UpdateJudge();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-08-11 14:04:06 -04:00
|
|
|
|
if (!isDuringJudging && (isFinalJudged))
|
2025-07-21 05:42:20 -04:00
|
|
|
|
{
|
|
|
|
|
|
foreach (NoteJudgeUnit unit in noteJudgeSubmodule.judgeUnitList.Where(unit => unit.isShowingJudge))
|
|
|
|
|
|
{
|
|
|
|
|
|
unit.SetShowingJudge(false);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int CompareTo(NoteBase other)
|
|
|
|
|
|
{
|
|
|
|
|
|
return exactJudgeTime.CompareTo(other.exactJudgeTime);
|
2025-06-03 02:42:28 -04:00
|
|
|
|
}
|
2025-07-26 04:20:25 -04:00
|
|
|
|
|
|
|
|
|
|
private void SetJudgeRankText()
|
|
|
|
|
|
{
|
|
|
|
|
|
float triggerTime = GameManager.instance.songTime;
|
|
|
|
|
|
float timeDifference = triggerTime - exactJudgeTime;
|
|
|
|
|
|
|
|
|
|
|
|
NoteJudgeType startJudgeType = GetStartJudgeType(timeDifference);
|
|
|
|
|
|
if (startJudgeType == NoteJudgeType.Perfect)
|
|
|
|
|
|
{
|
|
|
|
|
|
judgeRankHint.text = "PERFECT";
|
|
|
|
|
|
judgeRankHint.color = Color.cyan;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (startJudgeType == NoteJudgeType.Good)
|
|
|
|
|
|
{
|
|
|
|
|
|
judgeRankHint.text = "GOOD";
|
|
|
|
|
|
judgeRankHint.color = Color.green;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (startJudgeType == NoteJudgeType.Bad)
|
|
|
|
|
|
{
|
|
|
|
|
|
judgeRankHint.text = "BAD";
|
|
|
|
|
|
judgeRankHint.color = Color.magenta;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (startJudgeType == NoteJudgeType.Miss)
|
|
|
|
|
|
{
|
|
|
|
|
|
judgeRankHint.text = "MISS";
|
|
|
|
|
|
judgeRankHint.color = Color.white;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-08-11 14:04:06 -04:00
|
|
|
|
|
2025-08-22 14:54:40 -04:00
|
|
|
|
public virtual void SetPerfectPosition()
|
2025-08-11 14:04:06 -04:00
|
|
|
|
{
|
|
|
|
|
|
if (isOnTrack && track.trackTimeSubmodule is TrackTimeSubmoduleMovable movable)
|
|
|
|
|
|
{
|
|
|
|
|
|
float notePercent = movable.GetTrackPercent(GameManager.instance.songTime);
|
|
|
|
|
|
trackPositioner.SetPercent(notePercent);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2025-08-22 14:54:40 -04:00
|
|
|
|
|
|
|
|
|
|
protected virtual void SlowOffsetAfterExactJudgeTime()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (isOnTrack && track.trackTimeSubmodule is TrackTimeSubmoduleMovable movable)
|
|
|
|
|
|
{
|
|
|
|
|
|
float slowedTime = (GameManager.instance.songTime - exactJudgeTime) * 0.8f;
|
|
|
|
|
|
float notePercent = movable.GetTrackPercent(exactJudgeTime + slowedTime);
|
|
|
|
|
|
trackPositioner.SetPercent(notePercent);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*public virtual void SlowOffsetAfterExactJudgeTime()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (isOnTrack && track.trackTimeSubmodule is TrackTimeSubmoduleMovable movable)
|
|
|
|
|
|
{
|
|
|
|
|
|
float timeDifference = GameManager.instance.songTime - exactJudgeTime;
|
|
|
|
|
|
float percent = Mathf.Lerp(0f, 1f, timeDifference / (judgeIntervals.afterMiss + 0.2f));
|
|
|
|
|
|
float slowedTime = (GameManager.instance.songTime - exactJudgeTime) * percent;
|
|
|
|
|
|
//float percent = Mathf.Lerp(0, 0.5f, timeDifference / judgeIntervals.afterMiss);
|
|
|
|
|
|
//float slowedTime = (GameManager.instance.songTime - exactJudgeTime) * 0.5f;
|
|
|
|
|
|
float notePercent = movable.GetTrackPercent(exactJudgeTime + slowedTime);
|
|
|
|
|
|
trackPositioner.SetPercent(notePercent);
|
|
|
|
|
|
}
|
|
|
|
|
|
}*/
|
2025-06-03 02:42:28 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public abstract partial class NoteBase
|
|
|
|
|
|
{
|
|
|
|
|
|
public enum NoteJudgeType
|
|
|
|
|
|
{
|
2025-07-21 05:42:20 -04:00
|
|
|
|
Perfect = 0,
|
|
|
|
|
|
Good = 1,
|
|
|
|
|
|
Bad = 2,
|
|
|
|
|
|
Miss = 3,
|
|
|
|
|
|
NotJudged = -999
|
2025-06-03 02:42:28 -04:00
|
|
|
|
}
|
2025-07-21 05:42:20 -04:00
|
|
|
|
|
|
|
|
|
|
public static NoteJudgeType GetLowerType(NoteJudgeType typeA, NoteJudgeType typeB)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (typeA == NoteJudgeType.NotJudged) return typeB;
|
|
|
|
|
|
if (typeB == NoteJudgeType.NotJudged) return typeA;
|
|
|
|
|
|
|
|
|
|
|
|
return typeA > typeB ? typeA : typeB;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-06-03 02:42:28 -04:00
|
|
|
|
|
|
|
|
|
|
public class NoteJudgeIntervals
|
|
|
|
|
|
{
|
|
|
|
|
|
public TimeInterval beforeMiss;
|
|
|
|
|
|
public TimeInterval beforeBad;
|
|
|
|
|
|
public TimeInterval beforeGood;
|
|
|
|
|
|
public TimeInterval perfect;
|
|
|
|
|
|
public TimeInterval afterGood;
|
|
|
|
|
|
public TimeInterval afterBad;
|
|
|
|
|
|
public float afterMiss;
|
|
|
|
|
|
|
|
|
|
|
|
public NoteJudgeIntervals(TimeInterval beforeMiss, TimeInterval beforeBad, TimeInterval beforeGood,
|
|
|
|
|
|
TimeInterval perfect, TimeInterval afterGood, TimeInterval afterBad, float afterMiss)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.beforeMiss = beforeMiss;
|
|
|
|
|
|
this.beforeBad = beforeBad;
|
|
|
|
|
|
this.beforeGood = beforeGood;
|
|
|
|
|
|
this.perfect = perfect;
|
|
|
|
|
|
this.afterGood = afterGood;
|
|
|
|
|
|
this.afterBad = afterBad;
|
|
|
|
|
|
this.afterMiss = afterMiss;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public NoteJudgeType GetNoteJudgeType(float timeDifference)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (beforeMiss.IsInInterval(timeDifference))
|
|
|
|
|
|
{
|
|
|
|
|
|
return NoteJudgeType.Miss;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (beforeBad.IsInInterval(timeDifference))
|
|
|
|
|
|
{
|
|
|
|
|
|
return NoteJudgeType.Bad;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (beforeGood.IsInInterval(timeDifference))
|
|
|
|
|
|
{
|
|
|
|
|
|
return NoteJudgeType.Good;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (perfect.IsInInterval(timeDifference))
|
|
|
|
|
|
{
|
|
|
|
|
|
return NoteJudgeType.Perfect;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (afterGood.IsInInterval(timeDifference))
|
|
|
|
|
|
{
|
|
|
|
|
|
return NoteJudgeType.Good;
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (afterBad.IsInInterval(timeDifference))
|
|
|
|
|
|
{
|
|
|
|
|
|
return NoteJudgeType.Bad;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return NoteJudgeType.Miss; // Default to Miss if no other condition is met
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public class TimeInterval
|
|
|
|
|
|
{
|
|
|
|
|
|
public float intervalStart;
|
|
|
|
|
|
public float intervalEnd;
|
|
|
|
|
|
|
|
|
|
|
|
public TimeInterval(float start, float end)
|
|
|
|
|
|
{
|
|
|
|
|
|
intervalStart = start;
|
|
|
|
|
|
intervalEnd = end;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsInInterval(float time)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Mathf.Approximately(intervalStart, intervalEnd)) return false;
|
|
|
|
|
|
|
|
|
|
|
|
return time >= intervalStart && time <= intervalEnd;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static string GetNoteTypeName(NoteBase note)
|
|
|
|
|
|
{
|
|
|
|
|
|
return note switch
|
|
|
|
|
|
{
|
|
|
|
|
|
Tap => "Tap",
|
|
|
|
|
|
Stay => "Stay",
|
|
|
|
|
|
Hold => "Hold",
|
|
|
|
|
|
Flick => "Flick",
|
|
|
|
|
|
_ => throw new NotImplementedException("Note type not recognized")
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
namespace Beatmap
|
|
|
|
|
|
{
|
|
|
|
|
|
public abstract class NoteBase_BM : GameElement_BM
|
|
|
|
|
|
{
|
|
|
|
|
|
public float exactJudgeTime;
|
|
|
|
|
|
|
|
|
|
|
|
public NoteBase_BM()
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public NoteBase_BM(string elementName, Guid elementGuid, List<string> tags, GameElement_BM attachedElement, float exactJudgeTime)
|
|
|
|
|
|
: base(elementName, elementGuid, tags, attachedElement)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.exactJudgeTime = exactJudgeTime;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public override void ExecuteBM()
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|