mirror of
https://github.com/ppy/osu
synced 2024-12-17 12:25:19 +00:00
Merge remote-tracking branch 'upstream/master' into user-profile-fixes
This commit is contained in:
commit
781d76d094
osu.Desktop.VisualTests/Beatmaps
osu.Game
Beatmaps
Database
Screens
@ -10,7 +10,7 @@ namespace osu.Desktop.VisualTests.Beatmaps
|
||||
public class TestWorkingBeatmap : WorkingBeatmap
|
||||
{
|
||||
public TestWorkingBeatmap(Beatmap beatmap)
|
||||
: base(beatmap.BeatmapInfo)
|
||||
: base(beatmap.BeatmapInfo, true)
|
||||
{
|
||||
this.beatmap = beatmap;
|
||||
}
|
||||
|
@ -22,14 +22,17 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
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;
|
||||
BeatmapSetInfo = beatmapInfo.BeatmapSet;
|
||||
Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo.Metadata;
|
||||
WithStoryboard = withStoryboard;
|
||||
FullyLoaded = fullyLoaded;
|
||||
|
||||
Mods.ValueChanged += mods => applyRateAdjustments();
|
||||
}
|
||||
|
@ -14,8 +14,8 @@ namespace osu.Game.Database
|
||||
{
|
||||
private readonly BeatmapDatabase database;
|
||||
|
||||
public DatabaseWorkingBeatmap(BeatmapDatabase database, BeatmapInfo beatmapInfo, bool withStoryboard = false)
|
||||
: base(beatmapInfo, withStoryboard)
|
||||
public DatabaseWorkingBeatmap(BeatmapDatabase database, BeatmapInfo beatmapInfo, bool fullyLoaded = false)
|
||||
: base(beatmapInfo, fullyLoaded)
|
||||
{
|
||||
this.database = database;
|
||||
}
|
||||
@ -37,7 +37,7 @@ namespace osu.Game.Database
|
||||
beatmap = decoder.Decode(stream);
|
||||
}
|
||||
|
||||
if (beatmap == null || !WithStoryboard || BeatmapSetInfo.StoryboardFile == null)
|
||||
if (beatmap == null || !FullyLoaded || BeatmapSetInfo.StoryboardFile == null)
|
||||
return beatmap;
|
||||
|
||||
using (var stream = new StreamReader(reader.GetStream(BeatmapSetInfo.StoryboardFile)))
|
||||
|
@ -121,7 +121,9 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
Scheduler.AddDelayed(delegate
|
||||
{
|
||||
track.Start();
|
||||
// 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();
|
||||
|
||||
LoadComponentAsync(mainMenu = new MainMenu());
|
||||
|
||||
|
@ -35,8 +35,6 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
internal override bool HasLocalCursorDisplayed => !pauseContainer.IsPaused && !HasFailed && HitRenderer.ProvidingUserCursor;
|
||||
|
||||
public BeatmapInfo BeatmapInfo;
|
||||
|
||||
public Action RestartRequested;
|
||||
|
||||
internal override bool AllowBeatmapRulesetChange => false;
|
||||
@ -83,9 +81,9 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
try
|
||||
{
|
||||
if (!Beatmap.Value.WithStoryboard)
|
||||
// we need to ensure the storyboard is loaded.
|
||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(BeatmapInfo, withStoryboard: true);
|
||||
if (!Beatmap.Value.FullyLoaded)
|
||||
// we need to ensure extras like storyboards are loaded.
|
||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(Beatmap.Value.BeatmapInfo, withStoryboard: true);
|
||||
|
||||
if (Beatmap.Value.Beatmap == null)
|
||||
throw new InvalidOperationException("Beatmap was not loaded");
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
@ -31,7 +32,7 @@ namespace osu.Game.Screens.Select
|
||||
public Action OnBack;
|
||||
public Action OnStart;
|
||||
|
||||
private readonly FillFlowContainer buttons;
|
||||
private readonly FillFlowContainer<FooterButton> buttons;
|
||||
|
||||
public OsuLogo StartButton;
|
||||
|
||||
@ -43,29 +44,21 @@ namespace osu.Game.Screens.Select
|
||||
/// <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>
|
||||
/// </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,
|
||||
Height = play_song_select_button_height,
|
||||
Width = play_song_select_button_width,
|
||||
Depth = depth,
|
||||
SelectedColour = colour,
|
||||
DeselectedColour = colour.Opacity(0.5f),
|
||||
Hotkey = hotkey,
|
||||
};
|
||||
Text = text,
|
||||
Height = play_song_select_button_height,
|
||||
Width = play_song_select_button_width,
|
||||
Depth = depth,
|
||||
SelectedColour = colour,
|
||||
DeselectedColour = colour.Opacity(0.5f),
|
||||
Hotkey = hotkey,
|
||||
Hovered = updateModeLight,
|
||||
HoverLost = updateModeLight,
|
||||
Action = action,
|
||||
});
|
||||
|
||||
button.Hovered = () => updateModeLight(button);
|
||||
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);
|
||||
}
|
||||
private void updateModeLight() => modeLight.FadeColour(buttons.FirstOrDefault(b => b.IsHovered)?.SelectedColour ?? Color4.Transparent, TRANSITION_LENGTH, EasingTypes.OutQuint);
|
||||
|
||||
public Footer()
|
||||
{
|
||||
@ -111,7 +104,7 @@ namespace osu.Game.Screens.Select
|
||||
Spacing = new Vector2(padding, 0),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
buttons = new FillFlowContainer
|
||||
buttons = new FillFlowContainer<FooterButton>
|
||||
{
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(0.2f, 0),
|
||||
|
@ -189,7 +189,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
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);
|
||||
else
|
||||
carousel.SelectNext();
|
||||
|
Loading…
Reference in New Issue
Block a user