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

Move catch guide line to CatchObjectInspectorRuleset

This commit is contained in:
StanR 2023-02-18 20:17:48 +03:00
parent f6d3b6f111
commit 7ebc7a55f3
3 changed files with 35 additions and 66 deletions

View file

@ -5,16 +5,17 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Rulesets.Catch.Difficulty.Preprocessing; using osu.Game.Rulesets.Catch.Difficulty.Preprocessing;
using osu.Game.Rulesets.Catch.Edit; using osu.Game.Rulesets.Catch.Edit;
using osu.Game.Rulesets.Catch.Objects;
using osu.Game.Rulesets.Catch.Objects.Drawables;
using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Difficulty.Preprocessing;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI;
namespace PerformanceCalculatorGUI.Screens.ObjectInspection namespace PerformanceCalculatorGUI.Screens.ObjectInspection
@ -44,7 +45,7 @@ namespace PerformanceCalculatorGUI.Screens.ObjectInspection
public override bool PropagateNonPositionalInputSubTree => false; public override bool PropagateNonPositionalInputSubTree => false;
protected override Playfield CreatePlayfield() => new CatchObjectInspectorPlayfield(Beatmap.Difficulty, difficultyHitObjects); protected override Playfield CreatePlayfield() => new CatchObjectInspectorPlayfield(Beatmap.Difficulty);
protected override void Update() protected override void Update()
{ {
@ -79,48 +80,25 @@ namespace PerformanceCalculatorGUI.Screens.ObjectInspection
private partial class CatchObjectInspectorPlayfield : CatchEditorPlayfield private partial class CatchObjectInspectorPlayfield : CatchEditorPlayfield
{ {
private readonly IReadOnlyList<CatchDifficultyHitObject> difficultyHitObjects;
protected override GameplayCursorContainer CreateCursor() => null; protected override GameplayCursorContainer CreateCursor() => null;
public CatchObjectInspectorPlayfield(IBeatmapDifficultyInfo difficulty, IReadOnlyList<CatchDifficultyHitObject> difficultyHitObjects) public CatchObjectInspectorPlayfield(IBeatmapDifficultyInfo difficulty)
: base(difficulty) : base(difficulty)
{ {
this.difficultyHitObjects = difficultyHitObjects;
DisplayJudgements.Value = false; DisplayJudgements.Value = false;
} AddInternal(new Container
[BackgroundDependencyLoader]
private void load()
{
foreach (var dho in difficultyHitObjects)
{ {
HitObjectContainer.Add(new CatchInspectorDrawableHitObject(dho)); RelativeSizeAxes = Axes.X,
} Y = 440,
} Height = 6.0f,
CornerRadius = 4.0f,
private partial class CatchInspectorDrawableHitObject : DrawableCatchHitObject Masking = true,
{ Child = new Box
private readonly CatchDifficultyHitObject dho;
public CatchInspectorDrawableHitObject(CatchDifficultyHitObject dho)
: base(new CatchInspectorHitObject(dho.BaseObject))
{
this.dho = dho;
}
[BackgroundDependencyLoader]
private void load()
{
}
private class CatchInspectorHitObject : CatchHitObject
{
public CatchInspectorHitObject(HitObject obj)
{ {
StartTime = obj.StartTime; Colour = OsuColour.Gray(0.5f),
RelativeSizeAxes = Axes.Both
} }
} });
} }
} }
} }

View file

@ -40,21 +40,23 @@ namespace PerformanceCalculatorGUI.Screens.ObjectInspection
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OverlayColourProvider colors) private void load(OverlayColourProvider colors)
{ {
Children = new Drawable[]{ Children = new Drawable[]
{
bgBox = new Box bgBox = new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = colors.Background5, Colour = colors.Background5,
Alpha = 0.95f, Alpha = 0.95f,
}, },
new OsuScrollContainer() { new OsuScrollContainer()
{
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
ScrollbarAnchor = Anchor.TopLeft, ScrollbarAnchor = Anchor.TopLeft,
Child = flowContainer = new TextFlowContainer() Child = flowContainer = new TextFlowContainer()
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Masking = false, Masking = false,
Margin = new MarginPadding {Left = 15}, Margin = new MarginPadding { Left = 15 },
Origin = Anchor.TopLeft, Origin = Anchor.TopLeft,
}, },
}, },
@ -64,6 +66,7 @@ namespace PerformanceCalculatorGUI.Screens.ObjectInspection
public void UpdateValues() public void UpdateValues()
{ {
flowContainer.Text = ""; flowContainer.Text = "";
foreach (KeyValuePair<string, Dictionary<string, object>> GroupPair in InfoDictionary.Value) foreach (KeyValuePair<string, Dictionary<string, object>> GroupPair in InfoDictionary.Value)
{ {
// Big text // Big text
@ -88,18 +91,22 @@ namespace PerformanceCalculatorGUI.Screens.ObjectInspection
// value formatting // value formatting
object value = ValuePair.Value; object value = ValuePair.Value;
if (value is double val) if (value is double val)
{ {
value = Math.Truncate(val * 1000) / 1000; value = Math.Truncate(val * 1000) / 1000;
} }
if (value is float val2) if (value is float val2)
{ {
value = Math.Truncate(val2 * 1000) / 1000; value = Math.Truncate(val2 * 1000) / 1000;
} }
if (value is Vector2 val3) if (value is Vector2 val3)
{ {
value = new Vector2((float)(Math.Truncate(val3.X * 100) / 100), (float)Math.Truncate(val3.Y * 100) / 100); value = new Vector2((float)(Math.Truncate(val3.X * 100) / 100), (float)Math.Truncate(val3.Y * 100) / 100);
} }
flowContainer.AddText($" -> {value}\n\n", t => flowContainer.AddText($" -> {value}\n\n", t =>
{ {
t.Font = OsuFont.TorusAlternate.With(size: 21, weight: "SemiBold"); t.Font = OsuFont.TorusAlternate.With(size: 21, weight: "SemiBold");
@ -113,10 +120,12 @@ namespace PerformanceCalculatorGUI.Screens.ObjectInspection
public void AddGroup(string name, string[] overrides = null) public void AddGroup(string name, string[] overrides = null)
{ {
overrides ??= Array.Empty<string>(); overrides ??= Array.Empty<string>();
foreach (string other in overrides) foreach (string other in overrides)
{ {
InfoDictionary.Value.Remove(other); InfoDictionary.Value.Remove(other);
} }
InfoDictionary.Value[name] = new Dictionary<string, object>(); InfoDictionary.Value[name] = new Dictionary<string, object>();
} }
@ -128,18 +137,22 @@ namespace PerformanceCalculatorGUI.Screens.ObjectInspection
public void SetValue(string group, string name, object value) public void SetValue(string group, string name, object value)
{ {
InfoDictionary.Value.TryGetValue(group, out var exists); InfoDictionary.Value.TryGetValue(group, out var exists);
if (exists == null) if (exists == null)
{ {
AddGroup(group); AddGroup(group);
} }
if (value is double val) if (value is double val)
{ {
value = Math.Truncate(val * 1000) / 1000; value = Math.Truncate(val * 1000) / 1000;
} }
if (value is float val2) if (value is float val2)
{ {
value = Math.Truncate(val2 * 1000) / 1000; value = Math.Truncate(val2 * 1000) / 1000;
} }
if (value is Vector2 val3) if (value is Vector2 val3)
{ {
value = new Vector2((float)(Math.Truncate(val3.X * 100) / 100), (float)Math.Truncate(val3.Y * 100) / 100); value = new Vector2((float)(Math.Truncate(val3.X * 100) / 100), (float)Math.Truncate(val3.Y * 100) / 100);

View file

@ -24,7 +24,6 @@ using osu.Game.Rulesets.UI;
using osu.Game.Screens.Edit; using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Components; using osu.Game.Screens.Edit.Components;
using osu.Game.Screens.Edit.Components.Timelines.Summary; using osu.Game.Screens.Edit.Components.Timelines.Summary;
using osuTK;
using osuTK.Input; using osuTK.Input;
namespace PerformanceCalculatorGUI.Screens.ObjectInspection namespace PerformanceCalculatorGUI.Screens.ObjectInspection
@ -178,7 +177,6 @@ namespace PerformanceCalculatorGUI.Screens.ObjectInspection
}); });
dependencies.CacheAs(values); dependencies.CacheAs(values);
DrawableRuleset inspectorRuleset = null;
inspectContainer.Add(ruleset.Value.ShortName switch inspectContainer.Add(ruleset.Value.ShortName switch
{ {
@ -193,7 +191,7 @@ namespace PerformanceCalculatorGUI.Screens.ObjectInspection
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
PlayfieldBorderStyle = { Value = PlayfieldBorderStyle.Corners } PlayfieldBorderStyle = { Value = PlayfieldBorderStyle.Corners }
}, },
inspectorRuleset = new OsuObjectInspectorRuleset(rulesetInstance, playableBeatmap, modifiedMods, difficultyCalculator.Value as ExtendedOsuDifficultyCalculator, new OsuObjectInspectorRuleset(rulesetInstance, playableBeatmap, modifiedMods, difficultyCalculator.Value as ExtendedOsuDifficultyCalculator,
processorBeatmap.Track.Rate, focusedDiffHitBind) processorBeatmap.Track.Rate, focusedDiffHitBind)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -206,7 +204,7 @@ namespace PerformanceCalculatorGUI.Screens.ObjectInspection
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Margin = new MarginPadding(10) { Left = 0, Bottom = bottom_bar_height }, Margin = new MarginPadding(10) { Left = 0, Bottom = bottom_bar_height },
Child = inspectorRuleset = new TaikoObjectInspectorRuleset(rulesetInstance, playableBeatmap, modifiedMods, difficultyCalculator.Value as ExtendedTaikoDifficultyCalculator, Child = new TaikoObjectInspectorRuleset(rulesetInstance, playableBeatmap, modifiedMods, difficultyCalculator.Value as ExtendedTaikoDifficultyCalculator,
processorBeatmap.Track.Rate, focusedDiffHitBind) processorBeatmap.Track.Rate, focusedDiffHitBind)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -221,27 +219,7 @@ namespace PerformanceCalculatorGUI.Screens.ObjectInspection
Y = 100, Y = 100,
Children = new Drawable[] Children = new Drawable[]
{ {
// guideline bar new CatchObjectInspectorRuleset(rulesetInstance, playableBeatmap, modifiedMods, difficultyCalculator.Value as ExtendedCatchDifficultyCalculator,
new Container
{
RelativeSizeAxes = Axes.X,
Height = 3,
Y = 300,
Colour = Colour4.Red,
Children = new Drawable[]
{
// shadow
new Circle { Colour = Colour4.Gray, Size = new Vector2(10), Y = -3.3f + 2, X = -5 },
new Box { Colour = Colour4.Gray, Size = new Vector2(5, 20), Y = -8.3f + 2, X = 508 },
new Box { Colour = Colour4.Gray, RelativeSizeAxes = Axes.Both, Y = 2 },
// main
new Circle { Size = new Vector2(10), Y = -3.3f, X = -5 },
new Box { Size = new Vector2(5, 20), Y = -8.3f, X = 508 },
new Box { RelativeSizeAxes = Axes.Both },
}
},
inspectorRuleset = new CatchObjectInspectorRuleset(rulesetInstance, playableBeatmap, modifiedMods, difficultyCalculator.Value as ExtendedCatchDifficultyCalculator,
processorBeatmap.Track.Rate, focusedDiffHitBind) processorBeatmap.Track.Rate, focusedDiffHitBind)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,