Merge remote-tracking branch 'upstream/master' into user-profile-fixes

This commit is contained in:
Dean Herbert
2017-07-20 19:15:21 +09:00
7 changed files with 33 additions and 37 deletions

View File

@ -10,7 +10,7 @@ namespace osu.Desktop.VisualTests.Beatmaps
public class TestWorkingBeatmap : WorkingBeatmap public class TestWorkingBeatmap : WorkingBeatmap
{ {
public TestWorkingBeatmap(Beatmap beatmap) public TestWorkingBeatmap(Beatmap beatmap)
: base(beatmap.BeatmapInfo) : base(beatmap.BeatmapInfo, true)
{ {
this.beatmap = beatmap; this.beatmap = beatmap;
} }

View File

@ -22,14 +22,17 @@ namespace osu.Game.Beatmaps
public readonly Bindable<IEnumerable<Mod>> Mods = new Bindable<IEnumerable<Mod>>(new Mod[] { }); public readonly Bindable<IEnumerable<Mod>> Mods = new Bindable<IEnumerable<Mod>>(new Mod[] { });
public readonly bool WithStoryboard; /// <summary>
/// Denotes whether extras like storyboards have been loaded for this <see cref="WorkingBeatmap"/>.
/// </summary>
public bool FullyLoaded { get; protected set; }
protected WorkingBeatmap(BeatmapInfo beatmapInfo, bool withStoryboard = false) protected WorkingBeatmap(BeatmapInfo beatmapInfo, bool fullyLoaded = false)
{ {
BeatmapInfo = beatmapInfo; BeatmapInfo = beatmapInfo;
BeatmapSetInfo = beatmapInfo.BeatmapSet; BeatmapSetInfo = beatmapInfo.BeatmapSet;
Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo.Metadata; Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo.Metadata;
WithStoryboard = withStoryboard; FullyLoaded = fullyLoaded;
Mods.ValueChanged += mods => applyRateAdjustments(); Mods.ValueChanged += mods => applyRateAdjustments();
} }

View File

@ -14,8 +14,8 @@ namespace osu.Game.Database
{ {
private readonly BeatmapDatabase database; private readonly BeatmapDatabase database;
public DatabaseWorkingBeatmap(BeatmapDatabase database, BeatmapInfo beatmapInfo, bool withStoryboard = false) public DatabaseWorkingBeatmap(BeatmapDatabase database, BeatmapInfo beatmapInfo, bool fullyLoaded = false)
: base(beatmapInfo, withStoryboard) : base(beatmapInfo, fullyLoaded)
{ {
this.database = database; this.database = database;
} }
@ -37,7 +37,7 @@ namespace osu.Game.Database
beatmap = decoder.Decode(stream); beatmap = decoder.Decode(stream);
} }
if (beatmap == null || !WithStoryboard || BeatmapSetInfo.StoryboardFile == null) if (beatmap == null || !FullyLoaded || BeatmapSetInfo.StoryboardFile == null)
return beatmap; return beatmap;
using (var stream = new StreamReader(reader.GetStream(BeatmapSetInfo.StoryboardFile))) using (var stream = new StreamReader(reader.GetStream(BeatmapSetInfo.StoryboardFile)))

View File

@ -121,6 +121,8 @@ namespace osu.Game.Screens.Menu
Scheduler.AddDelayed(delegate Scheduler.AddDelayed(delegate
{ {
// Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Manu.
if (menuMusic)
track.Start(); track.Start();
LoadComponentAsync(mainMenu = new MainMenu()); LoadComponentAsync(mainMenu = new MainMenu());

View File

@ -35,8 +35,6 @@ namespace osu.Game.Screens.Play
internal override bool HasLocalCursorDisplayed => !pauseContainer.IsPaused && !HasFailed && HitRenderer.ProvidingUserCursor; internal override bool HasLocalCursorDisplayed => !pauseContainer.IsPaused && !HasFailed && HitRenderer.ProvidingUserCursor;
public BeatmapInfo BeatmapInfo;
public Action RestartRequested; public Action RestartRequested;
internal override bool AllowBeatmapRulesetChange => false; internal override bool AllowBeatmapRulesetChange => false;
@ -83,9 +81,9 @@ namespace osu.Game.Screens.Play
try try
{ {
if (!Beatmap.Value.WithStoryboard) if (!Beatmap.Value.FullyLoaded)
// we need to ensure the storyboard is loaded. // we need to ensure extras like storyboards are loaded.
Beatmap.Value = beatmaps.GetWorkingBeatmap(BeatmapInfo, withStoryboard: true); Beatmap.Value = beatmaps.GetWorkingBeatmap(Beatmap.Value.BeatmapInfo, withStoryboard: true);
if (Beatmap.Value.Beatmap == null) if (Beatmap.Value.Beatmap == null)
throw new InvalidOperationException("Beatmap was not loaded"); throw new InvalidOperationException("Beatmap was not loaded");

View File

@ -2,6 +2,7 @@
// 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; using System;
using System.Linq;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using OpenTK.Input; using OpenTK.Input;
@ -31,7 +32,7 @@ namespace osu.Game.Screens.Select
public Action OnBack; public Action OnBack;
public Action OnStart; public Action OnStart;
private readonly FillFlowContainer buttons; private readonly FillFlowContainer<FooterButton> buttons;
public OsuLogo StartButton; public OsuLogo StartButton;
@ -43,9 +44,7 @@ namespace osu.Game.Screens.Select
/// <para>Higher depth to be put on the left, and lower to be put on the right.</para> /// <para>Higher depth to be put on the left, and lower to be put on the right.</para>
/// <para>Notice this is different to <see cref="Options.BeatmapOptionsOverlay"/>!</para> /// <para>Notice this is different to <see cref="Options.BeatmapOptionsOverlay"/>!</para>
/// </param> /// </param>
public void AddButton(string text, Color4 colour, Action action, Key? hotkey = null, float depth = 0) public void AddButton(string text, Color4 colour, Action action, Key? hotkey = null, float depth = 0) => buttons.Add(new FooterButton
{
var button = new FooterButton
{ {
Text = text, Text = text,
Height = play_song_select_button_height, Height = play_song_select_button_height,
@ -54,18 +53,12 @@ namespace osu.Game.Screens.Select
SelectedColour = colour, SelectedColour = colour,
DeselectedColour = colour.Opacity(0.5f), DeselectedColour = colour.Opacity(0.5f),
Hotkey = hotkey, Hotkey = hotkey,
}; Hovered = updateModeLight,
HoverLost = updateModeLight,
Action = action,
});
button.Hovered = () => updateModeLight(button); private void updateModeLight() => modeLight.FadeColour(buttons.FirstOrDefault(b => b.IsHovered)?.SelectedColour ?? Color4.Transparent, TRANSITION_LENGTH, EasingTypes.OutQuint);
button.HoverLost = () => updateModeLight();
button.Action = action;
buttons.Add(button);
}
private void updateModeLight(FooterButton button = null)
{
modeLight.FadeColour(button?.SelectedColour ?? Color4.Transparent, TRANSITION_LENGTH, EasingTypes.OutQuint);
}
public Footer() public Footer()
{ {
@ -111,7 +104,7 @@ namespace osu.Game.Screens.Select
Spacing = new Vector2(padding, 0), Spacing = new Vector2(padding, 0),
Children = new Drawable[] Children = new Drawable[]
{ {
buttons = new FillFlowContainer buttons = new FillFlowContainer<FooterButton>
{ {
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
Spacing = new Vector2(0.2f, 0), Spacing = new Vector2(0.2f, 0),

View File

@ -189,7 +189,7 @@ namespace osu.Game.Screens.Select
private void carouselBeatmapsLoaded() private void carouselBeatmapsLoaded()
{ {
if (Beatmap.Value != null && !Beatmap.Value.BeatmapSetInfo.DeletePending) if (Beatmap.Value != null && Beatmap.Value.BeatmapSetInfo?.DeletePending != false)
carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo, false); carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo, false);
else else
carousel.SelectNext(); carousel.SelectNext();