mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09:00
Move control panel logic to its own class
This commit is contained in:
73
osu.Game.Tournament/Components/ControlPanel.cs
Normal file
73
osu.Game.Tournament/Components/ControlPanel.cs
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
// 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.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Tournament.Components
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// An element anchored to the right-hand area of a screen that provides streamer level controls.
|
||||||
|
/// Should be off-screen.
|
||||||
|
/// </summary>
|
||||||
|
public class ControlPanel : Container
|
||||||
|
{
|
||||||
|
private readonly FillFlowContainer buttons;
|
||||||
|
|
||||||
|
protected override Container<Drawable> Content => buttons;
|
||||||
|
|
||||||
|
public ControlPanel()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
AlwaysPresent = true;
|
||||||
|
Width = 0.15f;
|
||||||
|
Anchor = Anchor.TopRight;
|
||||||
|
|
||||||
|
InternalChildren = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = new Color4(54, 54, 54, 255)
|
||||||
|
},
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
|
||||||
|
Text = "Control Panel",
|
||||||
|
TextSize = 22f,
|
||||||
|
Font = "Exo2.0-Bold"
|
||||||
|
},
|
||||||
|
buttons = new FillFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Width = 0.75f,
|
||||||
|
|
||||||
|
Position = new Vector2(0, 35f),
|
||||||
|
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Spacing = new Vector2(0, 5f),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Spacer : CompositeDrawable
|
||||||
|
{
|
||||||
|
public Spacer(float height = 20)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
Height = height;
|
||||||
|
AlwaysPresent = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -9,7 +9,6 @@ using System.Threading.Tasks;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Textures;
|
using osu.Framework.Graphics.Textures;
|
||||||
using osu.Framework.IO.Stores;
|
using osu.Framework.IO.Stores;
|
||||||
@ -147,44 +146,7 @@ namespace osu.Game.Tournament.Screens.Drawings
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
// Control panel container
|
// Control panel container
|
||||||
new Container
|
new ControlPanel
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
AlwaysPresent = true,
|
|
||||||
Width = 0.15f,
|
|
||||||
Anchor = Anchor.TopRight,
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = new Color4(54, 54, 54, 255)
|
|
||||||
},
|
|
||||||
new OsuSpriteText
|
|
||||||
{
|
|
||||||
Anchor = Anchor.TopCentre,
|
|
||||||
Origin = Anchor.TopCentre,
|
|
||||||
|
|
||||||
Text = "Control Panel",
|
|
||||||
TextSize = 22f,
|
|
||||||
Font = "Exo2.0-Bold"
|
|
||||||
},
|
|
||||||
new FillFlowContainer
|
|
||||||
{
|
|
||||||
Anchor = Anchor.TopCentre,
|
|
||||||
Origin = Anchor.TopCentre,
|
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
Width = 0.75f,
|
|
||||||
|
|
||||||
Position = new Vector2(0, 35f),
|
|
||||||
|
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
Spacing = new Vector2(0, 5f),
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
new TriangleButton
|
new TriangleButton
|
||||||
{
|
{
|
||||||
@ -206,25 +168,8 @@ namespace osu.Game.Tournament.Screens.Drawings
|
|||||||
|
|
||||||
Text = "Reload",
|
Text = "Reload",
|
||||||
Action = reloadTeams
|
Action = reloadTeams
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
new FillFlowContainer
|
new ControlPanel.Spacer(),
|
||||||
{
|
|
||||||
Anchor = Anchor.BottomCentre,
|
|
||||||
Origin = Anchor.BottomCentre,
|
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
Width = 0.75f,
|
|
||||||
|
|
||||||
Position = new Vector2(0, -5f),
|
|
||||||
|
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
Spacing = new Vector2(0, 5f),
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new TriangleButton
|
new TriangleButton
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
@ -233,9 +178,6 @@ namespace osu.Game.Tournament.Screens.Drawings
|
|||||||
Action = () => reset()
|
Action = () => reset()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
teamsContainer.OnSelected += onTeamSelected;
|
teamsContainer.OnSelected += onTeamSelected;
|
||||||
|
Reference in New Issue
Block a user