mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 07:06:35 +09:00
Merge branch 'master' into footer_V2_implementation
This commit is contained in:
@ -64,7 +64,7 @@ namespace osu.Game.Screens.Select
|
||||
/// <summary>
|
||||
/// A function to optionally decide on a recommended difficulty from a beatmap set.
|
||||
/// </summary>
|
||||
public Func<IEnumerable<BeatmapInfo>, BeatmapInfo>? GetRecommendedBeatmap;
|
||||
public Func<IEnumerable<BeatmapInfo>, BeatmapInfo?>? GetRecommendedBeatmap;
|
||||
|
||||
private CarouselBeatmapSet? selectedBeatmapSet;
|
||||
|
||||
@ -119,7 +119,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
CarouselRoot newRoot = new CarouselRoot(this);
|
||||
|
||||
newRoot.AddItems(beatmapSets.Select(s => createCarouselSet(s.Detach())).Where(g => g != null));
|
||||
newRoot.AddItems(beatmapSets.Select(s => createCarouselSet(s.Detach())).OfType<CarouselBeatmapSet>());
|
||||
|
||||
root = newRoot;
|
||||
|
||||
@ -596,6 +596,9 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
public void FlushPendingFilterOperations()
|
||||
{
|
||||
if (!IsLoaded)
|
||||
return;
|
||||
|
||||
if (PendingFilter?.Completed == false)
|
||||
{
|
||||
applyActiveCriteria(false);
|
||||
@ -739,6 +742,8 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
foreach (var panel in Scroll.Children)
|
||||
{
|
||||
Debug.Assert(panel.Item != null);
|
||||
|
||||
if (toDisplay.Remove(panel.Item))
|
||||
{
|
||||
// panel already displayed.
|
||||
@ -770,6 +775,8 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
updateItem(item);
|
||||
|
||||
Debug.Assert(item.Item != null);
|
||||
|
||||
if (item.Item.Visible)
|
||||
{
|
||||
bool isSelected = item.Item.State.Value == CarouselItemState.Selected;
|
||||
|
@ -141,9 +141,9 @@ namespace osu.Game.Screens.Select
|
||||
LayoutEasing = Easing.OutQuad,
|
||||
Children = new[]
|
||||
{
|
||||
description = new MetadataSection(MetadataType.Description, searchOnSongSelect),
|
||||
source = new MetadataSection(MetadataType.Source, searchOnSongSelect),
|
||||
tags = new MetadataSection(MetadataType.Tags, searchOnSongSelect),
|
||||
description = new MetadataSectionDescription(searchOnSongSelect),
|
||||
source = new MetadataSectionSource(searchOnSongSelect),
|
||||
tags = new MetadataSectionTags(searchOnSongSelect),
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -187,9 +187,9 @@ namespace osu.Game.Screens.Select
|
||||
private void updateStatistics()
|
||||
{
|
||||
advanced.BeatmapInfo = BeatmapInfo;
|
||||
description.Text = BeatmapInfo?.DifficultyName;
|
||||
source.Text = BeatmapInfo?.Metadata.Source;
|
||||
tags.Text = BeatmapInfo?.Metadata.Tags;
|
||||
description.Metadata = BeatmapInfo?.DifficultyName ?? string.Empty;
|
||||
source.Metadata = BeatmapInfo?.Metadata.Source ?? string.Empty;
|
||||
tags.Metadata = BeatmapInfo?.Metadata.Tags ?? string.Empty;
|
||||
|
||||
// failTimes may have been previously fetched
|
||||
if (ratings != null && failTimes != null)
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using osu.Game.Beatmaps;
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -33,7 +31,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
public BeatmapSetInfo BeatmapSet;
|
||||
|
||||
public Func<IEnumerable<BeatmapInfo>, BeatmapInfo> GetRecommendedBeatmap;
|
||||
public Func<IEnumerable<BeatmapInfo>, BeatmapInfo?>? GetRecommendedBeatmap;
|
||||
|
||||
public CarouselBeatmapSet(BeatmapSetInfo beatmapSet)
|
||||
{
|
||||
@ -47,7 +45,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
.ForEach(AddItem);
|
||||
}
|
||||
|
||||
protected override CarouselItem GetNextToSelect()
|
||||
protected override CarouselItem? GetNextToSelect()
|
||||
{
|
||||
if (LastSelected == null || LastSelected.Filtered.Value)
|
||||
{
|
||||
@ -63,50 +61,75 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
if (!(other is CarouselBeatmapSet otherSet))
|
||||
return base.CompareTo(criteria, other);
|
||||
|
||||
int comparison = 0;
|
||||
|
||||
switch (criteria.Sort)
|
||||
{
|
||||
default:
|
||||
case SortMode.Artist:
|
||||
return string.Compare(BeatmapSet.Metadata.Artist, otherSet.BeatmapSet.Metadata.Artist, StringComparison.OrdinalIgnoreCase);
|
||||
comparison = string.Compare(BeatmapSet.Metadata.Artist, otherSet.BeatmapSet.Metadata.Artist, StringComparison.OrdinalIgnoreCase);
|
||||
break;
|
||||
|
||||
case SortMode.Title:
|
||||
return string.Compare(BeatmapSet.Metadata.Title, otherSet.BeatmapSet.Metadata.Title, StringComparison.OrdinalIgnoreCase);
|
||||
comparison = string.Compare(BeatmapSet.Metadata.Title, otherSet.BeatmapSet.Metadata.Title, StringComparison.OrdinalIgnoreCase);
|
||||
break;
|
||||
|
||||
case SortMode.Author:
|
||||
return string.Compare(BeatmapSet.Metadata.Author.Username, otherSet.BeatmapSet.Metadata.Author.Username, StringComparison.OrdinalIgnoreCase);
|
||||
comparison = string.Compare(BeatmapSet.Metadata.Author.Username, otherSet.BeatmapSet.Metadata.Author.Username, StringComparison.OrdinalIgnoreCase);
|
||||
break;
|
||||
|
||||
case SortMode.Source:
|
||||
return string.Compare(BeatmapSet.Metadata.Source, otherSet.BeatmapSet.Metadata.Source, StringComparison.OrdinalIgnoreCase);
|
||||
comparison = string.Compare(BeatmapSet.Metadata.Source, otherSet.BeatmapSet.Metadata.Source, StringComparison.OrdinalIgnoreCase);
|
||||
break;
|
||||
|
||||
case SortMode.DateAdded:
|
||||
return otherSet.BeatmapSet.DateAdded.CompareTo(BeatmapSet.DateAdded);
|
||||
comparison = otherSet.BeatmapSet.DateAdded.CompareTo(BeatmapSet.DateAdded);
|
||||
break;
|
||||
|
||||
case SortMode.DateRanked:
|
||||
// Beatmaps which have no ranked date should already be filtered away in this mode.
|
||||
if (BeatmapSet.DateRanked == null || otherSet.BeatmapSet.DateRanked == null)
|
||||
return 0;
|
||||
break;
|
||||
|
||||
return otherSet.BeatmapSet.DateRanked.Value.CompareTo(BeatmapSet.DateRanked.Value);
|
||||
comparison = otherSet.BeatmapSet.DateRanked.Value.CompareTo(BeatmapSet.DateRanked.Value);
|
||||
break;
|
||||
|
||||
case SortMode.LastPlayed:
|
||||
return -compareUsingAggregateMax(otherSet, b => (b.LastPlayed ?? DateTimeOffset.MinValue).ToUnixTimeSeconds());
|
||||
comparison = -compareUsingAggregateMax(otherSet, b => (b.LastPlayed ?? DateTimeOffset.MinValue).ToUnixTimeSeconds());
|
||||
break;
|
||||
|
||||
case SortMode.BPM:
|
||||
return compareUsingAggregateMax(otherSet, b => b.BPM);
|
||||
comparison = compareUsingAggregateMax(otherSet, b => b.BPM);
|
||||
break;
|
||||
|
||||
case SortMode.Length:
|
||||
return compareUsingAggregateMax(otherSet, b => b.Length);
|
||||
comparison = compareUsingAggregateMax(otherSet, b => b.Length);
|
||||
break;
|
||||
|
||||
case SortMode.Difficulty:
|
||||
return compareUsingAggregateMax(otherSet, b => b.StarRating);
|
||||
comparison = compareUsingAggregateMax(otherSet, b => b.StarRating);
|
||||
break;
|
||||
|
||||
case SortMode.DateSubmitted:
|
||||
// Beatmaps which have no submitted date should already be filtered away in this mode.
|
||||
if (BeatmapSet.DateSubmitted == null || otherSet.BeatmapSet.DateSubmitted == null)
|
||||
return 0;
|
||||
break;
|
||||
|
||||
return otherSet.BeatmapSet.DateSubmitted.Value.CompareTo(BeatmapSet.DateSubmitted.Value);
|
||||
comparison = otherSet.BeatmapSet.DateSubmitted.Value.CompareTo(BeatmapSet.DateSubmitted.Value);
|
||||
break;
|
||||
}
|
||||
|
||||
if (comparison != 0) return comparison;
|
||||
|
||||
// If the initial sort could not differentiate, attempt to use DateAdded to order sets in a stable fashion.
|
||||
// The directionality of this matches the current SortMode.DateAdded, but we may want to reconsider if that becomes a user decision (ie. asc / desc).
|
||||
comparison = otherSet.BeatmapSet.DateAdded.CompareTo(BeatmapSet.DateAdded);
|
||||
|
||||
if (comparison != 0) return comparison;
|
||||
|
||||
// If DateAdded fails to break the tie, fallback to our internal GUID for stability.
|
||||
// This basically means it's a stable random sort.
|
||||
return otherSet.BeatmapSet.ID.CompareTo(BeatmapSet.ID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -132,8 +155,8 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
bool filtered = Items.All(i => i.Filtered.Value);
|
||||
|
||||
filtered |= criteria.Sort == SortMode.DateRanked && BeatmapSet?.DateRanked == null;
|
||||
filtered |= criteria.Sort == SortMode.DateSubmitted && BeatmapSet?.DateSubmitted == null;
|
||||
filtered |= criteria.Sort == SortMode.DateRanked && BeatmapSet.DateRanked == null;
|
||||
filtered |= criteria.Sort == SortMode.DateSubmitted && BeatmapSet.DateSubmitted == null;
|
||||
|
||||
Filtered.Value = filtered;
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -26,7 +24,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
/// <summary>
|
||||
/// The last selected item.
|
||||
/// </summary>
|
||||
protected CarouselItem LastSelected { get; private set; }
|
||||
protected CarouselItem? LastSelected { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// We need to keep track of the index for cases where the selection is removed but we want to select a new item based on its old location.
|
||||
@ -112,7 +110,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
/// Finds the item this group would select next if it attempted selection
|
||||
/// </summary>
|
||||
/// <returns>An unfiltered item nearest to the last selected one or null if all items are filtered</returns>
|
||||
protected virtual CarouselItem GetNextToSelect()
|
||||
protected virtual CarouselItem? GetNextToSelect()
|
||||
{
|
||||
if (Items.Count == 0)
|
||||
return null;
|
||||
@ -141,7 +139,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
protected virtual void PerformSelection()
|
||||
{
|
||||
CarouselItem nextToSelect = GetNextToSelect();
|
||||
CarouselItem? nextToSelect = GetNextToSelect();
|
||||
|
||||
if (nextToSelect != null)
|
||||
nextToSelect.State.Value = CarouselItemState.Selected;
|
||||
@ -149,7 +147,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
updateSelected(null);
|
||||
}
|
||||
|
||||
private void updateSelected(CarouselItem newSelection)
|
||||
private void updateSelected(CarouselItem? newSelection)
|
||||
{
|
||||
if (newSelection != null)
|
||||
LastSelected = newSelection;
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
@ -95,9 +93,9 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
public partial class HoverLayer : HoverSampleDebounceComponent
|
||||
{
|
||||
private Sample sampleHover;
|
||||
private Sample? sampleHover;
|
||||
|
||||
private Box box;
|
||||
private Box box = null!;
|
||||
|
||||
public HoverLayer()
|
||||
{
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using osu.Framework.Bindables;
|
||||
|
||||
@ -43,7 +41,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
/// <summary>
|
||||
/// Create a fresh drawable version of this item.
|
||||
/// </summary>
|
||||
public abstract DrawableCarouselItem CreateDrawableRepresentation();
|
||||
public abstract DrawableCarouselItem? CreateDrawableRepresentation();
|
||||
|
||||
public virtual void Filter(FilterCriteria criteria)
|
||||
{
|
||||
@ -51,7 +49,12 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
public virtual int CompareTo(FilterCriteria criteria, CarouselItem other) => ItemID.CompareTo(other.ItemID);
|
||||
|
||||
public int CompareTo(CarouselItem other) => CarouselYPosition.CompareTo(other.CarouselYPosition);
|
||||
public int CompareTo(CarouselItem? other)
|
||||
{
|
||||
if (other == null) return 1;
|
||||
|
||||
return CarouselYPosition.CompareTo(other.CarouselYPosition);
|
||||
}
|
||||
}
|
||||
|
||||
public enum CarouselItemState
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@ -47,31 +45,31 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
private readonly BeatmapInfo beatmapInfo;
|
||||
|
||||
private Sprite background;
|
||||
private Sprite background = null!;
|
||||
|
||||
private Action<BeatmapInfo> startRequested;
|
||||
private Action<BeatmapInfo> editRequested;
|
||||
private Action<BeatmapInfo> hideRequested;
|
||||
private Action<BeatmapInfo>? startRequested;
|
||||
private Action<BeatmapInfo>? editRequested;
|
||||
private Action<BeatmapInfo>? hideRequested;
|
||||
|
||||
private Triangles triangles;
|
||||
private Triangles triangles = null!;
|
||||
|
||||
private StarCounter starCounter;
|
||||
private DifficultyIcon difficultyIcon;
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private BeatmapSetOverlay beatmapOverlay { get; set; }
|
||||
private StarCounter starCounter = null!;
|
||||
private DifficultyIcon difficultyIcon = null!;
|
||||
|
||||
[Resolved]
|
||||
private BeatmapDifficultyCache difficultyCache { get; set; }
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private ManageCollectionsDialog manageCollectionsDialog { get; set; }
|
||||
private BeatmapSetOverlay? beatmapOverlay { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private RealmAccess realm { get; set; }
|
||||
private BeatmapDifficultyCache difficultyCache { get; set; } = null!;
|
||||
|
||||
private IBindable<StarDifficulty?> starDifficultyBindable;
|
||||
private CancellationTokenSource starDifficultyCancellationSource;
|
||||
[Resolved]
|
||||
private ManageCollectionsDialog? manageCollectionsDialog { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private RealmAccess realm { get; set; } = null!;
|
||||
|
||||
private IBindable<StarDifficulty?> starDifficultyBindable = null!;
|
||||
private CancellationTokenSource? starDifficultyCancellationSource;
|
||||
|
||||
public DrawableCarouselBeatmap(CarouselBeatmap panel)
|
||||
{
|
||||
@ -79,8 +77,8 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
Item = panel;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(BeatmapManager manager, SongSelect songSelect)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(BeatmapManager? manager, SongSelect? songSelect)
|
||||
{
|
||||
Header.Height = height;
|
||||
|
||||
@ -194,7 +192,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
if (Item.State.Value == CarouselItemState.Selected)
|
||||
if (Item?.State.Value == CarouselItemState.Selected)
|
||||
startRequested?.Invoke(beatmapInfo);
|
||||
|
||||
return base.OnClick(e);
|
||||
@ -202,13 +200,13 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
protected override void ApplyState()
|
||||
{
|
||||
if (Item.State.Value != CarouselItemState.Collapsed && Alpha == 0)
|
||||
if (Item?.State.Value != CarouselItemState.Collapsed && Alpha == 0)
|
||||
starCounter.ReplayAnimation();
|
||||
|
||||
starDifficultyCancellationSource?.Cancel();
|
||||
|
||||
// Only compute difficulty when the item is visible.
|
||||
if (Item.State.Value != CarouselItemState.Collapsed)
|
||||
if (Item?.State.Value != CarouselItemState.Collapsed)
|
||||
{
|
||||
// We've potentially cancelled the computation above so a new bindable is required.
|
||||
starDifficultyBindable = difficultyCache.GetBindableDifficulty(beatmapInfo, (starDifficultyCancellationSource = new CancellationTokenSource()).Token);
|
||||
|
@ -1,14 +1,11 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -27,30 +24,28 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
{
|
||||
public const float HEIGHT = MAX_HEIGHT;
|
||||
|
||||
private Action<BeatmapSetInfo> restoreHiddenRequested;
|
||||
private Action<int> viewDetails;
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private IDialogOverlay dialogOverlay { get; set; }
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private ManageCollectionsDialog manageCollectionsDialog { get; set; }
|
||||
private Action<BeatmapSetInfo> restoreHiddenRequested = null!;
|
||||
private Action<int>? viewDetails;
|
||||
|
||||
[Resolved]
|
||||
private RealmAccess realm { get; set; }
|
||||
private IDialogOverlay? dialogOverlay { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private ManageCollectionsDialog? manageCollectionsDialog { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private RealmAccess realm { get; set; } = null!;
|
||||
|
||||
public IEnumerable<DrawableCarouselItem> DrawableBeatmaps => beatmapContainer?.IsLoaded != true ? Enumerable.Empty<DrawableCarouselItem>() : beatmapContainer.AliveChildren;
|
||||
|
||||
[CanBeNull]
|
||||
private Container<DrawableCarouselItem> beatmapContainer;
|
||||
private Container<DrawableCarouselItem>? beatmapContainer;
|
||||
|
||||
private BeatmapSetInfo beatmapSet;
|
||||
private BeatmapSetInfo beatmapSet = null!;
|
||||
|
||||
[CanBeNull]
|
||||
private Task beatmapsLoadTask;
|
||||
private Task? beatmapsLoadTask;
|
||||
|
||||
[Resolved]
|
||||
private BeatmapManager manager { get; set; }
|
||||
private BeatmapManager manager { get; set; } = null!;
|
||||
|
||||
protected override void FreeAfterUse()
|
||||
{
|
||||
@ -61,8 +56,8 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
ClearTransforms();
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(BeatmapSetOverlay beatmapOverlay)
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(BeatmapSetOverlay? beatmapOverlay)
|
||||
{
|
||||
restoreHiddenRequested = s =>
|
||||
{
|
||||
@ -78,10 +73,11 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
{
|
||||
base.Update();
|
||||
|
||||
Debug.Assert(Item != null);
|
||||
|
||||
// position updates should not occur if the item is filtered away.
|
||||
// this avoids panels flying across the screen only to be eventually off-screen or faded out.
|
||||
if (!Item.Visible)
|
||||
return;
|
||||
if (!Item.Visible) return;
|
||||
|
||||
float targetY = Item.CarouselYPosition;
|
||||
|
||||
@ -151,6 +147,8 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
private void updateBeatmapDifficulties()
|
||||
{
|
||||
Debug.Assert(Item != null);
|
||||
|
||||
var carouselBeatmapSet = (CarouselBeatmapSet)Item;
|
||||
|
||||
var visibleBeatmaps = carouselBeatmapSet.Items.Where(c => c.Visible).ToArray();
|
||||
@ -171,7 +169,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
{
|
||||
X = 100,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ChildrenEnumerable = visibleBeatmaps.Select(c => c.CreateDrawableRepresentation())
|
||||
ChildrenEnumerable = visibleBeatmaps.Select(c => c.CreateDrawableRepresentation()!)
|
||||
};
|
||||
|
||||
beatmapsLoadTask = LoadComponentAsync(beatmapContainer, loaded =>
|
||||
@ -196,10 +194,12 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
float yPos = DrawableCarouselBeatmap.CAROUSEL_BEATMAP_SPACING;
|
||||
|
||||
bool isSelected = Item.State.Value == CarouselItemState.Selected;
|
||||
bool isSelected = Item?.State.Value == CarouselItemState.Selected;
|
||||
|
||||
foreach (var panel in beatmapContainer.Children)
|
||||
{
|
||||
Debug.Assert(panel.Item != null);
|
||||
|
||||
if (isSelected)
|
||||
{
|
||||
panel.MoveToY(yPos, 800, Easing.OutQuint);
|
||||
@ -218,7 +218,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
List<MenuItem> items = new List<MenuItem>();
|
||||
|
||||
if (Item.State.Value == CarouselItemState.NotSelected)
|
||||
if (Item?.State.Value == CarouselItemState.NotSelected)
|
||||
items.Add(new OsuMenuItem("Expand", MenuItemType.Highlighted, () => Item.State.Value = CarouselItemState.Selected));
|
||||
|
||||
if (beatmapSet.OnlineID > 0 && viewDetails != null)
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Diagnostics;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
@ -34,9 +32,9 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) =>
|
||||
Header.ReceivePositionalInputAt(screenSpacePos);
|
||||
|
||||
private CarouselItem item;
|
||||
private CarouselItem? item;
|
||||
|
||||
public CarouselItem Item
|
||||
public CarouselItem? Item
|
||||
{
|
||||
get => item;
|
||||
set
|
||||
@ -105,7 +103,7 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
protected virtual void UpdateItem()
|
||||
{
|
||||
if (item == null)
|
||||
if (Item == null)
|
||||
return;
|
||||
|
||||
Scheduler.AddOnce(ApplyState);
|
||||
@ -128,12 +126,12 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
protected virtual void ApplyState()
|
||||
{
|
||||
Debug.Assert(Item != null);
|
||||
|
||||
// Use the fact that we know the precise height of the item from the model to avoid the need for AutoSize overhead.
|
||||
// Additionally, AutoSize doesn't work well due to content starting off-screen and being masked away.
|
||||
Height = Item.TotalHeight;
|
||||
|
||||
Debug.Assert(Item != null);
|
||||
|
||||
switch (Item.State.Value)
|
||||
{
|
||||
case CarouselItemState.NotSelected:
|
||||
@ -162,6 +160,8 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
protected override bool OnClick(ClickEvent e)
|
||||
{
|
||||
Debug.Assert(Item != null);
|
||||
|
||||
Item.State.Value = CarouselItemState.Selected;
|
||||
return true;
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input.Events;
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Graphics;
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
@ -23,6 +21,8 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
|
||||
private readonly CarouselBeatmapSet carouselSet;
|
||||
|
||||
private FillFlowContainer<DifficultyIcon> iconFlow = null!;
|
||||
|
||||
public SetPanelContent(CarouselBeatmapSet carouselSet)
|
||||
{
|
||||
this.carouselSet = carouselSet;
|
||||
@ -84,13 +84,12 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
TextPadding = new MarginPadding { Horizontal = 8, Vertical = 2 },
|
||||
Status = beatmapSet.Status
|
||||
},
|
||||
new FillFlowContainer<DifficultyIcon>
|
||||
iconFlow = new FillFlowContainer<DifficultyIcon>
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Origin = Anchor.CentreLeft,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Spacing = new Vector2(3),
|
||||
ChildrenEnumerable = getDifficultyIcons(),
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -98,6 +97,12 @@ namespace osu.Game.Screens.Select.Carousel
|
||||
};
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
iconFlow.ChildrenEnumerable = getDifficultyIcons();
|
||||
}
|
||||
|
||||
private const int maximum_difficulty_icons = 18;
|
||||
|
||||
private IEnumerable<DifficultyIcon> getDifficultyIcons()
|
||||
|
@ -30,14 +30,16 @@ namespace osu.Game.Screens.Select.Details
|
||||
{
|
||||
public partial class AdvancedStats : Container
|
||||
{
|
||||
[Resolved]
|
||||
private BeatmapDifficultyCache difficultyCache { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private IBindable<IReadOnlyList<Mod>> mods { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private IBindable<RulesetInfo> ruleset { get; set; }
|
||||
private OsuGameBase game { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private BeatmapDifficultyCache difficultyCache { get; set; }
|
||||
private IBindable<RulesetInfo> gameRuleset;
|
||||
|
||||
protected readonly StatisticRow FirstValue, HpDrain, Accuracy, ApproachRate;
|
||||
private readonly StatisticRow starDifficulty;
|
||||
@ -84,7 +86,13 @@ namespace osu.Game.Screens.Select.Details
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
ruleset.BindValueChanged(_ => updateStatistics());
|
||||
// the cached ruleset bindable might be a decoupled bindable provided by SongSelect,
|
||||
// which we can't rely on in combination with the game-wide selected mods list,
|
||||
// since mods could be updated to the new ruleset instances while the decoupled bindable is held behind,
|
||||
// therefore resulting in performing difficulty calculation with invalid states.
|
||||
gameRuleset = game.Ruleset.GetBoundCopy();
|
||||
gameRuleset.BindValueChanged(_ => updateStatistics());
|
||||
|
||||
mods.BindValueChanged(modsChanged, true);
|
||||
}
|
||||
|
||||
@ -142,7 +150,14 @@ namespace osu.Game.Screens.Select.Details
|
||||
|
||||
private CancellationTokenSource starDifficultyCancellationSource;
|
||||
|
||||
private void updateStarDifficulty()
|
||||
/// <summary>
|
||||
/// Updates the displayed star difficulty statistics with the values provided by the currently-selected beatmap, ruleset, and selected mods.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is scheduled to avoid scenarios wherein a ruleset changes first before selected mods do,
|
||||
/// potentially resulting in failure during difficulty calculation due to incomplete bindable state updates.
|
||||
/// </remarks>
|
||||
private void updateStarDifficulty() => Scheduler.AddOnce(() =>
|
||||
{
|
||||
starDifficultyCancellationSource?.Cancel();
|
||||
|
||||
@ -151,8 +166,8 @@ namespace osu.Game.Screens.Select.Details
|
||||
|
||||
starDifficultyCancellationSource = new CancellationTokenSource();
|
||||
|
||||
var normalStarDifficultyTask = difficultyCache.GetDifficultyAsync(BeatmapInfo, ruleset.Value, null, starDifficultyCancellationSource.Token);
|
||||
var moddedStarDifficultyTask = difficultyCache.GetDifficultyAsync(BeatmapInfo, ruleset.Value, mods.Value, starDifficultyCancellationSource.Token);
|
||||
var normalStarDifficultyTask = difficultyCache.GetDifficultyAsync(BeatmapInfo, gameRuleset.Value, null, starDifficultyCancellationSource.Token);
|
||||
var moddedStarDifficultyTask = difficultyCache.GetDifficultyAsync(BeatmapInfo, gameRuleset.Value, mods.Value, starDifficultyCancellationSource.Token);
|
||||
|
||||
Task.WhenAll(normalStarDifficultyTask, moddedStarDifficultyTask).ContinueWith(_ => Schedule(() =>
|
||||
{
|
||||
@ -164,7 +179,7 @@ namespace osu.Game.Screens.Select.Details
|
||||
|
||||
starDifficulty.Value = ((float)normalDifficulty.Value.Stars, (float)moddedDifficulty.Value.Stars);
|
||||
}), starDifficultyCancellationSource.Token, TaskContinuationOptions.OnlyOnRanToCompletion, TaskScheduler.Current);
|
||||
}
|
||||
});
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
|
@ -104,6 +104,9 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
|
||||
protected override APIRequest? FetchScores(CancellationToken cancellationToken)
|
||||
{
|
||||
scoreRetrievalRequest?.Cancel();
|
||||
scoreRetrievalRequest = null;
|
||||
|
||||
var fetchBeatmapInfo = BeatmapInfo;
|
||||
|
||||
if (fetchBeatmapInfo == null)
|
||||
@ -152,14 +155,21 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
else if (filterMods)
|
||||
requestMods = mods.Value;
|
||||
|
||||
scoreRetrievalRequest = new GetScoresRequest(fetchBeatmapInfo, fetchRuleset, Scope, requestMods);
|
||||
var newRequest = new GetScoresRequest(fetchBeatmapInfo, fetchRuleset, Scope, requestMods);
|
||||
newRequest.Success += response => Schedule(() =>
|
||||
{
|
||||
// Request may have changed since fetch request.
|
||||
// Can't rely on request cancellation due to Schedule inside SetScores so let's play it safe.
|
||||
if (!newRequest.Equals(scoreRetrievalRequest))
|
||||
return;
|
||||
|
||||
scoreRetrievalRequest.Success += response => SetScores(
|
||||
scoreManager.OrderByTotalScore(response.Scores.Select(s => s.ToScoreInfo(rulesets, fetchBeatmapInfo))),
|
||||
response.UserScore?.CreateScoreInfo(rulesets, fetchBeatmapInfo)
|
||||
);
|
||||
SetScores(
|
||||
scoreManager.OrderByTotalScore(response.Scores.Select(s => s.ToScoreInfo(rulesets, fetchBeatmapInfo))),
|
||||
response.UserScore?.CreateScoreInfo(rulesets, fetchBeatmapInfo)
|
||||
);
|
||||
});
|
||||
|
||||
return scoreRetrievalRequest;
|
||||
return scoreRetrievalRequest = newRequest;
|
||||
}
|
||||
|
||||
protected override LeaderboardScore CreateDrawableScore(ScoreInfo model, int index) => new LeaderboardScore(model, index, IsOnlineScope)
|
||||
|
@ -8,6 +8,7 @@ using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Overlays;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
@ -24,7 +25,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
private OsuScreen? playerLoader;
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
[Resolved]
|
||||
private INotificationOverlay? notifications { get; set; }
|
||||
|
||||
public override bool AllowExternalScreenChange => true;
|
||||
@ -89,7 +90,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
notifications?.Post(new SimpleNotification
|
||||
{
|
||||
Text = "The current ruleset doesn't have an autoplay mod avalaible!"
|
||||
Text = NotificationsStrings.NoAutoplayMod
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
@ -36,7 +34,8 @@ using osu.Framework.Input.Bindings;
|
||||
using osu.Game.Collections;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using System.Diagnostics;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
@ -49,7 +48,7 @@ namespace osu.Game.Screens.Select
|
||||
protected const float BACKGROUND_BLUR = 20;
|
||||
private const float left_area_padding = 20;
|
||||
|
||||
public FilterControl FilterControl { get; private set; }
|
||||
public FilterControl FilterControl { get; private set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this song select instance should take control of the global track,
|
||||
@ -64,74 +63,81 @@ namespace osu.Game.Screens.Select
|
||||
/// <summary>
|
||||
/// Can be null if <see cref="ShowFooter"/> is false.
|
||||
/// </summary>
|
||||
protected BeatmapOptionsOverlay BeatmapOptions { get; private set; }
|
||||
protected BeatmapOptionsOverlay BeatmapOptions { get; private set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Can be null if <see cref="ShowFooter"/> is false.
|
||||
/// </summary>
|
||||
protected Footer Footer { get; private set; }
|
||||
protected Footer? Footer { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Contains any panel which is triggered by a footer button.
|
||||
/// Helps keep them located beneath the footer itself.
|
||||
/// </summary>
|
||||
protected Container FooterPanels { get; private set; }
|
||||
protected Container FooterPanels { get; private set; } = null!;
|
||||
|
||||
/// <summary>
|
||||
/// Whether entering editor mode should be allowed.
|
||||
/// </summary>
|
||||
public virtual bool AllowEditing => true;
|
||||
|
||||
public bool BeatmapSetsLoaded => IsLoaded && Carousel?.BeatmapSetsLoaded == true;
|
||||
public bool BeatmapSetsLoaded => IsLoaded && Carousel.BeatmapSetsLoaded;
|
||||
|
||||
[Resolved]
|
||||
private Bindable<IReadOnlyList<Mod>> selectedMods { get; set; }
|
||||
private Bindable<IReadOnlyList<Mod>> selectedMods { get; set; } = null!;
|
||||
|
||||
protected BeatmapCarousel Carousel { get; private set; }
|
||||
protected BeatmapCarousel Carousel { get; private set; } = null!;
|
||||
|
||||
private ParallaxContainer wedgeBackground;
|
||||
private ParallaxContainer wedgeBackground = null!;
|
||||
|
||||
protected Container LeftArea { get; private set; }
|
||||
protected Container LeftArea { get; private set; } = null!;
|
||||
|
||||
private BeatmapInfoWedge beatmapInfoWedge;
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private IDialogOverlay dialogOverlay { get; set; }
|
||||
private BeatmapInfoWedge beatmapInfoWedge = null!;
|
||||
|
||||
[Resolved]
|
||||
private BeatmapManager beatmaps { get; set; }
|
||||
private IDialogOverlay? dialogOverlay { get; set; }
|
||||
|
||||
protected ModSelectOverlay ModSelect { get; private set; }
|
||||
[Resolved]
|
||||
private BeatmapManager beatmaps { get; set; } = null!;
|
||||
|
||||
protected Sample SampleConfirm { get; private set; }
|
||||
protected ModSelectOverlay ModSelect { get; private set; } = null!;
|
||||
|
||||
private Sample sampleChangeDifficulty;
|
||||
private Sample sampleChangeBeatmap;
|
||||
protected Sample? SampleConfirm { get; private set; }
|
||||
|
||||
private Container carouselContainer;
|
||||
private Sample sampleChangeDifficulty = null!;
|
||||
private Sample sampleChangeBeatmap = null!;
|
||||
|
||||
protected BeatmapDetailArea BeatmapDetails { get; private set; }
|
||||
private Container carouselContainer = null!;
|
||||
|
||||
private FooterButtonOptions beatmapOptionsButton;
|
||||
protected BeatmapDetailArea BeatmapDetails { get; private set; } = null!;
|
||||
|
||||
private FooterButtonOptions beatmapOptionsButton = null!;
|
||||
|
||||
private readonly Bindable<RulesetInfo> decoupledRuleset = new Bindable<RulesetInfo>();
|
||||
|
||||
private double audioFeedbackLastPlaybackTime;
|
||||
|
||||
[CanBeNull]
|
||||
private IDisposable modSelectOverlayRegistration;
|
||||
private IDisposable? modSelectOverlayRegistration;
|
||||
|
||||
[Resolved]
|
||||
private MusicController music { get; set; }
|
||||
private MusicController music { get; set; } = null!;
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
internal IOverlayManager OverlayManager { get; private set; }
|
||||
[Resolved]
|
||||
internal IOverlayManager? OverlayManager { get; private set; }
|
||||
|
||||
private Bindable<bool> configBackgroundBlur { get; set; } = new BindableBool();
|
||||
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(AudioManager audio, OsuColour colours, ManageCollectionsDialog manageCollectionsDialog, DifficultyRecommender recommender)
|
||||
private void load(AudioManager audio, OsuColour colours, ManageCollectionsDialog? manageCollectionsDialog, DifficultyRecommender? recommender, OsuConfigManager config)
|
||||
{
|
||||
// initial value transfer is required for FilterControl (it uses our re-cached bindables in its async load for the initial filter).
|
||||
transferRulesetValue();
|
||||
configBackgroundBlur = config.GetBindable<bool>(OsuSetting.SongSelectBackgroundBlur);
|
||||
configBackgroundBlur.BindValueChanged(e =>
|
||||
{
|
||||
if (!this.IsCurrentScreen())
|
||||
return;
|
||||
|
||||
ApplyToBackground(b => b.BlurAmount.Value = e.NewValue ? BACKGROUND_BLUR : 0);
|
||||
});
|
||||
|
||||
LoadComponentAsync(Carousel = new BeatmapCarousel
|
||||
{
|
||||
@ -146,6 +152,9 @@ namespace osu.Game.Screens.Select
|
||||
GetRecommendedBeatmap = s => recommender?.GetRecommendedBeatmap(s),
|
||||
}, c => carouselContainer.Child = c);
|
||||
|
||||
// initial value transfer is required for FilterControl (it uses our re-cached bindables in its async load for the initial filter).
|
||||
transferRulesetValue();
|
||||
|
||||
AddRangeInternal(new Drawable[]
|
||||
{
|
||||
new ResetScrollContainer(() => Carousel.ScrollToSelected())
|
||||
@ -273,7 +282,7 @@ namespace osu.Game.Screens.Select
|
||||
BeatmapOptions = new BeatmapOptionsOverlay(),
|
||||
}
|
||||
},
|
||||
Footer = new Footer(),
|
||||
Footer = new Footer()
|
||||
});
|
||||
}
|
||||
|
||||
@ -318,7 +327,7 @@ namespace osu.Game.Screens.Select
|
||||
/// Creates the buttons to be displayed in the footer.
|
||||
/// </summary>
|
||||
/// <returns>A set of <see cref="FooterButton"/> and an optional <see cref="OverlayContainer"/> which the button opens when pressed.</returns>
|
||||
protected virtual IEnumerable<(FooterButton, OverlayContainer)> CreateFooterButtons() => new (FooterButton, OverlayContainer)[]
|
||||
protected virtual IEnumerable<(FooterButton, OverlayContainer?)> CreateFooterButtons() => new (FooterButton, OverlayContainer?)[]
|
||||
{
|
||||
(new FooterButtonMods { Current = Mods }, ModSelect),
|
||||
(new FooterButtonRandom
|
||||
@ -339,7 +348,7 @@ namespace osu.Game.Screens.Select
|
||||
Carousel.Filter(criteria, shouldDebounce);
|
||||
}
|
||||
|
||||
private DependencyContainer dependencies;
|
||||
private DependencyContainer dependencies = null!;
|
||||
|
||||
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||
{
|
||||
@ -357,7 +366,7 @@ namespace osu.Game.Screens.Select
|
||||
/// </summary>
|
||||
protected abstract BeatmapDetailArea CreateBeatmapDetailArea();
|
||||
|
||||
public void Edit(BeatmapInfo beatmapInfo = null)
|
||||
public void Edit(BeatmapInfo? beatmapInfo = null)
|
||||
{
|
||||
if (!AllowEditing)
|
||||
throw new InvalidOperationException($"Attempted to edit when {nameof(AllowEditing)} is disabled");
|
||||
@ -372,7 +381,7 @@ namespace osu.Game.Screens.Select
|
||||
/// <param name="beatmapInfo">An optional beatmap to override the current carousel selection.</param>
|
||||
/// <param name="ruleset">An optional ruleset to override the current carousel selection.</param>
|
||||
/// <param name="customStartAction">An optional custom action to perform instead of <see cref="OnStart"/>.</param>
|
||||
public void FinaliseSelection(BeatmapInfo beatmapInfo = null, RulesetInfo ruleset = null, Action customStartAction = null)
|
||||
public void FinaliseSelection(BeatmapInfo? beatmapInfo = null, RulesetInfo? ruleset = null, Action? customStartAction = null)
|
||||
{
|
||||
// This is very important as we have not yet bound to screen-level bindables before the carousel load is completed.
|
||||
if (!Carousel.BeatmapSetsLoaded)
|
||||
@ -419,9 +428,9 @@ namespace osu.Game.Screens.Select
|
||||
/// <returns>If a resultant action occurred that takes the user away from SongSelect.</returns>
|
||||
protected abstract bool OnStart();
|
||||
|
||||
private ScheduledDelegate selectionChangedDebounce;
|
||||
private ScheduledDelegate? selectionChangedDebounce;
|
||||
|
||||
private void updateCarouselSelection(ValueChangedEvent<WorkingBeatmap> e = null)
|
||||
private void updateCarouselSelection(ValueChangedEvent<WorkingBeatmap>? e = null)
|
||||
{
|
||||
var beatmap = e?.NewValue ?? Beatmap.Value;
|
||||
if (beatmap is DummyWorkingBeatmap || !this.IsCurrentScreen()) return;
|
||||
@ -451,11 +460,11 @@ namespace osu.Game.Screens.Select
|
||||
}
|
||||
|
||||
// We need to keep track of the last selected beatmap ignoring debounce to play the correct selection sounds.
|
||||
private BeatmapInfo beatmapInfoPrevious;
|
||||
private BeatmapInfo beatmapInfoNoDebounce;
|
||||
private RulesetInfo rulesetNoDebounce;
|
||||
private BeatmapInfo? beatmapInfoPrevious;
|
||||
private BeatmapInfo? beatmapInfoNoDebounce;
|
||||
private RulesetInfo? rulesetNoDebounce;
|
||||
|
||||
private void updateSelectedBeatmap(BeatmapInfo beatmapInfo)
|
||||
private void updateSelectedBeatmap(BeatmapInfo? beatmapInfo)
|
||||
{
|
||||
if (beatmapInfo == null && beatmapInfoNoDebounce == null)
|
||||
return;
|
||||
@ -467,7 +476,7 @@ namespace osu.Game.Screens.Select
|
||||
performUpdateSelected();
|
||||
}
|
||||
|
||||
private void updateSelectedRuleset(RulesetInfo ruleset)
|
||||
private void updateSelectedRuleset(RulesetInfo? ruleset)
|
||||
{
|
||||
if (ruleset == null && rulesetNoDebounce == null)
|
||||
return;
|
||||
@ -485,7 +494,7 @@ namespace osu.Game.Screens.Select
|
||||
private void performUpdateSelected()
|
||||
{
|
||||
var beatmap = beatmapInfoNoDebounce;
|
||||
var ruleset = rulesetNoDebounce;
|
||||
RulesetInfo? ruleset = rulesetNoDebounce;
|
||||
|
||||
selectionChangedDebounce?.Cancel();
|
||||
|
||||
@ -694,6 +703,7 @@ namespace osu.Game.Screens.Select
|
||||
isHandlingLooping = true;
|
||||
|
||||
ensureTrackLooping(Beatmap.Value, TrackChangeDirection.None);
|
||||
|
||||
music.TrackChanged += ensureTrackLooping;
|
||||
}
|
||||
|
||||
@ -728,7 +738,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
decoupledRuleset.UnbindAll();
|
||||
|
||||
if (music != null)
|
||||
if (music.IsNotNull())
|
||||
music.TrackChanged -= ensureTrackLooping;
|
||||
|
||||
modSelectOverlayRegistration?.Dispose();
|
||||
@ -744,7 +754,7 @@ namespace osu.Game.Screens.Select
|
||||
ApplyToBackground(backgroundModeBeatmap =>
|
||||
{
|
||||
backgroundModeBeatmap.Beatmap = beatmap;
|
||||
backgroundModeBeatmap.BlurAmount.Value = BACKGROUND_BLUR;
|
||||
backgroundModeBeatmap.BlurAmount.Value = configBackgroundBlur.Value ? BACKGROUND_BLUR : 0f;
|
||||
backgroundModeBeatmap.FadeColour(Color4.White, 250);
|
||||
});
|
||||
|
||||
@ -763,7 +773,7 @@ namespace osu.Game.Screens.Select
|
||||
}
|
||||
}
|
||||
|
||||
private readonly WeakReference<ITrack> lastTrack = new WeakReference<ITrack>(null);
|
||||
private readonly WeakReference<ITrack?> lastTrack = new WeakReference<ITrack?>(null);
|
||||
|
||||
/// <summary>
|
||||
/// Ensures some music is playing for the current track.
|
||||
@ -864,18 +874,19 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
// if we have a pending filter operation, we want to run it now.
|
||||
// it could change selection (ie. if the ruleset has been changed).
|
||||
Carousel?.FlushPendingFilterOperations();
|
||||
Carousel.FlushPendingFilterOperations();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private void delete(BeatmapSetInfo beatmap)
|
||||
private void delete(BeatmapSetInfo? beatmap)
|
||||
{
|
||||
if (beatmap == null) return;
|
||||
|
||||
dialogOverlay?.Push(new BeatmapDeleteDialog(beatmap));
|
||||
}
|
||||
|
||||
private void clearScores(BeatmapInfo beatmapInfo)
|
||||
private void clearScores(BeatmapInfo? beatmapInfo)
|
||||
{
|
||||
if (beatmapInfo == null) return;
|
||||
|
||||
@ -950,7 +961,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private partial class ResetScrollContainer : Container
|
||||
{
|
||||
private readonly Action onHoverAction;
|
||||
private readonly Action? onHoverAction;
|
||||
|
||||
public ResetScrollContainer(Action onHoverAction)
|
||||
{
|
||||
|
Reference in New Issue
Block a user