-
Notifications
You must be signed in to change notification settings - Fork 81
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
Implemented functionality to calculate all local scores using Realm #213
base: master
Are you sure you want to change the base?
Changes from all commits
62294c9
8ec4ed2
1c81765
ce15637
ed1d7f6
eef465b
dd2123e
9acd859
5f912bf
a2b4f3b
6d082ac
417c6de
2b28193
dc560e3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Linq; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Graphics.Containers; | ||
using osu.Framework.Graphics; | ||
using osu.Game.Graphics.UserInterface; | ||
using osu.Game.Graphics.UserInterfaceV2; | ||
using osuTK; | ||
using osu.Framework.Extensions; | ||
using osu.Framework.Graphics.Cursor; | ||
using osu.Framework.Graphics.Sprites; | ||
using osu.Framework.Graphics.UserInterface; | ||
using osu.Framework.Input.Events; | ||
using osu.Game.Overlays.Toolbar; | ||
using osu.Framework.Bindables; | ||
using osu.Game.Scoring; | ||
using osu.Game.Beatmaps; | ||
using osu.Game.Rulesets.Osu.Mods; | ||
|
||
namespace PerformanceCalculatorGUI.Components | ||
{ | ||
public partial class LazerCalculationSettings : ToolbarButton, IHasPopover | ||
{ | ||
public readonly Bindable<bool> CalculateRankedMaps = new Bindable<bool>(true); | ||
public readonly Bindable<bool> CalculateUnrankedMaps = new Bindable<bool>(false); | ||
|
||
public readonly Bindable<bool> CalculateUnsubmittedScores = new Bindable<bool>(true); | ||
public readonly Bindable<bool> CalculateUnrankedMods = new Bindable<bool>(true); | ||
|
||
public readonly Bindable<bool> EnableScorev1Overwrite = new Bindable<bool>(false); | ||
|
||
public bool IsScorev1OverwritingEnabled => EnableScorev1Overwrite.Value; | ||
|
||
protected override Anchor TooltipAnchor => Anchor.TopRight; | ||
|
||
public LazerCalculationSettings() | ||
{ | ||
TooltipMain = "Calculation Settings"; | ||
|
||
SetIcon(new ScreenSelectionButtonIcon(FontAwesome.Solid.Cog) { IconSize = new Vector2(70) }); | ||
} | ||
|
||
public bool ShouldBeFiltered(ScoreInfo score) | ||
{ | ||
if (score.BeatmapInfo == null) | ||
return true; | ||
|
||
if (!CalculateRankedMaps.Value && score.BeatmapInfo.Status.GrantsPerformancePoints()) | ||
return true; | ||
|
||
if (!CalculateUnrankedMaps.Value && !score.BeatmapInfo.Status.GrantsPerformancePoints()) | ||
return true; | ||
|
||
if (!CalculateUnrankedMods.Value) | ||
{ | ||
// Check for legacy score because CL is unranked | ||
if (!score.Mods.All(m => m.Ranked || (score.IsLegacyScore && m is OsuModClassic))) | ||
return true; | ||
} | ||
|
||
if (!CalculateUnsubmittedScores.Value) | ||
{ | ||
if (score.OnlineID <= 0 && score.LegacyOnlineID <= 0) | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public Popover GetPopover() => new LazerCalculationSettingsPopover(this); | ||
|
||
protected override bool OnClick(ClickEvent e) | ||
{ | ||
this.ShowPopover(); | ||
return base.OnClick(e); | ||
} | ||
} | ||
|
||
public partial class LazerCalculationSettingsPopover : OsuPopover | ||
{ | ||
private readonly LazerCalculationSettings parent; | ||
|
||
public LazerCalculationSettingsPopover(LazerCalculationSettings parent) | ||
{ | ||
this.parent = parent; | ||
} | ||
|
||
[BackgroundDependencyLoader] | ||
private void load() | ||
{ | ||
Add(new Container | ||
{ | ||
AutoSizeAxes = Axes.Y, | ||
Width = 500, | ||
Children = new Drawable[] | ||
{ | ||
new FillFlowContainer | ||
{ | ||
Direction = FillDirection.Vertical, | ||
RelativeSizeAxes = Axes.X, | ||
AutoSizeAxes = Axes.Y, | ||
Spacing = new Vector2(18), | ||
Children = new Drawable[] | ||
{ | ||
new OsuCheckbox | ||
{ | ||
LabelText = "Calculate Ranked Maps", | ||
Current = { BindTarget = parent.CalculateRankedMaps } | ||
}, | ||
new OsuCheckbox | ||
{ | ||
LabelText = "Calculate Unranked Maps", | ||
Current = { BindTarget = parent.CalculateUnrankedMaps } | ||
}, | ||
new OsuCheckbox | ||
{ | ||
LabelText = "Calculate Unsubmitted Scores, such as scores set on local difficulties", | ||
Current = { BindTarget = parent.CalculateUnsubmittedScores } | ||
}, | ||
new OsuCheckbox | ||
{ | ||
LabelText = "Calculate Unranked Mods, Autopilot is excluded regardless", | ||
Current = { BindTarget = parent.CalculateUnsubmittedScores } | ||
}, | ||
new OsuCheckbox | ||
{ | ||
LabelText = "Enable Scorev1 score overwrite for legacy scores", | ||
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. What does this even mean? I'm struggling to understand what this option does. 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. In stable for each unique mod combination only score with the highest scorev1 is calculated. This switch is turning this mechanism on and off. 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. What does that have to do with lazer? It doesn't sound like you've properly thought through what this PR is set to achieve and are just throwing flags around the place in the name of optimisation... Like... why not just calculate all scores in the db all the time? If you want to only calculate the online scores then there already is a screen for that. 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. this is not about optimization
online profile doesn't account for score outside of the top100 (and they can be severely buffed in reworks like CSR) |
||
Current = { BindTarget = parent.EnableScorev1Overwrite } | ||
}, | ||
} | ||
} | ||
} | ||
}); | ||
} | ||
} | ||
} |
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.
Why is it a toolbar button? It doesn't seem to be on the toolbar
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.
Because I needed to make "options" button and ToolbarButton class was the easiest way to do it.