Skip to content
Open
Show file tree
Hide file tree
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
94 changes: 62 additions & 32 deletions PerformanceCalculatorGUI/Components/ExtendedProfileScore.cs

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions PerformanceCalculatorGUI/Components/SettingsPopover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
private Bindable<string> clientSecretBindable = null!;
private Bindable<string> pathBindable = null!;
private Bindable<string> cacheBindable = null!;
private Bindable<string> realmBindable = null!;
private Bindable<float> scaleBindable = null!;

private const string api_key_link = "https://osu.ppy.sh/home/account/edit#new-oauth-application";
Expand All @@ -40,6 +41,7 @@
clientSecretBindable = configManager.GetBindable<string>(Settings.ClientSecret);
pathBindable = configManager.GetBindable<string>(Settings.DefaultPath);
cacheBindable = configManager.GetBindable<string>(Settings.CachePath);
realmBindable = configManager.GetBindable<string>(Settings.RealmPath);
scaleBindable = osuConfig.GetBindable<float>(OsuSetting.UIScale);

Add(new Container
Expand Down Expand Up @@ -95,6 +97,12 @@
Label = "Beatmap cache path",
Current = { BindTarget = cacheBindable }
},
new LabelledTextBox
{
RelativeSizeAxes = Axes.X,
Label = "Realm path",
Current = { BindTarget = realmBindable}

Check failure on line 104 in PerformanceCalculatorGUI/Components/SettingsPopover.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Space is missing around braces in PerformanceCalculatorGUI\Components\SettingsPopover.cs on line 104
},
new Box
{
RelativeSizeAxes = Axes.X,
Expand Down
4 changes: 3 additions & 1 deletion PerformanceCalculatorGUI/Configuration/SettingsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ public enum Settings
ClientId,
ClientSecret,
DefaultPath,
CachePath
CachePath,
RealmPath
}

public class SettingsManager : IniConfigManager<Settings>
Expand All @@ -31,6 +32,7 @@ protected override void InitialiseDefaults()
SetDefault(Settings.ClientSecret, string.Empty);
SetDefault(Settings.DefaultPath, Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
SetDefault(Settings.CachePath, Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "cache"));
SetDefault(Settings.RealmPath, Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!, "realm"));
}
}
}
4 changes: 4 additions & 0 deletions PerformanceCalculatorGUI/PerformanceCalculatorSceneManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ private void load(OsuColour colours)
{
Action = () => setScreen(new CollectionsScreen())
},
new ScreenSelectionButton("Realm", FontAwesome.Solid.List)
{
Action = () => setScreen(new RealmScreen())
},
}
},
new FillFlowContainer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace PerformanceCalculatorGUI.Screens.Collections
{
public partial class ScoreContainer : Container
{
public ExtendedScore Score { get; }
public ExtendedScore ExtScore { get; }

private readonly IconButton deleteButton;

Expand All @@ -25,7 +25,7 @@ public ScoreContainer(ExtendedScore score)
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;

Score = score;
ExtScore = score;
Child = new GridContainer
{
RelativeSizeAxes = Axes.X,
Expand All @@ -43,7 +43,7 @@ public ScoreContainer(ExtendedScore score)
Icon = FontAwesome.Regular.TrashAlt,
Action = () =>
{
OnDelete?.Invoke((long)score.SoloScore.ID!);
OnDelete?.Invoke(ExtScore.Score.OnlineID!);
}
},
new ExtendedProfileScore(score, true)
Expand Down
8 changes: 4 additions & 4 deletions PerformanceCalculatorGUI/Screens/CollectionsScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ private void updateSorting(CollectionSortCriteria sortCriteria)
{
for (int i = 0; i < scoresList.Count; i++)
{
scoresList.SetLayoutPosition(scoresList[i], Array.IndexOf(currentCollection.Value!.Scores, scoresList[i].Score.SoloScore.ID));
scoresList.SetLayoutPosition(scoresList[i], Array.IndexOf(currentCollection.Value!.Scores, scoresList[i].ExtScore.Score.OnlineID));
}

return;
Expand All @@ -399,15 +399,15 @@ private void updateSorting(CollectionSortCriteria sortCriteria)
switch (sortCriteria)
{
case CollectionSortCriteria.Live:
sortedScores = scoresList.Children.OrderByDescending(x => x.Score.LivePP).ToArray();
sortedScores = scoresList.Children.OrderByDescending(x => x.ExtScore.LivePP).ToArray();
break;

case CollectionSortCriteria.Local:
sortedScores = scoresList.Children.OrderByDescending(x => x.Score.PerformanceAttributes?.Total).ToArray();
sortedScores = scoresList.Children.OrderByDescending(x => x.ExtScore.PerformanceAttributes?.Total).ToArray();
break;

case CollectionSortCriteria.Difference:
sortedScores = scoresList.Children.OrderByDescending(x => x.Score.PerformanceAttributes?.Total - x.Score.LivePP).ToArray();
sortedScores = scoresList.Children.OrderByDescending(x => x.ExtScore.PerformanceAttributes?.Total - x.ExtScore.LivePP).ToArray();
break;

default:
Expand Down
10 changes: 5 additions & 5 deletions PerformanceCalculatorGUI/Screens/ProfileScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@
{
var pinnedScores = await apiManager.GetJsonFromApi<List<SoloScoreInfo>>($"users/{player.OnlineID}/scores/pinned?mode={ruleset.Value.ShortName}&limit={max_api_scores_in_one_query}")
.ConfigureAwait(false);
apiScores = apiScores.Concat(pinnedScores.Where(p => !apiScores.Any(b => b.ID == p.ID)).ToArray()).ToList();

Check notice on line 313 in PerformanceCalculatorGUI/Screens/ProfileScreen.cs

View workflow job for this annotation

GitHub Actions / Code Quality

Simplify LINQ expression (use 'All') in PerformanceCalculatorGUI\Screens\ProfileScreen.cs on line 313
}

foreach (var score in apiScores)
Expand Down Expand Up @@ -371,11 +371,11 @@
var filteredPlays = new List<ExtendedScore>();

// List of all beatmap IDs in plays without duplicates
var beatmapIDs = plays.Select(x => x.SoloScore.BeatmapID).Distinct().ToList();
var beatmapIDs = plays.Select(x => x.Score.Beatmap.OnlineID).Distinct().ToList();

foreach (int id in beatmapIDs)
{
var bestPlayOnBeatmap = plays.Where(x => x.SoloScore.BeatmapID == id).OrderByDescending(x => x.PerformanceAttributes?.Total).First();
var bestPlayOnBeatmap = plays.Where(x => x.Score.Beatmap.OnlineID == id).OrderByDescending(x => x.PerformanceAttributes?.Total).First();
filteredPlays.Add(bestPlayOnBeatmap);
}

Expand Down Expand Up @@ -472,15 +472,15 @@
switch (sortCriteria)
{
case ProfileSortCriteria.Live:
sortedScores = scores.Children.OrderByDescending(x => x.Score.LivePP).ToArray();
sortedScores = scores.Children.OrderByDescending(x => x.ExtScore.LivePP).ToArray();
break;

case ProfileSortCriteria.Local:
sortedScores = scores.Children.OrderByDescending(x => x.Score.PerformanceAttributes?.Total).ToArray();
sortedScores = scores.Children.OrderByDescending(x => x.ExtScore.PerformanceAttributes?.Total).ToArray();
break;

case ProfileSortCriteria.Difference:
sortedScores = scores.Children.OrderByDescending(x => x.Score.PerformanceAttributes?.Total - x.Score.LivePP).ToArray();
sortedScores = scores.Children.OrderByDescending(x => x.ExtScore.PerformanceAttributes?.Total - x.ExtScore.LivePP).ToArray();
break;

default:
Expand Down
Loading