1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-12 04:49:40 +08:00

Merge remote-tracking branch 'refs/remotes/ppy/master' into rankings-tables

This commit is contained in:
Andrei Zavatski 2019-09-29 14:58:58 +03:00
commit 5314f76fda
11 changed files with 81 additions and 30 deletions

View File

@ -82,8 +82,8 @@ namespace osu.Game.Tests.Visual.SongSelect
private void ensureRandomFetchSuccess() =>
AddAssert("ensure prev random fetch worked", () => selectedSets.Peek() == carousel.SelectedBeatmapSet);
private void checkSelected(int set, int? diff = null) =>
AddAssert($"selected is set{set}{(diff.HasValue ? $" diff{diff.Value}" : "")}", () =>
private void waitForSelection(int set, int? diff = null) =>
AddUntilStep($"selected is set{set}{(diff.HasValue ? $" diff{diff.Value}" : "")}", () =>
{
if (diff != null)
return carousel.SelectedBeatmap == carousel.BeatmapSets.Skip(set - 1).First().Beatmaps.Skip(diff.Value - 1).First();
@ -168,24 +168,24 @@ namespace osu.Game.Tests.Visual.SongSelect
loadBeatmaps();
advanceSelection(direction: 1, diff: false);
checkSelected(1, 1);
waitForSelection(1, 1);
advanceSelection(direction: 1, diff: true);
checkSelected(1, 2);
waitForSelection(1, 2);
advanceSelection(direction: -1, diff: false);
checkSelected(set_count, 1);
waitForSelection(set_count, 1);
advanceSelection(direction: -1, diff: true);
checkSelected(set_count - 1, 3);
waitForSelection(set_count - 1, 3);
advanceSelection(diff: false);
advanceSelection(diff: false);
checkSelected(1, 2);
waitForSelection(1, 2);
advanceSelection(direction: -1, diff: true);
advanceSelection(direction: -1, diff: true);
checkSelected(set_count, 3);
waitForSelection(set_count, 3);
}
/// <summary>
@ -203,10 +203,10 @@ namespace osu.Game.Tests.Visual.SongSelect
AddStep("Filter", () => carousel.Filter(new FilterCriteria { SearchText = "set #3!" }, false));
checkVisibleItemCount(diff: false, count: 1);
checkVisibleItemCount(diff: true, count: 3);
checkSelected(3, 1);
waitForSelection(3, 1);
advanceSelection(diff: true, count: 4);
checkSelected(3, 2);
waitForSelection(3, 2);
AddStep("Un-filter (debounce)", () => carousel.Filter(new FilterCriteria()));
AddUntilStep("Wait for debounce", () => !carousel.PendingFilterTask);
@ -217,10 +217,10 @@ namespace osu.Game.Tests.Visual.SongSelect
setSelected(1, 2);
AddStep("Filter some difficulties", () => carousel.Filter(new FilterCriteria { SearchText = "Normal" }, false));
checkSelected(1, 1);
waitForSelection(1, 1);
AddStep("Un-filter", () => carousel.Filter(new FilterCriteria(), false));
checkSelected(1, 1);
waitForSelection(1, 1);
AddStep("Filter all", () => carousel.Filter(new FilterCriteria { SearchText = "Dingo" }, false));
@ -249,7 +249,7 @@ namespace osu.Game.Tests.Visual.SongSelect
IsLowerInclusive = true
}
}, false));
checkSelected(3, 2);
waitForSelection(3, 2);
AddStep("Un-filter", () => carousel.Filter(new FilterCriteria(), false));
}
@ -317,7 +317,7 @@ namespace osu.Game.Tests.Visual.SongSelect
checkVisibleItemCount(false, set_count);
checkSelected(set_count);
waitForSelection(set_count);
}
/// <summary>
@ -343,11 +343,11 @@ namespace osu.Game.Tests.Visual.SongSelect
AddAssert("Selection is non-null", () => currentSelection != null);
AddStep("Remove selected", () => carousel.RemoveBeatmapSet(carousel.SelectedBeatmapSet));
checkSelected(2);
waitForSelection(2);
AddStep("Remove first", () => carousel.RemoveBeatmapSet(carousel.BeatmapSets.First()));
AddStep("Remove first", () => carousel.RemoveBeatmapSet(carousel.BeatmapSets.First()));
checkSelected(1);
waitForSelection(1);
AddUntilStep("Remove all", () =>
{
@ -390,17 +390,17 @@ namespace osu.Game.Tests.Visual.SongSelect
checkVisibleItemCount(true, 2);
advanceSelection(true);
checkSelected(1, 3);
waitForSelection(1, 3);
setHidden(3);
checkSelected(1, 1);
waitForSelection(1, 1);
setHidden(2, false);
advanceSelection(true);
checkSelected(1, 2);
waitForSelection(1, 2);
setHidden(1);
checkSelected(1, 2);
waitForSelection(1, 2);
setHidden(2);
checkNoSelection();

View File

@ -0,0 +1,22 @@
// 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.
using osu.Framework.Configuration;
namespace osu.Game.Configuration
{
public class InMemoryConfigManager<T> : ConfigManager<T>
where T : struct
{
public InMemoryConfigManager()
{
InitialiseDefaults();
}
protected override void PerformLoad()
{
}
protected override bool PerformSave() => true;
}
}

View File

@ -6,6 +6,7 @@ namespace osu.Game.Configuration
public enum IntroSequence
{
Circles,
Triangles
Triangles,
Random
}
}

View File

@ -0,0 +1,21 @@
// 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.Configuration
{
/// <summary>
/// Stores global per-session statics. These will not be stored after exiting the game.
/// </summary>
public class SessionStatics : InMemoryConfigManager<Static>
{
protected override void InitialiseDefaults()
{
Set(Static.LoginOverlayDisplayed, false);
}
}
public enum Static
{
LoginOverlayDisplayed,
}
}

View File

@ -191,6 +191,7 @@ namespace osu.Game
dependencies.Cache(KeyBindingStore = new KeyBindingStore(contextFactory, RulesetStore));
dependencies.Cache(SettingsStore = new SettingsStore(contextFactory));
dependencies.Cache(RulesetConfigCache = new RulesetConfigCache(SettingsStore));
dependencies.Cache(new SessionStatics());
dependencies.Cache(new OsuColour());
fileImporters.Add(BeatmapManager);

View File

@ -57,7 +57,7 @@ namespace osu.Game.Overlays
protected override void LoadComplete()
{
beatmap.BindValueChanged(beatmapChanged, true);
mods.BindValueChanged(_ => updateAudioAdjustments(), true);
mods.BindValueChanged(_ => ResetTrackAdjustments(), true);
base.LoadComplete();
}
@ -213,12 +213,12 @@ namespace osu.Game.Overlays
current = beatmap.NewValue;
TrackChanged?.Invoke(current, direction);
updateAudioAdjustments();
ResetTrackAdjustments();
queuedDirection = null;
}
private void updateAudioAdjustments()
public void ResetTrackAdjustments()
{
var track = current?.Track;
if (track == null)

View File

@ -6,6 +6,7 @@ using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shaders;
using osu.Framework.MathUtils;
using osu.Game.Screens.Menu;
using osuTK;
using osu.Framework.Screens;
@ -59,6 +60,9 @@ namespace osu.Game.Screens
private IntroScreen getIntroSequence()
{
if (introSequence == IntroSequence.Random)
introSequence = (IntroSequence)RNG.Next(0, (int)IntroSequence.Random);
switch (introSequence)
{
case IntroSequence.Circles:

View File

@ -63,13 +63,15 @@ namespace osu.Game.Screens.Menu
protected override BackgroundScreen CreateBackground() => background;
private Bindable<int> holdDelay;
private Bindable<bool> loginDisplayed;
private ExitConfirmOverlay exitConfirmOverlay;
[BackgroundDependencyLoader(true)]
private void load(DirectOverlay direct, SettingsOverlay settings, OsuConfigManager config)
private void load(DirectOverlay direct, SettingsOverlay settings, OsuConfigManager config, SessionStatics statics)
{
holdDelay = config.GetBindable<int>(OsuSetting.UIHoldActivationDelay);
loginDisplayed = statics.GetBindable<bool>(Static.LoginOverlayDisplayed);
if (host.CanExit)
{
@ -170,7 +172,6 @@ namespace osu.Game.Screens.Menu
Beatmap.ValueChanged += beatmap_ValueChanged;
}
private bool loginDisplayed;
private bool exitConfirmed;
protected override void LogoArriving(OsuLogo logo, bool resuming)
@ -198,10 +199,10 @@ namespace osu.Game.Screens.Menu
bool displayLogin()
{
if (!loginDisplayed)
if (!loginDisplayed.Value)
{
Scheduler.AddDelayed(() => login?.Show(), 500);
loginDisplayed = true;
loginDisplayed.Value = true;
}
return true;

View File

@ -490,6 +490,7 @@ namespace osu.Game.Screens.Select
BeatmapDetails.Leaderboard.RefreshScores();
Beatmap.Value.Track.Looping = true;
music?.ResetTrackAdjustments();
if (Beatmap != null && !Beatmap.Value.BeatmapSetInfo.DeletePending)
{

View File

@ -21,7 +21,7 @@
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="Humanizer" Version="2.7.2" />
<PackageReference Include="Humanizer" Version="2.7.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />

View File

@ -113,7 +113,7 @@
<Reference Include="System.Net.Http" />
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="Humanizer" Version="2.7.2" />
<PackageReference Include="Humanizer" Version="2.7.9" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />