-
Notifications
You must be signed in to change notification settings - Fork 86
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,6 +63,7 @@ public partial class SimulateScreen : PerformanceCalculatorScreen | |
|
||
private LabelledNumberBox scoreIdTextBox; | ||
private StatefulButton scoreIdPopulateButton; | ||
private LabelledSwitchButton legacyScoreSwitchButton; | ||
|
||
private GridContainer accuracyContainer; | ||
private LimitedLabelledFractionalNumberBox accuracyTextBox; | ||
|
@@ -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", | ||
}, | ||
|
@@ -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?", | ||
} | ||
} | ||
}, | ||
|
@@ -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 | ||
{ | ||
|
@@ -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)); | ||
|
||
|
@@ -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 | ||
|
@@ -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); | ||
|
@@ -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") | ||
|
@@ -777,8 +796,8 @@ private void populateScoreParams() | |
|
||
missesTextBox.Show(); | ||
|
||
scoreTextBox.Value.Value = 1000000; | ||
scoreTextBox.Text = string.Empty; | ||
scoreTextBox.Show(); | ||
} | ||
else | ||
{ | ||
|
@@ -795,6 +814,8 @@ private void populateScoreParams() | |
scoreTextBox.Text = string.Empty; | ||
scoreTextBox.Show(); | ||
} | ||
|
||
updateScoreTextBox(); | ||
} | ||
|
||
private void updateAccuracyParams(bool useFullScoreData) | ||
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There can be lazer scores with CL There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those won't have scorev1 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's why I'm using legacy score switch instead of CL There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 | ||
|
@@ -897,7 +948,6 @@ private void resetCalculations() | |
createCalculators(); | ||
|
||
resetMods(); | ||
legacyTotalScore = null; | ||
|
||
calculateDifficulty(); | ||
calculatePerformance(); | ||
|
@@ -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) | ||
|
@@ -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; | ||
|
||
|
@@ -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()]; | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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