Skip to content

Commit

Permalink
Merge branch 'master' into fix-mods-masking
Browse files Browse the repository at this point in the history
  • Loading branch information
smoogipoo authored Oct 13, 2024
2 parents 8c55f80 + 856c911 commit bdc154b
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 16 deletions.
7 changes: 4 additions & 3 deletions PerformanceCalculatorGUI/RulesetHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,19 +103,19 @@ public static int AdjustManiaScore(int score, IReadOnlyList<Mod> mods)
return (int)Math.Round(1000000 * scoreMultiplier);
}

public static Dictionary<HitResult, int> GenerateHitResultsForRuleset(RulesetInfo ruleset, double accuracy, IBeatmap beatmap, int countMiss, int? countMeh, int? countGood)
public static Dictionary<HitResult, int> GenerateHitResultsForRuleset(RulesetInfo ruleset, double accuracy, IBeatmap beatmap, int countMiss, int? countMeh, int? countGood, int? countLargeTickMisses)
{
return ruleset.OnlineID switch
{
0 => generateOsuHitResults(accuracy, beatmap, countMiss, countMeh, countGood),
0 => generateOsuHitResults(accuracy, beatmap, countMiss, countMeh, countGood, countLargeTickMisses),
1 => generateTaikoHitResults(accuracy, beatmap, countMiss, countGood),
2 => generateCatchHitResults(accuracy, beatmap, countMiss, countMeh, countGood),
3 => generateManiaHitResults(accuracy, beatmap, countMiss),
_ => throw new ArgumentException("Invalid ruleset ID provided.")
};
}

private static Dictionary<HitResult, int> generateOsuHitResults(double accuracy, IBeatmap beatmap, int countMiss, int? countMeh, int? countGood)
private static Dictionary<HitResult, int> generateOsuHitResults(double accuracy, IBeatmap beatmap, int countMiss, int? countMeh, int? countGood, int? countLargeTickMisses)
{
int countGreat;

Expand Down Expand Up @@ -196,6 +196,7 @@ private static Dictionary<HitResult, int> generateOsuHitResults(double accuracy,
{ HitResult.Great, countGreat },
{ HitResult.Ok, countGood ?? 0 },
{ HitResult.Meh, countMeh ?? 0 },
{ HitResult.LargeTickMiss, countLargeTickMisses ?? 0 },
{ HitResult.Miss, countMiss }
};
}
Expand Down
61 changes: 48 additions & 13 deletions PerformanceCalculatorGUI/Screens/SimulateScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ public partial class SimulateScreen : PerformanceCalculatorScreen
private SwitchButton beatmapImportTypeSwitch;

private LimitedLabelledNumberBox missesTextBox;
private LimitedLabelledNumberBox largeTickMissesTextBox;
private LimitedLabelledNumberBox comboTextBox;
private LimitedLabelledNumberBox scoreTextBox;

Expand Down Expand Up @@ -135,8 +136,8 @@ private void load(OsuColour osuColour)
AutoSizeAxes = Axes.Y,
ColumnDimensions = new[]
{
new Dimension(),
new Dimension(GridSizeMode.Absolute),
new Dimension(),
new Dimension(GridSizeMode.AutoSize)
},
RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) },
Expand Down Expand Up @@ -254,21 +255,46 @@ private void load(OsuColour osuColour)
}
}
},
missesTextBox = new LimitedLabelledNumberBox
comboTextBox = new LimitedLabelledNumberBox
{
RelativeSizeAxes = Axes.X,
Anchor = Anchor.TopLeft,
Label = "Misses",
Label = "Combo",
PlaceholderText = "0",
MinValue = 0
},
comboTextBox = new LimitedLabelledNumberBox
new GridContainer
{
RelativeSizeAxes = Axes.X,
Anchor = Anchor.TopLeft,
Label = "Combo",
PlaceholderText = "0",
MinValue = 0
AutoSizeAxes = Axes.Y,
ColumnDimensions = new[]
{
new Dimension(),
new Dimension()
},
RowDimensions = new[] { new Dimension(GridSizeMode.AutoSize) },
Content = new[]
{
new Drawable[]
{
missesTextBox = new LimitedLabelledNumberBox
{
RelativeSizeAxes = Axes.X,
Anchor = Anchor.TopLeft,
Label = "Misses",
PlaceholderText = "0",
MinValue = 0
},
largeTickMissesTextBox = new LimitedLabelledNumberBox
{
RelativeSizeAxes = Axes.X,
Anchor = Anchor.TopLeft,
Label = "Large Tick Misses",
PlaceholderText = "0",
MinValue = 0
}
}
}
},
scoreTextBox = new LimitedLabelledNumberBox
{
Expand Down Expand Up @@ -423,28 +449,29 @@ private void load(OsuColour osuColour)
{
beatmapImportContainer.ColumnDimensions = new[]
{
new Dimension(GridSizeMode.Absolute),
new Dimension(),
new Dimension(GridSizeMode.Absolute),
new Dimension(GridSizeMode.AutoSize)
};
fixupTextBox(beatmapIdTextBox);
}
else
{
beatmapImportContainer.ColumnDimensions = new[]
{
new Dimension(),
new Dimension(GridSizeMode.Absolute),
new Dimension(),
new Dimension(GridSizeMode.AutoSize)
};
fixupTextBox(beatmapIdTextBox);
}
});

accuracyTextBox.Value.BindValueChanged(_ => debouncedCalculatePerformance());
goodsTextBox.Value.BindValueChanged(_ => debouncedCalculatePerformance());
mehsTextBox.Value.BindValueChanged(_ => debouncedCalculatePerformance());
missesTextBox.Value.BindValueChanged(_ => debouncedCalculatePerformance());
largeTickMissesTextBox.Value.BindValueChanged(_ => debouncedCalculatePerformance());
comboTextBox.Value.BindValueChanged(_ => debouncedCalculatePerformance());
scoreTextBox.Value.BindValueChanged(_ => debouncedCalculatePerformance());

Expand Down Expand Up @@ -636,7 +663,8 @@ private void calculatePerformance()
if (ruleset.Value.OnlineID != -1)
{
// official rulesets can generate more precise hits from accuracy
statistics = RulesetHelper.GenerateHitResultsForRuleset(ruleset.Value, accuracyTextBox.Value.Value / 100.0, beatmap, missesTextBox.Value.Value, countMeh, countGood);
statistics = RulesetHelper.GenerateHitResultsForRuleset(ruleset.Value, accuracyTextBox.Value.Value / 100.0, beatmap, missesTextBox.Value.Value, countMeh, countGood, largeTickMissesTextBox.Value.Value);

accuracy = RulesetHelper.GetAccuracyForRuleset(ruleset.Value, statistics);
}

Expand Down Expand Up @@ -671,6 +699,7 @@ private void populateScoreParams()
accuracyContainer.Hide();
comboTextBox.Hide();
missesTextBox.Hide();
largeTickMissesTextBox.Hide();
scoreTextBox.Hide();

if (ruleset.Value.ShortName == "osu" || ruleset.Value.ShortName == "taiko" || ruleset.Value.ShortName == "fruits")
Expand All @@ -681,6 +710,11 @@ private void populateScoreParams()
updateCombo(true);
comboTextBox.Show();
missesTextBox.Show();

if (ruleset.Value.ShortName == "osu")
{
largeTickMissesTextBox.Show();
}
}
else if (ruleset.Value.ShortName == "mania")
{
Expand All @@ -701,6 +735,7 @@ private void populateScoreParams()
updateCombo(true);
comboTextBox.Show();
missesTextBox.Show();
largeTickMissesTextBox.Show();

scoreTextBox.Text = string.Empty;
scoreTextBox.Show();
Expand Down

0 comments on commit bdc154b

Please sign in to comment.