mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 12:33:01 +08:00
Remove ViewBeatmapButton
This commit is contained in:
parent
ffed642929
commit
a4459972b6
@ -21,7 +21,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
typeof(Info),
|
||||
typeof(HeaderButton),
|
||||
typeof(ReadyButton),
|
||||
typeof(ViewBeatmapButton)
|
||||
typeof(MatchBeatmapPanel)
|
||||
};
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -28,7 +28,6 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
private void load()
|
||||
{
|
||||
ReadyButton readyButton;
|
||||
ViewBeatmapButton viewBeatmapButton;
|
||||
HostInfo hostInfo;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
@ -80,7 +79,6 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
Direction = FillDirection.Horizontal,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
viewBeatmapButton = new ViewBeatmapButton(),
|
||||
readyButton = new ReadyButton
|
||||
{
|
||||
Action = () => OnStart?.Invoke()
|
||||
@ -91,11 +89,7 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
},
|
||||
};
|
||||
|
||||
CurrentItem.BindValueChanged(item =>
|
||||
{
|
||||
viewBeatmapButton.Beatmap.Value = item.NewValue?.Beatmap;
|
||||
readyButton.Beatmap.Value = item.NewValue?.Beatmap;
|
||||
}, true);
|
||||
CurrentItem.BindValueChanged(item => readyButton.Beatmap.Value = item.NewValue?.Beatmap, true);
|
||||
|
||||
hostInfo.Host.BindTo(Host);
|
||||
}
|
||||
|
@ -1,46 +0,0 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Beatmaps;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Multi.Match.Components
|
||||
{
|
||||
public class ViewBeatmapButton : HeaderButton
|
||||
{
|
||||
public readonly Bindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>();
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private OsuGame osuGame { get; set; }
|
||||
|
||||
public ViewBeatmapButton()
|
||||
{
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
Size = new Vector2(200, 1);
|
||||
|
||||
Text = "View beatmap";
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
if (osuGame != null)
|
||||
Beatmap.BindValueChanged(beatmap => updateAction(beatmap.NewValue), true);
|
||||
}
|
||||
|
||||
private void updateAction(BeatmapInfo beatmap)
|
||||
{
|
||||
if (beatmap == null)
|
||||
{
|
||||
Enabled.Value = false;
|
||||
return;
|
||||
}
|
||||
|
||||
Action = () => osuGame.ShowBeatmap(beatmap.OnlineBeatmapID ?? 0);
|
||||
Enabled.Value = true;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user