Use bindable propagation rather than properties

This commit is contained in:
smoogipoo 2018-12-07 19:38:46 +09:00
parent 29263d7154
commit feb1adb51d
9 changed files with 177 additions and 206 deletions

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Localisation; using osu.Framework.Localisation;
@ -9,7 +10,7 @@ using osu.Game.Graphics.Sprites;
namespace osu.Game.Screens.Multi.Components namespace osu.Game.Screens.Multi.Components
{ {
public class BeatmapTitle : FillFlowContainer<OsuSpriteText> public class BeatmapTitle : CompositeDrawable
{ {
private readonly OsuSpriteText beatmapTitle, beatmapDash, beatmapArtist; private readonly OsuSpriteText beatmapTitle, beatmapDash, beatmapArtist;
@ -18,31 +19,25 @@ namespace osu.Game.Screens.Multi.Components
set { beatmapTitle.TextSize = beatmapDash.TextSize = beatmapArtist.TextSize = value; } set { beatmapTitle.TextSize = beatmapDash.TextSize = beatmapArtist.TextSize = value; }
} }
private BeatmapInfo beatmap; public readonly Bindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>();
public BeatmapInfo Beatmap
{
set
{
if (value == beatmap) return;
beatmap = value;
if (IsLoaded)
updateText();
}
}
public BeatmapTitle() public BeatmapTitle()
{ {
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
Direction = FillDirection.Horizontal;
Children = new[] InternalChild = new FillFlowContainer
{ {
beatmapTitle = new OsuSpriteText { Font = @"Exo2.0-BoldItalic", }, AutoSizeAxes = Axes.Both,
beatmapDash = new OsuSpriteText { Font = @"Exo2.0-BoldItalic", }, Direction = FillDirection.Horizontal,
beatmapArtist = new OsuSpriteText { Font = @"Exo2.0-RegularItalic", }, Children = new[]
{
beatmapTitle = new OsuSpriteText { Font = @"Exo2.0-BoldItalic", },
beatmapDash = new OsuSpriteText { Font = @"Exo2.0-BoldItalic", },
beatmapArtist = new OsuSpriteText { Font = @"Exo2.0-RegularItalic", },
}
}; };
Beatmap.BindValueChanged(v => updateText());
} }
protected override void LoadComplete() protected override void LoadComplete()
@ -53,16 +48,19 @@ namespace osu.Game.Screens.Multi.Components
private void updateText() private void updateText()
{ {
if (beatmap == null) if (!IsLoaded)
return;
if (Beatmap.Value == null)
{ {
beatmapTitle.Text = "Changing map"; beatmapTitle.Text = "Changing map";
beatmapDash.Text = beatmapArtist.Text = string.Empty; beatmapDash.Text = beatmapArtist.Text = string.Empty;
} }
else else
{ {
beatmapTitle.Text = new LocalisedString((beatmap.Metadata.TitleUnicode, beatmap.Metadata.Title)); beatmapTitle.Text = new LocalisedString((Beatmap.Value.Metadata.TitleUnicode, Beatmap.Value.Metadata.Title));
beatmapDash.Text = @" - "; beatmapDash.Text = @" - ";
beatmapArtist.Text = new LocalisedString((beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist)); beatmapArtist.Text = new LocalisedString((Beatmap.Value.Metadata.ArtistUnicode, Beatmap.Value.Metadata.Artist));
} }
} }
} }

View File

@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
@ -12,53 +13,55 @@ using osuTK;
namespace osu.Game.Screens.Multi.Components namespace osu.Game.Screens.Multi.Components
{ {
public class BeatmapTypeInfo : FillFlowContainer public class BeatmapTypeInfo : CompositeDrawable
{ {
private readonly ModeTypeInfo modeTypeInfo;
private readonly BeatmapTitle beatmapTitle;
private readonly OsuSpriteText beatmapAuthor; private readonly OsuSpriteText beatmapAuthor;
public BeatmapInfo Beatmap public readonly Bindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>();
{
set
{
modeTypeInfo.Beatmap = beatmapTitle.Beatmap = value;
beatmapAuthor.Text = value == null ? string.Empty : $"mapped by {value.Metadata.Author}";
}
}
public GameType Type public readonly Bindable<GameType> Type = new Bindable<GameType>();
{
set { modeTypeInfo.Type = value; }
}
public BeatmapTypeInfo() public BeatmapTypeInfo()
{ {
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
Direction = FillDirection.Horizontal;
LayoutDuration = 100;
Spacing = new Vector2(5f, 0f);
Children = new Drawable[] BeatmapTitle beatmapTitle;
ModeTypeInfo modeTypeInfo;
InternalChild = new FillFlowContainer
{ {
modeTypeInfo = new ModeTypeInfo(), AutoSizeAxes = Axes.Both,
new Container Direction = FillDirection.Horizontal,
LayoutDuration = 100,
Spacing = new Vector2(5, 0),
Children = new Drawable[]
{ {
AutoSizeAxes = Axes.X, modeTypeInfo = new ModeTypeInfo(),
Height = 30, new Container
Margin = new MarginPadding { Left = 5 },
Children = new Drawable[]
{ {
beatmapTitle = new BeatmapTitle(), AutoSizeAxes = Axes.X,
beatmapAuthor = new OsuSpriteText Height = 30,
Margin = new MarginPadding { Left = 5 },
Children = new Drawable[]
{ {
Anchor = Anchor.BottomLeft, beatmapTitle = new BeatmapTitle(),
Origin = Anchor.BottomLeft, beatmapAuthor = new OsuSpriteText
TextSize = 14, {
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
TextSize = 14,
},
}, },
}, },
}, }
}; };
modeTypeInfo.Beatmap.BindTo(Beatmap);
modeTypeInfo.Type.BindTo(Type);
beatmapTitle.Beatmap.BindTo(Beatmap);
Beatmap.BindValueChanged(v => beatmapAuthor.Text = v == null ? string.Empty : $"mapped by {v.Metadata.Author}");
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -38,10 +38,10 @@ namespace osu.Game.Screens.Multi.Components
private readonly Box selectionBox; private readonly Box selectionBox;
private readonly Bindable<string> nameBind = new Bindable<string>(); private readonly Bindable<string> nameBind = new Bindable<string>();
private readonly Bindable<BeatmapInfo> beatmapBind = new Bindable<BeatmapInfo>();
private readonly Bindable<User> hostBind = new Bindable<User>(); private readonly Bindable<User> hostBind = new Bindable<User>();
private readonly Bindable<RoomStatus> statusBind = new Bindable<RoomStatus>(); private readonly Bindable<RoomStatus> statusBind = new Bindable<RoomStatus>();
private readonly Bindable<GameType> typeBind = new Bindable<GameType>(); private readonly Bindable<GameType> typeBind = new Bindable<GameType>();
private readonly Bindable<BeatmapInfo> roomBeatmap = new Bindable<BeatmapInfo>();
private readonly Bindable<IEnumerable<User>> participantsBind = new Bindable<IEnumerable<User>>(); private readonly Bindable<IEnumerable<User>> participantsBind = new Bindable<IEnumerable<User>>();
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>(); private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
@ -104,7 +104,7 @@ namespace osu.Game.Screens.Multi.Components
{ {
Box sideStrip; Box sideStrip;
UpdateableBeatmapBackgroundSprite background; UpdateableBeatmapBackgroundSprite background;
OsuSpriteText name, status; OsuSpriteText status;
ParticipantInfo participantInfo; ParticipantInfo participantInfo;
BeatmapTitle beatmapTitle; BeatmapTitle beatmapTitle;
ModeTypeInfo modeTypeInfo; ModeTypeInfo modeTypeInfo;
@ -166,9 +166,10 @@ namespace osu.Game.Screens.Multi.Components
Spacing = new Vector2(5f), Spacing = new Vector2(5f),
Children = new Drawable[] Children = new Drawable[]
{ {
name = new OsuSpriteText new OsuSpriteText
{ {
TextSize = 18, TextSize = 18,
Current = nameBind
}, },
participantInfo = new ParticipantInfo(), participantInfo = new ParticipantInfo(),
}, },
@ -206,11 +207,6 @@ namespace osu.Game.Screens.Multi.Components
}, },
}; };
nameBind.ValueChanged += n => name.Text = n;
hostBind.ValueChanged += h => participantInfo.Host = h;
typeBind.ValueChanged += m => modeTypeInfo.Type = m;
participantsBind.ValueChanged += p => participantInfo.Participants = p;
statusBind.ValueChanged += s => statusBind.ValueChanged += s =>
{ {
status.Text = s.Message; status.Text = s.Message;
@ -221,19 +217,22 @@ namespace osu.Game.Screens.Multi.Components
background.Beatmap.BindTo(beatmap); background.Beatmap.BindTo(beatmap);
roomBeatmap.ValueChanged += b => beatmapBind.ValueChanged += b => beatmap.Value = beatmaps.GetWorkingBeatmap(b);
{
beatmap.Value = beatmaps.GetWorkingBeatmap(b);
beatmapTitle.Beatmap = b;
modeTypeInfo.Beatmap = b;
};
nameBind.BindTo(Room.Name); nameBind.BindTo(Room.Name);
hostBind.BindTo(Room.Host); hostBind.BindTo(Room.Host);
statusBind.BindTo(Room.Status); statusBind.BindTo(Room.Status);
typeBind.BindTo(Room.Type); typeBind.BindTo(Room.Type);
roomBeatmap.BindTo(Room.Beatmap); beatmapBind.BindTo(Room.Beatmap);
participantsBind.BindTo(Room.Participants); participantsBind.BindTo(Room.Participants);
modeTypeInfo.Beatmap.BindTo(beatmapBind);
modeTypeInfo.Type.BindTo(typeBind);
participantInfo.Host.BindTo(hostBind);
participantInfo.Participants.BindTo(participantsBind);
beatmapTitle.Beatmap.BindTo(beatmapBind);
} }
protected override void LoadComplete() protected override void LoadComplete()

View File

@ -1,6 +1,7 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
@ -10,74 +11,54 @@ using osuTK;
namespace osu.Game.Screens.Multi.Components namespace osu.Game.Screens.Multi.Components
{ {
public class ModeTypeInfo : Container public class ModeTypeInfo : CompositeDrawable
{ {
private const float height = 30; private const float height = 30;
private const float transition_duration = 100; private const float transition_duration = 100;
private readonly Container rulesetContainer, gameTypeContainer; private readonly Container rulesetContainer;
public BeatmapInfo Beatmap public readonly Bindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>();
{ public readonly Bindable<GameType> Type = new Bindable<GameType>();
set
{
if (value != null)
{
rulesetContainer.FadeIn(transition_duration);
rulesetContainer.Children = new[]
{
new DifficultyIcon(value)
{
Size = new Vector2(height),
},
};
}
else
{
rulesetContainer.FadeOut(transition_duration);
}
}
}
public GameType Type
{
set
{
gameTypeContainer.Children = new[]
{
new DrawableGameType(value)
{
Size = new Vector2(height),
},
};
}
}
public ModeTypeInfo() public ModeTypeInfo()
{ {
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
Children = new[] Container gameTypeContainer;
InternalChild = new FillFlowContainer
{ {
new FillFlowContainer AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5f, 0f),
LayoutDuration = 100,
Children = new[]
{ {
AutoSizeAxes = Axes.Both, rulesetContainer = new Container
Direction = FillDirection.Horizontal,
Spacing = new Vector2(5f, 0f),
LayoutDuration = 100,
Children = new[]
{ {
rulesetContainer = new Container AutoSizeAxes = Axes.Both,
{ },
AutoSizeAxes = Axes.Both, gameTypeContainer = new Container
}, {
gameTypeContainer = new Container AutoSizeAxes = Axes.Both,
{
AutoSizeAxes = Axes.Both,
},
}, },
}, },
}; };
Beatmap.BindValueChanged(updateBeatmap);
Type.BindValueChanged(v => gameTypeContainer.Child = new DrawableGameType(v) { Size = new Vector2(height) });
}
private void updateBeatmap(BeatmapInfo beatmap)
{
if (beatmap != null)
{
rulesetContainer.FadeIn(transition_duration);
rulesetContainer.Child = new DifficultyIcon(beatmap) { Size = new Vector2(height) };
}
else
rulesetContainer.FadeOut(transition_duration);
} }
} }
} }

View File

@ -1,69 +1,65 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. // Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Users;
namespace osu.Game.Screens.Multi.Components namespace osu.Game.Screens.Multi.Components
{ {
public class ParticipantCount : FillFlowContainer public class ParticipantCount : CompositeDrawable
{ {
private const float text_size = 30; private const float text_size = 30;
private const float transition_duration = 100; private const float transition_duration = 100;
private readonly OsuSpriteText count, slash, maxText; private readonly OsuSpriteText slash, maxText;
public int Count public readonly Bindable<IEnumerable<User>> Participants = new Bindable<IEnumerable<User>>();
{ public readonly Bindable<int?> MaxParticipants = new Bindable<int?>();
set => count.Text = value.ToString();
}
private int? max;
public int? Max
{
get => max;
set
{
if (value == max) return;
max = value;
updateMax();
}
}
public ParticipantCount() public ParticipantCount()
{ {
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
Direction = FillDirection.Horizontal;
LayoutDuration = transition_duration;
Children = new[] OsuSpriteText count;
InternalChild = new FillFlowContainer
{ {
count = new OsuSpriteText AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
LayoutDuration = transition_duration,
Children = new[]
{ {
TextSize = text_size, count = new OsuSpriteText
Font = @"Exo2.0-Bold" {
}, TextSize = text_size,
slash = new OsuSpriteText Font = @"Exo2.0-Bold"
{ },
Text = @"/", slash = new OsuSpriteText
TextSize = text_size, {
Font = @"Exo2.0-Light" Text = @"/",
}, TextSize = text_size,
maxText = new OsuSpriteText Font = @"Exo2.0-Light"
{ },
TextSize = text_size, maxText = new OsuSpriteText
Font = @"Exo2.0-Light" {
}, TextSize = text_size,
Font = @"Exo2.0-Light"
},
}
}; };
updateMax(); Participants.BindValueChanged(v => count.Text = v.Count().ToString());
MaxParticipants.BindValueChanged(_ => updateMax(), true);
} }
private void updateMax() private void updateMax()
{ {
if (Max == null) if (MaxParticipants.Value == null)
{ {
slash.FadeOut(transition_duration); slash.FadeOut(transition_duration);
maxText.FadeOut(transition_duration); maxText.FadeOut(transition_duration);
@ -71,7 +67,7 @@ namespace osu.Game.Screens.Multi.Components
else else
{ {
slash.FadeIn(transition_duration); slash.FadeIn(transition_duration);
maxText.Text = Max.ToString(); maxText.Text = MaxParticipants.Value.ToString();
maxText.FadeIn(transition_duration); maxText.FadeIn(transition_duration);
} }
} }

View File

@ -4,6 +4,7 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
@ -16,36 +17,21 @@ namespace osu.Game.Screens.Multi.Components
{ {
public class ParticipantInfo : Container public class ParticipantInfo : Container
{ {
private readonly Container flagContainer;
private readonly OsuSpriteText host; private readonly OsuSpriteText host;
private readonly FillFlowContainer levelRangeContainer; private readonly FillFlowContainer levelRangeContainer;
private readonly OsuSpriteText levelRangeLower;
private readonly OsuSpriteText levelRangeHigher;
public User Host public readonly Bindable<User> Host = new Bindable<User>();
{ public readonly Bindable<IEnumerable<User>> Participants = new Bindable<IEnumerable<User>>();
set
{
host.Text = value.Username;
flagContainer.Children = new[] { new DrawableFlag(value.Country) { RelativeSizeAxes = Axes.Both } };
}
}
public IEnumerable<User> Participants
{
set
{
var ranks = value.Select(u => u.Statistics.Ranks.Global);
levelRangeLower.Text = ranks.Min().ToString();
levelRangeHigher.Text = ranks.Max().ToString();
}
}
public ParticipantInfo(string rankPrefix = null) public ParticipantInfo(string rankPrefix = null)
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Height = 15f; Height = 15f;
OsuSpriteText levelRangeHigher;
OsuSpriteText levelRangeLower;
Container flagContainer;
Children = new Drawable[] Children = new Drawable[]
{ {
new FillFlowContainer new FillFlowContainer
@ -133,6 +119,19 @@ namespace osu.Game.Screens.Multi.Components
}, },
}, },
}; };
Host.BindValueChanged(v =>
{
host.Text = v.Username;
flagContainer.Child = new DrawableFlag(v.Country) { RelativeSizeAxes = Axes.Both };
});
Participants.BindValueChanged(v =>
{
var ranks = v.Select(u => u.Statistics.Ranks.Global);
levelRangeLower.Text = ranks.Min().ToString();
levelRangeHigher.Text = ranks.Max().ToString();
});
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -29,10 +29,10 @@ namespace osu.Game.Screens.Multi.Components
private readonly MarginPadding contentPadding = new MarginPadding { Horizontal = 20, Vertical = 10 }; private readonly MarginPadding contentPadding = new MarginPadding { Horizontal = 20, Vertical = 10 };
private readonly Bindable<string> nameBind = new Bindable<string>(); private readonly Bindable<string> nameBind = new Bindable<string>();
private readonly Bindable<BeatmapInfo> beatmapBind = new Bindable<BeatmapInfo>();
private readonly Bindable<User> hostBind = new Bindable<User>(); private readonly Bindable<User> hostBind = new Bindable<User>();
private readonly Bindable<RoomStatus> statusBind = new Bindable<RoomStatus>(); private readonly Bindable<RoomStatus> statusBind = new Bindable<RoomStatus>();
private readonly Bindable<GameType> typeBind = new Bindable<GameType>(); private readonly Bindable<GameType> typeBind = new Bindable<GameType>();
private readonly Bindable<BeatmapInfo> roomBeatmap = new Bindable<BeatmapInfo>();
private readonly Bindable<int?> maxParticipantsBind = new Bindable<int?>(); private readonly Bindable<int?> maxParticipantsBind = new Bindable<int?>();
private readonly Bindable<IEnumerable<User>> participantsBind = new Bindable<IEnumerable<User>>(); private readonly Bindable<IEnumerable<User>> participantsBind = new Bindable<IEnumerable<User>>();
@ -64,7 +64,7 @@ namespace osu.Game.Screens.Multi.Components
hostBind.UnbindBindings(); hostBind.UnbindBindings();
statusBind.UnbindBindings(); statusBind.UnbindBindings();
typeBind.UnbindBindings(); typeBind.UnbindBindings();
roomBeatmap.UnbindBindings(); beatmapBind.UnbindBindings();
maxParticipantsBind.UnbindBindings(); maxParticipantsBind.UnbindBindings();
participantsBind.UnbindBindings(); participantsBind.UnbindBindings();
@ -74,7 +74,7 @@ namespace osu.Game.Screens.Multi.Components
hostBind.BindTo(room.Host); hostBind.BindTo(room.Host);
statusBind.BindTo(room.Status); statusBind.BindTo(room.Status);
typeBind.BindTo(room.Type); typeBind.BindTo(room.Type);
roomBeatmap.BindTo(room.Beatmap); beatmapBind.BindTo(room.Beatmap);
maxParticipantsBind.BindTo(room.MaxParticipants); maxParticipantsBind.BindTo(room.MaxParticipants);
participantsBind.BindTo(room.Participants); participantsBind.BindTo(room.Participants);
} }
@ -131,6 +131,7 @@ namespace osu.Game.Screens.Multi.Components
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
TextSize = 30, TextSize = 30,
Current = nameBind
}, },
}, },
}, },
@ -203,26 +204,20 @@ namespace osu.Game.Screens.Multi.Components
}, },
}; };
nameBind.ValueChanged += n => name.Text = n;
hostBind.ValueChanged += h => participantInfo.Host = h;
typeBind.ValueChanged += t => beatmapTypeInfo.Type = t;
maxParticipantsBind.ValueChanged += m => participantCount.Max = m;
statusBind.ValueChanged += displayStatus; statusBind.ValueChanged += displayStatus;
beatmapBind.ValueChanged += b => beatmap.Value = beatmaps.GetWorkingBeatmap(b);
participantsBind.ValueChanged += p => participantsFlow.ChildrenEnumerable = p.Select(u => new UserTile(u));
background.Beatmap.BindTo(beatmap); background.Beatmap.BindTo(beatmap);
roomBeatmap.ValueChanged += b => participantInfo.Host.BindTo(hostBind);
{ participantInfo.Participants.BindTo(participantsBind);
beatmap.Value = beatmaps.GetWorkingBeatmap(b);
beatmapTypeInfo.Beatmap = b;
};
participantsBind.ValueChanged += p => participantCount.Participants.BindTo(participantsBind);
{ participantCount.MaxParticipants.BindTo(maxParticipantsBind);
participantCount.Count = p.Count();
participantInfo.Participants = p; beatmapTypeInfo.Type.BindTo(typeBind);
participantsFlow.ChildrenEnumerable = p.Select(u => new UserTile(u)); beatmapTypeInfo.Beatmap.BindTo(beatmapBind);
};
updateState(); updateState();
} }
@ -265,7 +260,7 @@ namespace osu.Game.Screens.Multi.Components
participantInfo.FadeIn(transition_duration); participantInfo.FadeIn(transition_duration);
statusBind.TriggerChange(); statusBind.TriggerChange();
roomBeatmap.TriggerChange(); beatmapBind.TriggerChange();
} }
} }

View File

@ -99,10 +99,11 @@ namespace osu.Game.Screens.Multi.Screens.Match
}, },
}; };
beatmapTypeInfo.Beatmap.BindTo(Beatmap);
beatmapTypeInfo.Type.BindTo(Type);
Availability.BindValueChanged(_ => updateAvailabilityStatus()); Availability.BindValueChanged(_ => updateAvailabilityStatus());
Status.BindValueChanged(_ => updateAvailabilityStatus()); Status.BindValueChanged(_ => updateAvailabilityStatus());
Beatmap.BindValueChanged(b => beatmapTypeInfo.Beatmap = b);
Type.BindValueChanged(t => beatmapTypeInfo.Type = t);
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -60,6 +60,9 @@ namespace osu.Game.Screens.Multi.Screens.Match
}, },
}; };
count.Participants.BindTo(Users);
count.MaxParticipants.BindTo(MaxParticipants);
Users.BindValueChanged(v => Users.BindValueChanged(v =>
{ {
usersFlow.Children = v.Select(u => new UserPanel(u) usersFlow.Children = v.Select(u => new UserPanel(u)
@ -69,11 +72,7 @@ namespace osu.Game.Screens.Multi.Screens.Match
Width = 300, Width = 300,
OnLoadComplete = d => d.FadeInFromZero(60), OnLoadComplete = d => d.FadeInFromZero(60),
}).ToList(); }).ToList();
count.Count = v.Count();
}); });
MaxParticipants.BindValueChanged(v => count.Max = v);
} }
} }
} }