2018-06-08 11:13:24 +00:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
2018-06-08 12:41:20 +00:00
|
|
|
|
using osu.Framework.Configuration;
|
2018-06-08 11:13:24 +00:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Game.Rulesets.Mania.UI;
|
2018-06-08 12:41:20 +00:00
|
|
|
|
using osu.Game.Rulesets.UI.Scrolling;
|
2018-06-08 11:13:24 +00:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Rulesets.Mania.Tests
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2018-06-08 12:41:20 +00:00
|
|
|
|
/// A container which provides a <see cref="IScrollingInfo"/> to children.
|
2018-06-08 11:13:24 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
public class ScrollingTestContainer : Container
|
|
|
|
|
{
|
2018-06-08 12:41:20 +00:00
|
|
|
|
private readonly ScrollingDirection direction;
|
2018-06-08 11:13:24 +00:00
|
|
|
|
|
2018-06-08 12:41:20 +00:00
|
|
|
|
public ScrollingTestContainer(ScrollingDirection direction)
|
2018-06-08 11:13:24 +00:00
|
|
|
|
{
|
2018-06-08 12:41:20 +00:00
|
|
|
|
this.direction = direction;
|
2018-06-08 11:13:24 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override IReadOnlyDependencyContainer CreateLocalDependencies(IReadOnlyDependencyContainer parent)
|
|
|
|
|
{
|
|
|
|
|
var dependencies = new DependencyContainer(base.CreateLocalDependencies(parent));
|
2018-06-08 12:41:20 +00:00
|
|
|
|
dependencies.CacheAs<IScrollingInfo>(new ScrollingInfo { Direction = { Value = direction }});
|
2018-06-08 11:13:24 +00:00
|
|
|
|
return dependencies;
|
|
|
|
|
}
|
2018-06-08 12:41:20 +00:00
|
|
|
|
|
|
|
|
|
private class ScrollingInfo : IScrollingInfo
|
|
|
|
|
{
|
|
|
|
|
public readonly Bindable<ScrollingDirection> Direction = new Bindable<ScrollingDirection>();
|
|
|
|
|
IBindable<ScrollingDirection> IScrollingInfo.Direction => Direction;
|
|
|
|
|
}
|
2018-06-08 11:13:24 +00:00
|
|
|
|
}
|
|
|
|
|
}
|