mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 14:53:21 +08:00
Merge remote-tracking branch 'upstream/master' into catch
# Conflicts: # osu.Desktop.Tests/Visual/TestCaseScrollingPlayfield.cs
This commit is contained in:
commit
976cff9af6
@ -1 +1 @@
|
|||||||
Subproject commit d29abdf0d042d832f0849c013d14762db04730e7
|
Subproject commit 67d89a36016f98c0ede576b859a2ccafe114fce8
|
@ -50,17 +50,27 @@ namespace osu.Desktop.Tests.Visual
|
|||||||
|
|
||||||
WorkingBeatmap beatmap = new TestWorkingBeatmap(b);
|
WorkingBeatmap beatmap = new TestWorkingBeatmap(b);
|
||||||
|
|
||||||
TestRulesetContainer rulesetContainer;
|
TestRulesetContainer horizontalRulesetContainer;
|
||||||
Add(rulesetContainer = new TestRulesetContainer(beatmap, true));
|
Add(horizontalRulesetContainer = new TestRulesetContainer(Axes.X, beatmap, true));
|
||||||
|
|
||||||
AddStep("Reverse direction", () => rulesetContainer.Playfield.Reversed.Value = !rulesetContainer.Playfield.Reversed);
|
TestRulesetContainer verticalRulesetContainer;
|
||||||
|
Add(verticalRulesetContainer = new TestRulesetContainer(Axes.Y, beatmap, true));
|
||||||
|
|
||||||
|
AddStep("Reverse direction", () =>
|
||||||
|
{
|
||||||
|
horizontalRulesetContainer.Playfield.Reversed.Toggle();
|
||||||
|
verticalRulesetContainer.Playfield.Reversed.Toggle();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestRulesetContainer : ScrollingRulesetContainer<TestPlayfield, TestHitObject, TestJudgement>
|
private class TestRulesetContainer : ScrollingRulesetContainer<TestPlayfield, TestHitObject, TestJudgement>
|
||||||
{
|
{
|
||||||
public TestRulesetContainer(WorkingBeatmap beatmap, bool isForCurrentRuleset)
|
private readonly Axes scrollingAxes;
|
||||||
|
|
||||||
|
public TestRulesetContainer(Axes scrollingAxes, WorkingBeatmap beatmap, bool isForCurrentRuleset)
|
||||||
: base(null, beatmap, isForCurrentRuleset)
|
: base(null, beatmap, isForCurrentRuleset)
|
||||||
{
|
{
|
||||||
|
this.scrollingAxes = scrollingAxes;
|
||||||
}
|
}
|
||||||
|
|
||||||
public new TestPlayfield Playfield => base.Playfield;
|
public new TestPlayfield Playfield => base.Playfield;
|
||||||
@ -69,9 +79,9 @@ namespace osu.Desktop.Tests.Visual
|
|||||||
|
|
||||||
protected override BeatmapConverter<TestHitObject> CreateBeatmapConverter() => new TestBeatmapConverter();
|
protected override BeatmapConverter<TestHitObject> CreateBeatmapConverter() => new TestBeatmapConverter();
|
||||||
|
|
||||||
protected override Playfield<TestHitObject, TestJudgement> CreatePlayfield() => new TestPlayfield();
|
protected override Playfield<TestHitObject, TestJudgement> CreatePlayfield() => new TestPlayfield(scrollingAxes);
|
||||||
|
|
||||||
protected override DrawableHitObject<TestHitObject, TestJudgement> GetVisualRepresentation(TestHitObject h) => new DrawableTestHitObject(h);
|
protected override DrawableHitObject<TestHitObject, TestJudgement> GetVisualRepresentation(TestHitObject h) => new DrawableTestHitObject(scrollingAxes, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class TestScoreProcessor : ScoreProcessor<TestHitObject, TestJudgement>
|
private class TestScoreProcessor : ScoreProcessor<TestHitObject, TestJudgement>
|
||||||
@ -93,10 +103,10 @@ namespace osu.Desktop.Tests.Visual
|
|||||||
|
|
||||||
private class DrawableTestHitObject : DrawableScrollingHitObject<TestHitObject, TestJudgement>
|
private class DrawableTestHitObject : DrawableScrollingHitObject<TestHitObject, TestJudgement>
|
||||||
{
|
{
|
||||||
public DrawableTestHitObject(TestHitObject hitObject)
|
public DrawableTestHitObject(Axes scrollingAxes, TestHitObject hitObject)
|
||||||
: base(hitObject)
|
: base(hitObject)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft;
|
Anchor = scrollingAxes == Axes.Y ? Anchor.TopCentre : Anchor.CentreLeft;
|
||||||
Origin = Anchor.Centre;
|
Origin = Anchor.Centre;
|
||||||
|
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
@ -119,8 +129,8 @@ namespace osu.Desktop.Tests.Visual
|
|||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
private readonly Container<Drawable> content;
|
private readonly Container<Drawable> content;
|
||||||
|
|
||||||
public TestPlayfield()
|
public TestPlayfield(Axes scrollingAxes)
|
||||||
: base(Axes.X)
|
: base(scrollingAxes)
|
||||||
{
|
{
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -5,13 +5,8 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Platform;
|
|
||||||
using osu.Game.Database;
|
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
using SQLite.Net;
|
|
||||||
using SQLite.Net.Attributes;
|
|
||||||
using SQLiteNetExtensions.Attributes;
|
|
||||||
|
|
||||||
namespace osu.Game.Input
|
namespace osu.Game.Input
|
||||||
{
|
{
|
||||||
|
@ -17,15 +17,10 @@ namespace osu.Game.Rulesets.Timing
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class ScrollingContainer : Container<DrawableHitObject>
|
public abstract class ScrollingContainer : Container<DrawableHitObject>
|
||||||
{
|
{
|
||||||
private readonly BindableDouble visibleTimeRange = new BindableDouble { Default = 1000 };
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the range of time that is visible by the length of the scrolling axes.
|
/// Gets or sets the range of time that is visible by the length of the scrolling axes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public BindableDouble VisibleTimeRange
|
public readonly BindableDouble VisibleTimeRange = new BindableDouble { Default = 1000 };
|
||||||
{
|
|
||||||
get { return visibleTimeRange; }
|
|
||||||
set { visibleTimeRange.BindTo(value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The axes through which this <see cref="ScrollingContainer"/> scrolls. This is set by the <see cref="SpeedAdjustmentContainer"/>.
|
/// The axes through which this <see cref="ScrollingContainer"/> scrolls. This is set by the <see cref="SpeedAdjustmentContainer"/>.
|
||||||
|
@ -16,25 +16,15 @@ namespace osu.Game.Rulesets.Timing
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class SpeedAdjustmentContainer : Container<DrawableHitObject>
|
public class SpeedAdjustmentContainer : Container<DrawableHitObject>
|
||||||
{
|
{
|
||||||
private readonly Bindable<double> visibleTimeRange = new Bindable<double> { Default = 1000 };
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the range of time that is visible by the length of the scrolling axes.
|
/// Gets or sets the range of time that is visible by the length of the scrolling axes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Bindable<double> VisibleTimeRange
|
public readonly Bindable<double> VisibleTimeRange = new Bindable<double> { Default = 1000 };
|
||||||
{
|
|
||||||
get { return visibleTimeRange; }
|
|
||||||
set { visibleTimeRange.BindTo(value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly BindableBool reversed = new BindableBool();
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether to reverse the scrolling direction is reversed.
|
/// Whether to reverse the scrolling direction is reversed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public BindableBool Reversed
|
public readonly BindableBool Reversed = new BindableBool();
|
||||||
{
|
|
||||||
get { return reversed; }
|
|
||||||
set { reversed.BindTo(value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override Container<DrawableHitObject> Content => content;
|
protected override Container<DrawableHitObject> Content => content;
|
||||||
private Container<DrawableHitObject> content;
|
private Container<DrawableHitObject> content;
|
||||||
@ -85,13 +75,13 @@ namespace osu.Game.Rulesets.Timing
|
|||||||
{
|
{
|
||||||
RelativeChildSize = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)-VisibleTimeRange : 1, (ScrollingAxes & Axes.Y) > 0 ? (float)-VisibleTimeRange : 1);
|
RelativeChildSize = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)-VisibleTimeRange : 1, (ScrollingAxes & Axes.Y) > 0 ? (float)-VisibleTimeRange : 1);
|
||||||
RelativeChildOffset = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)VisibleTimeRange : 0, (ScrollingAxes & Axes.Y) > 0 ? (float)VisibleTimeRange : 0);
|
RelativeChildOffset = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)VisibleTimeRange : 0, (ScrollingAxes & Axes.Y) > 0 ? (float)VisibleTimeRange : 0);
|
||||||
Origin = Anchor = Anchor.BottomLeft;
|
Origin = Anchor = Anchor.BottomRight;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
RelativeChildSize = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)VisibleTimeRange : 1, (ScrollingAxes & Axes.Y) > 0 ? (float)VisibleTimeRange : 1);
|
RelativeChildSize = new Vector2((ScrollingAxes & Axes.X) > 0 ? (float)VisibleTimeRange : 1, (ScrollingAxes & Axes.Y) > 0 ? (float)VisibleTimeRange : 1);
|
||||||
RelativeChildOffset = Vector2.Zero;
|
RelativeChildOffset = Vector2.Zero;
|
||||||
Anchor = Anchor = Anchor.TopLeft;
|
Origin = Anchor = Anchor.TopLeft;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The playfield.
|
/// The playfield.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected Playfield<TObject, TJudgement> Playfield { get; private set; }
|
public Playfield<TObject, TJudgement> Playfield { get; private set; }
|
||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
private readonly Container content;
|
private readonly Container content;
|
||||||
|
@ -7,7 +7,6 @@ using System.Linq;
|
|||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Transforms;
|
using osu.Framework.Graphics.Transforms;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
@ -72,12 +71,9 @@ namespace osu.Game.Rulesets.UI
|
|||||||
protected ScrollingPlayfield(Axes scrollingAxes, float? customWidth = null)
|
protected ScrollingPlayfield(Axes scrollingAxes, float? customWidth = null)
|
||||||
: base(customWidth)
|
: base(customWidth)
|
||||||
{
|
{
|
||||||
base.HitObjects = HitObjects = new ScrollingHitObjectContainer(scrollingAxes)
|
base.HitObjects = HitObjects = new ScrollingHitObjectContainer(scrollingAxes) { RelativeSizeAxes = Axes.Both };
|
||||||
{
|
HitObjects.VisibleTimeRange.BindTo(VisibleTimeRange);
|
||||||
RelativeSizeAxes = Axes.Both,
|
HitObjects.Reversed.BindTo(Reversed);
|
||||||
VisibleTimeRange = VisibleTimeRange,
|
|
||||||
Reversed = Reversed
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<ScrollingPlayfield<TObject, TJudgement>> nestedPlayfields;
|
private List<ScrollingPlayfield<TObject, TJudgement>> nestedPlayfields;
|
||||||
@ -143,32 +139,22 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal class ScrollingHitObjectContainer : HitObjectContainer
|
internal class ScrollingHitObjectContainer : HitObjectContainer
|
||||||
{
|
{
|
||||||
private readonly BindableDouble visibleTimeRange = new BindableDouble { Default = 1000 };
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the range of time that is visible by the length of the scrolling axes.
|
/// Gets or sets the range of time that is visible by the length of the scrolling axes.
|
||||||
/// For example, only hit objects with start time less than or equal to 1000 will be visible with <see cref="VisibleTimeRange"/> = 1000.
|
/// For example, only hit objects with start time less than or equal to 1000 will be visible with <see cref="VisibleTimeRange"/> = 1000.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Bindable<double> VisibleTimeRange
|
public readonly BindableDouble VisibleTimeRange = new BindableDouble { Default = 1000 };
|
||||||
{
|
|
||||||
get { return visibleTimeRange; }
|
|
||||||
set { visibleTimeRange.BindTo(value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
private readonly BindableBool reversed = new BindableBool();
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether to reverse the scrolling direction is reversed.
|
/// Whether to reverse the scrolling direction is reversed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public BindableBool Reversed
|
public readonly BindableBool Reversed = new BindableBool();
|
||||||
{
|
|
||||||
get { return reversed; }
|
|
||||||
set { reversed.BindTo(value); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Hit objects that are to be re-processed on the next update.
|
/// Hit objects that are to be re-processed on the next update.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly List<DrawableHitObject> queuedHitObjects = new List<DrawableHitObject>();
|
private readonly List<DrawableHitObject> queuedHitObjects = new List<DrawableHitObject>();
|
||||||
private readonly Container<SpeedAdjustmentContainer> speedAdjustments;
|
private readonly List<SpeedAdjustmentContainer> speedAdjustments = new List<SpeedAdjustmentContainer>();
|
||||||
|
|
||||||
private readonly Axes scrollingAxes;
|
private readonly Axes scrollingAxes;
|
||||||
|
|
||||||
@ -179,8 +165,6 @@ namespace osu.Game.Rulesets.UI
|
|||||||
public ScrollingHitObjectContainer(Axes scrollingAxes)
|
public ScrollingHitObjectContainer(Axes scrollingAxes)
|
||||||
{
|
{
|
||||||
this.scrollingAxes = scrollingAxes;
|
this.scrollingAxes = scrollingAxes;
|
||||||
|
|
||||||
AddInternal(speedAdjustments = new Container<SpeedAdjustmentContainer> { RelativeSizeAxes = Axes.Both });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -189,10 +173,12 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// <param name="speedAdjustment">The <see cref="SpeedAdjustmentContainer"/>.</param>
|
/// <param name="speedAdjustment">The <see cref="SpeedAdjustmentContainer"/>.</param>
|
||||||
public void AddSpeedAdjustment(SpeedAdjustmentContainer speedAdjustment)
|
public void AddSpeedAdjustment(SpeedAdjustmentContainer speedAdjustment)
|
||||||
{
|
{
|
||||||
speedAdjustment.VisibleTimeRange.BindTo(VisibleTimeRange);
|
|
||||||
speedAdjustment.ScrollingAxes = scrollingAxes;
|
speedAdjustment.ScrollingAxes = scrollingAxes;
|
||||||
speedAdjustment.Reversed = Reversed;
|
speedAdjustment.VisibleTimeRange.BindTo(VisibleTimeRange);
|
||||||
|
speedAdjustment.Reversed.BindTo(Reversed);
|
||||||
|
|
||||||
speedAdjustments.Add(speedAdjustment);
|
speedAdjustments.Add(speedAdjustment);
|
||||||
|
AddInternal(speedAdjustment);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<DrawableHitObject> Objects => speedAdjustments.SelectMany(s => s.Children);
|
public override IEnumerable<DrawableHitObject> Objects => speedAdjustments.SelectMany(s => s.Children);
|
||||||
|
Loading…
Reference in New Issue
Block a user