mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 00:09:55 +09:00
Move scroll direction to scrollinginfo
This commit is contained in:
@ -22,11 +22,14 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
||||
MaxValue = double.MaxValue
|
||||
};
|
||||
|
||||
public readonly Bindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>();
|
||||
private readonly IBindable<ScrollingDirection> direction = new Bindable<ScrollingDirection>();
|
||||
|
||||
[Resolved]
|
||||
private IScrollAlgorithm algorithm { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private IScrollingInfo scrollingInfo { get; set; }
|
||||
|
||||
private Cached initialStateCache = new Cached();
|
||||
|
||||
public ScrollingHitObjectContainer()
|
||||
@ -34,7 +37,13 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
TimeRange.ValueChanged += _ => initialStateCache.Invalidate();
|
||||
Direction.ValueChanged += _ => initialStateCache.Invalidate();
|
||||
direction.ValueChanged += _ => initialStateCache.Invalidate();
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
direction.BindTo(scrollingInfo.Direction);
|
||||
}
|
||||
|
||||
public override void Add(DrawableHitObject hitObject)
|
||||
@ -67,7 +76,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
||||
|
||||
if (!initialStateCache.IsValid)
|
||||
{
|
||||
switch (Direction.Value)
|
||||
switch (direction.Value)
|
||||
{
|
||||
case ScrollingDirection.Up:
|
||||
case ScrollingDirection.Down:
|
||||
@ -92,7 +101,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
||||
|
||||
if (hitObject.HitObject is IHasEndTime endTime)
|
||||
{
|
||||
switch (Direction.Value)
|
||||
switch (direction.Value)
|
||||
{
|
||||
case ScrollingDirection.Up:
|
||||
case ScrollingDirection.Down:
|
||||
@ -125,7 +134,7 @@ namespace osu.Game.Rulesets.UI.Scrolling
|
||||
|
||||
private void updatePosition(DrawableHitObject hitObject, double currentTime)
|
||||
{
|
||||
switch (Direction.Value)
|
||||
switch (direction.Value)
|
||||
{
|
||||
case ScrollingDirection.Up:
|
||||
hitObject.Y = algorithm.PositionAt(hitObject.HitObject.StartTime, currentTime, TimeRange, scrollLength);
|
||||
|
Reference in New Issue
Block a user