mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Merge branch 'master' into player-reduced-parallax
This commit is contained in:
Submodule osu-framework updated: 9a773e62eb...500a791577
@ -207,6 +207,12 @@ namespace osu.Game.Tests.Visual
|
|||||||
checkVisibleItemCount(true, 0);
|
checkVisibleItemCount(true, 0);
|
||||||
AddAssert("Selection is null", () => currentSelection == null);
|
AddAssert("Selection is null", () => currentSelection == null);
|
||||||
|
|
||||||
|
advanceSelection(true);
|
||||||
|
AddAssert("Selection is null", () => currentSelection == null);
|
||||||
|
|
||||||
|
advanceSelection(false);
|
||||||
|
AddAssert("Selection is null", () => currentSelection == null);
|
||||||
|
|
||||||
AddStep("Un-filter", () => carousel.Filter(new FilterCriteria(), false));
|
AddStep("Un-filter", () => carousel.Filter(new FilterCriteria(), false));
|
||||||
|
|
||||||
AddAssert("Selection is non-null", () => currentSelection != null);
|
AddAssert("Selection is non-null", () => currentSelection != null);
|
||||||
|
@ -8,6 +8,7 @@ using OpenTK;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
|
using osu.Framework.MathUtils;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.Containers
|
namespace osu.Game.Graphics.Containers
|
||||||
{
|
{
|
||||||
@ -63,8 +64,9 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
if (parallaxEnabled)
|
if (parallaxEnabled)
|
||||||
{
|
{
|
||||||
Vector2 offset = input.CurrentState.Mouse == null ? Vector2.Zero : ToLocalSpace(input.CurrentState.Mouse.NativeState.Position) - DrawSize / 2;
|
Vector2 offset = (input.CurrentState.Mouse == null ? Vector2.Zero : ToLocalSpace(input.CurrentState.Mouse.NativeState.Position) - DrawSize / 2) * ParallaxAmount;
|
||||||
content.MoveTo(offset * ParallaxAmount, firstUpdate ? 0 : 1000, Easing.OutQuint);
|
|
||||||
|
content.Position = Interpolation.ValueAt(Clock.ElapsedFrameTime, content.Position, offset, 0, 1000, Easing.OutQuint);
|
||||||
content.Scale = new Vector2(1 + ParallaxAmount);
|
content.Scale = new Vector2(1 + ParallaxAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,6 +65,14 @@ namespace osu.Game.Overlays.Mods
|
|||||||
Ruleset.TriggerChange();
|
Ruleset.TriggerChange();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool isDisposing)
|
||||||
|
{
|
||||||
|
base.Dispose(isDisposing);
|
||||||
|
|
||||||
|
Ruleset.UnbindAll();
|
||||||
|
SelectedMods.UnbindAll();
|
||||||
|
}
|
||||||
|
|
||||||
private void selectedModsChanged(IEnumerable<Mod> obj)
|
private void selectedModsChanged(IEnumerable<Mod> obj)
|
||||||
{
|
{
|
||||||
foreach (ModSection section in ModSectionsContainer.Children)
|
foreach (ModSection section in ModSectionsContainer.Children)
|
||||||
|
@ -353,7 +353,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
protected override bool OnExiting(Screen next)
|
protected override bool OnExiting(Screen next)
|
||||||
{
|
{
|
||||||
if ((!AllowPause || HasFailed || !ValidForResume || pauseContainer?.IsPaused != false || RulesetContainer?.HasReplayLoaded != false) && (!pauseContainer?.IsResuming ?? false))
|
if ((!AllowPause || HasFailed || !ValidForResume || pauseContainer?.IsPaused != false || RulesetContainer?.HasReplayLoaded != false) && (!pauseContainer?.IsResuming ?? true))
|
||||||
{
|
{
|
||||||
// In the case of replays, we may have changed the playback rate.
|
// In the case of replays, we may have changed the playback rate.
|
||||||
applyRateFromMods();
|
applyRateFromMods();
|
||||||
|
@ -109,7 +109,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
var xFill = value * UsableWidth;
|
var xFill = value * UsableWidth;
|
||||||
fill.Width = xFill;
|
fill.Width = xFill;
|
||||||
handleBase.MoveToX(xFill);
|
handleBase.X = xFill;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnUserChange() => OnSeek?.Invoke(Current);
|
protected override void OnUserChange() => OnSeek?.Invoke(Current);
|
||||||
|
@ -192,7 +192,9 @@ namespace osu.Game.Screens.Select
|
|||||||
/// <param name="skipDifficulties">Whether to skip individual difficulties and only increment over full groups.</param>
|
/// <param name="skipDifficulties">Whether to skip individual difficulties and only increment over full groups.</param>
|
||||||
public void SelectNext(int direction = 1, bool skipDifficulties = true)
|
public void SelectNext(int direction = 1, bool skipDifficulties = true)
|
||||||
{
|
{
|
||||||
if (!Items.Any())
|
var visibleItems = Items.Where(s => !s.Item.Filtered).ToList();
|
||||||
|
|
||||||
|
if (!visibleItems.Any())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DrawableCarouselItem drawable = null;
|
DrawableCarouselItem drawable = null;
|
||||||
@ -202,15 +204,15 @@ namespace osu.Game.Screens.Select
|
|||||||
// we can fix this by changing this method to not reference drawables / Items in the first place.
|
// we can fix this by changing this method to not reference drawables / Items in the first place.
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int originalIndex = Items.IndexOf(drawable);
|
int originalIndex = visibleItems.IndexOf(drawable);
|
||||||
int currentIndex = originalIndex;
|
int currentIndex = originalIndex;
|
||||||
|
|
||||||
// local function to increment the index in the required direction, wrapping over extremities.
|
// local function to increment the index in the required direction, wrapping over extremities.
|
||||||
int incrementIndex() => currentIndex = (currentIndex + direction + Items.Count) % Items.Count;
|
int incrementIndex() => currentIndex = (currentIndex + direction + visibleItems.Count) % visibleItems.Count;
|
||||||
|
|
||||||
while (incrementIndex() != originalIndex)
|
while (incrementIndex() != originalIndex)
|
||||||
{
|
{
|
||||||
var item = Items[currentIndex].Item;
|
var item = visibleItems[currentIndex].Item;
|
||||||
|
|
||||||
if (item.Filtered || item.State == CarouselItemState.Selected) continue;
|
if (item.Filtered || item.State == CarouselItemState.Selected) continue;
|
||||||
|
|
||||||
@ -407,12 +409,14 @@ namespace osu.Game.Screens.Select
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float depth = i + (item is DrawableCarouselBeatmapSet ? -Items.Count : 0);
|
||||||
|
|
||||||
// Only add if we're not already part of the content.
|
// Only add if we're not already part of the content.
|
||||||
if (!scrollableContent.Contains(item))
|
if (!scrollableContent.Contains(item))
|
||||||
{
|
{
|
||||||
// Makes sure headers are always _below_ items,
|
// Makes sure headers are always _below_ items,
|
||||||
// and depth flows downward.
|
// and depth flows downward.
|
||||||
item.Depth = i + (item is DrawableCarouselBeatmapSet ? -Items.Count : 0);
|
item.Depth = depth;
|
||||||
|
|
||||||
switch (item.LoadState)
|
switch (item.LoadState)
|
||||||
{
|
{
|
||||||
@ -426,6 +430,10 @@ namespace osu.Game.Screens.Select
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
scrollableContent.ChangeChildDepth(item, depth);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is not actually useful right now, but once we have groups may well be.
|
// this is not actually useful right now, but once we have groups may well be.
|
||||||
|
@ -1,11 +1,13 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// 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.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
@ -47,13 +49,15 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private SampleChannel sampleConfirm;
|
private SampleChannel sampleConfirm;
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
public readonly Bindable<IEnumerable<Mod>> SelectedMods = new Bindable<IEnumerable<Mod>>(new List<Mod>());
|
||||||
private void load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay, OsuGame game)
|
|
||||||
{
|
|
||||||
sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection");
|
|
||||||
|
|
||||||
if (game != null)
|
[BackgroundDependencyLoader(true)]
|
||||||
modSelect.SelectedMods.BindTo(game.SelectedMods);
|
private void load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay, OsuGame osu)
|
||||||
|
{
|
||||||
|
if (osu != null) SelectedMods.BindTo(osu.SelectedMods);
|
||||||
|
modSelect.SelectedMods.BindTo(SelectedMods);
|
||||||
|
|
||||||
|
sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection");
|
||||||
|
|
||||||
Footer.AddButton(@"mods", colours.Yellow, modSelect, Key.F1, float.MaxValue);
|
Footer.AddButton(@"mods", colours.Yellow, modSelect, Key.F1, float.MaxValue);
|
||||||
|
|
||||||
@ -80,7 +84,7 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
base.UpdateBeatmap(beatmap);
|
base.UpdateBeatmap(beatmap);
|
||||||
|
|
||||||
beatmap.Mods.BindTo(modSelect.SelectedMods);
|
beatmap.Mods.BindTo(SelectedMods);
|
||||||
|
|
||||||
BeatmapDetails.Beatmap = beatmap;
|
BeatmapDetails.Beatmap = beatmap;
|
||||||
|
|
||||||
@ -95,7 +99,7 @@ namespace osu.Game.Screens.Select
|
|||||||
if (removeAutoModOnResume)
|
if (removeAutoModOnResume)
|
||||||
{
|
{
|
||||||
var autoType = Ruleset.Value.CreateInstance().GetAutoplayMod().GetType();
|
var autoType = Ruleset.Value.CreateInstance().GetAutoplayMod().GetType();
|
||||||
modSelect.SelectedMods.Value = modSelect.SelectedMods.Value.Where(m => m.GetType() != autoType).ToArray();
|
SelectedMods.Value = SelectedMods.Value.Where(m => m.GetType() != autoType).ToArray();
|
||||||
removeAutoModOnResume = false;
|
removeAutoModOnResume = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,7 +129,7 @@ namespace osu.Game.Screens.Select
|
|||||||
if (Beatmap.Value.Track != null)
|
if (Beatmap.Value.Track != null)
|
||||||
Beatmap.Value.Track.Looping = false;
|
Beatmap.Value.Track.Looping = false;
|
||||||
|
|
||||||
Beatmap.Value.Mods.UnbindBindings();
|
SelectedMods.UnbindAll();
|
||||||
Beatmap.Value.Mods.Value = new Mod[] { };
|
Beatmap.Value.Mods.Value = new Mod[] { };
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -386,6 +386,8 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
protected override bool OnExiting(Screen next)
|
protected override bool OnExiting(Screen next)
|
||||||
{
|
{
|
||||||
|
FinaliseSelection();
|
||||||
|
|
||||||
beatmapInfoWedge.State = Visibility.Hidden;
|
beatmapInfoWedge.State = Visibility.Hidden;
|
||||||
|
|
||||||
Content.FadeOut(100);
|
Content.FadeOut(100);
|
||||||
|
Reference in New Issue
Block a user