Merge branch 'master' into spectator-replay-watcher

This commit is contained in:
Dean Herbert
2020-10-30 00:25:17 +09:00
committed by GitHub
22 changed files with 359 additions and 102 deletions

View File

@ -34,6 +34,8 @@ If you are looking to install or test osu! without setting up a development envi
| [Windows (x64)](https://github.com/ppy/osu/releases/latest/download/install.exe) | [macOS 10.12+](https://github.com/ppy/osu/releases/latest/download/osu.app.zip) | [Linux (x64)](https://github.com/ppy/osu/releases/latest/download/osu.AppImage) | [iOS(iOS 10+)](https://osu.ppy.sh/home/testflight) | [Android (5+)](https://github.com/ppy/osu/releases/latest/download/sh.ppy.osulazer.apk) | [Windows (x64)](https://github.com/ppy/osu/releases/latest/download/install.exe) | [macOS 10.12+](https://github.com/ppy/osu/releases/latest/download/osu.app.zip) | [Linux (x64)](https://github.com/ppy/osu/releases/latest/download/osu.AppImage) | [iOS(iOS 10+)](https://osu.ppy.sh/home/testflight) | [Android (5+)](https://github.com/ppy/osu/releases/latest/download/sh.ppy.osulazer.apk)
| ------------- | ------------- | ------------- | ------------- | ------------- | | ------------- | ------------- | ------------- | ------------- | ------------- |
- The iOS testflight link may fill up (Apple has a hard limit of 10,000 users). We reset it occasionally when this happens. Please do not ask about this. Check back regularly for link resets or follow [peppy](https://twitter.com/ppy) on twitter for announcements of link resets.
- When running on Windows 7 or 8.1, **[additional prerequisites](https://docs.microsoft.com/en-us/dotnet/core/install/dependencies?tabs=netcore31&pivots=os-windows)** may be required to correctly run .NET Core applications if your operating system is not up-to-date with the latest service packs. - When running on Windows 7 or 8.1, **[additional prerequisites](https://docs.microsoft.com/en-us/dotnet/core/install/dependencies?tabs=netcore31&pivots=os-windows)** may be required to correctly run .NET Core applications if your operating system is not up-to-date with the latest service packs.
If your platform is not listed above, there is still a chance you can manually build it by following the instructions below. If your platform is not listed above, there is still a chance you can manually build it by following the instructions below.

View File

@ -52,6 +52,6 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1016.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.1016.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.1019.0" /> <PackageReference Include="ppy.osu.Framework.Android" Version="2020.1029.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -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.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Performance;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Taiko.Objects.Drawables; using osu.Game.Rulesets.Taiko.Objects.Drawables;
using osu.Game.Rulesets.UI.Scrolling; using osu.Game.Rulesets.UI.Scrolling;

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System.Linq;
using NUnit.Framework; using NUnit.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
@ -27,6 +28,9 @@ namespace osu.Game.Tests.Visual.UserInterface
OsuSpriteText category; OsuSpriteText category;
OsuSpriteText genre; OsuSpriteText genre;
OsuSpriteText language; OsuSpriteText language;
OsuSpriteText extra;
OsuSpriteText ranks;
OsuSpriteText played;
Add(control = new BeatmapListingSearchControl Add(control = new BeatmapListingSearchControl
{ {
@ -46,6 +50,9 @@ namespace osu.Game.Tests.Visual.UserInterface
category = new OsuSpriteText(), category = new OsuSpriteText(),
genre = new OsuSpriteText(), genre = new OsuSpriteText(),
language = new OsuSpriteText(), language = new OsuSpriteText(),
extra = new OsuSpriteText(),
ranks = new OsuSpriteText(),
played = new OsuSpriteText()
} }
}); });
@ -54,6 +61,9 @@ namespace osu.Game.Tests.Visual.UserInterface
control.Category.BindValueChanged(c => category.Text = $"Category: {c.NewValue}", true); control.Category.BindValueChanged(c => category.Text = $"Category: {c.NewValue}", true);
control.Genre.BindValueChanged(g => genre.Text = $"Genre: {g.NewValue}", true); control.Genre.BindValueChanged(g => genre.Text = $"Genre: {g.NewValue}", true);
control.Language.BindValueChanged(l => language.Text = $"Language: {l.NewValue}", true); control.Language.BindValueChanged(l => language.Text = $"Language: {l.NewValue}", true);
control.Extra.BindCollectionChanged((u, v) => extra.Text = $"Extra: {(control.Extra.Any() ? string.Join('.', control.Extra.Select(i => i.ToString().ToLowerInvariant())) : "")}", true);
control.Ranks.BindCollectionChanged((u, v) => ranks.Text = $"Ranks: {(control.Ranks.Any() ? string.Join('.', control.Ranks.Select(i => i.ToString())) : "")}", true);
control.Played.BindValueChanged(p => played.Text = $"Played: {p.NewValue}", true);
} }
[Test] [Test]

View File

@ -1,11 +1,15 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using System.Linq;
using JetBrains.Annotations;
using osu.Framework.IO.Network; using osu.Framework.IO.Network;
using osu.Game.Extensions; using osu.Game.Extensions;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Overlays.BeatmapListing; using osu.Game.Overlays.BeatmapListing;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Scoring;
namespace osu.Game.Online.API.Requests namespace osu.Game.Online.API.Requests
{ {
@ -21,6 +25,14 @@ namespace osu.Game.Online.API.Requests
public SearchLanguage Language { get; } public SearchLanguage Language { get; }
[CanBeNull]
public IReadOnlyCollection<SearchExtra> Extra { get; }
public SearchPlayed Played { get; }
[CanBeNull]
public IReadOnlyCollection<ScoreRank> Ranks { get; }
private readonly string query; private readonly string query;
private readonly RulesetInfo ruleset; private readonly RulesetInfo ruleset;
private readonly Cursor cursor; private readonly Cursor cursor;
@ -35,7 +47,10 @@ namespace osu.Game.Online.API.Requests
SortCriteria sortCriteria = SortCriteria.Ranked, SortCriteria sortCriteria = SortCriteria.Ranked,
SortDirection sortDirection = SortDirection.Descending, SortDirection sortDirection = SortDirection.Descending,
SearchGenre genre = SearchGenre.Any, SearchGenre genre = SearchGenre.Any,
SearchLanguage language = SearchLanguage.Any) SearchLanguage language = SearchLanguage.Any,
IReadOnlyCollection<SearchExtra> extra = null,
IReadOnlyCollection<ScoreRank> ranks = null,
SearchPlayed played = SearchPlayed.Any)
{ {
this.query = string.IsNullOrEmpty(query) ? string.Empty : System.Uri.EscapeDataString(query); this.query = string.IsNullOrEmpty(query) ? string.Empty : System.Uri.EscapeDataString(query);
this.ruleset = ruleset; this.ruleset = ruleset;
@ -46,6 +61,9 @@ namespace osu.Game.Online.API.Requests
SortDirection = sortDirection; SortDirection = sortDirection;
Genre = genre; Genre = genre;
Language = language; Language = language;
Extra = extra;
Ranks = ranks;
Played = played;
} }
protected override WebRequest CreateWebRequest() protected override WebRequest CreateWebRequest()
@ -66,6 +84,15 @@ namespace osu.Game.Online.API.Requests
req.AddParameter("sort", $"{SortCriteria.ToString().ToLowerInvariant()}_{directionString}"); req.AddParameter("sort", $"{SortCriteria.ToString().ToLowerInvariant()}_{directionString}");
if (Extra != null && Extra.Any())
req.AddParameter("e", string.Join('.', Extra.Select(e => e.ToString().ToLowerInvariant())));
if (Ranks != null && Ranks.Any())
req.AddParameter("r", string.Join('.', Ranks.Select(r => r.ToString())));
if (Played != SearchPlayed.Any)
req.AddParameter("played", Played.ToString().ToLowerInvariant());
req.AddCursor(cursor); req.AddCursor(cursor);
return req; return req;

View File

@ -130,6 +130,9 @@ namespace osu.Game.Overlays.BeatmapListing
searchControl.Category.BindValueChanged(_ => queueUpdateSearch()); searchControl.Category.BindValueChanged(_ => queueUpdateSearch());
searchControl.Genre.BindValueChanged(_ => queueUpdateSearch()); searchControl.Genre.BindValueChanged(_ => queueUpdateSearch());
searchControl.Language.BindValueChanged(_ => queueUpdateSearch()); searchControl.Language.BindValueChanged(_ => queueUpdateSearch());
searchControl.Extra.CollectionChanged += (_, __) => queueUpdateSearch();
searchControl.Ranks.CollectionChanged += (_, __) => queueUpdateSearch();
searchControl.Played.BindValueChanged(_ => queueUpdateSearch());
sortCriteria.BindValueChanged(_ => queueUpdateSearch()); sortCriteria.BindValueChanged(_ => queueUpdateSearch());
sortDirection.BindValueChanged(_ => queueUpdateSearch()); sortDirection.BindValueChanged(_ => queueUpdateSearch());
@ -179,7 +182,10 @@ namespace osu.Game.Overlays.BeatmapListing
sortControl.Current.Value, sortControl.Current.Value,
sortControl.SortDirection.Value, sortControl.SortDirection.Value,
searchControl.Genre.Value, searchControl.Genre.Value,
searchControl.Language.Value); searchControl.Language.Value,
searchControl.Extra,
searchControl.Ranks,
searchControl.Played.Value);
getSetsRequest.Success += response => getSetsRequest.Success += response =>
{ {

View File

@ -13,6 +13,7 @@ using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osuTK.Graphics; using osuTK.Graphics;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Scoring;
namespace osu.Game.Overlays.BeatmapListing namespace osu.Game.Overlays.BeatmapListing
{ {
@ -28,6 +29,12 @@ namespace osu.Game.Overlays.BeatmapListing
public Bindable<SearchLanguage> Language => languageFilter.Current; public Bindable<SearchLanguage> Language => languageFilter.Current;
public BindableList<SearchExtra> Extra => extraFilter.Current;
public BindableList<ScoreRank> Ranks => ranksFilter.Current;
public Bindable<SearchPlayed> Played => playedFilter.Current;
public BeatmapSetInfo BeatmapSet public BeatmapSetInfo BeatmapSet
{ {
set set
@ -48,6 +55,9 @@ namespace osu.Game.Overlays.BeatmapListing
private readonly BeatmapSearchFilterRow<SearchCategory> categoryFilter; private readonly BeatmapSearchFilterRow<SearchCategory> categoryFilter;
private readonly BeatmapSearchFilterRow<SearchGenre> genreFilter; private readonly BeatmapSearchFilterRow<SearchGenre> genreFilter;
private readonly BeatmapSearchFilterRow<SearchLanguage> languageFilter; private readonly BeatmapSearchFilterRow<SearchLanguage> languageFilter;
private readonly BeatmapSearchMultipleSelectionFilterRow<SearchExtra> extraFilter;
private readonly BeatmapSearchScoreFilterRow ranksFilter;
private readonly BeatmapSearchFilterRow<SearchPlayed> playedFilter;
private readonly Box background; private readonly Box background;
private readonly UpdateableBeatmapSetCover beatmapCover; private readonly UpdateableBeatmapSetCover beatmapCover;
@ -105,6 +115,9 @@ namespace osu.Game.Overlays.BeatmapListing
categoryFilter = new BeatmapSearchFilterRow<SearchCategory>(@"Categories"), categoryFilter = new BeatmapSearchFilterRow<SearchCategory>(@"Categories"),
genreFilter = new BeatmapSearchFilterRow<SearchGenre>(@"Genre"), genreFilter = new BeatmapSearchFilterRow<SearchGenre>(@"Genre"),
languageFilter = new BeatmapSearchFilterRow<SearchLanguage>(@"Language"), languageFilter = new BeatmapSearchFilterRow<SearchLanguage>(@"Language"),
extraFilter = new BeatmapSearchMultipleSelectionFilterRow<SearchExtra>(@"Extra"),
ranksFilter = new BeatmapSearchScoreFilterRow(),
playedFilter = new BeatmapSearchFilterRow<SearchPlayed>(@"Played")
} }
} }
} }

View File

@ -1,20 +1,16 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System;
using JetBrains.Annotations; using JetBrains.Annotations;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osuTK; using osuTK;
using osuTK.Graphics;
using Humanizer; using Humanizer;
using osu.Game.Utils; using osu.Game.Utils;
@ -32,6 +28,7 @@ namespace osu.Game.Overlays.BeatmapListing
public BeatmapSearchFilterRow(string headerName) public BeatmapSearchFilterRow(string headerName)
{ {
Drawable filter;
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
AddInternal(new GridContainer AddInternal(new GridContainer
@ -49,7 +46,7 @@ namespace osu.Game.Overlays.BeatmapListing
}, },
Content = new[] Content = new[]
{ {
new Drawable[] new[]
{ {
new OsuSpriteText new OsuSpriteText
{ {
@ -58,17 +55,17 @@ namespace osu.Game.Overlays.BeatmapListing
Font = OsuFont.GetFont(size: 13), Font = OsuFont.GetFont(size: 13),
Text = headerName.Titleize() Text = headerName.Titleize()
}, },
CreateFilter().With(f => filter = CreateFilter()
{
f.Current = current;
})
} }
} }
}); });
if (filter is IHasCurrentValue<T> filterWithValue)
Current = filterWithValue.Current;
} }
[NotNull] [NotNull]
protected virtual BeatmapSearchFilter CreateFilter() => new BeatmapSearchFilter(); protected virtual Drawable CreateFilter() => new BeatmapSearchFilter();
protected class BeatmapSearchFilter : TabControl<T> protected class BeatmapSearchFilter : TabControl<T>
{ {
@ -97,63 +94,7 @@ namespace osu.Game.Overlays.BeatmapListing
protected override Dropdown<T> CreateDropdown() => new FilterDropdown(); protected override Dropdown<T> CreateDropdown() => new FilterDropdown();
protected override TabItem<T> CreateTabItem(T value) => new FilterTabItem(value); protected override TabItem<T> CreateTabItem(T value) => new FilterTabItem<T>(value);
protected class FilterTabItem : TabItem<T>
{
protected virtual float TextSize => 13;
[Resolved]
private OverlayColourProvider colourProvider { get; set; }
private readonly OsuSpriteText text;
public FilterTabItem(T value)
: base(value)
{
AutoSizeAxes = Axes.Both;
Anchor = Anchor.BottomLeft;
Origin = Anchor.BottomLeft;
AddRangeInternal(new Drawable[]
{
text = new OsuSpriteText
{
Font = OsuFont.GetFont(size: TextSize, weight: FontWeight.Regular),
Text = (value as Enum)?.GetDescription() ?? value.ToString()
},
new HoverClickSounds()
});
Enabled.Value = true;
}
[BackgroundDependencyLoader]
private void load()
{
updateState();
}
protected override bool OnHover(HoverEvent e)
{
base.OnHover(e);
updateState();
return true;
}
protected override void OnHoverLost(HoverLostEvent e)
{
base.OnHoverLost(e);
updateState();
}
protected override void OnActivated() => updateState();
protected override void OnDeactivated() => updateState();
private void updateState() => text.FadeColour(Active.Value ? Color4.White : getStateColour(), 200, Easing.OutQuint);
private Color4 getStateColour() => IsHovered ? colourProvider.Light1 : colourProvider.Light3;
}
private class FilterDropdown : OsuTabDropdown<T> private class FilterDropdown : OsuTabDropdown<T>
{ {

View File

@ -0,0 +1,93 @@
// 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 System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Events;
using osuTK;
namespace osu.Game.Overlays.BeatmapListing
{
public class BeatmapSearchMultipleSelectionFilterRow<T> : BeatmapSearchFilterRow<List<T>>
{
public new readonly BindableList<T> Current = new BindableList<T>();
private MultipleSelectionFilter filter;
public BeatmapSearchMultipleSelectionFilterRow(string headerName)
: base(headerName)
{
Current.BindTo(filter.Current);
}
protected sealed override Drawable CreateFilter() => filter = CreateMultipleSelectionFilter();
/// <summary>
/// Creates a filter control that can be used to simultaneously select multiple values of type <typeparamref name="T"/>.
/// </summary>
protected virtual MultipleSelectionFilter CreateMultipleSelectionFilter() => new MultipleSelectionFilter();
protected class MultipleSelectionFilter : FillFlowContainer<MultipleSelectionFilterTabItem>
{
public readonly BindableList<T> Current = new BindableList<T>();
[BackgroundDependencyLoader]
private void load()
{
Anchor = Anchor.BottomLeft;
Origin = Anchor.BottomLeft;
RelativeSizeAxes = Axes.X;
Height = 15;
Spacing = new Vector2(10, 0);
AddRange(GetValues().Select(CreateTabItem));
}
protected override void LoadComplete()
{
base.LoadComplete();
foreach (var item in Children)
item.Active.BindValueChanged(active => toggleItem(item.Value, active.NewValue));
}
/// <summary>
/// Returns all values to be displayed in this filter row.
/// </summary>
protected virtual IEnumerable<T> GetValues() => Enum.GetValues(typeof(T)).Cast<T>();
/// <summary>
/// Creates a <see cref="MultipleSelectionFilterTabItem"/> representing the supplied <paramref name="value"/>.
/// </summary>
protected virtual MultipleSelectionFilterTabItem CreateTabItem(T value) => new MultipleSelectionFilterTabItem(value);
private void toggleItem(T value, bool active)
{
if (active)
Current.Add(value);
else
Current.Remove(value);
}
}
protected class MultipleSelectionFilterTabItem : FilterTabItem<T>
{
public MultipleSelectionFilterTabItem(T value)
: base(value)
{
}
protected override bool OnClick(ClickEvent e)
{
base.OnClick(e);
Active.Toggle();
return true;
}
}
}
}

View File

@ -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.Graphics;
using osu.Game.Rulesets; using osu.Game.Rulesets;
namespace osu.Game.Overlays.BeatmapListing namespace osu.Game.Overlays.BeatmapListing
@ -13,7 +14,7 @@ namespace osu.Game.Overlays.BeatmapListing
{ {
} }
protected override BeatmapSearchFilter CreateFilter() => new RulesetFilter(); protected override Drawable CreateFilter() => new RulesetFilter();
private class RulesetFilter : BeatmapSearchFilter private class RulesetFilter : BeatmapSearchFilter
{ {

View File

@ -0,0 +1,50 @@
// 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 System.Collections.Generic;
using System.Linq;
using osu.Framework.Extensions;
using osu.Game.Scoring;
namespace osu.Game.Overlays.BeatmapListing
{
public class BeatmapSearchScoreFilterRow : BeatmapSearchMultipleSelectionFilterRow<ScoreRank>
{
public BeatmapSearchScoreFilterRow()
: base(@"Rank Achieved")
{
}
protected override MultipleSelectionFilter CreateMultipleSelectionFilter() => new RankFilter();
private class RankFilter : MultipleSelectionFilter
{
protected override MultipleSelectionFilterTabItem CreateTabItem(ScoreRank value) => new RankItem(value);
protected override IEnumerable<ScoreRank> GetValues() => base.GetValues().Reverse();
}
private class RankItem : MultipleSelectionFilterTabItem
{
public RankItem(ScoreRank value)
: base(value)
{
}
protected override string LabelFor(ScoreRank value)
{
switch (value)
{
case ScoreRank.XH:
return @"Silver SS";
case ScoreRank.SH:
return @"Silver S";
default:
return value.GetDescription();
}
}
}
}
}

View File

@ -0,0 +1,79 @@
// 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 System;
using osu.Framework.Allocation;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface;
using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osuTK.Graphics;
namespace osu.Game.Overlays.BeatmapListing
{
public class FilterTabItem<T> : TabItem<T>
{
[Resolved]
private OverlayColourProvider colourProvider { get; set; }
private OsuSpriteText text;
public FilterTabItem(T value)
: base(value)
{
}
[BackgroundDependencyLoader]
private void load()
{
AutoSizeAxes = Axes.Both;
Anchor = Anchor.BottomLeft;
Origin = Anchor.BottomLeft;
AddRangeInternal(new Drawable[]
{
text = new OsuSpriteText
{
Font = OsuFont.GetFont(size: 13, weight: FontWeight.Regular),
Text = LabelFor(Value)
},
new HoverClickSounds()
});
Enabled.Value = true;
updateState();
}
protected override bool OnHover(HoverEvent e)
{
base.OnHover(e);
updateState();
return true;
}
protected override void OnHoverLost(HoverLostEvent e)
{
base.OnHoverLost(e);
updateState();
}
protected override void OnActivated() => updateState();
protected override void OnDeactivated() => updateState();
/// <summary>
/// Returns the label text to be used for the supplied <paramref name="value"/>.
/// </summary>
protected virtual string LabelFor(T value) => (value as Enum)?.GetDescription() ?? value.ToString();
private void updateState()
{
text.FadeColour(IsHovered ? colourProvider.Light1 : getStateColour(), 200, Easing.OutQuint);
text.Font = text.Font.With(weight: Active.Value ? FontWeight.SemiBold : FontWeight.Regular);
}
private Color4 getStateColour() => Active.Value ? colourProvider.Content1 : colourProvider.Light2;
}
}

View File

@ -0,0 +1,16 @@
// 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 System.ComponentModel;
namespace osu.Game.Overlays.BeatmapListing
{
public enum SearchExtra
{
[Description("Has Video")]
Video,
[Description("Has Storyboard")]
Storyboard
}
}

View File

@ -0,0 +1,12 @@
// 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.Overlays.BeatmapListing
{
public enum SearchPlayed
{
Any,
Played,
Unplayed
}
}

View File

@ -120,6 +120,11 @@ namespace osu.Game.Rulesets.Edit
/// </summary> /// </summary>
public void Deselect() => State = SelectionState.NotSelected; public void Deselect() => State = SelectionState.NotSelected;
/// <summary>
/// Toggles the selection state of this <see cref="OverlaySelectionBlueprint"/>.
/// </summary>
public void ToggleSelection() => State = IsSelected ? SelectionState.NotSelected : SelectionState.Selected;
public bool IsSelected => State == SelectionState.Selected; public bool IsSelected => State == SelectionState.Selected;
/// <summary> /// <summary>

View File

@ -255,14 +255,13 @@ namespace osu.Game.Rulesets.UI
NotValid, NotValid,
/// <summary> /// <summary>
/// Whether we are running up-to-date with our parent clock. /// Playback is running behind real-time. Catch-up will be attempted by processing more than once per
/// If not, we will need to keep processing children until we catch up. /// game loop (limited to a sane maximum to avoid frame drops).
/// </summary> /// </summary>
RequiresCatchUp, RequiresCatchUp,
/// <summary> /// <summary>
/// Whether we are in a valid state (ie. should we keep processing children frames). /// In a valid state, progressing one child hierarchy loop per game loop.
/// This should be set to false when the replay is, for instance, waiting for future frames to arrive.
/// </summary> /// </summary>
Valid Valid
} }

View File

@ -6,6 +6,7 @@ using System.Linq;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Performance;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
namespace osu.Game.Rulesets.UI namespace osu.Game.Rulesets.UI

View File

@ -298,13 +298,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
{ {
Debug.Assert(!clickSelectionBegan); Debug.Assert(!clickSelectionBegan);
// Deselections are only allowed for control + left clicks
bool allowDeselection = e.ControlPressed && e.Button == MouseButton.Left;
// Todo: This is probably incorrectly disallowing multiple selections on stacked objects
if (!allowDeselection && SelectionHandler.SelectedBlueprints.Any(s => s.IsHovered))
return;
foreach (SelectionBlueprint blueprint in SelectionBlueprints.AliveChildren) foreach (SelectionBlueprint blueprint in SelectionBlueprints.AliveChildren)
{ {
if (blueprint.IsHovered) if (blueprint.IsHovered)

View File

@ -24,6 +24,7 @@ using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osu.Game.Rulesets.Objects.Types; using osu.Game.Rulesets.Objects.Types;
using osuTK; using osuTK;
using osuTK.Input;
namespace osu.Game.Screens.Edit.Compose.Components namespace osu.Game.Screens.Edit.Compose.Components
{ {
@ -224,14 +225,15 @@ namespace osu.Game.Screens.Edit.Compose.Components
/// <param name="state">The input state at the point of selection.</param> /// <param name="state">The input state at the point of selection.</param>
internal void HandleSelectionRequested(SelectionBlueprint blueprint, InputState state) internal void HandleSelectionRequested(SelectionBlueprint blueprint, InputState state)
{ {
if (state.Keyboard.ControlPressed) if (state.Keyboard.ShiftPressed && state.Mouse.IsPressed(MouseButton.Right))
{ EditorBeatmap.Remove(blueprint.HitObject);
if (blueprint.IsSelected) else if (state.Keyboard.ControlPressed && state.Mouse.IsPressed(MouseButton.Left))
blueprint.Deselect(); blueprint.ToggleSelection();
else else
blueprint.Select(); ensureSelected(blueprint);
} }
else
private void ensureSelected(SelectionBlueprint blueprint)
{ {
if (blueprint.IsSelected) if (blueprint.IsSelected)
return; return;
@ -239,7 +241,6 @@ namespace osu.Game.Screens.Edit.Compose.Components
DeselectAll?.Invoke(); DeselectAll?.Invoke();
blueprint.Select(); blueprint.Select();
} }
}
private void deleteSelected() private void deleteSelected()
{ {

View File

@ -450,12 +450,21 @@ namespace osu.Game.Screens.Edit
if (dialogOverlay == null || dialogOverlay.CurrentDialog is PromptForSaveDialog) if (dialogOverlay == null || dialogOverlay.CurrentDialog is PromptForSaveDialog)
{ {
confirmExit(); confirmExit();
return true; return false;
} }
if (isNewBeatmap || HasUnsavedChanges) if (isNewBeatmap || HasUnsavedChanges)
{ {
dialogOverlay?.Push(new PromptForSaveDialog(confirmExit, confirmExitWithSave)); dialogOverlay?.Push(new PromptForSaveDialog(() =>
{
confirmExit();
this.Exit();
}, () =>
{
confirmExitWithSave();
this.Exit();
}));
return true; return true;
} }
} }
@ -470,7 +479,6 @@ namespace osu.Game.Screens.Edit
{ {
exitConfirmed = true; exitConfirmed = true;
Save(); Save();
this.Exit();
} }
private void confirmExit() private void confirmExit()
@ -489,7 +497,6 @@ namespace osu.Game.Screens.Edit
} }
exitConfirmed = true; exitConfirmed = true;
this.Exit();
} }
private readonly Bindable<string> clipboard = new Bindable<string>(); private readonly Bindable<string> clipboard = new Bindable<string>();

View File

@ -26,7 +26,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Framework" Version="2020.1019.0" /> <PackageReference Include="ppy.osu.Framework" Version="2020.1029.1" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1016.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.1016.0" />
<PackageReference Include="Sentry" Version="2.1.6" /> <PackageReference Include="Sentry" Version="2.1.6" />
<PackageReference Include="SharpCompress" Version="0.26.0" /> <PackageReference Include="SharpCompress" Version="0.26.0" />

View File

@ -70,7 +70,7 @@
<Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http" />
</ItemGroup> </ItemGroup>
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.1019.0" /> <PackageReference Include="ppy.osu.Framework.iOS" Version="2020.1029.1" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.1016.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2020.1016.0" />
</ItemGroup> </ItemGroup>
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. --> <!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
@ -80,7 +80,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Framework" Version="2020.1019.0" /> <PackageReference Include="ppy.osu.Framework" Version="2020.1029.1" />
<PackageReference Include="SharpCompress" Version="0.26.0" /> <PackageReference Include="SharpCompress" Version="0.26.0" />
<PackageReference Include="NUnit" Version="3.12.0" /> <PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="SharpRaven" Version="2.4.0" /> <PackageReference Include="SharpRaven" Version="2.4.0" />