1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 16:32:54 +08:00

Decouple match info from match screen

This commit is contained in:
smoogipoo 2018-12-22 14:08:00 +09:00
parent d93421b796
commit c06cf5d379
2 changed files with 13 additions and 23 deletions

View File

@ -3,12 +3,10 @@
using System;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.Multiplayer;
@ -26,11 +24,7 @@ namespace osu.Game.Screens.Multi.Match.Components
private OsuColour colours;
public readonly IBindable<string> Name = new Bindable<string>();
public readonly IBindable<RoomAvailability> Availability = new Bindable<RoomAvailability>();
public readonly IBindable<RoomStatus> Status = new Bindable<RoomStatus>();
public readonly IBindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>();
public readonly IBindable<DateTimeOffset> EndDate = new Bindable<DateTimeOffset>();
private readonly RoomBindings bindings = new RoomBindings();
public Info(Room room)
{
@ -99,13 +93,15 @@ namespace osu.Game.Screens.Multi.Match.Components
},
};
viewBeatmapButton.Beatmap.BindTo(Beatmap);
readyButton.Beatmap.BindTo(Beatmap);
viewBeatmapButton.Beatmap.BindTo(bindings.CurrentBeatmap);
readyButton.Beatmap.BindTo(bindings.CurrentBeatmap);
Availability.BindValueChanged(_ => updateAvailabilityStatus());
Status.BindValueChanged(_ => updateAvailabilityStatus());
Name.BindValueChanged(n => name.Text = n);
EndDate.BindValueChanged(d => endDate.Date = d);
bindings.Availability.BindValueChanged(_ => updateAvailabilityStatus());
bindings.Status.BindValueChanged(_ => updateAvailabilityStatus());
bindings.Name.BindValueChanged(n => name.Text = n);
bindings.EndDate.BindValueChanged(d => endDate.Date = d);
bindings.Room = room;
}
[BackgroundDependencyLoader]
@ -126,10 +122,10 @@ namespace osu.Game.Screens.Multi.Match.Components
if (!IsLoaded)
return;
if (Status.Value != null)
if (bindings.Status.Value != null)
{
availabilityStatus.FadeColour(Status.Value.GetAppropriateColour(colours), 100);
availabilityStatus.Text = $"{Availability.Value.GetDescription()}, {Status.Value.Message}";
availabilityStatus.FadeColour(bindings.Status.Value.GetAppropriateColour(colours), 100);
availabilityStatus.Text = $"{bindings.Availability.Value.GetDescription()}, {bindings.Status.Value.Message}";
}
}
}

View File

@ -49,7 +49,6 @@ namespace osu.Game.Screens.Multi.Match
bindings.Room = room;
Info info;
Components.Header header;
RoomSettingsOverlay settings;
@ -61,7 +60,7 @@ namespace osu.Game.Screens.Multi.Match
Content = new[]
{
new Drawable[] { header = new Components.Header(room) { Depth = -1 } },
new Drawable[] { info = new Info(room) { OnStart = onStart } },
new Drawable[] { new Info(room) { OnStart = onStart } },
new Drawable[]
{
new GridContainer
@ -106,11 +105,6 @@ namespace osu.Game.Screens.Multi.Match
settings.Hide();
};
info.Name.BindTo(bindings.Name);
info.Status.BindTo(bindings.Status);
info.Availability.BindTo(bindings.Availability);
info.EndDate.BindTo(bindings.EndDate);
info.Beatmap.BindTo(bindings.CurrentBeatmap);
header.Type.BindTo(bindings.Type);
header.Beatmap.BindTo(bindings.CurrentBeatmap);
header.Mods.BindTo(bindings.CurrentMods);