Handle toolbar offsets better.

This commit is contained in:
Dean Herbert 2017-02-08 19:32:55 +09:00
parent 3cee23fc00
commit 2e119cd74f
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
6 changed files with 56 additions and 45 deletions

View File

@ -23,6 +23,7 @@
using osu.Game.Screens.Menu;
using OpenTK;
using System.Linq;
using osu.Framework.Graphics.Primitives;
namespace osu.Game
{
@ -226,6 +227,14 @@ protected override bool OnExiting()
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;

View File

@ -8,12 +8,9 @@
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
{
@ -135,8 +132,8 @@ protected override void PopIn()
protected override void PopOut()
{
MoveToY(-DrawSize.Y, transition_time, EasingTypes.InQuint);
FadeOut(transition_time, EasingTypes.InQuint);
MoveToY(-DrawSize.Y, transition_time, EasingTypes.OutQuint);
FadeOut(transition_time);
}
class PassThroughFlowContainer : FlowContainer

View File

@ -24,8 +24,6 @@ public abstract class OsuGameMode : GameMode
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;

View File

@ -11,15 +11,12 @@
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;
@ -45,7 +42,6 @@ public class PlaySongSelect : OsuGameMode
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 @@ public class PlaySongSelect : OsuGameMode
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,12 +85,12 @@ private void load(BeatmapDatabase beatmaps, AudioManager audio, BaseGame game,
OsuGame osuGame, OsuColour colours)
{
const float carousel_width = 640;
const float bottom_tool_height = 50;
beatmapGroups = new List<BeatmapGroup>();
Children = new Drawable[]
{
new ParallaxContainer
{
Masking = true,
ParallaxAmount = 0.005f,
RelativeSizeAxes = Axes.Both,
Children = new []
@ -143,7 +111,6 @@ private void load(BeatmapDatabase beatmaps, AudioManager audio, BaseGame game,
},
filter = new FilterControl
{
Position = wedged_container_start_position,
RelativeSizeAxes = Axes.X,
FilterChanged = filterChanged,
Exit = Exit,
@ -151,7 +118,6 @@ private void load(BeatmapDatabase beatmaps, AudioManager audio, BaseGame game,
beatmapInfoWedge = new BeatmapInfoWedge
{
Alpha = 0,
Position = wedged_container_start_position,
Size = wedged_container_size,
RelativeSizeAxes = Axes.X,
Margin = new MarginPadding { Top = 20, Right = 20, },
@ -236,8 +202,8 @@ protected override void OnEntering(GameMode last)
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 +235,7 @@ protected override void OnSuspending(GameMode next)
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);

View 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),
},
};
}
}
}

View File

@ -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" />