mirror of
https://github.com/ppy/osu-tools.git
synced 2025-06-09 09:35:15 +09:00
Update packages
This commit is contained in:
parent
03ebbd4e3b
commit
a6e6322814
6 changed files with 72 additions and 10 deletions
|
@ -1,4 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Import Project="..\osu.Tools.props" />
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
|
@ -6,10 +6,10 @@
|
|||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Game" Version="2022.319.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Rulesets.Osu" Version="2022.319.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Rulesets.Taiko" Version="2022.319.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Rulesets.Catch" Version="2022.319.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Rulesets.Mania" Version="2022.319.0" />
|
||||
<PackageReference Include="ppy.osu.Game" Version="2022.418.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Rulesets.Osu" Version="2022.418.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Rulesets.Taiko" Version="2022.418.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Rulesets.Catch" Version="2022.418.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Rulesets.Mania" Version="2022.418.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -3,7 +3,10 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Catch;
|
||||
|
@ -15,11 +18,51 @@ using osu.Game.Rulesets.Osu;
|
|||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.Taiko;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
using osu.Game.Skinning;
|
||||
using osu.Game.Utils;
|
||||
|
||||
namespace PerformanceCalculatorGUI
|
||||
{
|
||||
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)
|
||||
{
|
||||
return ruleset.OnlineID switch
|
||||
|
@ -222,5 +265,23 @@ namespace PerformanceCalculatorGUI
|
|||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -232,7 +232,7 @@ namespace PerformanceCalculatorGUI.Screens
|
|||
var parsedScore = new ProcessorScoreDecoder(working).Parse(scoreInfo);
|
||||
|
||||
var difficultyCalculator = rulesetInstance.CreateDifficultyCalculator(working);
|
||||
var difficultyAttributes = difficultyCalculator.Calculate(scoreInfo.Mods);
|
||||
var difficultyAttributes = difficultyCalculator.Calculate(RulesetHelper.ConvertToLegacyDifficultyAdjustmentMods(rulesetInstance, mods));
|
||||
var performanceCalculator = rulesetInstance.CreatePerformanceCalculator();
|
||||
|
||||
var livePp = score.PP ?? 0.0;
|
||||
|
@ -242,7 +242,7 @@ namespace PerformanceCalculatorGUI.Screens
|
|||
var extendedScore = new ExtendedScore(score, livePp, perfAttributes);
|
||||
plays.Add(extendedScore);
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (Exception)
|
||||
{
|
||||
// dont bother for now
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ namespace PerformanceCalculatorGUI.Screens.ObjectInspection
|
|||
|
||||
internal class OsuObjectInspectorLifetimeEntry : LifetimeEntry
|
||||
{
|
||||
public event Action? Invalidated;
|
||||
public event Action Invalidated;
|
||||
public readonly OsuHitObject HitObject;
|
||||
public readonly OsuDifficultyHitObject DifficultyHitObject;
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ namespace PerformanceCalculatorGUI.Screens
|
|||
var parsedScore = new ProcessorScoreDecoder(working).Parse(scoreInfo);
|
||||
|
||||
var difficultyCalculator = rulesetInstance.CreateDifficultyCalculator(working);
|
||||
var difficultyAttributes = difficultyCalculator.Calculate(scoreInfo.Mods);
|
||||
var difficultyAttributes = difficultyCalculator.Calculate(RulesetHelper.ConvertToLegacyDifficultyAdjustmentMods(rulesetInstance, mods));
|
||||
var performanceCalculator = rulesetInstance.CreatePerformanceCalculator();
|
||||
|
||||
var livePp = score.PP ?? 0.0;
|
||||
|
|
|
@ -690,6 +690,7 @@ namespace PerformanceCalculatorGUI.Screens
|
|||
accuracyContainer.Show();
|
||||
|
||||
comboTextBox.PlaceholderText = difficultyAttributes.MaxCombo.ToString();
|
||||
comboTextBox.Text = string.Empty;
|
||||
comboTextBox.MaxValue = comboTextBox.Value.Value = difficultyAttributes.MaxCombo;
|
||||
comboTextBox.Show();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue