osu/osu.Game/Screens/Multi/Match/Components/Info.cs

104 lines
3.8 KiB
C#
Raw Normal View History

// 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.
2018-05-29 04:51:04 +00:00
using System;
2019-02-05 10:00:01 +00:00
using osu.Framework.Allocation;
2018-05-29 04:51:04 +00:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Overlays.SearchableList;
using osu.Game.Screens.Multi.Components;
2018-11-20 07:51:59 +00:00
using osuTK;
2018-05-29 04:51:04 +00:00
2018-12-10 10:20:41 +00:00
namespace osu.Game.Screens.Multi.Match.Components
2018-05-29 04:51:04 +00:00
{
2019-02-05 10:00:01 +00:00
public class Info : MultiplayerComposite
2018-05-29 04:51:04 +00:00
{
public Action OnStart;
2019-02-05 10:00:01 +00:00
public Info()
2018-05-29 04:51:04 +00:00
{
RelativeSizeAxes = Axes.X;
2018-12-14 05:20:03 +00:00
AutoSizeAxes = Axes.Y;
2019-02-05 10:00:01 +00:00
}
2018-05-29 04:51:04 +00:00
2019-02-05 10:00:01 +00:00
[BackgroundDependencyLoader]
private void load()
{
ReadyButton readyButton;
ViewBeatmapButton viewBeatmapButton;
2018-12-25 09:07:19 +00:00
HostInfo hostInfo;
2018-12-07 07:20:05 +00:00
2019-02-05 10:00:01 +00:00
InternalChildren = new Drawable[]
2018-05-29 04:51:04 +00:00
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.FromHex(@"28242d"),
},
new Container
{
2018-12-14 05:20:03 +00:00
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
2019-01-25 05:10:59 +00:00
Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING + OsuScreen.HORIZONTAL_OVERFLOW_PADDING },
2018-05-29 04:51:04 +00:00
Children = new Drawable[]
{
2018-12-14 05:20:03 +00:00
new FillFlowContainer
2018-05-29 04:51:04 +00:00
{
2018-12-14 05:20:03 +00:00
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 10),
2018-05-29 04:51:04 +00:00
Padding = new MarginPadding { Vertical = 20 },
Children = new Drawable[]
{
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Children = new Drawable[]
{
new OsuSpriteText
{
Font = OsuFont.GetFont(size: 30),
2019-04-25 08:36:17 +00:00
Current = RoomName
},
2019-02-05 10:00:01 +00:00
new RoomStatusInfo(),
2018-12-14 05:20:03 +00:00
}
2018-05-29 04:51:04 +00:00
},
2018-12-25 09:07:19 +00:00
hostInfo = new HostInfo(),
2018-05-29 04:51:04 +00:00
},
},
2018-12-14 05:20:03 +00:00
new FillFlowContainer
2018-05-29 04:51:04 +00:00
{
2018-12-14 05:20:03 +00:00
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
AutoSizeAxes = Axes.X,
Height = 70,
Spacing = new Vector2(10, 0),
Direction = FillDirection.Horizontal,
Children = new Drawable[]
{
viewBeatmapButton = new ViewBeatmapButton(),
2019-02-05 10:00:01 +00:00
readyButton = new ReadyButton
2018-12-14 05:20:03 +00:00
{
Action = () => OnStart?.Invoke()
}
}
}
2018-05-29 04:51:04 +00:00
},
},
};
2018-12-07 07:20:05 +00:00
CurrentItem.BindValueChanged(item =>
2019-02-11 10:11:34 +00:00
{
viewBeatmapButton.Beatmap.Value = item.NewValue?.Beatmap;
readyButton.Beatmap.Value = item.NewValue?.Beatmap;
2019-02-11 10:11:34 +00:00
}, true);
2019-02-05 10:00:01 +00:00
hostInfo.Host.BindTo(Host);
2018-05-29 04:51:04 +00:00
}
}
}