Merge pull request #7921 from peppy/multiplayer-design-fixes

Improve consistency of buttons in multiplayer
This commit is contained in:
Dan Balasescu 2020-02-20 19:18:07 +09:00 committed by GitHub
commit 0bbc4abb35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 60 additions and 26 deletions

View File

@ -53,7 +53,7 @@ namespace osu.Game.Screens.Multi.Components
{ {
new TriangleButton new TriangleButton
{ {
Text = "create new item", Text = "Add new playlist entry",
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Size = Vector2.One, Size = Vector2.One,
Action = () => CreateNewItem?.Invoke() Action = () => CreateNewItem?.Invoke()

View File

@ -8,7 +8,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer;
using osuTK; using osuTK;
@ -22,7 +21,6 @@ namespace osu.Game.Screens.Multi.Match.Components
public readonly Bindable<PlaylistItem> SelectedItem = new Bindable<PlaylistItem>(); public readonly Bindable<PlaylistItem> SelectedItem = new Bindable<PlaylistItem>();
private readonly Drawable background; private readonly Drawable background;
private readonly OsuButton startButton;
public Footer() public Footer()
{ {
@ -32,7 +30,7 @@ namespace osu.Game.Screens.Multi.Match.Components
InternalChildren = new[] InternalChildren = new[]
{ {
background = new Box { RelativeSizeAxes = Axes.Both }, background = new Box { RelativeSizeAxes = Axes.Both },
startButton = new ReadyButton new ReadyButton
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
@ -47,7 +45,6 @@ namespace osu.Game.Screens.Multi.Match.Components
private void load(OsuColour colours) private void load(OsuColour colours)
{ {
background.Colour = OsuColour.FromHex(@"28242d"); background.Colour = OsuColour.FromHex(@"28242d");
startButton.BackgroundColour = colours.Green;
} }
} }
} }

View File

@ -226,7 +226,7 @@ namespace osu.Game.Screens.Multi.Match.Components
}, },
new Drawable[] new Drawable[]
{ {
new OsuButton new PurpleTriangleButton
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
Height = 40, Height = 40,
@ -447,10 +447,7 @@ namespace osu.Game.Screens.Multi.Match.Components
Menu.MaxHeight = 100; Menu.MaxHeight = 100;
} }
protected override string GenerateItemText(TimeSpan item) protected override string GenerateItemText(TimeSpan item) => item.Humanize();
{
return item.Humanize();
}
} }
} }
} }

View File

@ -0,0 +1,20 @@
// 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.
using osu.Framework.Allocation;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
namespace osu.Game.Screens.Multi.Match.Components
{
public class PurpleTriangleButton : TriangleButton
{
[BackgroundDependencyLoader]
private void load()
{
BackgroundColour = OsuColour.FromHex(@"593790");
Triangles.ColourLight = OsuColour.FromHex(@"7247b6");
Triangles.ColourDark = OsuColour.FromHex(@"593790");
}
}
}

View File

@ -6,12 +6,13 @@ using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer;
namespace osu.Game.Screens.Multi.Match.Components namespace osu.Game.Screens.Multi.Match.Components
{ {
public class ReadyButton : OsuButton public class ReadyButton : TriangleButton
{ {
public readonly Bindable<PlaylistItem> SelectedItem = new Bindable<PlaylistItem>(); public readonly Bindable<PlaylistItem> SelectedItem = new Bindable<PlaylistItem>();
@ -32,12 +33,16 @@ namespace osu.Game.Screens.Multi.Match.Components
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load(OsuColour colours)
{ {
beatmaps.ItemAdded += beatmapAdded; beatmaps.ItemAdded += beatmapAdded;
beatmaps.ItemRemoved += beatmapRemoved; beatmaps.ItemRemoved += beatmapRemoved;
SelectedItem.BindValueChanged(item => updateSelectedItem(item.NewValue), true); SelectedItem.BindValueChanged(item => updateSelectedItem(item.NewValue), true);
BackgroundColour = colours.Green;
Triangles.ColourDark = colours.Green;
Triangles.ColourLight = colours.GreenLight;
} }
private void updateSelectedItem(PlaylistItem item) private void updateSelectedItem(PlaylistItem item)

View File

@ -19,12 +19,12 @@ using osu.Game.Graphics.UserInterface;
using osu.Game.Input; using osu.Game.Input;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer;
using osu.Game.Overlays.BeatmapSet.Buttons;
using osu.Game.Screens.Menu; using osu.Game.Screens.Menu;
using osu.Game.Screens.Multi.Components; using osu.Game.Screens.Multi.Components;
using osu.Game.Screens.Multi.Lounge; using osu.Game.Screens.Multi.Lounge;
using osu.Game.Screens.Multi.Lounge.Components; using osu.Game.Screens.Multi.Lounge.Components;
using osu.Game.Screens.Multi.Match; using osu.Game.Screens.Multi.Match;
using osu.Game.Screens.Multi.Match.Components;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
using osuTK; using osuTK;
@ -129,22 +129,11 @@ namespace osu.Game.Screens.Multi
} }
}, },
new Header(screenStack), new Header(screenStack),
createButton = new HeaderButton createButton = new CreateRoomButton
{ {
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
RelativeSizeAxes = Axes.None, Action = createRoom
Size = new Vector2(150, Header.HEIGHT - 20),
Margin = new MarginPadding
{
Top = 10,
Right = 10 + HORIZONTAL_OVERFLOW_PADDING,
},
Text = "Create room",
Action = () => loungeSubScreen.Open(new Room
{
Name = { Value = $"{api.LocalUser}'s awesome room" }
}),
}, },
roomManager = new RoomManager() roomManager = new RoomManager()
} }
@ -276,6 +265,11 @@ namespace osu.Game.Screens.Multi
logo.Delay(WaveContainer.DISAPPEAR_DURATION / 2).FadeOut(); logo.Delay(WaveContainer.DISAPPEAR_DURATION / 2).FadeOut();
} }
private void createRoom()
{
loungeSubScreen.Open(new Room { Name = { Value = $"{api.LocalUser}'s awesome room" } });
}
private void beginHandlingTrack() private void beginHandlingTrack()
{ {
Beatmap.BindValueChanged(updateTrack, true); Beatmap.BindValueChanged(updateTrack, true);
@ -381,5 +375,26 @@ namespace osu.Game.Screens.Multi
protected override double TransformDuration => 200; protected override double TransformDuration => 200;
} }
} }
public class CreateRoomButton : PurpleTriangleButton
{
public CreateRoomButton()
{
Size = new Vector2(150, Header.HEIGHT - 20);
Margin = new MarginPadding
{
Top = 10,
Right = 10 + HORIZONTAL_OVERFLOW_PADDING,
};
}
[BackgroundDependencyLoader]
private void load()
{
Triangles.TriangleScale = 1.5f;
Text = "Create room";
}
}
} }
} }