1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-18 06:43:22 +08:00
osu-lazer/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 12:51:04 +08:00
using System;
2019-02-05 18:00:01 +08:00
using osu.Framework.Allocation;
2018-05-29 12:51:04 +08: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 15:51:59 +08:00
using osuTK;
2018-05-29 12:51:04 +08:00
2018-12-10 18:20:41 +08:00
namespace osu.Game.Screens.Multi.Match.Components
2018-05-29 12:51:04 +08:00
{
2019-02-05 18:00:01 +08:00
public class Info : MultiplayerComposite
2018-05-29 12:51:04 +08:00
{
public Action OnStart;
2019-02-05 18:00:01 +08:00
public Info()
2018-05-29 12:51:04 +08:00
{
RelativeSizeAxes = Axes.X;
2018-12-14 13:20:03 +08:00
AutoSizeAxes = Axes.Y;
2019-02-05 18:00:01 +08:00
}
2018-05-29 12:51:04 +08:00
2019-02-05 18:00:01 +08:00
[BackgroundDependencyLoader]
private void load()
{
ReadyButton readyButton;
ViewBeatmapButton viewBeatmapButton;
2018-12-25 17:07:19 +08:00
HostInfo hostInfo;
2018-12-07 15:20:05 +08:00
2019-02-05 18:00:01 +08:00
InternalChildren = new Drawable[]
2018-05-29 12:51:04 +08:00
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.FromHex(@"28242d"),
},
new Container
{
2018-12-14 13:20:03 +08:00
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
2019-01-25 13:10:59 +08:00
Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING + OsuScreen.HORIZONTAL_OVERFLOW_PADDING },
2018-05-29 12:51:04 +08:00
Children = new Drawable[]
{
2018-12-14 13:20:03 +08:00
new FillFlowContainer
2018-05-29 12:51:04 +08:00
{
2018-12-14 13:20:03 +08:00
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 10),
2018-05-29 12:51:04 +08: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 16:36:17 +08:00
Current = RoomName
},
2019-02-05 18:00:01 +08:00
new RoomStatusInfo(),
2018-12-14 13:20:03 +08:00
}
2018-05-29 12:51:04 +08:00
},
2018-12-25 17:07:19 +08:00
hostInfo = new HostInfo(),
2018-05-29 12:51:04 +08:00
},
},
2018-12-14 13:20:03 +08:00
new FillFlowContainer
2018-05-29 12:51:04 +08:00
{
2018-12-14 13:20:03 +08: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 18:00:01 +08:00
readyButton = new ReadyButton
2018-12-14 13:20:03 +08:00
{
Action = () => OnStart?.Invoke()
}
}
}
2018-05-29 12:51:04 +08:00
},
},
};
2018-12-07 15:20:05 +08:00
CurrentItem.BindValueChanged(item =>
2019-02-11 18:11:34 +08:00
{
viewBeatmapButton.Beatmap.Value = item.NewValue?.Beatmap;
readyButton.Beatmap.Value = item.NewValue?.Beatmap;
2019-02-11 18:11:34 +08:00
}, true);
2019-02-05 18:00:01 +08:00
hostInfo.Host.BindTo(Host);
2018-05-29 12:51:04 +08:00
}
}
}