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); }
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"; }
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); }
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"; } }