mirror of
https://github.com/ppy/osu.git
synced 2025-03-23 18:10:01 +08:00
Decouple header from matchscreen
This commit is contained in:
parent
c06cf5d379
commit
21cfe5a3e6
@ -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<BeatmapInfo> beatmap = new Bindable<BeatmapInfo>();
|
||||
private readonly Bindable<GameType> type = new Bindable<GameType>();
|
||||
private readonly Bindable<IEnumerable<Mod>> mods = new Bindable<IEnumerable<Mod>>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -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<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>();
|
||||
public readonly IBindable<GameType> Type = new Bindable<GameType>();
|
||||
public readonly IBindable<IEnumerable<Mod>> Mods = new Bindable<IEnumerable<Mod>>();
|
||||
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]
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user