1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-12 05:27:40 +08:00
osu-lazer/osu.Game/Screens/Multi/Screens/Match/Match.cs

59 lines
2.0 KiB
C#
Raw Normal View History

2018-05-29 08:01:56 +08:00
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
2018-05-29 09:11:01 +08:00
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
2018-05-29 08:01:56 +08:00
using osu.Game.Online.Multiplayer;
2018-05-29 09:11:01 +08:00
using osu.Game.Screens.Select;
2018-05-29 08:01:56 +08:00
namespace osu.Game.Screens.Multi.Screens.Match
{
public class Match : MultiplayerScreen
{
private readonly Room room;
2018-05-29 12:51:04 +08:00
private readonly Bindable<string> nameBind = new Bindable<string>();
private readonly Bindable<RoomStatus> statusBind = new Bindable<RoomStatus>();
private readonly Bindable<RoomAvailability> availabilityBind = new Bindable<RoomAvailability>();
private readonly Bindable<GameType> typeBind = new Bindable<GameType>();
2018-05-29 09:11:01 +08:00
private readonly Bindable<BeatmapInfo> beatmapBind = new Bindable<BeatmapInfo>();
2018-05-29 08:01:56 +08:00
public override string Title => room.Name.Value;
public Match(Room room)
{
this.room = room;
2018-05-29 09:11:01 +08:00
Header header;
2018-05-29 12:51:04 +08:00
Info info;
2018-05-29 09:11:01 +08:00
Children = new Drawable[]
{
header = new Header(),
2018-05-29 12:51:04 +08:00
info = new Info
{
Margin = new MarginPadding { Top = Header.HEIGHT },
},
2018-05-29 09:11:01 +08:00
};
2018-05-29 12:51:04 +08:00
header.BeatmapButton.Action = () => Push(new MatchSongSelect());
nameBind.ValueChanged += n => info.Name = n;
statusBind.ValueChanged += s => info.Status = s;
availabilityBind.ValueChanged += a => info.Availability = a;
typeBind.ValueChanged += t => info.Type = t;
2018-05-29 09:11:01 +08:00
beatmapBind.ValueChanged += b =>
{
header.BeatmapSet = b.BeatmapSet;
2018-05-29 12:51:04 +08:00
info.Beatmap = b;
2018-05-29 09:11:01 +08:00
};
2018-05-29 12:51:04 +08:00
nameBind.BindTo(room.Name);
statusBind.BindTo(room.Status);
availabilityBind.BindTo(room.Availability);
typeBind.BindTo(room.Type);
2018-05-29 09:11:01 +08:00
beatmapBind.BindTo(room.Beatmap);
2018-05-29 08:01:56 +08:00
}
}
}