mirror of
https://github.com/osukey/osukey.git
synced 2025-05-05 13:47:19 +09:00
Implement proper scrolling directions
This commit is contained in:
parent
f34131f8f4
commit
651e24e3cc
@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Catch.UI
|
|||||||
private readonly CatcherArea catcherArea;
|
private readonly CatcherArea catcherArea;
|
||||||
|
|
||||||
public CatchPlayfield(BeatmapDifficulty difficulty)
|
public CatchPlayfield(BeatmapDifficulty difficulty)
|
||||||
: base(Direction.Vertical)
|
: base(ScrollingDirection.Down)
|
||||||
{
|
{
|
||||||
Container explodingFruitContainer;
|
Container explodingFruitContainer;
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
private const float opacity_pressed = 0.25f;
|
private const float opacity_pressed = 0.25f;
|
||||||
|
|
||||||
public Column()
|
public Column()
|
||||||
: base(Direction.Vertical)
|
: base(ScrollingDirection.Down)
|
||||||
{
|
{
|
||||||
Width = column_width;
|
Width = column_width;
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ namespace osu.Game.Rulesets.Mania.UI
|
|||||||
private readonly int columnCount;
|
private readonly int columnCount;
|
||||||
|
|
||||||
public ManiaPlayfield(int columnCount)
|
public ManiaPlayfield(int columnCount)
|
||||||
: base(Direction.Vertical)
|
: base(ScrollingDirection.Down)
|
||||||
{
|
{
|
||||||
this.columnCount = columnCount;
|
this.columnCount = columnCount;
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Taiko.UI
|
|||||||
private readonly Box background;
|
private readonly Box background;
|
||||||
|
|
||||||
public TaikoPlayfield(ControlPointInfo controlPoints)
|
public TaikoPlayfield(ControlPointInfo controlPoints)
|
||||||
: base(Direction.Horizontal)
|
: base(ScrollingDirection.Left)
|
||||||
{
|
{
|
||||||
AddRangeInternal(new Drawable[]
|
AddRangeInternal(new Drawable[]
|
||||||
{
|
{
|
||||||
|
@ -24,8 +24,8 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
public TestCaseScrollingHitObjects()
|
public TestCaseScrollingHitObjects()
|
||||||
{
|
{
|
||||||
playfields.Add(new TestPlayfield(Direction.Vertical));
|
playfields.Add(new TestPlayfield(ScrollingDirection.Down));
|
||||||
playfields.Add(new TestPlayfield(Direction.Horizontal));
|
playfields.Add(new TestPlayfield(ScrollingDirection.Right));
|
||||||
|
|
||||||
playfields.ForEach(p => p.HitObjects.ControlPoints.Add(new MultiplierControlPoint(double.MinValue)));
|
playfields.ForEach(p => p.HitObjects.ControlPoints.Add(new MultiplierControlPoint(double.MinValue)));
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
p.Add(new TestDrawableHitObject(time)
|
p.Add(new TestDrawableHitObject(time)
|
||||||
{
|
{
|
||||||
Anchor = p.ScrollingDirection == Direction.Horizontal ? Anchor.CentreRight : Anchor.BottomCentre
|
Anchor = p.Direction == ScrollingDirection.Right ? Anchor.CentreRight : Anchor.BottomCentre
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
TestDrawableControlPoint createDrawablePoint(double t) => new TestDrawableControlPoint(t)
|
TestDrawableControlPoint createDrawablePoint(double t) => new TestDrawableControlPoint(t)
|
||||||
{
|
{
|
||||||
Anchor = p.ScrollingDirection == Direction.Horizontal ? Anchor.CentreRight : Anchor.BottomCentre
|
Anchor = p.Direction == ScrollingDirection.Right ? Anchor.CentreRight : Anchor.BottomCentre
|
||||||
};
|
};
|
||||||
|
|
||||||
p.Add(createDrawablePoint(time));
|
p.Add(createDrawablePoint(time));
|
||||||
@ -105,15 +105,15 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
public readonly BindableDouble TimeRange = new BindableDouble(5000);
|
public readonly BindableDouble TimeRange = new BindableDouble(5000);
|
||||||
|
|
||||||
public readonly Direction ScrollingDirection;
|
public readonly ScrollingDirection Direction;
|
||||||
|
|
||||||
public new ScrollingPlayfield.ScrollingHitObjectContainer HitObjects => (ScrollingPlayfield.ScrollingHitObjectContainer)base.HitObjects;
|
public new ScrollingPlayfield.ScrollingHitObjectContainer HitObjects => (ScrollingPlayfield.ScrollingHitObjectContainer)base.HitObjects;
|
||||||
|
|
||||||
public TestPlayfield(Direction scrollingDirection)
|
public TestPlayfield(ScrollingDirection direction)
|
||||||
{
|
{
|
||||||
ScrollingDirection = scrollingDirection;
|
Direction = direction;
|
||||||
|
|
||||||
base.HitObjects = new ScrollingPlayfield.ScrollingHitObjectContainer(scrollingDirection);
|
base.HitObjects = new ScrollingPlayfield.ScrollingHitObjectContainer(direction);
|
||||||
HitObjects.TimeRange.BindTo(TimeRange);
|
HitObjects.TimeRange.BindTo(TimeRange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
25
osu.Game/Rulesets/UI/ScrollingDirection.cs
Normal file
25
osu.Game/Rulesets/UI/ScrollingDirection.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE
|
||||||
|
|
||||||
|
namespace osu.Game.Rulesets.UI
|
||||||
|
{
|
||||||
|
public enum ScrollingDirection
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Hitobjects will scroll vertically from the bottom of the hitobject container.
|
||||||
|
/// </summary>
|
||||||
|
Up,
|
||||||
|
/// <summary>
|
||||||
|
/// Hitobjects will scroll vertically from the top of the hitobject container.
|
||||||
|
/// </summary>
|
||||||
|
Down,
|
||||||
|
/// <summary>
|
||||||
|
/// Hitobjects will scroll horizontally from the right of the hitobject container.
|
||||||
|
/// </summary>
|
||||||
|
Left,
|
||||||
|
/// <summary>
|
||||||
|
/// Hitobjects will scroll horizontally from the left of the hitobject container.
|
||||||
|
/// </summary>
|
||||||
|
Right
|
||||||
|
}
|
||||||
|
}
|
@ -58,10 +58,10 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="scrollingAxes">The axes on which <see cref="DrawableHitObject"/>s in this container should scroll.</param>
|
/// <param name="scrollingAxes">The axes on which <see cref="DrawableHitObject"/>s in this container should scroll.</param>
|
||||||
/// <param name="customWidth">Whether we want our internal coordinate system to be scaled to a specified width</param>
|
/// <param name="customWidth">Whether we want our internal coordinate system to be scaled to a specified width</param>
|
||||||
protected ScrollingPlayfield(Direction scrollingDirection, float? customWidth = null)
|
protected ScrollingPlayfield(ScrollingDirection direction, float? customWidth = null)
|
||||||
: base(customWidth)
|
: base(customWidth)
|
||||||
{
|
{
|
||||||
base.HitObjects = HitObjects = new ScrollingHitObjectContainer(scrollingDirection) { RelativeSizeAxes = Axes.Both };
|
base.HitObjects = HitObjects = new ScrollingHitObjectContainer(direction) { RelativeSizeAxes = Axes.Both };
|
||||||
HitObjects.TimeRange.BindTo(VisibleTimeRange);
|
HitObjects.TimeRange.BindTo(VisibleTimeRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,11 +133,11 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
public readonly SortedList<MultiplierControlPoint> ControlPoints = new SortedList<MultiplierControlPoint>();
|
public readonly SortedList<MultiplierControlPoint> ControlPoints = new SortedList<MultiplierControlPoint>();
|
||||||
|
|
||||||
private readonly Direction scrollingDirection;
|
private readonly ScrollingDirection direction;
|
||||||
|
|
||||||
public ScrollingHitObjectContainer(Direction scrollingDirection)
|
public ScrollingHitObjectContainer(ScrollingDirection direction)
|
||||||
{
|
{
|
||||||
this.scrollingDirection = scrollingDirection;
|
this.direction = direction;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
@ -155,14 +155,20 @@ namespace osu.Game.Rulesets.UI
|
|||||||
// Todo: We may need to consider scale here
|
// Todo: We may need to consider scale here
|
||||||
var finalPosition = (float)relativePosition * DrawSize;
|
var finalPosition = (float)relativePosition * DrawSize;
|
||||||
|
|
||||||
switch (scrollingDirection)
|
switch (direction)
|
||||||
{
|
{
|
||||||
case Direction.Horizontal:
|
case ScrollingDirection.Up:
|
||||||
obj.X = finalPosition.X;
|
obj.Y = -finalPosition.Y;
|
||||||
break;
|
break;
|
||||||
case Direction.Vertical:
|
case ScrollingDirection.Down:
|
||||||
obj.Y = finalPosition.Y;
|
obj.Y = finalPosition.Y;
|
||||||
break;
|
break;
|
||||||
|
case ScrollingDirection.Left:
|
||||||
|
obj.X = -finalPosition.X;
|
||||||
|
break;
|
||||||
|
case ScrollingDirection.Right:
|
||||||
|
obj.X = finalPosition.X;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -314,6 +314,7 @@
|
|||||||
<Compile Include="Rulesets\Mods\IApplicableFailOverride.cs" />
|
<Compile Include="Rulesets\Mods\IApplicableFailOverride.cs" />
|
||||||
<Compile Include="Rulesets\Mods\IApplicableMod.cs" />
|
<Compile Include="Rulesets\Mods\IApplicableMod.cs" />
|
||||||
<Compile Include="Rulesets\Mods\IApplicableToDrawableHitObject.cs" />
|
<Compile Include="Rulesets\Mods\IApplicableToDrawableHitObject.cs" />
|
||||||
|
<Compile Include="Rulesets\UI\ScrollingDirection.cs" />
|
||||||
<Compile Include="Screens\Select\ImportFromStablePopup.cs" />
|
<Compile Include="Screens\Select\ImportFromStablePopup.cs" />
|
||||||
<Compile Include="Overlays\Settings\SettingsButton.cs" />
|
<Compile Include="Overlays\Settings\SettingsButton.cs" />
|
||||||
<Compile Include="Rulesets\Edit\Layers\Selection\OriginHandle.cs" />
|
<Compile Include="Rulesets\Edit\Layers\Selection\OriginHandle.cs" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user