mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 07:42:55 +08:00
Merge branch 'master' into chat-async-improvements
This commit is contained in:
commit
cbc1eff8f1
@ -2,6 +2,7 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Development;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
@ -12,7 +13,6 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Notifications;
|
using osu.Game.Overlays.Notifications;
|
||||||
using osu.Game.Utils;
|
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ namespace osu.Desktop.Overlays
|
|||||||
},
|
},
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Colour = DebugUtils.IsDebug ? colours.Red : Color4.White,
|
Colour = DebugUtils.IsDebugBuild ? colours.Red : Color4.White,
|
||||||
Text = game.Version
|
Text = game.Version
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -216,13 +216,13 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
private void testRankedText(Mod mod)
|
private void testRankedText(Mod mod)
|
||||||
{
|
{
|
||||||
AddWaitStep("wait for fade", 1);
|
waitForLoad();
|
||||||
AddAssert("check for ranked", () => modSelect.UnrankedLabel.Alpha == 0);
|
AddAssert("check for ranked", () => modSelect.UnrankedLabel.Alpha == 0);
|
||||||
selectNext(mod);
|
selectNext(mod);
|
||||||
AddWaitStep("wait for fade", 1);
|
waitForLoad();
|
||||||
AddAssert("check for unranked", () => modSelect.UnrankedLabel.Alpha != 0);
|
AddAssert("check for unranked", () => modSelect.UnrankedLabel.Alpha != 0);
|
||||||
selectPrevious(mod);
|
selectPrevious(mod);
|
||||||
AddWaitStep("wait for fade", 1);
|
waitForLoad();
|
||||||
AddAssert("check for ranked", () => modSelect.UnrankedLabel.Alpha == 0);
|
AddAssert("check for ranked", () => modSelect.UnrankedLabel.Alpha == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -232,6 +232,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
private void checkSelected(Mod mod)
|
private void checkSelected(Mod mod)
|
||||||
{
|
{
|
||||||
|
waitForLoad();
|
||||||
AddAssert($"check {mod.Name} is selected", () =>
|
AddAssert($"check {mod.Name} is selected", () =>
|
||||||
{
|
{
|
||||||
var button = modSelect.GetModButton(mod);
|
var button = modSelect.GetModButton(mod);
|
||||||
@ -239,8 +240,14 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void waitForLoad()
|
||||||
|
{
|
||||||
|
AddUntilStep("wait for icons to load", () => modSelect.AllLoaded);
|
||||||
|
}
|
||||||
|
|
||||||
private void checkNotSelected(Mod mod)
|
private void checkNotSelected(Mod mod)
|
||||||
{
|
{
|
||||||
|
waitForLoad();
|
||||||
AddAssert($"check {mod.Name} is not selected", () =>
|
AddAssert($"check {mod.Name} is not selected", () =>
|
||||||
{
|
{
|
||||||
var button = modSelect.GetModButton(mod);
|
var button = modSelect.GetModButton(mod);
|
||||||
@ -254,6 +261,8 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
{
|
{
|
||||||
public new Bindable<IReadOnlyList<Mod>> SelectedMods => base.SelectedMods;
|
public new Bindable<IReadOnlyList<Mod>> SelectedMods => base.SelectedMods;
|
||||||
|
|
||||||
|
public bool AllLoaded => ModSectionsContainer.Children.All(c => c.ModIconsLoaded);
|
||||||
|
|
||||||
public ModButton GetModButton(Mod mod)
|
public ModButton GetModButton(Mod mod)
|
||||||
{
|
{
|
||||||
var section = ModSectionsContainer.Children.Single(s => s.ModType == mod.Type);
|
var section = ModSectionsContainer.Children.Single(s => s.ModType == mod.Type);
|
||||||
|
@ -184,6 +184,8 @@ namespace osu.Game
|
|||||||
LocalConfig.BindWith(OsuSetting.VolumeInactive, userInactiveVolume);
|
LocalConfig.BindWith(OsuSetting.VolumeInactive, userInactiveVolume);
|
||||||
|
|
||||||
IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true);
|
IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true);
|
||||||
|
|
||||||
|
Beatmap.BindValueChanged(beatmapChanged, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ExternalLinkOpener externalLinkOpener;
|
private ExternalLinkOpener externalLinkOpener;
|
||||||
@ -284,6 +286,23 @@ namespace osu.Game
|
|||||||
}, $"watch {databasedScoreInfo}", bypassScreenAllowChecks: true);
|
}, $"watch {databasedScoreInfo}", bypassScreenAllowChecks: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Beatmap jukebox progression
|
||||||
|
|
||||||
|
private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> beatmap)
|
||||||
|
{
|
||||||
|
var nextBeatmap = beatmap.NewValue;
|
||||||
|
if (nextBeatmap?.Track != null)
|
||||||
|
nextBeatmap.Track.Completed += currentTrackCompleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void currentTrackCompleted()
|
||||||
|
{
|
||||||
|
if (!Beatmap.Value.Track.Looping && !Beatmap.Disabled)
|
||||||
|
musicController.NextTrack();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
private ScheduledDelegate performFromMainMenuTask;
|
private ScheduledDelegate performFromMainMenuTask;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -446,7 +465,7 @@ namespace osu.Game
|
|||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
}, rightFloatingOverlayContent.Add, true);
|
}, rightFloatingOverlayContent.Add, true);
|
||||||
|
|
||||||
loadComponentSingleFile(new MusicController
|
loadComponentSingleFile(musicController = new MusicController
|
||||||
{
|
{
|
||||||
GetToolbarHeight = () => ToolbarOffset,
|
GetToolbarHeight = () => ToolbarOffset,
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
@ -719,8 +738,11 @@ namespace osu.Game
|
|||||||
private Container topMostOverlayContent;
|
private Container topMostOverlayContent;
|
||||||
|
|
||||||
private FrameworkConfigManager frameworkConfig;
|
private FrameworkConfigManager frameworkConfig;
|
||||||
|
|
||||||
private ScalingContainer screenContainer;
|
private ScalingContainer screenContainer;
|
||||||
|
|
||||||
|
private MusicController musicController;
|
||||||
|
|
||||||
protected override bool OnExiting()
|
protected override bool OnExiting()
|
||||||
{
|
{
|
||||||
if (screenStack.CurrentScreen is Loader)
|
if (screenStack.CurrentScreen is Loader)
|
||||||
|
@ -10,6 +10,7 @@ using System.Threading.Tasks;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
|
using osu.Framework.Development;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.IO.Stores;
|
using osu.Framework.IO.Stores;
|
||||||
@ -34,7 +35,6 @@ using osu.Game.Rulesets.Mods;
|
|||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
using DebugUtils = osu.Game.Utils.DebugUtils;
|
|
||||||
|
|
||||||
namespace osu.Game
|
namespace osu.Game
|
||||||
{
|
{
|
||||||
@ -97,7 +97,7 @@ namespace osu.Game
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (!IsDeployedBuild)
|
if (!IsDeployedBuild)
|
||||||
return @"local " + (DebugUtils.IsDebug ? @"debug" : @"release");
|
return @"local " + (DebugUtils.IsDebugBuild ? @"debug" : @"release");
|
||||||
|
|
||||||
var version = AssemblyVersion;
|
var version = AssemblyVersion;
|
||||||
return $@"{version.Major}.{version.Minor}.{version.Build}";
|
return $@"{version.Major}.{version.Minor}.{version.Build}";
|
||||||
|
@ -10,6 +10,7 @@ using osu.Game.Rulesets.Mods;
|
|||||||
using System;
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Threading;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
@ -33,6 +34,13 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
public IEnumerable<Mod> SelectedMods => buttons.Select(b => b.SelectedMod).Where(m => m != null);
|
public IEnumerable<Mod> SelectedMods => buttons.Select(b => b.SelectedMod).Where(m => m != null);
|
||||||
|
|
||||||
|
private CancellationTokenSource modsLoadCts;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// True when all mod icons have completed loading.
|
||||||
|
/// </summary>
|
||||||
|
public bool ModIconsLoaded { get; private set; } = true;
|
||||||
|
|
||||||
public IEnumerable<Mod> Mods
|
public IEnumerable<Mod> Mods
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
@ -48,7 +56,15 @@ namespace osu.Game.Overlays.Mods
|
|||||||
};
|
};
|
||||||
}).ToArray();
|
}).ToArray();
|
||||||
|
|
||||||
ButtonsContainer.Children = modContainers;
|
modsLoadCts?.Cancel();
|
||||||
|
ModIconsLoaded = false;
|
||||||
|
|
||||||
|
LoadComponentsAsync(modContainers, c =>
|
||||||
|
{
|
||||||
|
ModIconsLoaded = true;
|
||||||
|
ButtonsContainer.ChildrenEnumerable = c;
|
||||||
|
}, (modsLoadCts = new CancellationTokenSource()).Token);
|
||||||
|
|
||||||
buttons = modContainers.OfType<ModButton>().ToArray();
|
buttons = modContainers.OfType<ModButton>().ToArray();
|
||||||
|
|
||||||
if (value.Any())
|
if (value.Any())
|
||||||
|
@ -70,9 +70,6 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
Width = 400;
|
Width = 400;
|
||||||
Margin = new MarginPadding(10);
|
Margin = new MarginPadding(10);
|
||||||
|
|
||||||
// required to let MusicController handle beatmap cycling.
|
|
||||||
AlwaysPresent = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -349,18 +346,11 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
direction = last > next ? TransformDirection.Prev : TransformDirection.Next;
|
direction = last > next ? TransformDirection.Prev : TransformDirection.Next;
|
||||||
}
|
}
|
||||||
|
|
||||||
//current.Track.Completed -= currentTrackCompleted;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
current = beatmap.NewValue;
|
|
||||||
|
|
||||||
if (current != null)
|
|
||||||
current.Track.Completed += currentTrackCompleted;
|
|
||||||
|
|
||||||
progressBar.CurrentTime = 0;
|
progressBar.CurrentTime = 0;
|
||||||
|
|
||||||
updateDisplay(current, direction);
|
updateDisplay(current = beatmap.NewValue, direction);
|
||||||
updateAudioAdjustments();
|
updateAudioAdjustments();
|
||||||
|
|
||||||
queuedDirection = null;
|
queuedDirection = null;
|
||||||
@ -378,12 +368,6 @@ namespace osu.Game.Overlays
|
|||||||
mod.ApplyToClock(track);
|
mod.ApplyToClock(track);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void currentTrackCompleted() => Schedule(() =>
|
|
||||||
{
|
|
||||||
if (!current.Track.Looping && !beatmap.Disabled && beatmapSets.Any())
|
|
||||||
next();
|
|
||||||
});
|
|
||||||
|
|
||||||
private ScheduledDelegate pendingBeatmapSwitch;
|
private ScheduledDelegate pendingBeatmapSwitch;
|
||||||
|
|
||||||
private void updateDisplay(WorkingBeatmap beatmap, TransformDirection direction)
|
private void updateDisplay(WorkingBeatmap beatmap, TransformDirection direction)
|
||||||
@ -447,10 +431,6 @@ namespace osu.Game.Overlays
|
|||||||
{
|
{
|
||||||
base.PopOut();
|
base.PopOut();
|
||||||
|
|
||||||
// This is here mostly as a performance fix.
|
|
||||||
// If the playlist is not hidden it will update children even when the music controller is hidden (due to AlwaysPresent).
|
|
||||||
playlist.Hide();
|
|
||||||
|
|
||||||
this.FadeOut(transition_length, Easing.OutQuint);
|
this.FadeOut(transition_length, Easing.OutQuint);
|
||||||
dragContainer.ScaleTo(0.9f, transition_length, Easing.OutQuint);
|
dragContainer.ScaleTo(0.9f, transition_length, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
@ -548,5 +528,10 @@ namespace osu.Game.Overlays
|
|||||||
return base.OnDragEnd(e);
|
return base.OnDragEnd(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Play the next random or playlist track.
|
||||||
|
/// </summary>
|
||||||
|
public void NextTrack() => next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Development;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
@ -12,7 +13,6 @@ using osu.Game.Graphics.UserInterface;
|
|||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
using DebugUtils = osu.Game.Utils.DebugUtils;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Settings
|
namespace osu.Game.Overlays.Settings
|
||||||
{
|
{
|
||||||
@ -59,7 +59,7 @@ namespace osu.Game.Overlays.Settings
|
|||||||
Text = game.Name,
|
Text = game.Name,
|
||||||
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold),
|
Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold),
|
||||||
},
|
},
|
||||||
new BuildDisplay(game.Version, DebugUtils.IsDebug)
|
new BuildDisplay(game.Version, DebugUtils.IsDebugBuild)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
|
@ -143,10 +143,10 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
FillMode = FillMode.Fill,
|
FillMode = FillMode.Fill,
|
||||||
},
|
},
|
||||||
new FillFlowContainer
|
// Todo: This should be a fill flow, but has invalidation issues (see https://github.com/ppy/osu-framework/issues/223)
|
||||||
|
new Container
|
||||||
{
|
{
|
||||||
Depth = -1,
|
Depth = -1,
|
||||||
Direction = FillDirection.Horizontal,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
// This makes the gradient not be perfectly horizontal, but diagonal at a ~40° angle
|
// This makes the gradient not be perfectly horizontal, but diagonal at a ~40° angle
|
||||||
Shear = new Vector2(0.8f, 0),
|
Shear = new Vector2(0.8f, 0),
|
||||||
@ -157,6 +157,7 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
RelativePositionAxes = Axes.Both,
|
||||||
Colour = Color4.Black,
|
Colour = Color4.Black,
|
||||||
Width = 0.4f,
|
Width = 0.4f,
|
||||||
},
|
},
|
||||||
@ -164,20 +165,26 @@ namespace osu.Game.Screens.Select.Carousel
|
|||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
RelativePositionAxes = Axes.Both,
|
||||||
Colour = ColourInfo.GradientHorizontal(Color4.Black, new Color4(0f, 0f, 0f, 0.9f)),
|
Colour = ColourInfo.GradientHorizontal(Color4.Black, new Color4(0f, 0f, 0f, 0.9f)),
|
||||||
Width = 0.05f,
|
Width = 0.05f,
|
||||||
|
X = 0.4f,
|
||||||
},
|
},
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
RelativePositionAxes = Axes.Both,
|
||||||
Colour = ColourInfo.GradientHorizontal(new Color4(0f, 0f, 0f, 0.9f), new Color4(0f, 0f, 0f, 0.1f)),
|
Colour = ColourInfo.GradientHorizontal(new Color4(0f, 0f, 0f, 0.9f), new Color4(0f, 0f, 0f, 0.1f)),
|
||||||
Width = 0.2f,
|
Width = 0.2f,
|
||||||
|
X = 0.45f,
|
||||||
},
|
},
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
RelativePositionAxes = Axes.Both,
|
||||||
Colour = ColourInfo.GradientHorizontal(new Color4(0f, 0f, 0f, 0.1f), new Color4(0, 0, 0, 0)),
|
Colour = ColourInfo.GradientHorizontal(new Color4(0f, 0f, 0f, 0.1f), new Color4(0, 0, 0, 0)),
|
||||||
Width = 0.05f,
|
Width = 0.05f,
|
||||||
|
X = 0.65f,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
namespace osu.Game.Utils
|
|
||||||
{
|
|
||||||
public static class DebugUtils
|
|
||||||
{
|
|
||||||
public static bool IsDebug
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
// ReSharper disable once RedundantAssignment
|
|
||||||
bool isDebug = false;
|
|
||||||
// Debug.Assert conditions are only evaluated in debug mode
|
|
||||||
System.Diagnostics.Debug.Assert(isDebug = true);
|
|
||||||
// ReSharper disable once ConditionIsAlwaysTrueOrFalse
|
|
||||||
return isDebug;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user