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 @@ public MatchBeatmapDetailArea()
{
new TriangleButton
{
Text = "create new item",
Text = "Add new playlist entry",
RelativeSizeAxes = Axes.Both,
Size = Vector2.One,
Action = () => CreateNewItem?.Invoke()

View File

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

View File

@ -226,7 +226,7 @@ private void load(OsuColour colours)
},
new Drawable[]
{
new OsuButton
new PurpleTriangleButton
{
RelativeSizeAxes = Axes.X,
Height = 40,
@ -447,10 +447,7 @@ public DurationDropdown()
Menu.MaxHeight = 100;
}
protected override string GenerateItemText(TimeSpan item)
{
return item.Humanize();
}
protected override string GenerateItemText(TimeSpan item) => 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 osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.Multiplayer;
namespace osu.Game.Screens.Multi.Match.Components
{
public class ReadyButton : OsuButton
public class ReadyButton : TriangleButton
{
public readonly Bindable<PlaylistItem> SelectedItem = new Bindable<PlaylistItem>();
@ -32,12 +33,16 @@ public ReadyButton()
}
[BackgroundDependencyLoader]
private void load()
private void load(OsuColour colours)
{
beatmaps.ItemAdded += beatmapAdded;
beatmaps.ItemRemoved += beatmapRemoved;
SelectedItem.BindValueChanged(item => updateSelectedItem(item.NewValue), true);
BackgroundColour = colours.Green;
Triangles.ColourDark = colours.Green;
Triangles.ColourLight = colours.GreenLight;
}
private void updateSelectedItem(PlaylistItem item)

View File

@ -19,12 +19,12 @@
using osu.Game.Input;
using osu.Game.Online.API;
using osu.Game.Online.Multiplayer;
using osu.Game.Overlays.BeatmapSet.Buttons;
using osu.Game.Screens.Menu;
using osu.Game.Screens.Multi.Components;
using osu.Game.Screens.Multi.Lounge;
using osu.Game.Screens.Multi.Lounge.Components;
using osu.Game.Screens.Multi.Match;
using osu.Game.Screens.Multi.Match.Components;
using osu.Game.Screens.Play;
using osuTK;
@ -129,22 +129,11 @@ public Multiplayer()
}
},
new Header(screenStack),
createButton = new HeaderButton
createButton = new CreateRoomButton
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
RelativeSizeAxes = Axes.None,
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" }
}),
Action = createRoom
},
roomManager = new RoomManager()
}
@ -276,6 +265,11 @@ protected override void LogoExiting(OsuLogo logo)
logo.Delay(WaveContainer.DISAPPEAR_DURATION / 2).FadeOut();
}
private void createRoom()
{
loungeSubScreen.Open(new Room { Name = { Value = $"{api.LocalUser}'s awesome room" } });
}
private void beginHandlingTrack()
{
Beatmap.BindValueChanged(updateTrack, true);
@ -381,5 +375,26 @@ private class BackgroundSprite : UpdateableBeatmapBackgroundSprite
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";
}
}
}
}