2018-05-29 09:11:01 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2018-06-02 03:23:11 +08:00
|
|
|
|
using System;
|
2018-05-29 09:11:01 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
2018-12-06 11:21:30 +08:00
|
|
|
|
using osu.Framework.Configuration;
|
2018-05-29 09:11:01 +08:00
|
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
|
|
|
|
using osu.Framework.Graphics;
|
2018-05-29 12:53:45 +08:00
|
|
|
|
using osu.Framework.Graphics.Colour;
|
2018-05-29 09:11:01 +08:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Beatmaps.Drawables;
|
|
|
|
|
using osu.Game.Graphics;
|
2018-12-10 17:50:52 +08:00
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
2018-12-10 18:03:22 +08:00
|
|
|
|
using osu.Game.Online.Multiplayer;
|
2018-05-29 09:11:01 +08:00
|
|
|
|
using osu.Game.Overlays.SearchableList;
|
2018-11-20 15:51:59 +08:00
|
|
|
|
using osuTK.Graphics;
|
2018-05-29 09:11:01 +08:00
|
|
|
|
|
2018-12-10 18:20:41 +08:00
|
|
|
|
namespace osu.Game.Screens.Multi.Match.Components
|
2018-05-29 09:11:01 +08:00
|
|
|
|
{
|
|
|
|
|
public class Header : Container
|
|
|
|
|
{
|
2018-05-29 12:51:04 +08:00
|
|
|
|
public const float HEIGHT = 200;
|
|
|
|
|
|
2018-12-06 11:21:30 +08:00
|
|
|
|
public readonly IBindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
|
|
|
|
|
2018-05-29 09:11:01 +08:00
|
|
|
|
private readonly Box tabStrip;
|
|
|
|
|
|
2018-12-10 17:00:57 +08:00
|
|
|
|
public readonly MatchTabControl Tabs;
|
2018-05-29 09:11:01 +08:00
|
|
|
|
|
2018-06-20 16:41:48 +08:00
|
|
|
|
public Action OnRequestSelectBeatmap;
|
2018-06-02 03:23:11 +08:00
|
|
|
|
|
2018-05-29 09:11:01 +08:00
|
|
|
|
public Header()
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
2018-05-29 12:51:04 +08:00
|
|
|
|
Height = HEIGHT;
|
2018-05-29 09:11:01 +08:00
|
|
|
|
|
2018-06-02 03:23:11 +08:00
|
|
|
|
BeatmapSelectButton beatmapButton;
|
2018-12-06 11:21:30 +08:00
|
|
|
|
UpdateableBeatmapBackgroundSprite background;
|
2018-05-29 09:11:01 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2018-12-06 11:21:30 +08:00
|
|
|
|
new Container
|
2018-05-29 09:11:01 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Masking = true,
|
2018-12-06 17:31:12 +08:00
|
|
|
|
Child = background = new HeaderBeatmapBackgroundSprite { RelativeSizeAxes = Axes.Both }
|
2018-05-29 09:11:01 +08:00
|
|
|
|
},
|
2018-05-29 12:53:45 +08:00
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0), Color4.Black.Opacity(0.5f)),
|
|
|
|
|
},
|
2018-05-29 09:11:01 +08:00
|
|
|
|
tabStrip = new Box
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Height = 1,
|
|
|
|
|
},
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING },
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
|
Width = 200,
|
|
|
|
|
Padding = new MarginPadding { Vertical = 5 },
|
2018-06-02 03:23:11 +08:00
|
|
|
|
Child = beatmapButton = new BeatmapSelectButton
|
2018-05-29 09:11:01 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2018-12-10 17:50:52 +08:00
|
|
|
|
Height = 1
|
2018-05-29 09:11:01 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
2018-12-10 17:00:57 +08:00
|
|
|
|
Tabs = new MatchTabControl
|
2018-05-29 09:11:01 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
|
Origin = Anchor.BottomLeft,
|
2018-12-10 17:00:57 +08:00
|
|
|
|
RelativeSizeAxes = Axes.X
|
2018-05-29 09:11:01 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
2018-06-02 03:23:11 +08:00
|
|
|
|
|
2018-06-20 16:41:48 +08:00
|
|
|
|
beatmapButton.Action = () => OnRequestSelectBeatmap?.Invoke();
|
2018-12-06 11:21:30 +08:00
|
|
|
|
|
|
|
|
|
background.Beatmap.BindTo(Beatmap);
|
2018-05-29 09:11:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuColour colours)
|
|
|
|
|
{
|
|
|
|
|
tabStrip.Colour = colours.Yellow;
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-10 17:50:52 +08:00
|
|
|
|
private class BeatmapSelectButton : TriangleButton
|
2018-05-29 09:11:01 +08:00
|
|
|
|
{
|
2018-12-10 18:03:22 +08:00
|
|
|
|
private readonly IBindable<bool> createdBind = new Bindable<bool>();
|
|
|
|
|
|
|
|
|
|
[Resolved]
|
|
|
|
|
private Room room { get; set; }
|
|
|
|
|
|
2018-05-29 09:11:01 +08:00
|
|
|
|
public BeatmapSelectButton()
|
|
|
|
|
{
|
2018-12-10 17:50:52 +08:00
|
|
|
|
Text = "Select beatmap";
|
2018-05-29 09:11:01 +08:00
|
|
|
|
}
|
2018-12-10 18:03:22 +08:00
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load()
|
|
|
|
|
{
|
|
|
|
|
createdBind.BindTo(room.Created);
|
|
|
|
|
createdBind.BindValueChanged(v => Enabled.Value = !v, true);
|
|
|
|
|
}
|
2018-05-29 09:11:01 +08:00
|
|
|
|
}
|
2018-12-06 17:31:12 +08:00
|
|
|
|
|
|
|
|
|
private class HeaderBeatmapBackgroundSprite : UpdateableBeatmapBackgroundSprite
|
|
|
|
|
{
|
|
|
|
|
protected override double FadeDuration => 0;
|
|
|
|
|
}
|
2018-05-29 09:11:01 +08:00
|
|
|
|
}
|
|
|
|
|
}
|