diff --git a/osu.Game/Screens/Multi/Screens/Match/AvailabilityPicker.cs b/osu.Game/Screens/Multi/Screens/Match/AvailabilityPicker.cs new file mode 100644 index 0000000000..db79b7811d --- /dev/null +++ b/osu.Game/Screens/Multi/Screens/Match/AvailabilityPicker.cs @@ -0,0 +1,85 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Framework.Extensions; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.UserInterface; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Online.Multiplayer; +using OpenTK; + +namespace osu.Game.Screens.Multi.Screens.Match +{ + public class AvailabilityPicker : TabControl + { + protected override TabItem CreateTabItem(RoomAvailability value) => new AvailabilityPickerItem(value); + protected override Dropdown CreateDropdown() => null; + + public AvailabilityPicker() + { + RelativeSizeAxes = Axes.X; + Height = 35; + + TabContainer.Spacing = new Vector2(10); + + AddItem(RoomAvailability.Public); + AddItem(RoomAvailability.FriendsOnly); + AddItem(RoomAvailability.InviteOnly); + } + + private class AvailabilityPickerItem : TabItem + { + private const float transition_duration = 200; + + private readonly Box selection; + + public AvailabilityPickerItem(RoomAvailability value) : base(value) + { + RelativeSizeAxes = Axes.Y; + Width = 120; + Masking = true; + CornerRadius = 5; + + Children = new Drawable[] + { + new Box + { + RelativeSizeAxes = Axes.Both, + Colour = OsuColour.FromHex(@"3d3943"), + }, + selection = new Box + { + RelativeSizeAxes = Axes.Both, + Alpha = 0, + }, + new OsuSpriteText + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Font = @"Exo2.0-Bold", + Text = value.GetDescription(), + }, + }; + } + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + selection.Colour = colours.GreenLight; + } + + protected override void OnActivated() + { + selection.FadeIn(transition_duration, Easing.OutQuint); + } + + protected override void OnDeactivated() + { + selection.FadeOut(transition_duration, Easing.OutQuint); + } + } + } +} diff --git a/osu.Game/Screens/Multi/Screens/Match/RoomSettingsOverlay.cs b/osu.Game/Screens/Multi/Screens/Match/RoomSettingsOverlay.cs index 3780e43a4c..15bf9f6c0d 100644 --- a/osu.Game/Screens/Multi/Screens/Match/RoomSettingsOverlay.cs +++ b/osu.Game/Screens/Multi/Screens/Match/RoomSettingsOverlay.cs @@ -50,7 +50,10 @@ namespace osu.Game.Screens.Multi.Screens.Match { Child = new SettingsTextBox(), }, - new Section("ROOM VISIBILITY"), + new Section("ROOM VISIBILITY") + { + Child = new AvailabilityPicker(), + }, new Section("GAME TYPE") { Child = new GameTypePicker(),