Skip to content
Open
Changes from 1 commit
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
57 changes: 47 additions & 10 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
Copy Markdown
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.

Copy link
Copy Markdown
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,7 @@ private void load(OsuColour osuColour)
sliderTailMissesTextBox.Value.BindValueChanged(_ => debouncedCalculatePerformance());
comboTextBox.Value.BindValueChanged(_ => debouncedCalculatePerformance());
scoreTextBox.Value.BindValueChanged(_ => debouncedCalculatePerformance());
legacyScoreSwitchButton.Current.BindValueChanged(_ => updateScoreTextBox());

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

Expand Down Expand Up @@ -734,7 +740,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 All @@ -754,6 +761,7 @@ private void populateScoreParams()
largeTickMissesTextBox.Hide();
sliderTailMissesTextBox.Hide();
scoreTextBox.Hide();
legacyScoreSwitchButton.Hide();

if (ruleset.Value.ShortName == "osu" || ruleset.Value.ShortName == "taiko" || ruleset.Value.ShortName == "fruits")
{
Expand All @@ -768,6 +776,10 @@ private void populateScoreParams()
{
largeTickMissesTextBox.Show();
sliderTailMissesTextBox.Show();
legacyScoreSwitchButton.Show();

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

missesTextBox.Show();

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

updateScoreTextBox();
}

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

private void updateScoreTextBox()
{
if (ruleset.Value.ShortName == "osu" && legacyScoreSwitchButton.Current.Value)

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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 +931,6 @@ private void resetCalculations()
createCalculators();

resetMods();
legacyTotalScore = null;

calculateDifficulty();
calculatePerformance();
Expand Down Expand Up @@ -989,8 +1022,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 +1041,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
Loading