static void Postfix(SaberAfterCutSwingRatingCounter saberAfterCutSwingRatingCounter, FlyingScoreTextEffect __instance, ref Color ____color, NoteCutInfo noteCutInfo) { ScoreController.ScoreWithoutMultiplier(noteCutInfo, saberAfterCutSwingRatingCounter, out int before_plus_acc, out int after, out int accuracy); int total = before_plus_acc + after; Config.judge(__instance, noteCutInfo, saberAfterCutSwingRatingCounter, ref ____color, total, before_plus_acc - accuracy, after, accuracy); }
private void AfterCutSwingRatingCounter_didFinishEvent(SaberAfterCutSwingRatingCounter v) { ScoreController.RawScoreWithoutMultiplier(noteCutInfos[v], v, out int beforeCut, out int afterCut, out int why); if (noteCutInfos[v].saberType == Saber.SaberType.SaberA) { totalScoreLeft += beforeCut + afterCut; ++totalCutCountLeft; } else { totalScoreRight += beforeCut + afterCut; ++totalCutCountRight; } if (settings.SeparateSaberCounts) { double leftAverage = Math.Round(((double)(totalScoreLeft)) / (totalCutCountLeft)); double rightAverage = Math.Round(((double)(totalScoreRight)) / (totalCutCountRight)); leftAverage = Double.IsNaN(leftAverage) ? 0 : leftAverage; rightAverage = Double.IsNaN(rightAverage) ? 0 : rightAverage; cutCounter.text = $"{leftAverage}"; cutCounter.text += $" {rightAverage}"; } else { cutCounter.text = $"{Math.Round(((double)(totalScoreRight + totalScoreLeft)) / (totalCutCountRight + totalCutCountLeft))}"; } noteCutInfos.Remove(v); }
static bool Prefix(GameNoteController __instance, Saber saber, Vector3 cutPoint, Quaternion orientation, Vector3 cutDirVec, bool allowBadCut, ref AudioTimeSyncController ____audioTimeSyncController, ref BoxCuttableBySaber ____bigCuttableBySaber, ref BoxCuttableBySaber ____smallCuttableBySaber, NoteBasicCutInfoSO ____noteBasicCutInfo) { if ((int)__instance.noteData.cutDirection >= 2000) { float timeDeviation = __instance.noteData.time - ____audioTimeSyncController.songTime; bool flag; bool flag2; bool flag3; float cutDirDeviation; ____noteBasicCutInfo.GetBasicCutInfo(__instance.noteTransform, __instance.noteData.noteType, NoteCutDirection.Any, saber.saberType, saber.bladeSpeed, cutDirVec, out flag, out flag2, out flag3, out cutDirDeviation); float swingRating = 0f; SaberAfterCutSwingRatingCounter afterCutSwingRatingCounter = null; if (flag && flag2 && flag3) { swingRating = saber.ComputeSwingRating(); afterCutSwingRatingCounter = saber.CreateAfterCutSwingRatingCounter(); } else if (!allowBadCut) { return(false); } Vector3 vector = orientation * Vector3.up; Plane plane = new Plane(vector, cutPoint); float cutDistanceToCenter = Mathf.Abs(plane.GetDistanceToPoint(__instance.noteTransform.position)); NoteCutInfo noteCutInfo = new NoteCutInfo(flag2, flag, flag3, false, saber.bladeSpeed, cutDirVec, saber.saberType, swingRating, timeDeviation, cutDirDeviation, plane.ClosestPointOnPlane(__instance.transform.position), vector, afterCutSwingRatingCounter, cutDistanceToCenter); ____bigCuttableBySaber.canBeCut = false; ____smallCuttableBySaber.canBeCut = false; __instance.SendNoteWasCutEvent(noteCutInfo); return(false); } return(true); }
static bool Prefix(SaberAfterCutSwingRatingCounter afterCutRating, FlyingScoreTextEffect __instance, ref Color ____color, NoteCutInfo ____noteCutInfo, int ____multiplier) { ScoreController.ScoreWithoutMultiplier(____noteCutInfo, afterCutRating, out int before, out int after); int total = before + after; Config.judge(__instance, ____noteCutInfo, afterCutRating, ref ____color, total); return(false); }
static bool Prefix(SaberAfterCutSwingRatingCounter saberAfterCutSwingRatingCounter, FlyingScoreEffect __instance, NoteCutInfo ____noteCutInfo) { if (Config.instance.doIntermediateUpdates) { ScoreController.RawScoreWithoutMultiplier(____noteCutInfo, saberAfterCutSwingRatingCounter, out int before_plus_acc, out int after, out int accuracy); int total = before_plus_acc + after; Config.judge(__instance, ____noteCutInfo, saberAfterCutSwingRatingCounter, total, before_plus_acc - accuracy, after, accuracy); } return(false); }
static void Postfix(SaberAfterCutSwingRatingCounter saberAfterCutSwingRatingCounter, FlyingScoreEffect __instance, ref Color ____color, NoteCutInfo noteCutInfo) { void judge(SaberAfterCutSwingRatingCounter counter) { ScoreController.RawScoreWithoutMultiplier(noteCutInfo, counter, out int before_plus_acc, out int after, out int accuracy); int total = before_plus_acc + after; Config.judge(__instance, noteCutInfo, counter, total, before_plus_acc - accuracy, after, accuracy); // If the counter is finished, remove our event from it counter.didFinishEvent -= judge; } // Apply judgments a total of twice - once when the effect is created, once when it finishes. judge(saberAfterCutSwingRatingCounter); saberAfterCutSwingRatingCounter.didFinishEvent += judge; }
public static void judge(FlyingScoreEffect scoreEffect, NoteCutInfo noteCutInfo, SaberAfterCutSwingRatingCounter saberAfterCutSwingRatingCounter, int score, int before, int after, int accuracy) { // as of 0.13, the TextMeshPro is private; use reflection to grab it out of a private field TextMeshPro text = scoreEffect.getPrivateField <TextMeshPro>("_text"); // enable rich text text.richText = true; // disable word wrap, make sure full text displays text.enableWordWrapping = false; text.overflowMode = TextOverflowModes.Overflow; Judgment judgment = DEFAULT_JUDGMENT; int index; // save in case we need to fade for (index = 0; index < instance.judgments.Length; index++) { Judgment j = instance.judgments[index]; if (score >= j.threshold) { judgment = j; break; } } Color color; if (judgment.fade) { Judgment fadeJudgment = instance.judgments[index - 1]; Color baseColor = toColor(judgment.color); Color fadeColor = toColor(fadeJudgment.color); float lerpDistance = Mathf.InverseLerp(judgment.threshold, fadeJudgment.threshold, score); color = Color.Lerp(baseColor, fadeColor, lerpDistance); } else { color = toColor(judgment.color); } scoreEffect.setPrivateField("_color", color); if (instance.displayMode == "format") { StringBuilder formattedBuilder = new StringBuilder(); string formatString = judgment.text; int nextPercentIndex = formatString.IndexOf('%'); while (nextPercentIndex != -1) { formattedBuilder.Append(formatString.Substring(0, nextPercentIndex)); if (formatString.Length == nextPercentIndex + 1) { formatString += " "; } char specifier = formatString[nextPercentIndex + 1]; switch (specifier) { case 'b': formattedBuilder.Append(before); break; case 'c': formattedBuilder.Append(accuracy); break; case 'a': formattedBuilder.Append(after); break; case 'B': formattedBuilder.Append(judgeSegment(before, instance.beforeCutAngleJudgments)); break; case 'C': formattedBuilder.Append(judgeSegment(accuracy, instance.accuracyJudgments)); break; case 'A': formattedBuilder.Append(judgeSegment(after, instance.afterCutAngleJudgments)); break; case 's': formattedBuilder.Append(score); break; case 'p': formattedBuilder.Append(string.Format("{0:0}", score / 115d * 100)); break; case '%': formattedBuilder.Append("%"); break; case 'n': formattedBuilder.Append("\n"); break; default: formattedBuilder.Append("%" + specifier); break; } formatString = formatString.Remove(0, nextPercentIndex + 2); nextPercentIndex = formatString.IndexOf('%'); } formattedBuilder.Append(formatString); text.text = formattedBuilder.ToString(); return; } if (instance.displayMode == "textOnly") { text.text = judgment.text; return; } if (instance.displayMode == "numeric") { text.text = score.ToString(); return; } if (instance.displayMode == "scoreOnTop") { text.text = score + "\n" + judgment.text + "\n"; return; } text.text = judgment.text + "\n" + score + "\n"; }
static void Prefix(NoteCutInfo noteCutInfo, ref int noteLineIndex, int multiplier, Vector3 pos, Color color, SaberAfterCutSwingRatingCounter saberAfterCutSwingRatingCounter) { if (noteLineIndex < 0) { noteLineIndex = 0; } if (noteLineIndex > 3) { noteLineIndex = 3; } }
public static void judge(FlyingScoreTextEffect text, NoteCutInfo noteCutInfo, SaberAfterCutSwingRatingCounter saberAfterCutSwingRatingCounter, ref Color color, int score, int before, int after, int accuracy) { Judgment judgment = DEFAULT_JUDGMENT; int index; // save in case we need to fade for (index = 0; index < instance.judgments.Length; index++) { Judgment j = instance.judgments[index]; if (score >= j.threshold) { judgment = j; break; } } if (judgment.fade) { Judgment fadeJudgment = instance.judgments[index - 1]; Color baseColor = toColor(judgment.color); Color fadeColor = toColor(fadeJudgment.color); float lerpDistance = Mathf.InverseLerp(judgment.threshold, fadeJudgment.threshold, score); color = Color.Lerp(baseColor, fadeColor, lerpDistance); } else { color = toColor(judgment.color); } if (instance.displayMode == "format") { StringBuilder formattedBuilder = new StringBuilder(); string formatString = judgment.text; int nextPercentIndex = formatString.IndexOf('%'); while (nextPercentIndex != -1) { formattedBuilder.Append(formatString.Substring(0, nextPercentIndex)); if (formatString.Length == nextPercentIndex + 1) { formatString += " "; } char specifier = formatString[nextPercentIndex + 1]; switch (specifier) { case 'b': formattedBuilder.Append(before); break; case 'c': formattedBuilder.Append(accuracy); break; case 'a': formattedBuilder.Append(after); break; case 'B': formattedBuilder.Append(judgeSegment(before, instance.beforeCutAngleJudgments)); break; case 'C': formattedBuilder.Append(judgeSegment(accuracy, instance.accuracyJudgments)); break; case 'A': formattedBuilder.Append(judgeSegment(after, instance.afterCutAngleJudgments)); break; case 's': formattedBuilder.Append(score); break; case '%': formattedBuilder.Append("%"); break; case 'n': formattedBuilder.Append("\n"); break; default: formattedBuilder.Append("%" + specifier); break; } formatString = formatString.Remove(0, nextPercentIndex + 2); nextPercentIndex = formatString.IndexOf('%'); } formattedBuilder.Append(formatString); text.text = formattedBuilder.ToString(); return; } if (instance.displayMode == "textOnly") { text.text = judgment.text; return; } if (instance.displayMode == "numeric") { return; } if (instance.displayMode == "scoreOnTop") { text.text = score + "\n" + judgment.text + "\n"; return; } text.text = judgment.text + "\n" + score + "\n"; }
public static void judge(FlyingScoreTextEffect text, NoteCutInfo noteCutInfo, SaberAfterCutSwingRatingCounter saberAfterCutSwingRatingCounter, ref Color color, int score) { Judgment judgment = DEFAULT_JUDGMENT; int index; // save in case we need to fade for (index = 0; index < instance.judgments.Length; index++) { Judgment j = instance.judgments[index]; if (score >= j.threshold) { judgment = j; break; } } if (judgment.fade) { Judgment fadeJudgment = instance.judgments[index - 1]; Color baseColor = toColor(judgment.color); Color fadeColor = toColor(fadeJudgment.color); float lerpDistance = Mathf.InverseLerp(judgment.threshold, fadeJudgment.threshold, score); color = Color.Lerp(baseColor, fadeColor, lerpDistance); } else { color = toColor(judgment.color); } //Hardcore Competetive Mode by wulkanat if (instance.displayMode == mode_hardcoreCompetetive) { float beforeCut = noteCutInfo.swingRating; float accuracy = 1f - Mathf.Clamp01(noteCutInfo.cutDistanceToCenter / 0.2f); float afterCut = 0f; if (saberAfterCutSwingRatingCounter != null) { afterCut = saberAfterCutSwingRatingCounter.rating; } int beforeCutScore, accuracyScore, afterCutScore; int beforeMax, accuracyMax, afterMax; if (percentages) { beforeMax = 100; accuracyMax = 100; afterMax = 100; } else { beforeMax = 70; accuracyMax = 10; afterMax = 30; } beforeCutScore = Mathf.RoundToInt(beforeMax * beforeCut); accuracyScore = Mathf.RoundToInt(accuracyMax * accuracy); afterCutScore = Mathf.RoundToInt(afterMax * afterCut); if (beforeCutScore == beforeMax && accuracyScore == accuracyMax && afterCutScore == afterMax) { text.text = "Perfect"; return; } StringBuilder formattedBuilder = new StringBuilder(); if (percentages) { formattedBuilder.Append("<color=#" + floatToHexColor(1f - score / 110f) + floatToHexColor(score / 110f) + "00>" + (int)((score / 110f) * 100f) + "%\n"); } else { formattedBuilder.Append("<color=#" + floatToHexColor(1f - score / 110f) + floatToHexColor(score / 110f) + "00>" + score + "\n"); } if (beforeCutScore == beforeMax) { formattedBuilder.Append("<color=#FFFFFF>P "); } else { formattedBuilder.Append("<color=#" + floatToHexColor(1f - beforeCut) + (floatToHexColor(beforeCut) + "00>" + beforeCutScore + " ")); } if (accuracyScore == accuracyMax) { formattedBuilder.Append("<color=#FFFFFF>P "); } else { formattedBuilder.Append("<color=#" + floatToHexColor(1f - accuracy) + floatToHexColor(accuracy) + "00>" + accuracyScore + " "); } if (afterCutScore == afterMax) { formattedBuilder.Append("<color=#FFFFFF>P"); } else { formattedBuilder.Append("<color=#" + floatToHexColor(1f - afterCut) + floatToHexColor(afterCut) + "00>" + afterCutScore); } text.text = formattedBuilder.ToString(); //Feature doesn't work /*if (saberAfterCutSwingRatingCounter.didFinish) * { * using (StreamWriter file = File.AppendText(fullPathRatings)) * { * file.WriteLine(saberAfterCutSwingRatingCounter.RequestId + " <<>> " + beforeCut + " " + accuracy + " " + afterCut + " | " + score); * } * }*/ return; } else if (instance.displayMode == mode_format) { int beforeCutScore, accuracyScore, afterCutScore; beforeCutScore = Mathf.RoundToInt(70f * noteCutInfo.swingRating); float accuracy = 1f - Mathf.Clamp01(noteCutInfo.cutDistanceToCenter / 0.2f); accuracyScore = Mathf.RoundToInt(10f * accuracy); afterCutScore = 0; if (saberAfterCutSwingRatingCounter != null) { afterCutScore = Mathf.RoundToInt(30f * saberAfterCutSwingRatingCounter.rating); } StringBuilder formattedBuilder = new StringBuilder(); string formatString = judgment.text; int nextPercentIndex = formatString.IndexOf(format_indicator); while (nextPercentIndex != -1) { formattedBuilder.Append(formatString.Substring(0, nextPercentIndex)); if (formatString.Length == nextPercentIndex + 1) { formatString += " "; } char specifier = formatString[nextPercentIndex + 1]; switch (specifier) { case format_beforeCutScore: formattedBuilder.Append(beforeCutScore); break; case format_accuracyScore: formattedBuilder.Append(accuracyScore); break; case format_afterCutScore: formattedBuilder.Append(afterCutScore); break; case FORMAT_BEFORECUTSCORE: formattedBuilder.Append(judgeSegment(beforeCutScore, instance.beforeCutAngleJudgments)); break; case FORMAT_ACCUTRACYSCORE: formattedBuilder.Append(judgeSegment(accuracyScore, instance.accuracyJudgments)); break; case FORMAT_AFTERCUTSCORE: formattedBuilder.Append(judgeSegment(afterCutScore, instance.afterCutAngleJudgments)); break; case format_score: formattedBuilder.Append(score); break; case format_indicatorChar: formattedBuilder.Append(format_indicatorChar); break; case format_lineBreak: formattedBuilder.Append("\n"); break; default: formattedBuilder.Append(format_indicator + specifier); break; } formatString = formatString.Remove(0, nextPercentIndex + 2); nextPercentIndex = formatString.IndexOf(format_indicator); } formattedBuilder.Append(formatString); text.text = formattedBuilder.ToString(); return; } else if (instance.displayMode == mode_textOnly) { text.text = judgment.text; } else if (instance.displayMode == mode_numeric) { return; } else if (instance.displayMode == mode_scoreOnTop) { text.text = score + "\n" + judgment.text + "\n"; } else { text.text = judgment.text + "\n" + score + "\n"; } }
private void AfterCutSwingRatingCounter_didFinishEvent(SaberAfterCutSwingRatingCounter afterCutRating) { _afterCutSwingRatingCounter.didFinishEvent -= AfterCutSwingRatingCounter_didFinishEvent; didFinishEvent(this); }
public ScoreBuffer(NoteCutInfo noteCutInfo, SaberAfterCutSwingRatingCounter afterCutSwingRatingCounter) { _noteCutInfo = noteCutInfo; _afterCutSwingRatingCounter = afterCutSwingRatingCounter; _afterCutSwingRatingCounter.didFinishEvent += AfterCutSwingRatingCounter_didFinishEvent; }