mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 23:12:55 +08:00
Merge pull request #331 from peppy/toolbar-toggle
Improve toolbar and song select behaviour.
This commit is contained in:
commit
ee41c4d657
@ -23,6 +23,7 @@ using osu.Game.Screens;
|
||||
using osu.Game.Screens.Menu;
|
||||
using OpenTK;
|
||||
using System.Linq;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
|
||||
namespace osu.Game
|
||||
{
|
||||
@ -168,6 +169,9 @@ namespace osu.Game
|
||||
{
|
||||
switch (args.Key)
|
||||
{
|
||||
case Key.T:
|
||||
Toolbar.ToggleVisibility();
|
||||
return true;
|
||||
case Key.O:
|
||||
options.ToggleVisibility();
|
||||
return true;
|
||||
@ -223,6 +227,14 @@ namespace osu.Game
|
||||
return base.OnExiting();
|
||||
}
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
{
|
||||
base.UpdateAfterChildren();
|
||||
|
||||
if (modeStack.ChildGameMode != null)
|
||||
modeStack.ChildGameMode.Padding = new MarginPadding { Top = Toolbar.Position.Y + Toolbar.DrawHeight };
|
||||
}
|
||||
|
||||
private void modeAdded(GameMode newMode)
|
||||
{
|
||||
newMode.ModePushed += modeAdded;
|
||||
|
@ -11,13 +11,14 @@ using osu.Framework.Graphics.Transformations;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Overlays.Toolbar;
|
||||
|
||||
namespace osu.Game.Overlays.Options
|
||||
{
|
||||
public class Sidebar : Container
|
||||
{
|
||||
private FlowContainer content;
|
||||
internal const int DEFAULT_WIDTH = 60;
|
||||
internal const float DEFAULT_WIDTH = ToolbarButton.WIDTH;
|
||||
internal const int EXPANDED_WIDTH = 200;
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
|
@ -8,25 +8,23 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Modes;
|
||||
using osu.Game.Online.API;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
public class Toolbar : OverlayContainer
|
||||
{
|
||||
public const float HEIGHT = 50;
|
||||
public const float HEIGHT = 40;
|
||||
|
||||
public Action OnHome;
|
||||
public Action<PlayMode> OnPlayModeChange;
|
||||
|
||||
private ToolbarModeSelector modeSelector;
|
||||
private ToolbarUserArea userArea;
|
||||
|
||||
private const int transition_time = 250;
|
||||
private const int transition_time = 500;
|
||||
|
||||
private const float alpha_hovering = 0.8f;
|
||||
private const float alpha_normal = 0.6f;
|
||||
@ -70,7 +68,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
Icon = FontAwesome.fa_search
|
||||
},
|
||||
new ToolbarUserArea(),
|
||||
userArea = new ToolbarUserArea(),
|
||||
new ToolbarButton
|
||||
{
|
||||
Icon = FontAwesome.fa_bars
|
||||
@ -130,13 +128,15 @@ namespace osu.Game.Overlays.Toolbar
|
||||
protected override void PopIn()
|
||||
{
|
||||
MoveToY(0, transition_time, EasingTypes.OutQuint);
|
||||
FadeIn(transition_time, EasingTypes.OutQuint);
|
||||
FadeIn(transition_time / 2, EasingTypes.OutQuint);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
MoveToY(-DrawSize.Y, transition_time, EasingTypes.InQuint);
|
||||
FadeOut(transition_time, EasingTypes.InQuint);
|
||||
userArea?.LoginOverlay.Hide();
|
||||
|
||||
MoveToY(-DrawSize.Y, transition_time, EasingTypes.OutQuint);
|
||||
FadeOut(transition_time);
|
||||
}
|
||||
|
||||
class PassThroughFlowContainer : FlowContainer
|
||||
|
@ -21,6 +21,8 @@ namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
public class ToolbarButton : Container
|
||||
{
|
||||
public const float WIDTH = Toolbar.HEIGHT * 1.4f;
|
||||
|
||||
public FontAwesome Icon
|
||||
{
|
||||
get { return DrawableIcon.Icon; }
|
||||
@ -66,6 +68,9 @@ namespace osu.Game.Overlays.Toolbar
|
||||
|
||||
public ToolbarButton()
|
||||
{
|
||||
Width = WIDTH;
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
HoverBackground = new Box
|
||||
@ -80,7 +85,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
Direction = FlowDirection.HorizontalOnly,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Padding = new MarginPadding { Left = 20, Right = 20 },
|
||||
Padding = new MarginPadding { Left = Toolbar.HEIGHT / 2, Right = Toolbar.HEIGHT / 2 },
|
||||
Spacing = new Vector2(5),
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
AutoSizeAxes = Axes.X,
|
||||
@ -121,9 +126,6 @@ namespace osu.Game.Overlays.Toolbar
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
AutoSizeAxes = Axes.X;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -10,7 +10,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
class ToolbarUserArea : Container
|
||||
{
|
||||
private LoginOverlay loginOverlay;
|
||||
public LoginOverlay LoginOverlay;
|
||||
private ToolbarUserButton button;
|
||||
|
||||
public override RectangleF BoundingBox => button.BoundingBox;
|
||||
@ -25,9 +25,9 @@ namespace osu.Game.Overlays.Toolbar
|
||||
Children = new Drawable[] {
|
||||
button = new ToolbarUserButton
|
||||
{
|
||||
Action = toggle,
|
||||
Action = () => LoginOverlay.ToggleVisibility(),
|
||||
},
|
||||
loginOverlay = new LoginOverlay
|
||||
LoginOverlay = new LoginOverlay
|
||||
{
|
||||
BypassAutoSizeAxes = Axes.Both,
|
||||
Position = new Vector2(0, 1),
|
||||
@ -37,10 +37,5 @@ namespace osu.Game.Overlays.Toolbar
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private void toggle()
|
||||
{
|
||||
loginOverlay.ToggleVisibility();
|
||||
}
|
||||
}
|
||||
}
|
@ -20,6 +20,8 @@ namespace osu.Game.Overlays.Toolbar
|
||||
|
||||
public ToolbarUserButton()
|
||||
{
|
||||
AutoSizeAxes = Axes.X;
|
||||
|
||||
DrawableText.Font = @"Exo2.0-MediumItalic";
|
||||
|
||||
Add(new OpaqueBackground { Depth = 1 });
|
||||
|
@ -14,6 +14,7 @@ using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Overlays.Toolbar;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
@ -33,6 +34,8 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
private AudioSample sampleOsuClick;
|
||||
|
||||
private Toolbar toolbar;
|
||||
|
||||
private FlowContainerWithOrigin buttonFlow;
|
||||
|
||||
//todo: make these non-internal somehow.
|
||||
@ -117,9 +120,10 @@ namespace osu.Game.Screens.Menu
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
private void load(AudioManager audio, OsuGame game)
|
||||
{
|
||||
sampleOsuClick = audio.Sample.Get(@"Menu/menuhit");
|
||||
toolbar = game.Toolbar;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@ -215,6 +219,8 @@ namespace osu.Game.Screens.Menu
|
||||
switch (state)
|
||||
{
|
||||
case MenuState.Initial:
|
||||
toolbar?.Hide();
|
||||
|
||||
buttonAreaBackground.ScaleTo(Vector2.One, 500, EasingTypes.Out);
|
||||
buttonArea.FadeOut(300);
|
||||
|
||||
@ -239,9 +245,10 @@ namespace osu.Game.Screens.Menu
|
||||
buttonArea.FadeIn(300);
|
||||
|
||||
if (lastState == MenuState.Initial)
|
||||
//todo: this propagates to invisible children and causes delays later down the track (on first MenuState.Play)
|
||||
buttonArea.Delay(150, true);
|
||||
|
||||
Scheduler.AddDelayed(() => toolbar?.Show(), 150);
|
||||
|
||||
foreach (Button b in buttonsTopLevel)
|
||||
b.State = ButtonState.Expanded;
|
||||
|
||||
|
@ -1,20 +1,16 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.GameModes;
|
||||
using osu.Framework.GameModes.Testing;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Modes;
|
||||
using osu.Game.Screens.Backgrounds;
|
||||
using osu.Game.Screens.Charts;
|
||||
using osu.Game.Screens.Direct;
|
||||
using osu.Game.Screens.Edit;
|
||||
using osu.Game.Screens.Multiplayer;
|
||||
using osu.Game.Screens.Play;
|
||||
using OpenTK;
|
||||
using osu.Game.Screens.Select;
|
||||
|
||||
@ -25,7 +21,7 @@ namespace osu.Game.Screens.Menu
|
||||
private ButtonSystem buttons;
|
||||
public override string Name => @"Main Menu";
|
||||
|
||||
internal override bool ShowOverlays => true;
|
||||
internal override bool ShowOverlays => buttons.State != MenuState.Initial;
|
||||
|
||||
private BackgroundMode background;
|
||||
|
||||
@ -42,7 +38,7 @@ namespace osu.Game.Screens.Menu
|
||||
ParallaxAmount = 0.01f,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
buttons = new ButtonSystem()
|
||||
buttons = new ButtonSystem
|
||||
{
|
||||
OnChart = delegate { Push(new ChartListing()); },
|
||||
OnDirect = delegate { Push(new OnlineListing()); },
|
||||
@ -63,11 +59,11 @@ namespace osu.Game.Screens.Menu
|
||||
background.Preload(game);
|
||||
|
||||
buttons.OnSettings = game.ToggleOptions;
|
||||
|
||||
}
|
||||
|
||||
protected override void OnEntering(GameMode last)
|
||||
{
|
||||
|
||||
base.OnEntering(last);
|
||||
buttons.FadeInFromZero(500);
|
||||
}
|
||||
|
@ -24,8 +24,6 @@ namespace osu.Game.Screens
|
||||
|
||||
protected new OsuGameBase Game => base.Game as OsuGameBase;
|
||||
|
||||
protected float ToolbarPadding => ShowOverlays ? (Game as OsuGame)?.Toolbar.DrawHeight ?? 0 : 0;
|
||||
|
||||
private bool boundToBeatmap;
|
||||
private Bindable<WorkingBeatmap> beatmap;
|
||||
|
||||
|
@ -27,14 +27,12 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
public FilterControl()
|
||||
{
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
Colour = Color4.Black,
|
||||
Alpha = 0.6f,
|
||||
Alpha = 0.8f,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new FlowContainer
|
||||
|
@ -11,15 +11,12 @@ using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.GameModes;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Modes;
|
||||
using osu.Game.Screens.Backgrounds;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Audio.Sample;
|
||||
@ -29,8 +26,8 @@ using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Framework.Input;
|
||||
using OpenTK.Input;
|
||||
using osu.Game.Graphics;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Threading;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
@ -45,7 +42,6 @@ namespace osu.Game.Screens.Select
|
||||
private TrackManager trackManager;
|
||||
|
||||
private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 225);
|
||||
private static readonly Vector2 wedged_container_start_position = new Vector2(0, 50);
|
||||
private BeatmapInfoWedge beatmapInfoWedge;
|
||||
|
||||
private static readonly Vector2 background_blur = new Vector2(20);
|
||||
@ -58,34 +54,6 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private Footer footer;
|
||||
|
||||
class WedgeBackground : Container
|
||||
{
|
||||
public WedgeBackground()
|
||||
{
|
||||
Children = new[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new Vector2(1, 0.5f),
|
||||
Colour = Color4.Black.Opacity(0.5f),
|
||||
Shear = new Vector2(0.15f, 0),
|
||||
EdgeSmoothness = new Vector2(2, 0),
|
||||
},
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
RelativePositionAxes = Axes.Y,
|
||||
Size = new Vector2(1, -0.5f),
|
||||
Position = new Vector2(0, 1),
|
||||
Colour = Color4.Black.Opacity(0.5f),
|
||||
Shear = new Vector2(-0.15f, 0),
|
||||
EdgeSmoothness = new Vector2(2, 0),
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Player player;
|
||||
FilterControl filter;
|
||||
|
||||
@ -117,20 +85,25 @@ namespace osu.Game.Screens.Select
|
||||
OsuGame osuGame, OsuColour colours)
|
||||
{
|
||||
const float carousel_width = 640;
|
||||
const float bottom_tool_height = 50;
|
||||
const float filter_height = 100;
|
||||
|
||||
beatmapGroups = new List<BeatmapGroup>();
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new ParallaxContainer
|
||||
{
|
||||
Padding = new MarginPadding { Top = filter_height },
|
||||
ParallaxAmount = 0.005f,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new []
|
||||
Children = new[]
|
||||
{
|
||||
new WedgeBackground
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding { Right = carousel_width * 0.76f },
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
Right = carousel_width * 0.76f
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
@ -143,18 +116,21 @@ namespace osu.Game.Screens.Select
|
||||
},
|
||||
filter = new FilterControl
|
||||
{
|
||||
Position = wedged_container_start_position,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = filter_height,
|
||||
FilterChanged = filterChanged,
|
||||
Exit = Exit,
|
||||
},
|
||||
beatmapInfoWedge = new BeatmapInfoWedge
|
||||
{
|
||||
Alpha = 0,
|
||||
Position = wedged_container_start_position,
|
||||
Size = wedged_container_size,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Margin = new MarginPadding { Top = 20, Right = 20, },
|
||||
Margin = new MarginPadding
|
||||
{
|
||||
Top = 20,
|
||||
Right = 20,
|
||||
},
|
||||
},
|
||||
footer = new Footer()
|
||||
{
|
||||
@ -236,8 +212,8 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
Content.FadeInFromZero(250);
|
||||
|
||||
beatmapInfoWedge.MoveToX(wedged_container_start_position.X - 50);
|
||||
beatmapInfoWedge.MoveToX(wedged_container_start_position.X, 800, EasingTypes.OutQuint);
|
||||
beatmapInfoWedge.MoveToX(-50);
|
||||
beatmapInfoWedge.MoveToX(0, 800, EasingTypes.OutQuint);
|
||||
|
||||
filter.Activate();
|
||||
}
|
||||
@ -269,7 +245,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
protected override bool OnExiting(GameMode next)
|
||||
{
|
||||
beatmapInfoWedge.MoveTo(wedged_container_start_position + new Vector2(-100, 50), 800, EasingTypes.InQuint);
|
||||
beatmapInfoWedge.MoveToX(-100, 800, EasingTypes.InQuint);
|
||||
beatmapInfoWedge.RotateTo(10, 800, EasingTypes.InQuint);
|
||||
|
||||
Content.FadeOut(100);
|
||||
|
40
osu.Game/Screens/Select/WedgeBackground.cs
Normal file
40
osu.Game/Screens/Select/WedgeBackground.cs
Normal file
@ -0,0 +1,40 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
public class WedgeBackground : Container
|
||||
{
|
||||
public WedgeBackground()
|
||||
{
|
||||
Children = new[]
|
||||
{
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Size = new Vector2(1, 0.5f),
|
||||
Colour = Color4.Black.Opacity(0.5f),
|
||||
Shear = new Vector2(0.15f, 0),
|
||||
EdgeSmoothness = new Vector2(2, 0),
|
||||
},
|
||||
new Box
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
RelativePositionAxes = Axes.Y,
|
||||
Size = new Vector2(1, -0.5f),
|
||||
Position = new Vector2(0, 1),
|
||||
Colour = Color4.Black.Opacity(0.5f),
|
||||
Shear = new Vector2(-0.15f, 0),
|
||||
EdgeSmoothness = new Vector2(2, 0),
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -188,6 +188,7 @@
|
||||
<Compile Include="Overlays\Toolbar\ToolbarModeSelector.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Screens\Select\BeatmapInfoWedge.cs" />
|
||||
<Compile Include="Screens\Select\WedgeBackground.cs" />
|
||||
<Compile Include="Users\User.cs" />
|
||||
<Compile Include="Graphics\UserInterface\Volume\VolumeControl.cs" />
|
||||
<Compile Include="Database\BeatmapDatabase.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user