Skip to content

Commit

Permalink
Merge branch 'master' into stacking-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
bdach committed Jul 11, 2024
2 parents 9cc0e01 + f1fa34e commit 38796aa
Show file tree
Hide file tree
Showing 68 changed files with 2,052 additions and 505 deletions.
7 changes: 7 additions & 0 deletions osu.Game.Rulesets.Catch/CatchRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
using osu.Game.Rulesets.Scoring.Legacy;
using osu.Game.Rulesets.UI;
using osu.Game.Scoring;
using osu.Game.Screens.Edit.Setup;
using osu.Game.Screens.Ranking.Statistics;
using osu.Game.Skinning;

Expand Down Expand Up @@ -222,6 +223,12 @@ public override LocalisableString GetDisplayNameForHitResult(HitResult result)

public override HitObjectComposer CreateHitObjectComposer() => new CatchHitObjectComposer(this);

public override IEnumerable<SetupSection> CreateEditorSetupSections() =>
[
new DifficultySection(),
new ColoursSection(),
];

public override IBeatmapVerifier CreateBeatmapVerifier() => new CatchBeatmapVerifier();

public override StatisticItem[] CreateStatisticsForScore(ScoreInfo score, IBeatmap playableBeatmap)
Expand Down
9 changes: 9 additions & 0 deletions osu.Game.Rulesets.Mania/Edit/DrawableManiaEditorRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Rulesets.Mania.Configuration;
using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.UI;
Expand All @@ -18,6 +19,8 @@ public partial class DrawableManiaEditorRuleset : DrawableManiaRuleset, ISupport
{
public BindableBool ShowSpeedChanges { get; } = new BindableBool();

public double? TimelineTimeRange { get; set; }

public new IScrollingInfo ScrollingInfo => base.ScrollingInfo;

public DrawableManiaEditorRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod>? mods)
Expand All @@ -38,5 +41,11 @@ protected override void LoadComplete()
Origin = Anchor.Centre,
Size = Vector2.One
};

protected override void Update()
{
TargetTimeRange = TimelineTimeRange == null || ShowSpeedChanges.Value ? ComputeScrollTime(Config.Get<int>(ManiaRulesetSetting.ScrollSpeed)) : TimelineTimeRange.Value;
base.Update();
}
}
}
19 changes: 15 additions & 4 deletions osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// 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.

#nullable disable

using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using osu.Framework.Allocation;
using osu.Game.Beatmaps;
using osu.Game.Rulesets.Edit;
using osu.Game.Rulesets.Edit.Tools;
Expand All @@ -14,14 +13,18 @@
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.UI;
using osu.Game.Rulesets.UI.Scrolling;
using osu.Game.Screens.Edit;
using osu.Game.Screens.Edit.Compose.Components;
using osuTK;

namespace osu.Game.Rulesets.Mania.Edit
{
public partial class ManiaHitObjectComposer : ScrollingHitObjectComposer<ManiaHitObject>
{
private DrawableManiaEditorRuleset drawableRuleset;
private DrawableManiaEditorRuleset drawableRuleset = null!;

[Resolved]
private EditorScreenWithTimeline? screenWithTimeline { get; set; }

public ManiaHitObjectComposer(Ruleset ruleset)
: base(ruleset)
Expand Down Expand Up @@ -72,7 +75,7 @@ public override void SelectFromTimestamp(double timestamp, string objectDescript
if (!double.TryParse(split[0], out double time) || !int.TryParse(split[1], out int column))
continue;

ManiaHitObject current = remainingHitObjects.FirstOrDefault(h => h.StartTime == time && h.Column == column);
ManiaHitObject? current = remainingHitObjects.FirstOrDefault(h => h.StartTime == time && h.Column == column);

if (current == null)
continue;
Expand All @@ -83,5 +86,13 @@ public override void SelectFromTimestamp(double timestamp, string objectDescript
remainingHitObjects = remainingHitObjects.Where(h => h != current && h.StartTime >= current.StartTime).ToList();
}
}

protected override void Update()
{
base.Update();

if (screenWithTimeline?.TimelineArea.Timeline != null)
drawableRuleset.TimelineTimeRange = EditorClock.TrackLength / screenWithTimeline.TimelineArea.Timeline.CurrentZoom / 2;
}
}
}
9 changes: 9 additions & 0 deletions osu.Game.Rulesets.Mania/Edit/Setup/ManiaDifficultySection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public partial class ManiaDifficultySection : SetupSection
public override LocalisableString Title => EditorSetupStrings.DifficultyHeader;

private LabelledSliderBar<float> keyCountSlider { get; set; } = null!;
private LabelledSwitchButton specialStyle { get; set; } = null!;
private LabelledSliderBar<float> healthDrainSlider { get; set; } = null!;
private LabelledSliderBar<float> overallDifficultySlider { get; set; } = null!;
private LabelledSliderBar<double> baseVelocitySlider { get; set; } = null!;
Expand Down Expand Up @@ -49,6 +50,13 @@ private void load()
Precision = 1,
}
},
specialStyle = new LabelledSwitchButton
{
Label = "Use special (N+1) style",
FixedLabelWidth = LABEL_WIDTH,
Description = "Changes one column to act as a classic \"scratch\" or \"special\" column, which can be moved around by the user's skin (to the left/right/centre). Generally used in 6K (5+1) or 8K (7+1) configurations.",
Current = { Value = Beatmap.BeatmapInfo.SpecialStyle }
},
healthDrainSlider = new LabelledSliderBar<float>
{
Label = BeatmapsetsStrings.ShowStatsDrain,
Expand Down Expand Up @@ -145,6 +153,7 @@ private void updateValues()
// for now, update these on commit rather than making BeatmapMetadata bindables.
// after switching database engines we can reconsider if switching to bindables is a good direction.
Beatmap.Difficulty.CircleSize = keyCountSlider.Current.Value;
Beatmap.BeatmapInfo.SpecialStyle = specialStyle.Current.Value;
Beatmap.Difficulty.DrainRate = healthDrainSlider.Current.Value;
Beatmap.Difficulty.OverallDifficulty = overallDifficultySlider.Current.Value;
Beatmap.Difficulty.SliderMultiplier = baseVelocitySlider.Current.Value;
Expand Down
49 changes: 0 additions & 49 deletions osu.Game.Rulesets.Mania/Edit/Setup/ManiaSetupSection.cs

This file was deleted.

7 changes: 4 additions & 3 deletions osu.Game.Rulesets.Mania/ManiaRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -419,9 +419,10 @@ public override IRulesetFilterCriteria CreateRulesetFilterCriteria()
return new ManiaFilterCriteria();
}

public override RulesetSetupSection CreateEditorSetupSection() => new ManiaSetupSection();

public override SetupSection CreateEditorDifficultySection() => new ManiaDifficultySection();
public override IEnumerable<SetupSection> CreateEditorSetupSections() =>
[
new ManiaDifficultySection(),
];

public int GetKeyCount(IBeatmapInfo beatmapInfo, IReadOnlyList<Mod>? mods = null)
=> ManiaBeatmapConverter.GetColumnCount(LegacyBeatmapConversionDifficultyInfo.FromBeatmapInfo(beatmapInfo), mods);
Expand Down
18 changes: 13 additions & 5 deletions osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
using osu.Framework.Bindables;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics;
using osu.Framework.Input;
using osu.Framework.Platform;
using osu.Framework.Threading;
using osu.Framework.Utils;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Input.Handlers;
Expand Down Expand Up @@ -56,13 +57,18 @@ public partial class DrawableManiaRuleset : DrawableScrollingRuleset<ManiaHitObj

private readonly Bindable<ManiaScrollingDirection> configDirection = new Bindable<ManiaScrollingDirection>();
private readonly BindableInt configScrollSpeed = new BindableInt();
private double smoothTimeRange;

private double currentTimeRange;
protected double TargetTimeRange;

// Stores the current speed adjustment active in gameplay.
private readonly Track speedAdjustmentTrack = new TrackVirtual(0);

private ISkinSource currentSkin = null!;

[Resolved]
private GameHost gameHost { get; set; } = null!;

public DrawableManiaRuleset(Ruleset ruleset, IBeatmap beatmap, IReadOnlyList<Mod>? mods = null)
: base(ruleset, beatmap, mods)
{
Expand Down Expand Up @@ -101,9 +107,9 @@ private void load(ISkinSource source)
configDirection.BindValueChanged(direction => Direction.Value = (ScrollingDirection)direction.NewValue, true);

Config.BindWith(ManiaRulesetSetting.ScrollSpeed, configScrollSpeed);
configScrollSpeed.BindValueChanged(speed => this.TransformTo(nameof(smoothTimeRange), ComputeScrollTime(speed.NewValue), 200, Easing.OutQuint));
configScrollSpeed.BindValueChanged(speed => TargetTimeRange = ComputeScrollTime(speed.NewValue));

TimeRange.Value = smoothTimeRange = ComputeScrollTime(configScrollSpeed.Value);
TimeRange.Value = TargetTimeRange = currentTimeRange = ComputeScrollTime(configScrollSpeed.Value);

KeyBindingInputManager.Add(new ManiaTouchInputArea());
}
Expand Down Expand Up @@ -144,7 +150,9 @@ private void updateTimeRange()
// This scaling factor preserves the scroll speed as the scroll length varies from changes to the hit position.
float scale = lengthToHitPosition / length_to_default_hit_position;

TimeRange.Value = smoothTimeRange * speedAdjustmentTrack.AggregateTempo.Value * speedAdjustmentTrack.AggregateFrequency.Value * scale;
// we're intentionally using the game host's update clock here to decouple the time range tween from the gameplay clock (which can be arbitrarily paused, or even rewinding)
currentTimeRange = Interpolation.DampContinuously(currentTimeRange, TargetTimeRange, 50, gameHost.UpdateThread.Clock.ElapsedFrameTime);
TimeRange.Value = currentTimeRange * speedAdjustmentTrack.AggregateTempo.Value * speedAdjustmentTrack.AggregateFrequency.Value * scale;
}

/// <summary>
Expand Down
Loading

0 comments on commit 38796aa

Please sign in to comment.