修了很多bug和增加功能,优化不少问题
This commit is contained in:
@@ -68,6 +68,44 @@ public class Note : BaseNote
|
||||
return Mathf.FloorToInt(baseScore * mult);
|
||||
}
|
||||
|
||||
private static bool TryRewriteNonMissJudgeToPerfect(int trackIndex, ref string judgeResult)
|
||||
{
|
||||
if (judgeResult != "Great" && judgeResult != "Good") return false;
|
||||
var ally = GetAllyForTrackCached(trackIndex);
|
||||
if (ally == null || ally.IsDead) return false;
|
||||
if (!ally.IsNonMissToPerfectRewriteActive()) return false;
|
||||
|
||||
judgeResult = "Perfect";
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void AdjustCountsAfterRewriteToPerfect(int trackIndex, string originalJudge)
|
||||
{
|
||||
var sm = ScoreManager.Instance;
|
||||
if (sm == null) return;
|
||||
|
||||
if (originalJudge == "Great")
|
||||
{
|
||||
sm.countGreat = Mathf.Max(0, sm.countGreat - 1);
|
||||
if (trackIndex >= 0 && trackIndex < sm.trackGreatCounts.Length)
|
||||
sm.trackGreatCounts[trackIndex] = Mathf.Max(0, sm.trackGreatCounts[trackIndex] - 1);
|
||||
}
|
||||
else if (originalJudge == "Good")
|
||||
{
|
||||
sm.countGood = Mathf.Max(0, sm.countGood - 1);
|
||||
if (trackIndex >= 0 && trackIndex < sm.trackGoodCounts.Length)
|
||||
sm.trackGoodCounts[trackIndex] = Mathf.Max(0, sm.trackGoodCounts[trackIndex] - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
sm.countPerfect += 1;
|
||||
if (trackIndex >= 0 && trackIndex < sm.trackPerfectCounts.Length)
|
||||
sm.trackPerfectCounts[trackIndex] += 1;
|
||||
}
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
anim = GetComponent<AnimationController>();
|
||||
@@ -326,6 +364,12 @@ public class Note : BaseNote
|
||||
|
||||
if (!string.IsNullOrEmpty(judgeResult))
|
||||
{
|
||||
string originalJudge = judgeResult;
|
||||
if (TryRewriteNonMissJudgeToPerfect(TrackIndex, ref judgeResult))
|
||||
{
|
||||
AdjustCountsAfterRewriteToPerfect(TrackIndex, originalJudge);
|
||||
}
|
||||
|
||||
InputManager.Instance?.ShowJudgeResult(TrackIndex, judgeResult);
|
||||
JudgeSoundManager.Instance?.PlayJudgeSound(judgeResult);
|
||||
teamUIController.Instance?.OnJudgeResult(judgeResult);
|
||||
|
||||
Reference in New Issue
Block a user