2019-01-24 08:43:03 +00:00
|
|
|
|
// 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.
|
2018-05-29 01:11:01 +00:00
|
|
|
|
|
2018-06-01 19:23:11 +00:00
|
|
|
|
using System;
|
2018-05-29 01:11:01 +00:00
|
|
|
|
using osu.Framework.Allocation;
|
2019-02-21 10:04:31 +00:00
|
|
|
|
using osu.Framework.Bindables;
|
2018-05-29 01:11:01 +00:00
|
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
|
|
|
|
using osu.Framework.Graphics;
|
2018-05-29 04:53:45 +00:00
|
|
|
|
using osu.Framework.Graphics.Colour;
|
2018-05-29 01:11:01 +00:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
|
using osu.Game.Beatmaps.Drawables;
|
|
|
|
|
using osu.Game.Graphics;
|
2018-12-10 10:03:22 +00:00
|
|
|
|
using osu.Game.Online.Multiplayer;
|
2018-05-29 01:11:01 +00:00
|
|
|
|
using osu.Game.Overlays.SearchableList;
|
2019-03-06 08:13:28 +00:00
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2018-12-20 06:17:33 +00:00
|
|
|
|
using osu.Game.Screens.Multi.Components;
|
|
|
|
|
using osu.Game.Screens.Play.HUD;
|
|
|
|
|
using osuTK;
|
2018-11-20 07:51:59 +00:00
|
|
|
|
using osuTK.Graphics;
|
2018-05-29 01:11:01 +00:00
|
|
|
|
|
2018-12-10 10:20:41 +00:00
|
|
|
|
namespace osu.Game.Screens.Multi.Match.Components
|
2018-05-29 01:11:01 +00:00
|
|
|
|
{
|
2019-02-05 10:00:01 +00:00
|
|
|
|
public class Header : MultiplayerComposite
|
2018-05-29 01:11:01 +00:00
|
|
|
|
{
|
2018-05-29 04:51:04 +00:00
|
|
|
|
public const float HEIGHT = 200;
|
|
|
|
|
|
2019-08-13 08:34:16 +00:00
|
|
|
|
public readonly BindableBool ShowBeatmapPanel = new BindableBool();
|
2018-12-06 03:21:30 +00:00
|
|
|
|
|
2019-08-13 08:34:16 +00:00
|
|
|
|
public MatchTabControl Tabs { get; private set; }
|
2018-05-29 01:11:01 +00:00
|
|
|
|
|
2019-08-13 08:34:16 +00:00
|
|
|
|
public Action RequestBeatmapSelection;
|
2019-08-08 04:08:51 +00:00
|
|
|
|
|
|
|
|
|
private MatchBeatmapPanel beatmapPanel;
|
|
|
|
|
|
2019-02-05 10:00:01 +00:00
|
|
|
|
public Header()
|
2018-05-29 01:11:01 +00:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
2018-05-29 04:51:04 +00:00
|
|
|
|
Height = HEIGHT;
|
2019-02-05 10:00:01 +00:00
|
|
|
|
}
|
2018-05-29 01:11:01 +00:00
|
|
|
|
|
2019-02-05 10:00:01 +00:00
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load(OsuColour colours)
|
|
|
|
|
{
|
2018-06-01 19:23:11 +00:00
|
|
|
|
BeatmapSelectButton beatmapButton;
|
2018-12-20 06:17:33 +00:00
|
|
|
|
ModDisplay modDisplay;
|
|
|
|
|
|
2019-02-05 10:00:01 +00:00
|
|
|
|
InternalChildren = new Drawable[]
|
2018-05-29 01:11:01 +00:00
|
|
|
|
{
|
2018-12-06 03:21:30 +00:00
|
|
|
|
new Container
|
2018-05-29 01:11:01 +00:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Masking = true,
|
2018-12-20 06:17:33 +00:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2019-02-05 10:00:01 +00:00
|
|
|
|
new HeaderBackgroundSprite { RelativeSizeAxes = Axes.Both },
|
2018-12-20 06:17:33 +00:00
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2019-08-08 08:29:50 +00:00
|
|
|
|
Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0.7f), Color4.Black.Opacity(0.8f)),
|
2018-12-20 06:17:33 +00:00
|
|
|
|
},
|
2019-08-08 04:08:51 +00:00
|
|
|
|
beatmapPanel = new MatchBeatmapPanel
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.CentreRight,
|
|
|
|
|
Origin = Anchor.CentreRight,
|
|
|
|
|
Margin = new MarginPadding { Right = 100 },
|
|
|
|
|
}
|
2018-12-20 06:17:33 +00:00
|
|
|
|
}
|
2018-05-29 04:53:45 +00:00
|
|
|
|
},
|
2019-02-05 10:00:01 +00:00
|
|
|
|
new Box
|
2018-05-29 01:11:01 +00:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
|
RelativeSizeAxes = Axes.X,
|
|
|
|
|
Height = 1,
|
2019-02-05 10:00:01 +00:00
|
|
|
|
Colour = colours.Yellow
|
2018-05-29 01:11:01 +00:00
|
|
|
|
},
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2019-01-25 05:10:59 +00:00
|
|
|
|
Padding = new MarginPadding { Horizontal = SearchableListOverlay.WIDTH_PADDING + OsuScreen.HORIZONTAL_OVERFLOW_PADDING },
|
2018-05-29 01:11:01 +00:00
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2018-12-20 06:17:33 +00:00
|
|
|
|
new FillFlowContainer
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Axes.Both,
|
2018-12-20 08:33:55 +00:00
|
|
|
|
Padding = new MarginPadding { Top = 20 },
|
2018-12-20 06:17:33 +00:00
|
|
|
|
Direction = FillDirection.Vertical,
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
2019-02-05 10:00:01 +00:00
|
|
|
|
new BeatmapTypeInfo(),
|
2018-12-20 06:17:33 +00:00
|
|
|
|
modDisplay = new ModDisplay
|
|
|
|
|
{
|
|
|
|
|
Scale = new Vector2(0.75f),
|
|
|
|
|
DisplayUnrankedText = false
|
|
|
|
|
},
|
|
|
|
|
}
|
|
|
|
|
},
|
2018-05-29 01:11:01 +00:00
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.TopRight,
|
|
|
|
|
Origin = Anchor.TopRight,
|
|
|
|
|
RelativeSizeAxes = Axes.Y,
|
|
|
|
|
Width = 200,
|
2018-12-26 07:11:40 +00:00
|
|
|
|
Padding = new MarginPadding { Vertical = 10 },
|
2019-02-05 10:00:01 +00:00
|
|
|
|
Child = beatmapButton = new BeatmapSelectButton
|
2018-05-29 01:11:01 +00:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2018-12-26 07:11:40 +00:00
|
|
|
|
Height = 1,
|
2018-05-29 01:11:01 +00:00
|
|
|
|
},
|
|
|
|
|
},
|
2019-02-05 10:00:01 +00:00
|
|
|
|
Tabs = new MatchTabControl
|
2018-05-29 01:11:01 +00:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
|
Origin = Anchor.BottomLeft,
|
2018-12-10 09:00:57 +00:00
|
|
|
|
RelativeSizeAxes = Axes.X
|
2018-05-29 01:11:01 +00:00
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
2018-06-01 19:23:11 +00:00
|
|
|
|
|
2019-04-10 08:13:12 +00:00
|
|
|
|
CurrentItem.BindValueChanged(item => modDisplay.Current.Value = item.NewValue?.RequiredMods?.ToArray() ?? Array.Empty<Mod>(), true);
|
2018-12-20 06:17:33 +00:00
|
|
|
|
|
2019-02-05 10:00:01 +00:00
|
|
|
|
beatmapButton.Action = () => RequestBeatmapSelection?.Invoke();
|
2018-05-29 01:11:01 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-08-08 04:08:51 +00:00
|
|
|
|
protected override void LoadComplete()
|
|
|
|
|
{
|
|
|
|
|
base.LoadComplete();
|
|
|
|
|
ShowBeatmapPanel.BindValueChanged(value => beatmapPanel.FadeTo(value.NewValue ? 1 : 0, 200, Easing.OutQuint), true);
|
|
|
|
|
}
|
|
|
|
|
|
2018-12-14 05:20:03 +00:00
|
|
|
|
private class BeatmapSelectButton : HeaderButton
|
2018-05-29 01:11:01 +00:00
|
|
|
|
{
|
2019-02-08 06:44:05 +00:00
|
|
|
|
[Resolved(typeof(Room), nameof(Room.RoomID))]
|
2019-02-05 10:00:01 +00:00
|
|
|
|
private Bindable<int?> roomId { get; set; }
|
2018-12-10 10:03:22 +00:00
|
|
|
|
|
2019-02-05 10:00:01 +00:00
|
|
|
|
public BeatmapSelectButton()
|
2018-05-29 01:11:01 +00:00
|
|
|
|
{
|
2018-12-10 09:50:52 +00:00
|
|
|
|
Text = "Select beatmap";
|
2019-02-05 10:00:01 +00:00
|
|
|
|
}
|
2018-12-10 10:03:22 +00:00
|
|
|
|
|
2019-02-05 10:00:01 +00:00
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load()
|
|
|
|
|
{
|
2019-02-22 11:13:38 +00:00
|
|
|
|
roomId.BindValueChanged(id => this.FadeTo(id.NewValue.HasValue ? 0 : 1), true);
|
2018-12-10 10:03:22 +00:00
|
|
|
|
}
|
2018-05-29 01:11:01 +00:00
|
|
|
|
}
|
2018-12-06 09:31:12 +00:00
|
|
|
|
|
2019-02-05 10:00:01 +00:00
|
|
|
|
private class HeaderBackgroundSprite : MultiplayerBackgroundSprite
|
2018-12-06 09:31:12 +00:00
|
|
|
|
{
|
2019-02-05 10:00:01 +00:00
|
|
|
|
protected override UpdateableBeatmapBackgroundSprite CreateBackgroundSprite() => new BackgroundSprite { RelativeSizeAxes = Axes.Both };
|
|
|
|
|
|
|
|
|
|
private class BackgroundSprite : UpdateableBeatmapBackgroundSprite
|
|
|
|
|
{
|
2019-06-04 02:04:28 +00:00
|
|
|
|
protected override double TransformDuration => 200;
|
2019-02-05 10:00:01 +00:00
|
|
|
|
}
|
2018-12-06 09:31:12 +00:00
|
|
|
|
}
|
2018-05-29 01:11:01 +00:00
|
|
|
|
}
|
|
|
|
|
}
|