diff --git a/osu.Game.Tests/Visual/TestCaseMatchHeader.cs b/osu.Game.Tests/Visual/TestCaseMatchHeader.cs index 8ff16a20b9..ac964e22a6 100644 --- a/osu.Game.Tests/Visual/TestCaseMatchHeader.cs +++ b/osu.Game.Tests/Visual/TestCaseMatchHeader.cs @@ -3,10 +3,8 @@ using System; using System.Collections.Generic; -using osu.Framework.Configuration; using osu.Game.Beatmaps; using osu.Game.Online.Multiplayer; -using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Screens.Multi.Match.Components; @@ -20,37 +18,34 @@ namespace osu.Game.Tests.Visual typeof(Header) }; - private readonly Bindable beatmap = new Bindable(); - private readonly Bindable type = new Bindable(); - private readonly Bindable> mods = new Bindable>(); - public TestCaseMatchHeader() { - var header = new Header(new Room()); + var room = new Room(); - header.Beatmap.BindTo(beatmap); - header.Type.BindTo(type); - header.Mods.BindTo(mods); + var header = new Header(room); - beatmap.Value = new BeatmapInfo + room.Playlist.Add(new PlaylistItem { - Metadata = new BeatmapMetadata + Beatmap = new BeatmapInfo { - Title = "Title", - Artist = "Artist", - AuthorString = "Author", + Metadata = new BeatmapMetadata + { + Title = "Title", + Artist = "Artist", + AuthorString = "Author", + }, + Version = "Version", + Ruleset = new OsuRuleset().RulesetInfo }, - Version = "Version", - Ruleset = new OsuRuleset().RulesetInfo - }; + RequiredMods = + { + new OsuModDoubleTime(), + new OsuModNoFail(), + new OsuModRelax(), + } + }); - type.Value = new GameTypeTimeshift(); - mods.Value = new Mod[] - { - new OsuModDoubleTime(), - new OsuModNoFail(), - new OsuModRelax(), - }; + room.Type.Value = new GameTypeTimeshift(); Child = header; } diff --git a/osu.Game/Screens/Multi/Match/Components/Header.cs b/osu.Game/Screens/Multi/Match/Components/Header.cs index f306ee698f..b2d39151c1 100644 --- a/osu.Game/Screens/Multi/Match/Components/Header.cs +++ b/osu.Game/Screens/Multi/Match/Components/Header.cs @@ -2,7 +2,6 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System; -using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; @@ -10,12 +9,10 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; using osu.Game.Graphics; using osu.Game.Online.Multiplayer; using osu.Game.Overlays.SearchableList; -using osu.Game.Rulesets.Mods; using osu.Game.Screens.Multi.Components; using osu.Game.Screens.Play.HUD; using osuTK; @@ -27,9 +24,7 @@ namespace osu.Game.Screens.Multi.Match.Components { public const float HEIGHT = 200; - public readonly IBindable Beatmap = new Bindable(); - public readonly IBindable Type = new Bindable(); - public readonly IBindable> Mods = new Bindable>(); + private readonly RoomBindings bindings = new RoomBindings(); private readonly Box tabStrip; @@ -42,6 +37,8 @@ namespace osu.Game.Screens.Multi.Match.Components RelativeSizeAxes = Axes.X; Height = HEIGHT; + bindings.Room = room; + BeatmapTypeInfo beatmapTypeInfo; BeatmapSelectButton beatmapButton; UpdateableBeatmapBackgroundSprite background; @@ -114,13 +111,12 @@ namespace osu.Game.Screens.Multi.Match.Components }, }; - beatmapTypeInfo.Beatmap.BindTo(Beatmap); - beatmapTypeInfo.Type.BindTo(Type); - background.Beatmap.BindTo(Beatmap); - Mods.BindValueChanged(m => modDisplay.Current.Value = m, true); + beatmapTypeInfo.Beatmap.BindTo(bindings.CurrentBeatmap); + beatmapTypeInfo.Type.BindTo(bindings.Type); + background.Beatmap.BindTo(bindings.CurrentBeatmap); + bindings.CurrentMods.BindValueChanged(m => modDisplay.Current.Value = m, true); beatmapButton.Action = () => OnRequestSelectBeatmap?.Invoke(); - } [BackgroundDependencyLoader] diff --git a/osu.Game/Screens/Multi/Match/MatchScreen.cs b/osu.Game/Screens/Multi/Match/MatchScreen.cs index 513b49713a..9a5950417b 100644 --- a/osu.Game/Screens/Multi/Match/MatchScreen.cs +++ b/osu.Game/Screens/Multi/Match/MatchScreen.cs @@ -104,10 +104,6 @@ namespace osu.Game.Screens.Multi.Match else settings.Hide(); }; - - header.Type.BindTo(bindings.Type); - header.Beatmap.BindTo(bindings.CurrentBeatmap); - header.Mods.BindTo(bindings.CurrentMods); } protected override void LoadComplete()