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

Hide scroll speed changes in std and ctb editor #29448

Merged
merged 6 commits into from
Aug 29, 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: 2 additions & 0 deletions osu.Game.Rulesets.Catch/CatchRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,5 +254,7 @@ public override BeatmapDifficulty GetRateAdjustedDisplayDifficulty(IBeatmapDiffi

return adjustedDifficulty;
}

public override bool EditorShowScrollSpeed => false;
}
}
2 changes: 2 additions & 0 deletions osu.Game.Rulesets.Osu/OsuRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -359,5 +359,7 @@ public override BeatmapDifficulty GetRateAdjustedDisplayDifficulty(IBeatmapDiffi

return adjustedDifficulty;
}

public override bool EditorShowScrollSpeed => false;
}
}
5 changes: 5 additions & 0 deletions osu.Game/Rulesets/Ruleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -401,5 +401,10 @@ public virtual IEnumerable<SetupSection> CreateEditorSetupSections() =>
new DifficultySection(),
new ColoursSection(),
];

/// <summary>
/// Can be overridden to avoid showing scroll speed changes in the editor.
/// </summary>
public virtual bool EditorShowScrollSpeed => true;
}
}
2 changes: 0 additions & 2 deletions osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ public abstract partial class DrawableScrollingRuleset<TObject> : DrawableRulese
MaxValue = time_span_max
};

ScrollVisualisationMethod IDrawableScrollingRuleset.VisualisationMethod => VisualisationMethod;

/// <summary>
/// Whether the player can change <see cref="TimeRange"/>.
/// </summary>
Expand Down
4 changes: 0 additions & 4 deletions osu.Game/Rulesets/UI/Scrolling/IDrawableScrollingRuleset.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Game.Configuration;

namespace osu.Game.Rulesets.UI.Scrolling
{
/// <summary>
/// An interface for scrolling-based <see cref="DrawableRuleset{TObject}"/>s.
/// </summary>
public interface IDrawableScrollingRuleset
{
ScrollVisualisationMethod VisualisationMethod { get; }

IScrollingInfo ScrollingInfo { get; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,14 @@ private void refreshDisplay()
{
ClearInternal();

AddInternal(new ControlPointVisualisation(effect));
if (beatmap.BeatmapInfo.Ruleset.CreateInstance().EditorShowScrollSpeed)
{
AddInternal(new ControlPointVisualisation(effect)
{
// importantly, override the x position being set since we do that in the GroupVisualisation parent drawable.
X = 0,
});
}

if (!kiai.Value)
return;
Expand Down
5 changes: 1 addition & 4 deletions osu.Game/Screens/Edit/Timing/EffectSection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Configuration;
using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Rulesets.UI.Scrolling;

namespace osu.Game.Screens.Edit.Timing
{
Expand Down Expand Up @@ -38,8 +36,7 @@ protected override void LoadComplete()
kiai.Current.BindValueChanged(_ => saveChanges());
scrollSpeedSlider.Current.BindValueChanged(_ => saveChanges());

var drawableRuleset = Beatmap.BeatmapInfo.Ruleset.CreateInstance().CreateDrawableRulesetWith(Beatmap.PlayableBeatmap);
if (drawableRuleset is not IDrawableScrollingRuleset scrollingRuleset || scrollingRuleset.VisualisationMethod == ScrollVisualisationMethod.Constant)
if (!Beatmap.BeatmapInfo.Ruleset.CreateInstance().EditorShowScrollSpeed)
scrollSpeedSlider.Hide();

void saveChanges()
Expand Down
12 changes: 11 additions & 1 deletion osu.Game/Screens/Edit/Timing/RowAttributes/EffectRowAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ public partial class EffectRowAttribute : RowAttribute

private AttributeText kiaiModeBubble = null!;
private AttributeText text = null!;
private AttributeProgressBar progressBar = null!;

[Resolved]
protected EditorBeatmap Beatmap { get; private set; } = null!;

public EffectRowAttribute(EffectControlPoint effect)
: base(effect, "effect")
Expand All @@ -28,14 +32,20 @@ private void load()
{
Content.AddRange(new Drawable[]
{
new AttributeProgressBar(Point)
progressBar = new AttributeProgressBar(Point)
{
Current = scrollSpeed,
},
text = new AttributeText(Point) { Width = 45 },
kiaiModeBubble = new AttributeText(Point) { Text = "kiai" },
});

if (!Beatmap.BeatmapInfo.Ruleset.CreateInstance().EditorShowScrollSpeed)
{
text.Hide();
progressBar.Hide();
}

kiaiMode.BindValueChanged(enabled => kiaiModeBubble.FadeTo(enabled.NewValue ? 1 : 0), true);
scrollSpeed.BindValueChanged(_ => updateText(), true);
}
Expand Down
Loading