mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09:00
Add AvailabilityPicker.
This commit is contained in:
85
osu.Game/Screens/Multi/Screens/Match/AvailabilityPicker.cs
Normal file
85
osu.Game/Screens/Multi/Screens/Match/AvailabilityPicker.cs
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// 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<RoomAvailability>
|
||||||
|
{
|
||||||
|
protected override TabItem<RoomAvailability> CreateTabItem(RoomAvailability value) => new AvailabilityPickerItem(value);
|
||||||
|
protected override Dropdown<RoomAvailability> 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<RoomAvailability>
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -50,7 +50,10 @@ namespace osu.Game.Screens.Multi.Screens.Match
|
|||||||
{
|
{
|
||||||
Child = new SettingsTextBox(),
|
Child = new SettingsTextBox(),
|
||||||
},
|
},
|
||||||
new Section("ROOM VISIBILITY"),
|
new Section("ROOM VISIBILITY")
|
||||||
|
{
|
||||||
|
Child = new AvailabilityPicker(),
|
||||||
|
},
|
||||||
new Section("GAME TYPE")
|
new Section("GAME TYPE")
|
||||||
{
|
{
|
||||||
Child = new GameTypePicker(),
|
Child = new GameTypePicker(),
|
||||||
|
Reference in New Issue
Block a user