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.Drawables;
|
|
|
|
|
using osu.Game.Graphics;
|
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-12-20 14:17:33 +08:00
|
|
|
|
using osu.Game.Screens.Multi.Components;
|
|
|
|
|
using osu.Game.Screens.Play.HUD;
|
|
|
|
|
using osuTK;
|
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-22 13:12:27 +08:00
|
|
|
|
private readonly RoomBindings bindings = new RoomBindings();
|
2018-12-06 11:21:30 +08:00
|
|
|
|
|
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-12-20 14:17:33 +08:00
|
|
|
|
public Header(Room room)
|
2018-05-29 09:11:01 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
2018-05-29 12:51:04 +08:00
|
|
|
|
Height = HEIGHT;
|
2018-05-29 09:11:01 +08:00
|
|
|
|
|
2018-12-22 13:12:27 +08:00
|
|
|
|
bindings.Room = room;
|
|
|
|
|
|
2018-12-20 14:17:33 +08:00
|
|
|
|
BeatmapTypeInfo beatmapTypeInfo;
|
2018-06-02 03:23:11 +08:00
|
|
|
|
BeatmapSelectButton beatmapButton;
|
2018-12-06 11:21:30 +08:00
|
|
|
|
UpdateableBeatmapBackgroundSprite background;
|
2018-12-20 14:17:33 +08:00
|
|
|
|
ModDisplay modDisplay;
|
|
|
|
|
|
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-20 14:17:33 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
background = new HeaderBeatmapBackgroundSprite { RelativeSizeAxes = Axes.Both },
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0.4f), Color4.Black.Opacity(0.6f)),
|
|
|
|
|
},
|
|
|
|
|
}
|
2018-05-29 12:53:45 +08:00
|
|
|
|
},
|
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,
|
2018-12-20 16:33:55 +08:00
|
|
|
|
Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING },
|
2018-05-29 09:11:01 +08:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2018-12-20 14:17:33 +08:00
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
2018-12-20 16:33:55 +08:00
|
|
|
|
Padding = new MarginPadding { Top = 20 },
|
2018-12-20 14:17:33 +08:00
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
beatmapTypeInfo = new BeatmapTypeInfo(),
|
|
|
|
|
modDisplay = new ModDisplay
|
|
|
|
|
{
|
|
|
|
|
Scale = new Vector2(0.75f),
|
|
|
|
|
DisplayUnrankedText = false
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
},
|
2018-05-29 09:11:01 +08:00
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
|
Width = 200,
|
2018-12-26 15:11:40 +08:00
|
|
|
|
Padding = new MarginPadding { Vertical = 10 },
|
2018-12-20 14:17:33 +08:00
|
|
|
|
Child = beatmapButton = new BeatmapSelectButton(room)
|
2018-05-29 09:11:01 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2018-12-26 15:11:40 +08:00
|
|
|
|
Height = 1,
|
2018-05-29 09:11:01 +08:00
|
|
|
|
},
|
|
|
|
|
},
|
2018-12-20 14:17:33 +08:00
|
|
|
|
Tabs = new MatchTabControl(room)
|
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-12-22 13:12:27 +08:00
|
|
|
|
beatmapTypeInfo.Beatmap.BindTo(bindings.CurrentBeatmap);
|
2018-12-27 17:16:17 +08:00
|
|
|
|
beatmapTypeInfo.Ruleset.BindTo(bindings.CurrentRuleset);
|
2018-12-22 13:12:27 +08:00
|
|
|
|
beatmapTypeInfo.Type.BindTo(bindings.Type);
|
|
|
|
|
background.Beatmap.BindTo(bindings.CurrentBeatmap);
|
|
|
|
|
bindings.CurrentMods.BindValueChanged(m => modDisplay.Current.Value = m, true);
|
2018-12-20 14:17:33 +08:00
|
|
|
|
|
2018-06-20 16:41:48 +08:00
|
|
|
|
beatmapButton.Action = () => OnRequestSelectBeatmap?.Invoke();
|
2018-05-29 09:11:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuColour colours)
|
|
|
|
|
{
|
|
|
|
|
tabStrip.Colour = colours.Yellow;
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-14 13:20:03 +08:00
|
|
|
|
private class BeatmapSelectButton : HeaderButton
|
2018-05-29 09:11:01 +08:00
|
|
|
|
{
|
2018-12-12 15:20:11 +08:00
|
|
|
|
private readonly IBindable<int?> roomIDBind = new Bindable<int?>();
|
2018-12-10 18:03:22 +08:00
|
|
|
|
|
2018-12-20 14:17:33 +08:00
|
|
|
|
public BeatmapSelectButton(Room room)
|
2018-05-29 09:11:01 +08:00
|
|
|
|
{
|
2018-12-10 17:50:52 +08:00
|
|
|
|
Text = "Select beatmap";
|
2018-12-10 18:03:22 +08:00
|
|
|
|
|
2018-12-12 15:20:11 +08:00
|
|
|
|
roomIDBind.BindTo(room.RoomID);
|
2018-12-14 13:33:50 +08:00
|
|
|
|
roomIDBind.BindValueChanged(v => this.FadeTo(v.HasValue ? 0 : 1), true);
|
2018-12-10 18:03:22 +08:00
|
|
|
|
}
|
2018-05-29 09:11:01 +08:00
|
|
|
|
}
|
2018-12-06 17:31:12 +08:00
|
|
|
|
|
|
|
|
|
private class HeaderBeatmapBackgroundSprite : UpdateableBeatmapBackgroundSprite
|
|
|
|
|
{
|
2018-12-26 20:18:55 +08:00
|
|
|
|
protected override double FadeDuration => 200;
|
2018-12-06 17:31:12 +08:00
|
|
|
|
}
|
2018-05-29 09:11:01 +08:00
|
|
|
|
}
|
|
|
|
|
}
|