Use RoomID for creation

This commit is contained in:
smoogipoo 2018-12-12 16:20:11 +09:00
parent 439d741dee
commit 6123a11b67
4 changed files with 9 additions and 11 deletions

View File

@ -14,7 +14,7 @@ namespace osu.Game.Online.Multiplayer
{ {
public class Room public class Room
{ {
public Bindable<int> RoomID { get; } = new Bindable<int>(); public Bindable<int?> RoomID { get; } = new Bindable<int?>();
[JsonProperty("name")] [JsonProperty("name")]
public readonly Bindable<string> Name = new Bindable<string>("My awesome room!"); public readonly Bindable<string> Name = new Bindable<string>("My awesome room!");
@ -34,6 +34,7 @@ namespace osu.Game.Online.Multiplayer
public void CopyFrom(Room other) public void CopyFrom(Room other)
{ {
RoomID.Value = other.RoomID;
Name.Value = other.Name; Name.Value = other.Name;
Host.Value = other.Host; Host.Value = other.Host;
Status.Value = other.Status; Status.Value = other.Status;
@ -43,8 +44,6 @@ namespace osu.Game.Online.Multiplayer
MaxParticipants.Value = other.MaxParticipants; MaxParticipants.Value = other.MaxParticipants;
Participants.Value = other.Participants.Value.ToArray(); Participants.Value = other.Participants.Value.ToArray();
} }
public Bindable<bool> Created = new Bindable<bool>();
} }
public class PlaylistItem public class PlaylistItem

View File

@ -100,7 +100,7 @@ namespace osu.Game.Screens.Multi.Match.Components
private class BeatmapSelectButton : TriangleButton private class BeatmapSelectButton : TriangleButton
{ {
private readonly IBindable<bool> createdBind = new Bindable<bool>(); private readonly IBindable<int?> roomIDBind = new Bindable<int?>();
[Resolved] [Resolved]
private Room room { get; set; } private Room room { get; set; }
@ -113,8 +113,8 @@ namespace osu.Game.Screens.Multi.Match.Components
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
createdBind.BindTo(room.Created); roomIDBind.BindTo(room.RoomID);
createdBind.BindValueChanged(v => Enabled.Value = !v, true); roomIDBind.BindValueChanged(v => Enabled.Value = !v.HasValue, true);
} }
} }

View File

@ -14,7 +14,7 @@ namespace osu.Game.Screens.Multi.Match.Components
{ {
public class MatchTabControl : PageTabControl<MatchPage> public class MatchTabControl : PageTabControl<MatchPage>
{ {
private readonly IBindable<bool> created = new Bindable<bool>(); private readonly IBindable<int?> roomIdBind = new Bindable<int?>();
[Resolved] [Resolved]
private Room room { get; set; } private Room room { get; set; }
@ -28,10 +28,10 @@ namespace osu.Game.Screens.Multi.Match.Components
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
created.BindTo(room.Created); roomIdBind.BindTo(room.RoomID);
created.BindValueChanged(v => roomIdBind.BindValueChanged(v =>
{ {
if (v) if (v.HasValue)
{ {
Items.ForEach(t => t.Enabled.Value = !(t is SettingsMatchPage)); Items.ForEach(t => t.Enabled.Value = !(t is SettingsMatchPage));
Current.Value = new RoomMatchPage(); Current.Value = new RoomMatchPage();

View File

@ -25,7 +25,6 @@ namespace osu.Game.Screens.Multi
// Todo: Perform API request // Todo: Perform API request
room.Created.Value = true;
rooms.Add(room); rooms.Add(room);
} }
} }