-
Notifications
You must be signed in to change notification settings - Fork 82
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
Change ObjectInspector to work via object selection #208
Open
Givikap120
wants to merge
26
commits into
ppy:master
Choose a base branch
from
Givikap120:pp_dev_helper
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
ee7ec3c
osu select by cursor inspector function
Givikap120 4f2d98a
new way of doing things
Givikap120 e6ddcf3
removed unnecessary things
Givikap120 fd1deb7
removed temporary unused things
Givikap120 c1e8c38
fixed issues with osu inspector
Givikap120 35fef60
moved inspectors to ruleset-respective folders
Givikap120 3a9d68d
Added basic taiko functionality
Givikap120 8d3eadd
implemented catch
Givikap120 f073b85
Merge branch 'ppy:master' into pp_dev_helper
Givikap120 af0c080
Update PerformanceCalculatorGUI.csproj
Givikap120 2659546
Update CatchSelectableDrawableObject.cs
Givikap120 2b8cab4
changed abstractions structure
Givikap120 c1a3b39
Added catch support and pooling
Givikap120 0830dd1
reverted useless ObjectInspector changes
Givikap120 1cea094
code factor fix
Givikap120 7a1a2fd
minor fixes
Givikap120 0b37191
moved selection logic to the object itself
Givikap120 c513681
fixed pausing/resuming working incorrectly
Givikap120 d248e51
Fixed Strong notes being outlined incorrectly
Givikap120 66e41d1
Merge branch 'master' into pp_dev_helper
stanriders e9ef567
Cleanup
stanriders 08cc7d3
Change catch inspector to use bindables for selection, remove pooling…
stanriders 701e327
Remove unused class
stanriders 1c6359e
remvoe outdated comments
Givikap120 61e1ce0
Refactor taiko
stanriders 3d62ad1
Merge branch 'pp_dev_helper' of https://github.com/Givikap120/osu-too…
stanriders File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
115 changes: 115 additions & 0 deletions
115
PerformanceCalculatorGUI/Screens/ObjectInspection/Catch/CatchObjectInspectorRuleset.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable enable | ||
|
||
using System.Collections.Generic; | ||
using System.Linq; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Bindables; | ||
using osu.Framework.Input.Events; | ||
using osu.Game.Beatmaps; | ||
using osu.Game.Rulesets; | ||
using osu.Game.Rulesets.Catch.Difficulty.Preprocessing; | ||
using osu.Game.Rulesets.Catch.Edit; | ||
using osu.Game.Rulesets.Catch.Objects; | ||
using osu.Game.Rulesets.Mods; | ||
using osu.Game.Rulesets.Objects; | ||
using osu.Game.Rulesets.UI; | ||
using osuTK.Input; | ||
|
||
namespace PerformanceCalculatorGUI.Screens.ObjectInspection.Catch | ||
{ | ||
public partial class CatchObjectInspectorRuleset : DrawableCatchEditorRuleset | ||
{ | ||
private readonly CatchDifficultyHitObject[] difficultyHitObjects; | ||
private CatchObjectInspectorPlayfield inspectorPlayfield; | ||
|
||
[Resolved] | ||
private ObjectDifficultyValuesContainer difficultyValuesContainer { get; set; } | ||
|
||
public CatchObjectInspectorRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod> mods, ExtendedCatchDifficultyCalculator difficultyCalculator, double clockRate) | ||
: base(ruleset, beatmap, mods) | ||
{ | ||
difficultyHitObjects = difficultyCalculator.GetDifficultyHitObjects(beatmap, clockRate) | ||
.Cast<CatchDifficultyHitObject>().ToArray(); | ||
} | ||
|
||
protected override void LoadComplete() | ||
{ | ||
base.LoadComplete(); | ||
|
||
inspectorPlayfield.SelectedObject.BindValueChanged(value => | ||
{ | ||
difficultyValuesContainer.CurrentDifficultyHitObject.Value = difficultyHitObjects.FirstOrDefault(x => x.BaseObject.StartTime == value.NewValue?.HitObject.StartTime); | ||
}); | ||
} | ||
|
||
public override bool PropagatePositionalInputSubTree => true; | ||
|
||
public override bool PropagateNonPositionalInputSubTree => false; | ||
|
||
public override bool AllowBackwardsSeeks => true; | ||
|
||
protected override Playfield CreatePlayfield() => inspectorPlayfield = new CatchObjectInspectorPlayfield(Beatmap.Difficulty); | ||
|
||
private partial class CatchObjectInspectorPlayfield : CatchEditorPlayfield | ||
{ | ||
public readonly Bindable<CatchSelectableHitObject?> SelectedObject = new Bindable<CatchSelectableHitObject?>(); | ||
|
||
public CatchObjectInspectorPlayfield(IBeatmapDifficultyInfo difficulty) | ||
: base(difficulty) | ||
{ | ||
DisplayJudgements.Value = false; | ||
} | ||
|
||
protected override void OnHitObjectAdded(HitObject hitObject) | ||
{ | ||
base.OnHitObjectAdded(hitObject); | ||
|
||
// Potential room for pooling here? | ||
switch (hitObject) | ||
{ | ||
case Fruit fruit: | ||
{ | ||
HitObjectContainer.Add(new CatchSelectableHitObject(fruit) | ||
{ | ||
PlayfieldSelectedObject = { BindTarget = SelectedObject } | ||
}); | ||
|
||
break; | ||
} | ||
|
||
case JuiceStream juiceStream: | ||
{ | ||
foreach (var nested in juiceStream.NestedHitObjects) | ||
{ | ||
if (nested is TinyDroplet) | ||
continue; | ||
|
||
HitObjectContainer.Add(new CatchSelectableHitObject((CatchHitObject)nested) | ||
{ | ||
PlayfieldSelectedObject = { BindTarget = SelectedObject } | ||
}); | ||
} | ||
|
||
break; | ||
} | ||
} | ||
} | ||
|
||
protected override GameplayCursorContainer CreateCursor() => null!; | ||
|
||
protected override bool OnClick(ClickEvent e) | ||
{ | ||
if (e.Button == MouseButton.Left) | ||
{ | ||
SelectedObject.Value?.Deselect(); | ||
SelectedObject.Value = null; | ||
} | ||
|
||
return false; | ||
} | ||
} | ||
} | ||
} |
87 changes: 87 additions & 0 deletions
87
PerformanceCalculatorGUI/Screens/ObjectInspection/Catch/CatchSelectableHitObject.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
#nullable enable | ||
|
||
using osu.Framework.Allocation; | ||
using osu.Game.Rulesets.Catch.Objects.Drawables; | ||
using osu.Game.Rulesets.Catch.Objects; | ||
using osuTK; | ||
using osu.Game.Graphics.UserInterface; | ||
using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components; | ||
using osu.Framework.Input.Events; | ||
using osuTK.Input; | ||
using osu.Framework.Bindables; | ||
|
||
namespace PerformanceCalculatorGUI.Screens.ObjectInspection.Catch | ||
{ | ||
public partial class CatchSelectableHitObject : DrawableCatchHitObject | ||
{ | ||
// This is HitCirclePiece instead of FruitOutline because FruitOutline doesn't register input for some reason | ||
private HitCirclePiece outline = null!; | ||
private SelectionState state; | ||
|
||
public readonly Bindable<CatchSelectableHitObject?> PlayfieldSelectedObject = new Bindable<CatchSelectableHitObject?>(); | ||
|
||
public CatchSelectableHitObject(CatchHitObject hitObject) | ||
: base(hitObject) | ||
{ | ||
X = hitObject.EffectiveX; | ||
state = SelectionState.NotSelected; | ||
} | ||
|
||
[BackgroundDependencyLoader] | ||
private void load() | ||
{ | ||
AddInternal(outline = new HitCirclePiece | ||
{ | ||
Alpha = 0, | ||
Scale = HitObject is Droplet ? new Vector2(HitObject.Scale) * 0.5f : new Vector2(HitObject.Scale) | ||
}); | ||
|
||
PlayfieldSelectedObject.BindValueChanged(x => | ||
{ | ||
if (x.NewValue != this) | ||
{ | ||
Deselect(); | ||
} | ||
}); | ||
} | ||
|
||
protected override bool OnClick(ClickEvent e) | ||
{ | ||
if (e.Button != MouseButton.Left) | ||
return false; | ||
|
||
if (!IsHovered) | ||
return false; | ||
|
||
if (state == SelectionState.Selected) | ||
{ | ||
Deselect(); | ||
PlayfieldSelectedObject.Value = null; | ||
|
||
return true; | ||
} | ||
|
||
state = SelectionState.Selected; | ||
outline.Show(); | ||
PlayfieldSelectedObject.Value = this; | ||
|
||
return true; | ||
} | ||
|
||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => outline.ReceivePositionalInputAt(screenSpacePos); | ||
|
||
public override bool HandlePositionalInput => ShouldBeAlive || IsPresent; | ||
|
||
public void Deselect() | ||
{ | ||
if (IsLoaded) | ||
{ | ||
state = SelectionState.NotSelected; | ||
outline.Hide(); | ||
} | ||
} | ||
} | ||
} |
41 changes: 0 additions & 41 deletions
41
PerformanceCalculatorGUI/Screens/ObjectInspection/CatchObjectInspectorRuleset.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general we don't
#nullable enable
in new files.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm planning to go over the whole project and enabling nullables everywhere after I'm done refactoring this pr