8000 Add ability to calculate legacy scores with scorev1 by Givikap120 · Pull Request #272 · ppy/osu-tools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add ability to calculate legacy scores with scorev1 #272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
76 changes: 65 additions & 11 deletions PerformanceCalculatorGUI/Screens/SimulateScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public partial class SimulateScreen : PerformanceCalculatorScreen

private LabelledNumberBox scoreIdTextBox;
private StatefulButton scoreIdPopulateButton;
private LabelledSwitchButton legacyScoreSwitchButton;

private GridContainer accuracyContainer;
private LimitedLabelledFractionalNumberBox accuracyTextBox;
Expand Down Expand Up @@ -229,7 +230,7 @@ private void load(OsuColour osuColour)
scoreIdTextBox = new LabelledNumberBox
{
RelativeSizeAxes = Axes.X,
Width = 0.7f,
Width = 0.45f,
Label = "Score ID",
PlaceholderText = "0",
},
Expand All @@ -248,6 +249,13 @@ private void load(OsuColour osuColour)
notificationDisplay.Display(new Notification("Incorrect score id"));
}
}
},
legacyScoreSwitchButton = new LabelledSwitchButton
{
RelativeSizeAxes = Axes.X,
Width = 0.25f,
Anchor = Anchor.TopLeft,
Label = "Is legacy score?",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be better if we just assumed that if score field is populated then its a legacy score, and if not it's a lazer score.

8000

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's too implicit and unintuitive

}
}
},
Expand Down Expand Up @@ -356,10 +364,7 @@ private void load(OsuColour osuColour)
RelativeSizeAxes = Axes.X,
Anchor = Anchor.TopLeft,
Label = "Score",
PlaceholderText = "1000000",
MinValue = 0,
MaxValue = 1000000,
Value = { Value = 1000000 }
},
new OsuSpriteText
{
Expand Down Expand Up @@ -516,6 +521,11 @@ private void load(OsuColour osuColour)
sliderTailMissesTextBox.Value.BindValueChanged(_ => debouncedCalculatePerformance());
comboTextBox.Value.BindValueChanged(_ => debouncedCalculatePerformance());
scoreTextBox.Value.BindValueChanged(_ => debouncedCalculatePerformance());
legacyScoreSwitchButton.Current.BindValueChanged(_ =>
{
updateMissesTextboxes();
updateScoreTextBox();
});

fullScoreDataSwitch.Current.BindValueChanged(val => updateAccuracyParams(val.NewValue));

Expand Down Expand Up @@ -563,6 +573,11 @@ private void modsChanged(ValueChangedEvent<IReadOnlyList<Mod>> mods)
if (working is null)
return;

// We expect that if user have added CL mod - they want to calculate legacy score
if (!mods.OldValue.OfType<ModClassic>().Any() && mods.NewValue.OfType<ModClassic>().Any(m => m.UsesDefaultConfiguration))
legacyScoreSwitchButton.Current.Value = true;

updateScoreTextBox();
updateMissesTextboxes();

// recreate calculators to update DHOs
Expand Down Expand Up @@ -734,7 +749,8 @@ private void calculatePerformance()
Mods = appliedMods.Value.ToArray(),
TotalScore = score,
Ruleset = ruleset.Value,
LegacyTotalScore = legacyTotalScore,
IsLegacyScore = legacyScoreSwitchButton.Current.Value,
LegacyTotalScore = scoreTextBox.Value.Value,
}, difficultyAttributes);

performanceAttributesContainer.Attributes.Value = AttributeConversion.ToDictionary(ppAttributes);
Expand Down Expand Up @@ -768,6 +784,9 @@ private void populateScoreParams()
{
largeTickMissesTextBox.Show();
sliderTailMissesTextBox.Show();

scoreTextBox.Value.Value = 0;
scoreTextBox.Text = string.Empty;
}
}
else if (ruleset.Value.ShortName == "mania")
Expand All @@ -777,8 +796,8 @@ private void populateScoreParams()

missesTextBox.Show();

scoreTextBox.Value.Value = 1000000;
scoreTextBox.Text = string.Empty;
scoreTextBox.Show();
}
else
{
Expand All @@ -795,6 +814,8 @@ private void populateScoreParams()
scoreTextBox.Text = string.Empty;
scoreTextBox.Show();
}

updateScoreTextBox();
}

private void updateAccuracyParams(bool useFullScoreData)
Expand Down Expand Up @@ -869,6 +890,36 @@ private void updateAccuracyParams(bool useFullScoreData)
}
}

private void updateScoreTextBox()
{
if (!appliedMods.Value.OfType<ModClassic>().Any(m => m.UsesDefaultConfiguration))
{
legacyScoreSwitchButton.Current.Value = false;
legacyScoreSwitchButton.Hide();
}
else if (ruleset.Value.ShortName == "osu")
{
legacyScoreSwitchButton.Show();
}

if (ruleset.Value.ShortName == "osu" && legacyScoreSwitchButton.Current.Value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe show score textbox if CL is enabled instead, legacy scores can't be without CL

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There can be lazer scores with CL

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those won't have scorev1

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's why I'm using legacy score switch instead of CL

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
scoreTextBox.PlaceholderText = "0";
scoreTextBox.MaxValue = int.MaxValue;
scoreTextBox.Show();
}
else if (ruleset.Value.ShortName == "mania")
{
scoreTextBox.PlaceholderText = "1000000";
scoreTextBox.MaxValue = 1000000;
scoreTextBox.Show();
}
else
{
scoreTextBox.Hide();
}
}

private void fixupTextBox(LabelledTextBox textbox)
{
// This is a hack around TextBox's way of updating layout and positioning of text
Expand Down Expand Up @@ -897,7 +948,6 @@ private void resetCalculations()
createCalculators();

resetMods();
legacyTotalScore = null;

calculateDifficulty();
calculatePerformance();
Expand Down Expand Up @@ -989,8 +1039,6 @@ private void showError(string message, bool log = true)
notificationDisplay.Display(new Notification(message));
}

private long? legacyTotalScore;

private void populateSettingsFromScore(long scoreId)
{
if (scoreIdPopulateButton.State.Value == ButtonState.Loading)
Expand All @@ -1010,10 +1058,16 @@ private void populateSettingsFromScore(long scoreId)
changeBeatmap(scoreInfo.BeatmapID.ToString());
}

legacyScoreSwitchButton.Current.Value = scoreInfo.IsLegacyScore;

ruleset.Value = rulesets.GetRuleset(scoreInfo.RulesetID);
appliedMods.Value = scoreInfo.Mods.Select(x => x.ToMod(ruleset.Value.CreateInstance())).ToList();

legacyTotalScore = scoreInfo.LegacyTotalScore;
if (scoreInfo.LegacyTotalScore != null)
{
scoreTextBox.Value.Value = (int)scoreInfo.LegacyTotalScore;
scoreTextBox.Text = scoreInfo.LegacyTotalScore.ToString();
}

fullScoreDataSwitch.Current.Value = true;

Expand Down Expand Up @@ -1104,7 +1158,7 @@ private void updateMissesTextboxes()
if (ruleset.Value.ShortName == "osu")
{
// Large tick misses and slider tail misses are only relevant in PP if slider head accuracy exists
if (appliedMods.Value.OfType<OsuModClassic>().Any(m => m.NoSliderHeadAccuracy.Value))
if (legacyScoreSwitchButton.Current.Value)
{
missesContainer.Content = new[] { new[] { missesTextBox } };
missesContainer.ColumnDimensions = [new Dimension()];
Expand Down
Loading
0