1
0
Fork 0
mirror of https://github.com/ppy/osu-tools.git synced 2025-06-09 17:44:46 +09:00

Update packages

This commit is contained in:
StanR 2022-04-18 01:16:29 +03:00
parent 03ebbd4e3b
commit a6e6322814
6 changed files with 72 additions and 10 deletions

View file

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\osu.Tools.props" /> <Import Project="..\osu.Tools.props" />
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
@ -6,10 +6,10 @@
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ppy.osu.Game" Version="2022.319.0" /> <PackageReference Include="ppy.osu.Game" Version="2022.418.0" />
<PackageReference Include="ppy.osu.Game.Rulesets.Osu" Version="2022.319.0" /> <PackageReference Include="ppy.osu.Game.Rulesets.Osu" Version="2022.418.0" />
<PackageReference Include="ppy.osu.Game.Rulesets.Taiko" Version="2022.319.0" /> <PackageReference Include="ppy.osu.Game.Rulesets.Taiko" Version="2022.418.0" />
<PackageReference Include="ppy.osu.Game.Rulesets.Catch" Version="2022.319.0" /> <PackageReference Include="ppy.osu.Game.Rulesets.Catch" Version="2022.418.0" />
<PackageReference Include="ppy.osu.Game.Rulesets.Mania" Version="2022.319.0" /> <PackageReference Include="ppy.osu.Game.Rulesets.Mania" Version="2022.418.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -3,7 +3,10 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO;
using System.Linq; using System.Linq;
using osu.Framework.Audio.Track;
using osu.Framework.Graphics.Textures;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Rulesets.Catch; using osu.Game.Rulesets.Catch;
@ -15,11 +18,51 @@ using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Taiko; using osu.Game.Rulesets.Taiko;
using osu.Game.Rulesets.Taiko.Objects; using osu.Game.Rulesets.Taiko.Objects;
using osu.Game.Skinning;
using osu.Game.Utils;
namespace PerformanceCalculatorGUI namespace PerformanceCalculatorGUI
{ {
public static class RulesetHelper public static class RulesetHelper
{ {
/// <summary>
/// Transforms a given <see cref="Mod"/> combination into one which is applicable to legacy scores.
/// This is used to match osu!stable/osu!web calculations for the time being, until such a point that these mods do get considered.
/// </summary>
public static Mod[] ConvertToLegacyDifficultyAdjustmentMods(Ruleset ruleset, Mod[] mods)
{
var beatmap = new EmptyWorkingBeatmap
{
BeatmapInfo =
{
Ruleset = ruleset.RulesetInfo,
Difficulty = new BeatmapDifficulty()
}
};
var allMods = ruleset.CreateAllMods().ToArray();
var allowedMods = ModUtils.FlattenMods(
ruleset.CreateDifficultyCalculator(beatmap).CreateDifficultyAdjustmentModCombinations())
.Select(m => m.GetType())
.Distinct()
.ToHashSet();
// Special case to allow either DT or NC.
if (mods.Any(m => m is ModDoubleTime))
allowedMods.Add(allMods.Single(m => m is ModNightcore).GetType());
var result = new List<Mod>();
var classicMod = allMods.SingleOrDefault(m => m is ModClassic);
if (classicMod != null)
result.Add(classicMod);
result.AddRange(mods.Where(m => allowedMods.Contains(m.GetType())));
return result.ToArray();
}
public static DifficultyCalculator GetExtendedDifficultyCalculator(RulesetInfo ruleset, IWorkingBeatmap working) public static DifficultyCalculator GetExtendedDifficultyCalculator(RulesetInfo ruleset, IWorkingBeatmap working)
{ {
return ruleset.OnlineID switch return ruleset.OnlineID switch
@ -222,5 +265,23 @@ namespace PerformanceCalculatorGUI
return hits / total; return hits / total;
} }
private class EmptyWorkingBeatmap : WorkingBeatmap
{
public EmptyWorkingBeatmap()
: base(new BeatmapInfo(), null)
{
}
protected override IBeatmap GetBeatmap() => throw new NotImplementedException();
protected 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

@ -232,7 +232,7 @@ namespace PerformanceCalculatorGUI.Screens
var parsedScore = new ProcessorScoreDecoder(working).Parse(scoreInfo); var parsedScore = new ProcessorScoreDecoder(working).Parse(scoreInfo);
var difficultyCalculator = rulesetInstance.CreateDifficultyCalculator(working); var difficultyCalculator = rulesetInstance.CreateDifficultyCalculator(working);
var difficultyAttributes = difficultyCalculator.Calculate(scoreInfo.Mods); var difficultyAttributes = difficultyCalculator.Calculate(RulesetHelper.ConvertToLegacyDifficultyAdjustmentMods(rulesetInstance, mods));
var performanceCalculator = rulesetInstance.CreatePerformanceCalculator(); var performanceCalculator = rulesetInstance.CreatePerformanceCalculator();
var livePp = score.PP ?? 0.0; var livePp = score.PP ?? 0.0;
@ -242,7 +242,7 @@ namespace PerformanceCalculatorGUI.Screens
var extendedScore = new ExtendedScore(score, livePp, perfAttributes); var extendedScore = new ExtendedScore(score, livePp, perfAttributes);
plays.Add(extendedScore); plays.Add(extendedScore);
} }
catch (Exception e) catch (Exception)
{ {
// dont bother for now // dont bother for now
} }

View file

@ -88,7 +88,7 @@ namespace PerformanceCalculatorGUI.Screens.ObjectInspection
internal class OsuObjectInspectorLifetimeEntry : LifetimeEntry internal class OsuObjectInspectorLifetimeEntry : LifetimeEntry
{ {
public event Action? Invalidated; public event Action Invalidated;
public readonly OsuHitObject HitObject; public readonly OsuHitObject HitObject;
public readonly OsuDifficultyHitObject DifficultyHitObject; public readonly OsuDifficultyHitObject DifficultyHitObject;

View file

@ -215,7 +215,7 @@ namespace PerformanceCalculatorGUI.Screens
var parsedScore = new ProcessorScoreDecoder(working).Parse(scoreInfo); var parsedScore = new ProcessorScoreDecoder(working).Parse(scoreInfo);
var difficultyCalculator = rulesetInstance.CreateDifficultyCalculator(working); var difficultyCalculator = rulesetInstance.CreateDifficultyCalculator(working);
var difficultyAttributes = difficultyCalculator.Calculate(scoreInfo.Mods); var difficultyAttributes = difficultyCalculator.Calculate(RulesetHelper.ConvertToLegacyDifficultyAdjustmentMods(rulesetInstance, mods));
var performanceCalculator = rulesetInstance.CreatePerformanceCalculator(); var performanceCalculator = rulesetInstance.CreatePerformanceCalculator();
var livePp = score.PP ?? 0.0; var livePp = score.PP ?? 0.0;

View file

@ -690,6 +690,7 @@ namespace PerformanceCalculatorGUI.Screens
accuracyContainer.Show(); accuracyContainer.Show();
comboTextBox.PlaceholderText = difficultyAttributes.MaxCombo.ToString(); comboTextBox.PlaceholderText = difficultyAttributes.MaxCombo.ToString();
comboTextBox.Text = string.Empty;
comboTextBox.MaxValue = comboTextBox.Value.Value = difficultyAttributes.MaxCombo; comboTextBox.MaxValue = comboTextBox.Value.Value = difficultyAttributes.MaxCombo;
comboTextBox.Show(); comboTextBox.Show();