mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 12:53:11 +08:00
Merge branch 'master' into new-difficulty-creation-v3
This commit is contained in:
commit
b7d7e6612e
@ -128,6 +128,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
|
||||
AddStep("choose clear all scores", () => InputManager.Key(Key.Number4));
|
||||
|
||||
AddUntilStep("wait for dialog display", () => Game.Dependencies.Get<DialogOverlay>().IsLoaded);
|
||||
AddUntilStep("wait for dialog", () => Game.Dependencies.Get<DialogOverlay>().CurrentDialog != null);
|
||||
AddStep("confirm deletion", () => InputManager.Key(Key.Number1));
|
||||
AddUntilStep("wait for dialog dismissed", () => Game.Dependencies.Get<DialogOverlay>().CurrentDialog == null);
|
||||
@ -172,6 +173,7 @@ namespace osu.Game.Tests.Visual.Navigation
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
|
||||
AddUntilStep("wait for dialog display", () => Game.Dependencies.Get<DialogOverlay>().IsLoaded);
|
||||
AddUntilStep("wait for dialog", () => Game.Dependencies.Get<DialogOverlay>().CurrentDialog != null);
|
||||
AddStep("confirm deletion", () => InputManager.Key(Key.Number1));
|
||||
AddUntilStep("wait for dialog dismissed", () => Game.Dependencies.Get<DialogOverlay>().CurrentDialog == null);
|
||||
|
@ -601,7 +601,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
{
|
||||
BeatmapSetInfo testMixed = null;
|
||||
|
||||
createCarousel();
|
||||
createCarousel(new List<BeatmapSetInfo>());
|
||||
|
||||
AddStep("add mixed ruleset beatmapset", () =>
|
||||
{
|
||||
@ -765,22 +765,22 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
{
|
||||
bool changed = false;
|
||||
|
||||
createCarousel(c =>
|
||||
if (beatmapSets == null)
|
||||
{
|
||||
beatmapSets = new List<BeatmapSetInfo>();
|
||||
|
||||
for (int i = 1; i <= (count ?? set_count); i++)
|
||||
{
|
||||
beatmapSets.Add(randomDifficulties
|
||||
? TestResources.CreateTestBeatmapSetInfo()
|
||||
: TestResources.CreateTestBeatmapSetInfo(3));
|
||||
}
|
||||
}
|
||||
|
||||
createCarousel(beatmapSets, c =>
|
||||
{
|
||||
carouselAdjust?.Invoke(c);
|
||||
|
||||
if (beatmapSets == null)
|
||||
{
|
||||
beatmapSets = new List<BeatmapSetInfo>();
|
||||
|
||||
for (int i = 1; i <= (count ?? set_count); i++)
|
||||
{
|
||||
beatmapSets.Add(randomDifficulties
|
||||
? TestResources.CreateTestBeatmapSetInfo()
|
||||
: TestResources.CreateTestBeatmapSetInfo(3));
|
||||
}
|
||||
}
|
||||
|
||||
carousel.Filter(initialCriteria?.Invoke() ?? new FilterCriteria());
|
||||
carousel.BeatmapSetsChanged = () => changed = true;
|
||||
carousel.BeatmapSets = beatmapSets;
|
||||
@ -789,7 +789,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
AddUntilStep("Wait for load", () => changed);
|
||||
}
|
||||
|
||||
private void createCarousel(Action<BeatmapCarousel> carouselAdjust = null, Container target = null)
|
||||
private void createCarousel(List<BeatmapSetInfo> beatmapSets, Action<BeatmapCarousel> carouselAdjust = null, Container target = null)
|
||||
{
|
||||
AddStep("Create carousel", () =>
|
||||
{
|
||||
@ -803,6 +803,8 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
|
||||
carouselAdjust?.Invoke(carousel);
|
||||
|
||||
carousel.BeatmapSets = beatmapSets;
|
||||
|
||||
(target ?? this).Child = carousel;
|
||||
});
|
||||
}
|
||||
|
@ -399,7 +399,10 @@ namespace osu.Game.Online.API
|
||||
lock (queue)
|
||||
{
|
||||
if (state.Value == APIState.Offline)
|
||||
{
|
||||
request.Fail(new WebException(@"User not logged in"));
|
||||
return;
|
||||
}
|
||||
|
||||
queue.Enqueue(request);
|
||||
}
|
||||
@ -416,7 +419,7 @@ namespace osu.Game.Online.API
|
||||
if (failOldRequests)
|
||||
{
|
||||
foreach (var req in oldQueueRequests)
|
||||
req.Fail(new WebException(@"Disconnected from server"));
|
||||
req.Fail(new WebException($@"Request failed from flush operation (state {state.Value})"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ using osu.Game.Input.Bindings;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using osu.Game.Skinning;
|
||||
@ -83,10 +84,7 @@ namespace osu.Game.Screens.Play
|
||||
Children = new Drawable[]
|
||||
{
|
||||
CreateFailingLayer(),
|
||||
mainComponents = new SkinnableTargetContainer(SkinnableTarget.MainHUDComponents)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
mainComponents = new MainComponentsContainer(),
|
||||
topRightElements = new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
@ -325,5 +323,29 @@ namespace osu.Game.Screens.Play
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private class MainComponentsContainer : SkinnableTargetContainer
|
||||
{
|
||||
private Bindable<ScoringMode> scoringMode;
|
||||
|
||||
[Resolved]
|
||||
private OsuConfigManager config { get; set; }
|
||||
|
||||
public MainComponentsContainer()
|
||||
: base(SkinnableTarget.MainHUDComponents)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
// When the scoring mode changes, relative positions of elements may change (see DefaultSkin.GetDrawableComponent).
|
||||
// This is a best effort implementation for cases where users haven't customised layouts.
|
||||
scoringMode = config.GetBindable<ScoringMode>(OsuSetting.ScoreDisplayMode);
|
||||
scoringMode.BindValueChanged(val => Reload());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,6 +6,8 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Caching;
|
||||
using osu.Framework.Graphics;
|
||||
@ -106,7 +108,7 @@ namespace osu.Game.Screens.Select
|
||||
set
|
||||
{
|
||||
loadedTestBeatmaps = true;
|
||||
loadBeatmapSets(value);
|
||||
Schedule(() => loadBeatmapSets(value));
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,6 +153,10 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private readonly DrawablePool<DrawableCarouselBeatmapSet> setPool = new DrawablePool<DrawableCarouselBeatmapSet>(100);
|
||||
|
||||
private Sample spinSample;
|
||||
|
||||
private int visibleSetsCount;
|
||||
|
||||
public BeatmapCarousel()
|
||||
{
|
||||
root = new CarouselRoot(this);
|
||||
@ -169,8 +175,10 @@ namespace osu.Game.Screens.Select
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
private void load(OsuConfigManager config, AudioManager audio)
|
||||
{
|
||||
spinSample = audio.Samples.Get("SongSelect/random-spin");
|
||||
|
||||
config.BindWith(OsuSetting.RandomSelectAlgorithm, RandomAlgorithm);
|
||||
config.BindWith(OsuSetting.SongSelectRightMouseScroll, RightClickScrollingEnabled);
|
||||
|
||||
@ -419,6 +427,9 @@ namespace osu.Game.Screens.Select
|
||||
return false;
|
||||
|
||||
var visibleSets = beatmapSets.Where(s => !s.Filtered.Value).ToList();
|
||||
|
||||
visibleSetsCount = visibleSets.Count;
|
||||
|
||||
if (!visibleSets.Any())
|
||||
return false;
|
||||
|
||||
@ -450,6 +461,9 @@ namespace osu.Game.Screens.Select
|
||||
else
|
||||
set = visibleSets.ElementAt(RNG.Next(visibleSets.Count));
|
||||
|
||||
if (selectedBeatmapSet != null)
|
||||
playSpinSample(distanceBetween(set, selectedBeatmapSet));
|
||||
|
||||
select(set);
|
||||
return true;
|
||||
}
|
||||
@ -464,12 +478,25 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
if (RandomAlgorithm.Value == RandomSelectAlgorithm.RandomPermutation)
|
||||
previouslyVisitedRandomSets.Remove(selectedBeatmapSet);
|
||||
|
||||
if (selectedBeatmapSet != null)
|
||||
playSpinSample(distanceBetween(beatmap, selectedBeatmapSet));
|
||||
|
||||
select(beatmap);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private double distanceBetween(CarouselItem item1, CarouselItem item2) => Math.Ceiling(Math.Abs(item1.CarouselYPosition - item2.CarouselYPosition) / DrawableCarouselItem.MAX_HEIGHT);
|
||||
|
||||
private void playSpinSample(double distance)
|
||||
{
|
||||
var chan = spinSample.GetChannel();
|
||||
chan.Frequency.Value = 1f + Math.Min(1f, distance / visibleSetsCount);
|
||||
chan.Play();
|
||||
}
|
||||
|
||||
private void select(CarouselItem item)
|
||||
{
|
||||
if (!AllowSelection)
|
||||
|
@ -100,6 +100,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private Sample sampleChangeDifficulty;
|
||||
private Sample sampleChangeBeatmap;
|
||||
private Sample sampleRandomBeatmap;
|
||||
|
||||
private Container carouselContainer;
|
||||
|
||||
@ -109,6 +110,8 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private double audioFeedbackLastPlaybackTime;
|
||||
|
||||
private bool randomSelectionPending;
|
||||
|
||||
[Resolved]
|
||||
private MusicController music { get; set; }
|
||||
|
||||
@ -288,6 +291,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
sampleChangeDifficulty = audio.Samples.Get(@"SongSelect/select-difficulty");
|
||||
sampleChangeBeatmap = audio.Samples.Get(@"SongSelect/select-expand");
|
||||
sampleRandomBeatmap = audio.Samples.Get(@"SongSelect/select-random");
|
||||
SampleConfirm = audio.Samples.Get(@"SongSelect/confirm-selection");
|
||||
|
||||
if (dialogOverlay != null)
|
||||
@ -315,8 +319,16 @@ namespace osu.Game.Screens.Select
|
||||
(new FooterButtonMods { Current = Mods }, ModSelect),
|
||||
(new FooterButtonRandom
|
||||
{
|
||||
NextRandom = () => Carousel.SelectNextRandom(),
|
||||
PreviousRandom = Carousel.SelectPreviousRandom
|
||||
NextRandom = () =>
|
||||
{
|
||||
randomSelectionPending = true;
|
||||
Carousel.SelectNextRandom();
|
||||
},
|
||||
PreviousRandom = () =>
|
||||
{
|
||||
randomSelectionPending = true;
|
||||
Carousel.SelectPreviousRandom();
|
||||
}
|
||||
}, null),
|
||||
(new FooterButtonOptions(), BeatmapOptions)
|
||||
};
|
||||
@ -486,7 +498,9 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
if (beatmap != null && beatmapInfoPrevious != null && Time.Current - audioFeedbackLastPlaybackTime >= 50)
|
||||
{
|
||||
if (beatmap.BeatmapSet?.ID == beatmapInfoPrevious.BeatmapSet?.ID)
|
||||
if (randomSelectionPending)
|
||||
sampleRandomBeatmap.Play();
|
||||
else if (beatmap.BeatmapSet?.ID == beatmapInfoPrevious.BeatmapSet?.ID)
|
||||
sampleChangeDifficulty.Play();
|
||||
else
|
||||
sampleChangeBeatmap.Play();
|
||||
@ -494,6 +508,7 @@ namespace osu.Game.Screens.Select
|
||||
audioFeedbackLastPlaybackTime = Time.Current;
|
||||
}
|
||||
|
||||
randomSelectionPending = false;
|
||||
beatmapInfoPrevious = beatmap;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user