2020-12-20 23:04:06 +08:00
|
|
|
// 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.
|
|
|
|
|
2020-12-29 14:51:46 +08:00
|
|
|
using System;
|
2020-12-20 23:04:06 +08:00
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
|
2020-12-25 23:50:00 +08:00
|
|
|
namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
2020-12-20 23:04:06 +08:00
|
|
|
{
|
2020-12-25 12:38:11 +08:00
|
|
|
public class MultiplayerMatchFooter : CompositeDrawable
|
2020-12-20 23:04:06 +08:00
|
|
|
{
|
|
|
|
public const float HEIGHT = 50;
|
2021-04-07 16:35:18 +08:00
|
|
|
private const float ready_button_width = 600;
|
|
|
|
private const float spectate_button_width = 200;
|
2020-12-20 23:04:06 +08:00
|
|
|
|
2020-12-30 23:29:36 +08:00
|
|
|
public Action OnReadyClick
|
2020-12-29 14:51:46 +08:00
|
|
|
{
|
2020-12-30 23:29:36 +08:00
|
|
|
set => readyButton.OnReadyClick = value;
|
2020-12-29 14:51:46 +08:00
|
|
|
}
|
|
|
|
|
2021-04-07 16:35:18 +08:00
|
|
|
public Action OnSpectateClick
|
|
|
|
{
|
|
|
|
set => spectateButton.OnSpectateClick = value;
|
|
|
|
}
|
|
|
|
|
2020-12-20 23:04:06 +08:00
|
|
|
private readonly Drawable background;
|
2020-12-29 14:51:46 +08:00
|
|
|
private readonly MultiplayerReadyButton readyButton;
|
2021-04-07 16:35:18 +08:00
|
|
|
private readonly MultiplayerSpectateButton spectateButton;
|
2020-12-20 23:04:06 +08:00
|
|
|
|
2020-12-25 12:38:11 +08:00
|
|
|
public MultiplayerMatchFooter()
|
2020-12-20 23:04:06 +08:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
Height = HEIGHT;
|
|
|
|
|
|
|
|
InternalChildren = new[]
|
|
|
|
{
|
|
|
|
background = new Box { RelativeSizeAxes = Axes.Both },
|
2021-04-07 16:35:18 +08:00
|
|
|
new GridContainer
|
2020-12-20 23:04:06 +08:00
|
|
|
{
|
2021-04-07 16:35:18 +08:00
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Content = new[]
|
|
|
|
{
|
|
|
|
new Drawable[]
|
|
|
|
{
|
|
|
|
null,
|
|
|
|
spectateButton = new MultiplayerSpectateButton
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
},
|
|
|
|
null,
|
|
|
|
readyButton = new MultiplayerReadyButton
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
},
|
|
|
|
null
|
|
|
|
}
|
|
|
|
},
|
|
|
|
ColumnDimensions = new[]
|
|
|
|
{
|
|
|
|
new Dimension(),
|
|
|
|
new Dimension(maxSize: spectate_button_width),
|
|
|
|
new Dimension(GridSizeMode.Absolute, 10),
|
|
|
|
new Dimension(maxSize: ready_button_width),
|
|
|
|
new Dimension()
|
|
|
|
}
|
2020-12-20 23:04:06 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(OsuColour colours)
|
|
|
|
{
|
|
|
|
background.Colour = Color4Extensions.FromHex(@"28242d");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|