mirror of
https://github.com/ppy/osu.git
synced 2025-02-08 13:52:58 +08:00
69 lines
2.3 KiB
C#
69 lines
2.3 KiB
C#
// 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.Sprites;
|
|
using osu.Framework.Input.Events;
|
|
using osu.Game.Graphics.Containers;
|
|
using osu.Game.Graphics.UserInterface;
|
|
using osu.Game.Screens.Play.HUD;
|
|
using osuTK;
|
|
|
|
namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
|
{
|
|
public partial class ExpandingPlayerSettingsOverlay : ExpandingContainer
|
|
{
|
|
private const float padding = 10;
|
|
|
|
public const float CONTRACTED_WIDTH = button_size + padding * 2;
|
|
public const float EXPANDED_WIDTH = player_settings_width + button_size + padding * 3;
|
|
|
|
private const float player_settings_width = 270;
|
|
private const float button_size = IconButton.DEFAULT_BUTTON_SIZE;
|
|
|
|
public ExpandingPlayerSettingsOverlay()
|
|
: base(CONTRACTED_WIDTH, EXPANDED_WIDTH)
|
|
{
|
|
Origin = Anchor.TopRight;
|
|
Anchor = Anchor.TopRight;
|
|
|
|
PlayerSettingsOverlay playerSettingsOverlay;
|
|
|
|
InternalChild = new FillFlowContainer
|
|
{
|
|
Origin = Anchor.TopLeft,
|
|
Anchor = Anchor.TopLeft,
|
|
Direction = FillDirection.Horizontal,
|
|
AutoSizeAxes = Axes.Both,
|
|
Margin = new MarginPadding(padding),
|
|
Spacing = new Vector2(padding),
|
|
Children = new Drawable[]
|
|
{
|
|
new IconButton
|
|
{
|
|
Icon = FontAwesome.Solid.Cog,
|
|
Origin = Anchor.TopLeft,
|
|
Anchor = Anchor.TopLeft,
|
|
Action = () => Expanded.Toggle()
|
|
},
|
|
playerSettingsOverlay = new PlayerSettingsOverlay
|
|
{
|
|
Anchor = Anchor.TopLeft,
|
|
Origin = Anchor.TopLeft
|
|
}
|
|
}
|
|
};
|
|
|
|
playerSettingsOverlay.Show();
|
|
}
|
|
|
|
protected override void OnHoverLost(HoverLostEvent e)
|
|
{
|
|
// Prevent unexpanding when hovering player settings
|
|
if (!Contains(e.ScreenSpaceMousePosition))
|
|
base.OnHoverLost(e);
|
|
}
|
|
}
|
|
}
|