Merge pull request #186 from peppy/general-fixes

General UI improvements.
This commit is contained in:
Thomas Müller 2016-11-23 08:16:01 +01:00 committed by GitHub
commit bd4ba32ebc
19 changed files with 131 additions and 131 deletions

@ -1 +1 @@
Subproject commit 7022964256829c7fab596ce34ad70d09f6433bcf
Subproject commit 34193c7f15aba3520f73f8ca36c0fbc9cd3951d4

View File

@ -4,18 +4,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using osu.Framework;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Game.Database;
using OpenTK;
using osu.Framework.Allocation;
namespace osu.Game.Beatmaps.Drawable
namespace osu.Game.Beatmaps.Drawables
{
class BeatmapGroup : IStateful<BeatmapGroupState>
{

View File

@ -3,6 +3,7 @@
using System;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
@ -11,9 +12,8 @@ using osu.Game.Graphics;
using osu.Game.Graphics.UserInterface;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics.Colour;
namespace osu.Game.Beatmaps.Drawable
namespace osu.Game.Beatmaps.Drawables
{
class BeatmapPanel : Panel
{

View File

@ -2,21 +2,19 @@
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
using osu.Game.Database;
using osu.Game.Configuration;
using osu.Game.Graphics;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Game.Configuration;
using osu.Framework.Graphics.Colour;
using osu.Framework;
namespace osu.Game.Beatmaps.Drawable
namespace osu.Game.Beatmaps.Drawables
{
class BeatmapSetHeader : Panel
{
@ -31,7 +29,7 @@ namespace osu.Game.Beatmaps.Drawable
this.beatmap = beatmap;
Hidden = false;
Children = new Framework.Graphics.Drawable[]
Children = new Drawable[]
{
new PanelBackground(beatmap)
{
@ -158,7 +156,6 @@ namespace osu.Game.Beatmaps.Drawable
[BackgroundDependencyLoader]
private void load(OsuGameBase game)
{
//todo: masking check
new BeatmapBackground(working)
{
Anchor = Anchor.Centre,

View File

@ -1,13 +1,13 @@
//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.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Beatmaps.Drawable
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Beatmaps.Drawables
{
class DifficultyIcon : Container
{

View File

@ -8,7 +8,7 @@ using osu.Framework.Input;
using OpenTK;
using OpenTK.Graphics;
namespace osu.Game.Beatmaps.Drawable
namespace osu.Game.Beatmaps.Drawables
{
class Panel : Container, IStateful<PanelSelectedState>
{
@ -17,9 +17,9 @@ namespace osu.Game.Beatmaps.Drawable
public bool Hidden = true;
private Container nestedContainer;
protected override Container<Framework.Graphics.Drawable> Content => nestedContainer;
protected override Container<Drawable> Content => nestedContainer;
public Panel()
protected Panel()
{
Height = MAX_HEIGHT;
RelativeSizeAxes = Axes.X;

View File

@ -144,7 +144,7 @@ namespace osu.Game.Database
var beatmapSetInfo = Query<BeatmapSetInfo>().FirstOrDefault(s => s.BeatmapSetID == beatmapInfo.BeatmapSetID);
//we need metadata
GetChildren(beatmapSetInfo, false);
GetChildren(beatmapSetInfo);
if (beatmapSetInfo == null)
throw new InvalidOperationException($@"Beatmap set {beatmapInfo.BeatmapSetID} is not in the local database.");
@ -181,7 +181,7 @@ namespace osu.Game.Database
return connection.GetAllWithChildren(filter, recursive);
}
public T GetChildren<T>(T item, bool recursive = true)
public T GetChildren<T>(T item, bool recursive = false)
{
if (item == null) return default(T);

View File

@ -2,18 +2,15 @@
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics.Containers;
using osu.Framework.Graphics.Textures;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework;
using System.Threading.Tasks;
using osu.Framework.Graphics.Textures;
using osu.Framework.Allocation;
namespace osu.Game.Graphics.Background
namespace osu.Game.Graphics.Backgrounds
{
public class Background : BufferedContainer
{
@ -31,7 +28,8 @@ namespace osu.Game.Graphics.Background
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Colour = Color4.DarkGray
Colour = Color4.DarkGray,
FillMode = FillMode.Fill,
});
}
@ -41,11 +39,5 @@ namespace osu.Game.Graphics.Background
if (!string.IsNullOrEmpty(textureName))
Sprite.Texture = textures.Get(textureName);
}
protected override void Update()
{
base.Update();
Sprite.Scale = new Vector2(Math.Max(DrawSize.X / Sprite.DrawSize.X, DrawSize.Y / Sprite.DrawSize.Y));
}
}
}

View File

@ -19,9 +19,6 @@ namespace osu.Game.Graphics.UserInterface.Volume
private VolumeMeter volumeMeterMaster;
private FlowContainer content;
protected override Container<Drawable> Content => content;
private void volumeChanged(object sender, EventArgs e)
{
Show();
@ -34,14 +31,23 @@ namespace osu.Game.Graphics.UserInterface.Volume
Anchor = Anchor.BottomRight;
Origin = Anchor.BottomRight;
AddInternal(content = new FlowContainer
Children = new Drawable[]
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Margin = new MarginPadding { Left = 10, Right = 10, Top = 30, Bottom = 30 },
Spacing = new Vector2(15, 0),
});
new FlowContainer
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Margin = new MarginPadding { Left = 10, Right = 10, Top = 30, Bottom = 30 },
Spacing = new Vector2(15, 0),
Children = new Drawable[]
{
volumeMeterMaster = new VolumeMeter("Master"),
volumeMeterEffect = new VolumeMeter("Effects"),
volumeMeterMusic = new VolumeMeter("Music")
}
}
};
}
protected override void LoadComplete()
@ -52,12 +58,9 @@ namespace osu.Game.Graphics.UserInterface.Volume
VolumeSample.ValueChanged += volumeChanged;
VolumeTrack.ValueChanged += volumeChanged;
Add(new[]
{
volumeMeterMaster = new VolumeMeter("Master", VolumeGlobal),
new VolumeMeter("Effects", VolumeSample),
new VolumeMeter("Music", VolumeTrack)
});
volumeMeterMaster.Bindable = VolumeGlobal;
volumeMeterEffect.Bindable = VolumeSample;
volumeMeterMusic.Bindable = VolumeTrack;
}
protected override void Dispose(bool isDisposing)
@ -81,6 +84,9 @@ namespace osu.Game.Graphics.UserInterface.Volume
ScheduledDelegate popOutDelegate;
private VolumeMeter volumeMeterEffect;
private VolumeMeter volumeMeterMusic;
protected override void PopIn()
{
ClearTransformations();

View File

@ -13,11 +13,10 @@ namespace osu.Game.Graphics.UserInterface.Volume
internal class VolumeMeter : Container
{
private Box meterFill;
private BindableDouble volume;
public BindableDouble Bindable;
public VolumeMeter(string meterName, BindableDouble volume)
public VolumeMeter(string meterName)
{
this.volume = volume;
Size = new Vector2(40, 180);
Children = new Drawable[]
{
@ -65,10 +64,10 @@ namespace osu.Game.Graphics.UserInterface.Volume
public double Volume
{
get { return volume.Value; }
get { return Bindable.Value; }
private set
{
volume.Value = value;
Bindable.Value = value;
updateFill();
}
}

View File

@ -392,7 +392,8 @@ namespace osu.Game.Overlays
{
sprite = new Sprite
{
Colour = new Color4(150, 150, 150, 255)
Colour = new Color4(150, 150, 150, 255),
FillMode = FillMode.Fill,
},
new Box
{
@ -410,12 +411,6 @@ namespace osu.Game.Overlays
{
sprite.Texture = beatmap?.Background ?? textures.Get(@"Backgrounds/bg4");
}
protected override void LoadComplete()
{
base.LoadComplete();
sprite.Scale = new Vector2(Math.Max(DrawSize.X / sprite.DrawSize.X, DrawSize.Y / sprite.DrawSize.Y));
}
}
}
}

View File

@ -104,11 +104,13 @@ namespace osu.Game.Overlays
{
tooltip1 = new SpriteText
{
Shadow = true,
TextSize = 22,
Font = @"Exo2.0-Bold",
},
tooltip2 = new SpriteText
{
Shadow = true,
TextSize = 16
}
}

View File

@ -5,7 +5,7 @@ using osu.Framework.Allocation;
using OpenTK;
using osu.Framework.Graphics.Transformations;
using osu.Game.Beatmaps;
using osu.Game.Graphics.Background;
using osu.Game.Graphics.Backgrounds;
namespace osu.Game.Screens.Backgrounds
{

View File

@ -1,7 +1,7 @@
//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.Game.Graphics.Background;
using osu.Game.Graphics.Backgrounds;
namespace osu.Game.Screens.Backgrounds
{

View File

@ -3,7 +3,7 @@
using osu.Framework;
using osu.Framework.Allocation;
using osu.Game.Graphics.Background;
using osu.Game.Graphics.Backgrounds;
namespace osu.Game.Screens.Backgrounds
{

View File

@ -1,4 +1,5 @@
using OpenTK;
using System;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -61,7 +62,7 @@ namespace osu.Game.Screens.Select
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Texture = beatmap.Background,
Scale = new Vector2(1366 / beatmap.Background.Width * 0.6f),
FillMode = FillMode.Fill,
},
},
},

View File

@ -1,17 +1,17 @@
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using osu.Framework.Caching;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Transformations;
using osu.Game.Beatmaps.Drawable;
using osu.Game.Database;
using System;
using System.Collections.Generic;
using System.Linq;
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK;
using osu.Framework.Caching;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Transformations;
using osu.Game.Database;
using System;
using System.Collections.Generic;
using System.Linq;
using osu.Game.Beatmaps.Drawables;
namespace osu.Game.Screens.Select
{
class CarouselContainer : ScrollContainer

View File

@ -16,7 +16,6 @@ using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Drawable;
using osu.Game.Database;
using osu.Game.Modes;
using osu.Game.Screens.Backgrounds;
@ -24,6 +23,8 @@ using OpenTK;
using OpenTK.Graphics;
using osu.Game.Screens.Play;
using osu.Framework;
using osu.Game.Beatmaps.Drawables;
using osu.Game.Graphics.Containers;
namespace osu.Game.Screens.Select
{
@ -33,11 +34,10 @@ namespace osu.Game.Screens.Select
private BeatmapDatabase database;
protected override BackgroundMode CreateBackground() => new BackgroundModeBeatmap(Beatmap);
private CarouselContainer carousell;
private CarouselContainer carousel;
private TrackManager trackManager;
private Container backgroundWedgesContainer;
private static readonly Vector2 wedged_container_size = new Vector2(700, 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_start_position = new Vector2(0, 50);
private BeatmapInfoOverlay wedgedBeatmapInfoOverlay;
@ -45,46 +45,60 @@ namespace osu.Game.Screens.Select
private static readonly Vector2 BACKGROUND_BLUR = new Vector2(20);
private CancellationTokenSource initialAddSetsTask;
class WedgeBackground : Container
{
public WedgeBackground()
{
Children = new[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Size = new Vector2(1, 0.5f),
Colour = new Color4(0, 0, 0, 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 = new Color4(0, 0, 0, 0.5f),
Shear = new Vector2(-0.15f, 0),
EdgeSmoothness = new Vector2(2, 0),
},
};
}
}
/// <param name="database">Optionally provide a database to use instead of the OsuGame one.</param>
public PlaySongSelect(BeatmapDatabase database = null)
{
this.database = database;
const float scrollWidth = 640;
const float carouselWidth = 640;
const float bottomToolHeight = 50;
Children = new Drawable[]
{
backgroundWedgesContainer = new Container
new ParallaxContainer
{
ParallaxAmount = 0.005f,
RelativeSizeAxes = Axes.Both,
Size = Vector2.One,
Padding = new MarginPadding { Right = scrollWidth },
Children = new[]
Children = new []
{
new Box
new WedgeBackground
{
RelativeSizeAxes = Axes.Both,
Size = new Vector2(1, 0.5f),
Colour = new Color4(0, 0, 0, 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 = new Color4(0, 0, 0, 0.5f),
Shear = new Vector2(-0.15f, 0),
EdgeSmoothness = new Vector2(2, 0),
Padding = new MarginPadding { Right = carouselWidth * 0.76f },
},
}
},
carousell = new CarouselContainer
carousel = new CarouselContainer
{
RelativeSizeAxes = Axes.Y,
Size = new Vector2(scrollWidth, 1),
Size = new Vector2(carouselWidth, 1),
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
},
@ -93,6 +107,7 @@ namespace osu.Game.Screens.Select
Alpha = 0,
Position = wedged_container_start_position,
Size = wedged_container_size,
RelativeSizeAxes = Axes.X,
Shear = wedged_container_shear,
Margin = new MarginPadding { Top = 20, Right = 20, },
Masking = true,
@ -130,7 +145,7 @@ namespace osu.Game.Screens.Select
Colour = new Color4(238, 51, 153, 255),
Action = () => Push(new Player
{
BeatmapInfo = carousell.SelectedGroup.SelectedPanel.Beatmap,
BeatmapInfo = carousel.SelectedGroup.SelectedPanel.Beatmap,
PreferredPlayMode = playMode.Value
})
},
@ -242,7 +257,7 @@ namespace osu.Game.Screens.Select
private void selectBeatmap(BeatmapInfo beatmap)
{
carousell.SelectBeatmap(beatmap);
carousel.SelectBeatmap(beatmap);
}
/// <summary>
@ -286,15 +301,15 @@ namespace osu.Game.Screens.Select
//this likely won't scale so well, but allows us to completely async the loading flow.
Task.WhenAll(group.BeatmapPanels.Select(panel => panel.Preload(game))).ContinueWith(task => Schedule(delegate
{
carousell.AddGroup(group);
carousel.AddGroup(group);
if (Beatmap == null)
carousell.SelectBeatmap(beatmapSet.Beatmaps.First());
carousel.SelectBeatmap(beatmapSet.Beatmaps.First());
else
{
var panel = group.BeatmapPanels.FirstOrDefault(p => p.Beatmap.Equals(Beatmap.BeatmapInfo));
if (panel != null)
carousell.SelectGroup(group, panel);
carousel.SelectGroup(group, panel);
}
}));
}

View File

@ -70,9 +70,9 @@
<Compile Include="Beatmaps\Beatmap.cs" />
<Compile Include="Beatmaps\Formats\ConstructableBeatmapDecoder.cs" />
<Compile Include="Beatmaps\WorkingBeatmap.cs" />
<Compile Include="Beatmaps\Drawable\BeatmapSetHeader.cs" />
<Compile Include="Beatmaps\Drawable\DifficultyIcon.cs" />
<Compile Include="Beatmaps\Drawable\Panel.cs" />
<Compile Include="Beatmaps\Drawables\BeatmapSetHeader.cs" />
<Compile Include="Beatmaps\Drawables\DifficultyIcon.cs" />
<Compile Include="Beatmaps\Drawables\Panel.cs" />
<Compile Include="Modes\Objects\Drawables\DrawableHitObject.cs" />
<Compile Include="Modes\Objects\HitObject.cs" />
<Compile Include="Modes\Objects\HitObjectConverter.cs" />
@ -107,8 +107,8 @@
<Compile Include="Screens\Select\MatchSongSelect.cs" />
<Compile Include="Screens\OsuGameMode.cs" />
<Compile Include="Screens\Play\ModSelect.cs" />
<Compile Include="Beatmaps\Drawable\BeatmapGroup.cs" />
<Compile Include="Beatmaps\Drawable\BeatmapPanel.cs" />
<Compile Include="Beatmaps\Drawables\BeatmapGroup.cs" />
<Compile Include="Beatmaps\Drawables\BeatmapPanel.cs" />
<Compile Include="Screens\Play\Player.cs" />
<Compile Include="Screens\Charts\ChartListing.cs" />
<Compile Include="Modes\PlayMode.cs" />
@ -125,7 +125,7 @@
<Compile Include="Graphics\UserInterface\RollingCounter.cs" />
<Compile Include="Graphics\UserInterface\Volume\VolumeControlReceptor.cs" />
<Compile Include="Input\GlobalHotkeys.cs" />
<Compile Include="Graphics\Background\Background.cs" />
<Compile Include="Graphics\Backgrounds\Background.cs" />
<Compile Include="Graphics\Containers\ParallaxContainer.cs" />
<Compile Include="Graphics\Cursor\OsuCursorContainer.cs" />
<Compile Include="Graphics\Processing\RatioAdjust.cs" />