1
0
Fork 0
mirror of https://github.com/ppy/osu-tools.git synced 2025-06-07 23:07:01 +09:00

Fix remaining code style issues

This commit is contained in:
StanR 2025-01-31 21:27:12 +05:00
parent 5c438d2a92
commit 03c60ad39f
9 changed files with 58 additions and 73 deletions

View file

@ -7,7 +7,6 @@ using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using Humanizer;
using McMaster.Extensions.CommandLineUtils;
using Newtonsoft.Json;
using osu.Game.Configuration;

View file

@ -89,7 +89,7 @@ namespace PerformanceCalculator.Profile
{
string json = JsonConvert.SerializeObject(new
{
Username = userData.Username,
userData.Username,
LivePp = totalLivePP,
LocalPp = totalLocalPP,
PlaycountPp = playcountBonusPP,

View file

@ -5,14 +5,15 @@ using osu.Framework.Graphics.Sprites;
using osu.Framework.Localisation;
using osu.Game.Beatmaps.Drawables.Cards;
namespace PerformanceCalculatorGUI.Components;
public partial class ScreenSelectionButtonIcon : IconPill
namespace PerformanceCalculatorGUI.Components
{
public ScreenSelectionButtonIcon(IconUsage? icon = null)
: base(icon ?? FontAwesome.Solid.List)
public partial class ScreenSelectionButtonIcon : IconPill
{
}
public ScreenSelectionButtonIcon(IconUsage? icon = null)
: base(icon ?? FontAwesome.Solid.List)
{
}
public override LocalisableString TooltipText => string.Empty;
public override LocalisableString TooltipText => string.Empty;
}
}

View file

@ -10,23 +10,24 @@ using osu.Game.Rulesets.Difficulty.Preprocessing;
using osu.Game.Rulesets.Difficulty.Skills;
using osu.Game.Rulesets.Mods;
namespace PerformanceCalculatorGUI;
public class ExtendedCatchDifficultyCalculator : CatchDifficultyCalculator, IExtendedDifficultyCalculator
namespace PerformanceCalculatorGUI
{
private Skill[] skills;
public ExtendedCatchDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
: base(ruleset, beatmap)
public class ExtendedCatchDifficultyCalculator : CatchDifficultyCalculator, IExtendedDifficultyCalculator
{
}
private Skill[] skills;
public Skill[] GetSkills() => skills;
public DifficultyHitObject[] GetDifficultyHitObjects(IBeatmap beatmap, double clockRate) => CreateDifficultyHitObjects(beatmap, clockRate).ToArray();
public ExtendedCatchDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
: base(ruleset, beatmap)
{
}
protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
{
this.skills = skills;
return base.CreateDifficultyAttributes(beatmap, mods, skills, clockRate);
public Skill[] GetSkills() => skills;
public DifficultyHitObject[] GetDifficultyHitObjects(IBeatmap beatmap, double clockRate) => CreateDifficultyHitObjects(beatmap, clockRate).ToArray();
protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
{
this.skills = skills;
return base.CreateDifficultyAttributes(beatmap, mods, skills, clockRate);
}
}
}

View file

@ -10,23 +10,24 @@ using osu.Game.Rulesets.Difficulty.Skills;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Difficulty;
namespace PerformanceCalculatorGUI;
public class ExtendedOsuDifficultyCalculator : OsuDifficultyCalculator, IExtendedDifficultyCalculator
namespace PerformanceCalculatorGUI
{
private Skill[] skills;
public ExtendedOsuDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
: base(ruleset, beatmap)
public class ExtendedOsuDifficultyCalculator : OsuDifficultyCalculator, IExtendedDifficultyCalculator
{
}
private Skill[] skills;
public Skill[] GetSkills() => skills;
public DifficultyHitObject[] GetDifficultyHitObjects(IBeatmap beatmap, double clockRate) => CreateDifficultyHitObjects(beatmap, clockRate).ToArray();
public ExtendedOsuDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
: base(ruleset, beatmap)
{
}
protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
{
this.skills = skills;
return base.CreateDifficultyAttributes(beatmap, mods, skills, clockRate);
public Skill[] GetSkills() => skills;
public DifficultyHitObject[] GetDifficultyHitObjects(IBeatmap beatmap, double clockRate) => CreateDifficultyHitObjects(beatmap, clockRate).ToArray();
protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
{
this.skills = skills;
return base.CreateDifficultyAttributes(beatmap, mods, skills, clockRate);
}
}
}

View file

@ -10,23 +10,24 @@ using osu.Game.Rulesets.Difficulty.Skills;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Taiko.Difficulty;
namespace PerformanceCalculatorGUI;
public class ExtendedTaikoDifficultyCalculator : TaikoDifficultyCalculator, IExtendedDifficultyCalculator
namespace PerformanceCalculatorGUI
{
private Skill[] skills;
public ExtendedTaikoDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
: base(ruleset, beatmap)
public class ExtendedTaikoDifficultyCalculator : TaikoDifficultyCalculator, IExtendedDifficultyCalculator
{
}
private Skill[] skills;
public Skill[] GetSkills() => skills;
public DifficultyHitObject[] GetDifficultyHitObjects(IBeatmap beatmap, double clockRate) => CreateDifficultyHitObjects(beatmap, clockRate).ToArray();
public ExtendedTaikoDifficultyCalculator(IRulesetInfo ruleset, IWorkingBeatmap beatmap)
: base(ruleset, beatmap)
{
}
protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
{
this.skills = skills;
return base.CreateDifficultyAttributes(beatmap, mods, skills, clockRate);
public Skill[] GetSkills() => skills;
public DifficultyHitObject[] GetDifficultyHitObjects(IBeatmap beatmap, double clockRate) => CreateDifficultyHitObjects(beatmap, clockRate).ToArray();
protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate)
{
this.skills = skills;
return base.CreateDifficultyAttributes(beatmap, mods, skills, clockRate);
}
}
}

View file

@ -332,23 +332,5 @@ namespace PerformanceCalculatorGUI
((6 * (countPerfect + countGreat)) + (4 * countGood) + (2 * countOk) + countMeh) /
(6 * total);
}
private class EmptyWorkingBeatmap : WorkingBeatmap
{
public EmptyWorkingBeatmap()
: base(new BeatmapInfo(), null)
{
}
protected override IBeatmap GetBeatmap() => throw new NotImplementedException();
public override Texture GetBackground() => throw new NotImplementedException();
protected override Track GetBeatmapTrack() => throw new NotImplementedException();
protected override ISkin GetSkin() => throw new NotImplementedException();
public override Stream GetStream(string storagePath) => throw new NotImplementedException();
}
}
}

View file

@ -323,7 +323,7 @@ namespace PerformanceCalculatorGUI.Screens
var difficultyAttributes = difficultyCalculator.Calculate(mods);
var performanceCalculator = rulesetInstance.CreatePerformanceCalculator();
double livePp = score.PP ?? 0.0;
double? livePp = score.PP;
var perfAttributes = performanceCalculator?.Calculate(parsedScore.ScoreInfo, difficultyAttributes);
score.PP = perfAttributes?.Total ?? 0.0;
@ -346,14 +346,14 @@ namespace PerformanceCalculatorGUI.Screens
catch (OperationCanceledException) { }
var localOrdered = plays.OrderByDescending(x => x.SoloScore.PP).ToList();
var liveOrdered = plays.OrderByDescending(x => x.LivePP).ToList();
var liveOrdered = plays.OrderByDescending(x => x.LivePP ?? 0.0).ToList();
int index = 0;
decimal totalLocalPP = (decimal)(localOrdered.Select(x => x.SoloScore.PP).Sum(play => Math.Pow(0.95, index++) * play) ?? 0.0);
decimal totalLivePP = player.PP ?? (decimal)0.0;
index = 0;
decimal nonBonusLivePP = (decimal)liveOrdered.Select(x => x.LivePP).Sum(play => Math.Pow(0.95, index++) * play);
decimal nonBonusLivePP = (decimal)liveOrdered.Select(x => x.LivePP ?? 0.0).Sum(play => Math.Pow(0.95, index++) * play);
//todo: implement properly. this is pretty damn wrong.
decimal playcountBonusPP = (totalLivePP - nonBonusLivePP);

View file

@ -278,7 +278,7 @@ namespace PerformanceCalculatorGUI.Screens
if (includePinnedCheckbox.Current.Value)
{
var pinnedScores = await apiManager.GetJsonFromApi<List<SoloScoreInfo>>($"users/{player.OnlineID}/scores/pinned?mode={ruleset.Value.ShortName}&limit=100").ConfigureAwait(false);
apiScores = apiScores.Concat(pinnedScores.Where(p => !apiScores.Any(b => b.ID == p.ID))).ToList();
apiScores = apiScores.Concat(pinnedScores.Where(p => !apiScores.Any(b => b.ID == p.ID)).ToArray()).ToList();
}
foreach (var score in apiScores)