Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GUI object inspectors, update packages #206

Merged
merged 3 commits into from
Jun 26, 2024
Merged
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
2 changes: 1 addition & 1 deletion PerformanceCalculatorGUI/Components/StrainVisualizer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private void updateGraphs(ValueChangedEvent<Skill[]> val)
{
graphsContainer.Clear();

var skills = val.NewValue.Where(x => x is StrainSkill).ToArray();
var skills = val.NewValue.Where(x => x is StrainSkill or StrainDecaySkill).ToArray();

// dont bother if there are no strain skills to draw
if (skills.Length == 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ protected override void OnFocus(FocusEvent e)
OnFocused?.Invoke();
base.OnFocus(e);

GetContainingInputManager().TriggerFocusContention(this);
GetContainingFocusManager()?.TriggerFocusContention(this);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System.Globalization;
using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Game.Graphics.UserInterface;

namespace PerformanceCalculatorGUI.Components.TextBoxes
Expand All @@ -14,7 +13,7 @@ private partial class FractionalNumberBox : OsuTextBox
{
protected override bool AllowIme => false;

protected override bool CanAddCharacter(char character) => character.IsAsciiDigit() || character == CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator[0];
protected override bool CanAddCharacter(char character) => char.IsAsciiDigit(character) || character == CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator[0];

protected override void OnUserTextAdded(string added)
{
Expand Down
10 changes: 5 additions & 5 deletions PerformanceCalculatorGUI/PerformanceCalculatorGUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game" Version="2024.130.2" />
<PackageReference Include="ppy.osu.Game.Rulesets.Osu" Version="2024.130.2" />
<PackageReference Include="ppy.osu.Game.Rulesets.Taiko" Version="2024.130.2" />
<PackageReference Include="ppy.osu.Game.Rulesets.Catch" Version="2024.130.2" />
<PackageReference Include="ppy.osu.Game.Rulesets.Mania" Version="2024.130.2" />
<PackageReference Include="ppy.osu.Game" Version="2024.625.2" />
<PackageReference Include="ppy.osu.Game.Rulesets.Osu" Version="2024.625.2" />
<PackageReference Include="ppy.osu.Game.Rulesets.Taiko" Version="2024.625.2" />
<PackageReference Include="ppy.osu.Game.Rulesets.Catch" Version="2024.625.2" />
<PackageReference Include="ppy.osu.Game.Rulesets.Mania" Version="2024.625.2" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,15 @@
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Catch.Difficulty.Preprocessing;
using osu.Game.Rulesets.Catch.Edit;
using osu.Game.Rulesets.Catch.UI;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.UI;

namespace PerformanceCalculatorGUI.Screens.ObjectInspection
{
public partial class CatchObjectInspectorRuleset : DrawableCatchRuleset
public partial class CatchObjectInspectorRuleset : DrawableCatchEditorRuleset
{
private readonly CatchDifficultyHitObject[] difficultyHitObjects;

Expand All @@ -36,36 +30,12 @@ public CatchObjectInspectorRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyL

public override bool PropagateNonPositionalInputSubTree => false;

protected override Playfield CreatePlayfield() => new CatchObjectInspectorPlayfield(Beatmap.Difficulty);
public override bool AllowBackwardsSeeks => true;

protected override void Update()
{
base.Update();
objectDifficultyValuesContainer.CurrentDifficultyHitObject.Value = difficultyHitObjects.LastOrDefault(x => x.StartTime < Clock.CurrentTime);
}

private partial class CatchObjectInspectorPlayfield : CatchEditorPlayfield
{
protected override GameplayCursorContainer CreateCursor() => null!;

public CatchObjectInspectorPlayfield(IBeatmapDifficultyInfo difficulty)
: base(difficulty)
{
DisplayJudgements.Value = false;
AddInternal(new Container
{
RelativeSizeAxes = Axes.X,
Y = 440,
Height = 6.0f,
CornerRadius = 4.0f,
Masking = true,
Child = new Box
{
Colour = OsuColour.Gray(0.5f),
RelativeSizeAxes = Axes.Both
}
});
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Utils;
using osu.Game.Graphics.Containers;
using osu.Game.Overlays;
using osu.Game.Rulesets.Catch.Difficulty.Preprocessing;
Expand Down Expand Up @@ -132,7 +131,7 @@ private void drawOsuValues(OsuDifficultyHitObject hitObject)
});

if (hitObject.Angle is not null)
flowContainer.Add(new ObjectInspectorDifficultyValue("Angle", MathUtils.RadiansToDegrees(hitObject.Angle.Value)));
flowContainer.Add(new ObjectInspectorDifficultyValue("Angle", double.RadiansToDegrees(hitObject.Angle.Value)));

if (hitObject.BaseObject is Slider)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ private void load(OverlayColourProvider colourProvider)
},
"taiko" => new TaikoPlayfieldAdjustmentContainer
{
RelativeSizeAxes = Axes.Both,
Child = new TaikoObjectInspectorRuleset(rulesetInstance, playableBeatmap, modifiedMods, difficultyCalculator.Value as ExtendedTaikoDifficultyCalculator,
processorBeatmap.Track.Rate)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Osu.Difficulty.Preprocessing;
using osu.Game.Rulesets.Osu.Edit;
using osu.Game.Rulesets.Osu.Objects.Drawables;
using osu.Game.Rulesets.Osu.UI;
using osu.Game.Rulesets.UI;

namespace PerformanceCalculatorGUI.Screens.ObjectInspection
{
public partial class OsuObjectInspectorRuleset : DrawableOsuRuleset
public partial class OsuObjectInspectorRuleset : DrawableOsuEditorRuleset
{
private readonly OsuDifficultyHitObject[] difficultyHitObjects;

Expand All @@ -39,6 +40,8 @@ protected override void Update()

public override bool PropagateNonPositionalInputSubTree => false;

public override bool AllowBackwardsSeeks => true;

protected override Playfield CreatePlayfield() => new OsuObjectInspectorPlayfield(difficultyHitObjects);

private partial class OsuObjectInspectorPlayfield : OsuPlayfield
Expand All @@ -55,14 +58,12 @@ public OsuObjectInspectorPlayfield(IReadOnlyList<OsuDifficultyHitObject> difficu

protected override void OnNewDrawableHitObject(DrawableHitObject d)
{
base.OnNewDrawableHitObject(d);
d.ApplyCustomUpdateState += updateState;
}

private void updateState(DrawableHitObject hitObject, ArmedState state)
{
if (state == ArmedState.Idle)
return;

if (hitObject is DrawableSliderRepeat repeat)
{
repeat.Arrow.ApplyTransformsAt(hitObject.StateUpdateTime, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,13 @@
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing;
using osu.Game.Rulesets.Taiko.Edit;
using osu.Game.Rulesets.Taiko.UI;
using osu.Game.Rulesets.UI;

namespace PerformanceCalculatorGUI.Screens.ObjectInspection
{
public partial class TaikoObjectInspectorRuleset : DrawableTaikoRuleset
public partial class TaikoObjectInspectorRuleset : DrawableTaikoEditorRuleset
{
private readonly TaikoDifficultyHitObject[] difficultyHitObjects;

Expand All @@ -31,6 +32,8 @@ public TaikoObjectInspectorRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyL

public override bool PropagateNonPositionalInputSubTree => false;

public override bool AllowBackwardsSeeks => true;

protected override Playfield CreatePlayfield() => new TaikoObjectInspectorPlayfield();

protected override void Update()
Expand Down
Loading