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 drum rolls losing width on strong state toggle in editor #30508

Merged
merged 2 commits into from
Nov 11, 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
10 changes: 5 additions & 5 deletions osu.Game.Rulesets.Taiko/Edit/TaikoSelectionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ private void load()

public void SetStrongState(bool state)
{
if (SelectedItems.OfType<Hit>().All(h => h.IsStrong == state))
if (SelectedItems.OfType<TaikoStrongableHitObject>().All(h => h.IsStrong == state))
return;

EditorBeatmap.PerformOnSelection(h =>
{
if (!(h is Hit taikoHit)) return;
if (h is not TaikoStrongableHitObject strongable) return;

if (taikoHit.IsStrong != state)
if (strongable.IsStrong != state)
{
taikoHit.IsStrong = state;
EditorBeatmap.Update(taikoHit);
strongable.IsStrong = state;
EditorBeatmap.Update(strongable);
}
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ protected override void RecreatePieces()
{
base.RecreatePieces();
updateColour();
Height = HitObject.IsStrong ? TaikoStrongableHitObject.DEFAULT_STRONG_SIZE : TaikoHitObject.DEFAULT_SIZE;
}

protected override void OnFree()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Skinning.Default;
using osu.Game.Skinning;
using osuTK;

namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
Expand Down Expand Up @@ -44,6 +45,12 @@ protected override void OnApply()
IsFirstTick.Value = HitObject.FirstTick;
}

protected override void RecreatePieces()
{
base.RecreatePieces();
Size = new Vector2(HitObject.IsStrong ? TaikoStrongableHitObject.DEFAULT_STRONG_SIZE : TaikoHitObject.DEFAULT_SIZE);
}

protected override void CheckForResult(bool userTriggered, double timeOffset)
{
if (!userTriggered)
Expand Down
2 changes: 2 additions & 0 deletions osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
using osu.Game.Rulesets.Scoring;
using osu.Game.Rulesets.Taiko.Skinning.Default;
using osu.Game.Skinning;
using osuTK;

namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
Expand Down Expand Up @@ -63,6 +64,7 @@ protected override void RecreatePieces()
{
updateActionsFromType();
base.RecreatePieces();
Size = new Vector2(HitObject.IsStrong ? TaikoStrongableHitObject.DEFAULT_STRONG_SIZE : TaikoHitObject.DEFAULT_SIZE);
}

protected override void OnFree()
Expand Down
11 changes: 10 additions & 1 deletion osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
using osu.Game.Rulesets.Taiko.Skinning.Default;
using osu.Game.Screens.Play;
using osu.Game.Skinning;
using osuTK;

namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
Expand All @@ -34,6 +35,8 @@ public partial class DrawableSwell : DrawableTaikoHitObject<Swell>
/// </summary>
private const double ring_appear_offset = 100;

private Vector2 baseSize;

private readonly Container<DrawableSwellTick> ticks;
private readonly Container bodyContainer;
private readonly CircularContainer targetRing;
Expand Down Expand Up @@ -141,6 +144,12 @@ private void load(OsuColour colours)
Origin = Anchor.Centre,
});

protected override void RecreatePieces()
{
base.RecreatePieces();
Size = baseSize = new Vector2(TaikoHitObject.DEFAULT_SIZE);
}

protected override void OnFree()
{
base.OnFree();
Expand Down Expand Up @@ -269,7 +278,7 @@ protected override void Update()
{
base.Update();

Size = BaseSize * Parent!.RelativeChildSize;
Size = baseSize * Parent!.RelativeChildSize;

// Make the swell stop at the hit target
X = Math.Max(0, X);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ public abstract partial class DrawableTaikoHitObject<TObject> : DrawableTaikoHit

public new TObject HitObject => (TObject)base.HitObject;

protected Vector2 BaseSize;
protected SkinnableDrawable MainPiece;

protected DrawableTaikoHitObject([CanBeNull] TObject hitObject)
Expand All @@ -152,8 +151,6 @@ protected override void OnApply()

protected virtual void RecreatePieces()
{
Size = BaseSize = new Vector2(TaikoHitObject.DEFAULT_SIZE);

if (MainPiece != null)
Content.Remove(MainPiece, true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using osu.Framework.Graphics.Containers;
using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using osuTK;

namespace osu.Game.Rulesets.Taiko.Objects.Drawables
{
Expand Down Expand Up @@ -44,13 +43,6 @@ protected override void OnFree()
isStrong.UnbindEvents();
}

protected override void RecreatePieces()
{
base.RecreatePieces();
if (HitObject.IsStrong)
Size = BaseSize = new Vector2(TaikoStrongableHitObject.DEFAULT_STRONG_SIZE);
}

protected override void AddNestedHitObject(DrawableHitObject hitObject)
{
base.AddNestedHitObject(hitObject);
Expand Down
Loading