Merge pull request #193 from peppy/general-fixes

General things
This commit is contained in:
Thomas Müller 2016-11-24 20:28:41 +01:00 committed by GitHub
commit 78be1dd3af
10 changed files with 80 additions and 60 deletions

@ -1 +1 @@
Subproject commit 71bbc980602829cf7eb0db537ebaa2f9668acda5 Subproject commit 09c18c415d280448c44cb73f2c4e60e0092b974c

View File

@ -37,15 +37,6 @@ namespace osu.Game.Modes.Osu.UI
AddInternal(new Drawable[] AddInternal(new Drawable[]
{ {
new Box
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Colour = Color4.Black,
Depth = float.MinValue,
Alpha = 0.5f,
},
approachCircles = new Container approachCircles = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,

View File

@ -0,0 +1,24 @@
//Copyright (c) 2007-2016 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.Graphics.Sprites;
namespace osu.Game.Beatmaps.Drawables
{
class BeatmapBackgroundSprite : Sprite
{
private readonly WorkingBeatmap working;
public BeatmapBackgroundSprite(WorkingBeatmap working)
{
this.working = working;
}
[BackgroundDependencyLoader]
private void load(OsuGameBase game)
{
Texture = working.Background;
}
}
}

View File

@ -156,38 +156,17 @@ namespace osu.Game.Beatmaps.Drawables
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuGameBase game) private void load(OsuGameBase game)
{ {
new BeatmapBackground(working) new BeatmapBackgroundSprite(working)
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
FillMode = FillMode.Fill,
}.Preload(game, (bg) => }.Preload(game, (bg) =>
{ {
Add(bg); Add(bg);
ForceRedraw(); ForceRedraw();
}); });
} }
class BeatmapBackground : Sprite
{
private readonly WorkingBeatmap working;
public BeatmapBackground(WorkingBeatmap working)
{
this.working = working;
}
[BackgroundDependencyLoader]
private void load(OsuGameBase game)
{
Texture = working.Background;
}
protected override void LoadComplete()
{
base.LoadComplete();
Scale = new Vector2(1366 / (Texture?.Width ?? 1) * 0.6f);
}
}
} }
} }
} }

View File

@ -14,6 +14,8 @@ namespace osu.Game.Modes.UI
public virtual void Add(DrawableHitObject h) => HitObjects.Add(h); public virtual void Add(DrawableHitObject h) => HitObjects.Add(h);
public override bool Contains(Vector2 screenSpacePos) => true;
public Playfield() public Playfield()
{ {
AddInternal(HitObjects = new HitObjectContainer AddInternal(HitObjects = new HitObjectContainer
@ -25,6 +27,8 @@ namespace osu.Game.Modes.UI
public class HitObjectContainer : Container<DrawableHitObject> public class HitObjectContainer : Container<DrawableHitObject>
{ {
protected override Vector2 DrawScale => new Vector2(DrawSize.X / 512); protected override Vector2 DrawScale => new Vector2(DrawSize.X / 512);
public override bool Contains(Vector2 screenSpacePos) => true;
} }
} }
} }

View File

@ -1,6 +1,7 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>. //Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio; using osu.Framework.Audio;
using osu.Framework.Audio.Track; using osu.Framework.Audio.Track;
@ -125,26 +126,28 @@ namespace osu.Game.Screens.Play
{ {
} }
bool leftViaKeyboard;
bool rightViaKeyboard;
protected override void TransformState(InputState state) protected override void TransformState(InputState state)
{ {
base.TransformState(state); base.TransformState(state);
MouseState mouse = (MouseState)state.Mouse; MouseState mouse = (MouseState)state.Mouse;
foreach (Key k in state.Keyboard.Keys) if (state.Keyboard != null)
{ {
switch (k) leftViaKeyboard = state.Keyboard.Keys.Contains(Key.Z);
{ rightViaKeyboard = state.Keyboard.Keys.Contains(Key.X);
case Key.Z: }
mouse.ButtonStates.Find(s => s.Button == MouseButton.Left).State = true;
break; if (state.Mouse != null)
case Key.X: {
mouse.ButtonStates.Find(s => s.Button == MouseButton.Right).State = true; if (leftViaKeyboard) mouse.ButtonStates.Find(s => s.Button == MouseButton.Left).State = true;
break; if (rightViaKeyboard) mouse.ButtonStates.Find(s => s.Button == MouseButton.Right).State = true;
}
} }
} }
} }
} }
} }

View File

@ -1,4 +1,6 @@
using System; using System;
using osu.Framework;
using osu.Framework.Allocation;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -8,31 +10,37 @@ using osu.Framework.Graphics.Sprites;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Database; using osu.Game.Database;
using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Colour;
using osu.Game.Beatmaps.Drawables;
namespace osu.Game.Screens.Select namespace osu.Game.Screens.Select
{ {
class BeatmapInfoOverlay : Container class BeatmapInfoWedge : Container
{ {
private Container beatmapInfoContainer; private Container beatmapInfoContainer;
private BaseGame game;
[BackgroundDependencyLoader]
private void load(BaseGame game)
{
this.game = game;
}
public void UpdateBeatmap(WorkingBeatmap beatmap) public void UpdateBeatmap(WorkingBeatmap beatmap)
{ {
if (beatmap == null) if (beatmap == null)
return; return;
float newDepth = 0; var lastContainer = beatmapInfoContainer;
if (beatmapInfoContainer != null)
{ float newDepth = lastContainer?.Depth - 1 ?? 0;
newDepth = beatmapInfoContainer.Depth - 1;
beatmapInfoContainer.FadeOut(250);
beatmapInfoContainer.Expire();
}
FadeIn(250); FadeIn(250);
BeatmapSetInfo beatmapSetInfo = beatmap.BeatmapSetInfo; BeatmapSetInfo beatmapSetInfo = beatmap.BeatmapSetInfo;
BeatmapInfo beatmapInfo = beatmap.BeatmapInfo; BeatmapInfo beatmapInfo = beatmap.BeatmapInfo;
Add(beatmapInfoContainer = new BufferedContainer
(beatmapInfoContainer = new BufferedContainer
{ {
Depth = newDepth, Depth = newDepth,
PixelSnapping = true, PixelSnapping = true,
@ -51,18 +59,17 @@ namespace osu.Game.Screens.Select
}, },
// We use a container, such that we can set the colour gradient to go across the // We use a container, such that we can set the colour gradient to go across the
// vertices of the masked container instead of the vertices of the (larger) sprite. // vertices of the masked container instead of the vertices of the (larger) sprite.
beatmap.Background == null ? new Container() : new Container new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
ColourInfo = ColourInfo.GradientVertical(Color4.White, new Color4(1f, 1f, 1f, 0.3f)), ColourInfo = ColourInfo.GradientVertical(Color4.White, new Color4(1f, 1f, 1f, 0.3f)),
Children = new [] Children = new []
{ {
// Zoomed-in and cropped beatmap background // Zoomed-in and cropped beatmap background
new Sprite new BeatmapBackgroundSprite(beatmap)
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Texture = beatmap.Background,
FillMode = FillMode.Fill, FillMode = FillMode.Fill,
}, },
}, },
@ -117,6 +124,12 @@ namespace osu.Game.Screens.Select
} }
} }
} }
}).Preload(game, delegate(Drawable d)
{
lastContainer?.FadeOut(250);
lastContainer?.Expire();
Add(d);
}); });
} }
} }

View File

@ -80,6 +80,8 @@ namespace osu.Game.Screens.Select
if (panel == SelectedPanel) if (panel == SelectedPanel)
selectedY = currentY + panel.DrawHeight / 2 - DrawHeight / 2; selectedY = currentY + panel.DrawHeight / 2 - DrawHeight / 2;
panel.MoveToX(-50, 500, EasingTypes.OutExpo);
movePanel(panel, true, ref currentY); movePanel(panel, true, ref currentY);
} }
} }
@ -88,7 +90,10 @@ namespace osu.Game.Screens.Select
group.Header.MoveToX(0, 500, EasingTypes.OutExpo); group.Header.MoveToX(0, 500, EasingTypes.OutExpo);
foreach (BeatmapPanel panel in group.BeatmapPanels) foreach (BeatmapPanel panel in group.BeatmapPanels)
{
panel.MoveToX(0, 500, EasingTypes.OutExpo);
movePanel(panel, false, ref currentY); movePanel(panel, false, ref currentY);
}
} }
} }

View File

@ -40,7 +40,7 @@ namespace osu.Game.Screens.Select
private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 225); private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 225);
private static readonly Vector2 wedged_container_shear = new Vector2(0.15f, 0); private static readonly Vector2 wedged_container_shear = new Vector2(0.15f, 0);
private static readonly Vector2 wedged_container_start_position = new Vector2(0, 50); private static readonly Vector2 wedged_container_start_position = new Vector2(0, 50);
private BeatmapInfoOverlay wedgedBeatmapInfoOverlay; private BeatmapInfoWedge beatmapInfoWedge;
private static readonly Vector2 BACKGROUND_BLUR = new Vector2(20); private static readonly Vector2 BACKGROUND_BLUR = new Vector2(20);
private CancellationTokenSource initialAddSetsTask; private CancellationTokenSource initialAddSetsTask;
@ -102,7 +102,7 @@ namespace osu.Game.Screens.Select
Anchor = Anchor.CentreRight, Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight, Origin = Anchor.CentreRight,
}, },
wedgedBeatmapInfoOverlay = new BeatmapInfoOverlay beatmapInfoWedge = new BeatmapInfoWedge
{ {
Alpha = 0, Alpha = 0,
Position = wedged_container_start_position, Position = wedged_container_start_position,
@ -239,7 +239,7 @@ namespace osu.Game.Screens.Select
(Background as BackgroundModeBeatmap)?.BlurTo(BACKGROUND_BLUR, 1000); (Background as BackgroundModeBeatmap)?.BlurTo(BACKGROUND_BLUR, 1000);
} }
wedgedBeatmapInfoOverlay.UpdateBeatmap(beatmap); beatmapInfoWedge.UpdateBeatmap(beatmap);
} }
/// <summary> /// <summary>

View File

@ -63,6 +63,7 @@
</Reference> </Reference>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Beatmaps\Drawables\BeatmapBackgroundSprite.cs" />
<Compile Include="Modes\HitJudgementResolver.cs" /> <Compile Include="Modes\HitJudgementResolver.cs" />
<Compile Include="Modes\Objects\HitObjectParser.cs" /> <Compile Include="Modes\Objects\HitObjectParser.cs" />
<Compile Include="Overlays\DragBar.cs" /> <Compile Include="Overlays\DragBar.cs" />
@ -159,7 +160,7 @@
<Compile Include="Overlays\ToolbarModeButton.cs" /> <Compile Include="Overlays\ToolbarModeButton.cs" />
<Compile Include="Overlays\ToolbarModeSelector.cs" /> <Compile Include="Overlays\ToolbarModeSelector.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Screens\Select\BeatmapInfoOverlay.cs" /> <Compile Include="Screens\Select\BeatmapInfoWedge.cs" />
<Compile Include="Users\User.cs" /> <Compile Include="Users\User.cs" />
<Compile Include="Graphics\UserInterface\Volume\VolumeControl.cs" /> <Compile Include="Graphics\UserInterface\Volume\VolumeControl.cs" />
<Compile Include="Database\BeatmapDatabase.cs" /> <Compile Include="Database\BeatmapDatabase.cs" />