mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Add ExpandingBar UI element
This commit is contained in:
50
osu.Game.Tests/Visual/UserInterface/TestSceneExpandingBar.cs
Normal file
50
osu.Game.Tests/Visual/UserInterface/TestSceneExpandingBar.cs
Normal file
@ -0,0 +1,50 @@
|
||||
// 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.
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
public class TestSceneExpandingBar : OsuTestScene
|
||||
{
|
||||
public TestSceneExpandingBar()
|
||||
{
|
||||
Container container;
|
||||
ExpandingBar expandingBar;
|
||||
|
||||
Add(container = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Colour = Color4.Gray,
|
||||
Alpha = 0.5f,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
expandingBar = new ExpandingBar
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
ExpandedSize = 10,
|
||||
CollapsedSize = 2,
|
||||
Colour = Color4.DeepSkyBlue,
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
AddStep(@"Collapse", () => expandingBar.Collapse());
|
||||
AddStep(@"Uncollapse", () => expandingBar.Expand());
|
||||
AddSliderStep(@"Resize container", 1, 300, 150, value => container.ResizeTo(value));
|
||||
AddStep(@"Horizontal", () => expandingBar.RelativeSizeAxes = Axes.X);
|
||||
AddStep(@"Anchor top", () => expandingBar.Anchor = Anchor.TopCentre);
|
||||
AddStep(@"Vertical", () => expandingBar.RelativeSizeAxes = Axes.Y);
|
||||
AddStep(@"Anchor left", () => expandingBar.Anchor = Anchor.CentreLeft);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user