mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Merge branch 'master' into songselect-preview-fix
This commit is contained in:
@ -12,7 +12,6 @@ using osu.Game.Beatmaps.Drawables;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Framework.Input;
|
||||
using OpenTK.Input;
|
||||
using System.Collections;
|
||||
using osu.Framework.MathUtils;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
@ -22,7 +21,7 @@ using osu.Framework.Configuration;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
internal class BeatmapCarousel : ScrollContainer, IEnumerable<BeatmapGroup>
|
||||
internal class BeatmapCarousel : ScrollContainer
|
||||
{
|
||||
public BeatmapInfo SelectedBeatmap => selectedPanel?.Beatmap;
|
||||
|
||||
@ -77,8 +76,9 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private readonly List<Panel> panels = new List<Panel>();
|
||||
|
||||
private BeatmapGroup selectedGroup;
|
||||
private readonly Stack<KeyValuePair<BeatmapGroup, BeatmapPanel>> randomSelectedBeatmaps = new Stack<KeyValuePair<BeatmapGroup, BeatmapPanel>>();
|
||||
|
||||
private BeatmapGroup selectedGroup;
|
||||
private BeatmapPanel selectedPanel;
|
||||
|
||||
public BeatmapCarousel()
|
||||
@ -170,16 +170,21 @@ namespace osu.Game.Screens.Select
|
||||
} while (index != startIndex);
|
||||
}
|
||||
|
||||
public void SelectRandom()
|
||||
private IEnumerable<BeatmapGroup> getVisibleGroups() => groups.Where(selectGroup => selectGroup.State != BeatmapGroupState.Hidden);
|
||||
|
||||
public void SelectNextRandom()
|
||||
{
|
||||
IEnumerable<BeatmapGroup> visibleGroups = groups.Where(selectGroup => selectGroup.State != BeatmapGroupState.Hidden);
|
||||
randomSelectedBeatmaps.Push(new KeyValuePair<BeatmapGroup, BeatmapPanel>(selectedGroup, selectedGroup.SelectedPanel));
|
||||
|
||||
var visibleGroups = getVisibleGroups();
|
||||
if (!visibleGroups.Any())
|
||||
return;
|
||||
|
||||
BeatmapGroup group;
|
||||
|
||||
if (randomType == SelectionRandomType.RandomPermutation)
|
||||
{
|
||||
IEnumerable<BeatmapGroup> notSeenGroups = visibleGroups.Except(seenGroups);
|
||||
var notSeenGroups = visibleGroups.Except(seenGroups);
|
||||
if (!notSeenGroups.Any())
|
||||
{
|
||||
seenGroups.Clear();
|
||||
@ -197,6 +202,27 @@ namespace osu.Game.Screens.Select
|
||||
selectGroup(group, panel);
|
||||
}
|
||||
|
||||
public void SelectPreviousRandom()
|
||||
{
|
||||
if (!randomSelectedBeatmaps.Any())
|
||||
return;
|
||||
|
||||
var visibleGroups = getVisibleGroups();
|
||||
if (!visibleGroups.Any())
|
||||
return;
|
||||
|
||||
while (randomSelectedBeatmaps.Any())
|
||||
{
|
||||
var beatmapCoordinates = randomSelectedBeatmaps.Pop();
|
||||
var group = beatmapCoordinates.Key;
|
||||
if (visibleGroups.Contains(group))
|
||||
{
|
||||
selectGroup(group, beatmapCoordinates.Value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private FilterCriteria criteria = new FilterCriteria();
|
||||
|
||||
private ScheduledDelegate filterTask;
|
||||
@ -238,10 +264,6 @@ namespace osu.Game.Screens.Select
|
||||
perform();
|
||||
}
|
||||
|
||||
public IEnumerator<BeatmapGroup> GetEnumerator() => groups.GetEnumerator();
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||
|
||||
private BeatmapGroup createGroup(BeatmapSetInfo beatmapSet)
|
||||
{
|
||||
foreach (var b in beatmapSet.Beatmaps)
|
||||
@ -280,7 +302,7 @@ namespace osu.Game.Screens.Select
|
||||
panels.Remove(p);
|
||||
|
||||
scrollableContent.Remove(group.Header);
|
||||
scrollableContent.Remove(group.BeatmapPanels);
|
||||
scrollableContent.RemoveRange(group.BeatmapPanels);
|
||||
|
||||
if (selectedGroup == group)
|
||||
SelectNext();
|
||||
|
@ -33,7 +33,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
public BeatmapDetailArea()
|
||||
{
|
||||
AddInternal(new Drawable[]
|
||||
AddRangeInternal(new Drawable[]
|
||||
{
|
||||
new BeatmapDetailAreaTabControl
|
||||
{
|
||||
@ -61,7 +61,7 @@ namespace osu.Game.Screens.Select
|
||||
},
|
||||
});
|
||||
|
||||
Add(new Drawable[]
|
||||
AddRange(new Drawable[]
|
||||
{
|
||||
Details = new BeatmapDetails
|
||||
{
|
||||
|
@ -8,10 +8,10 @@ using osu.Framework.Configuration;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
|
@ -6,7 +6,6 @@ using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
@ -16,6 +15,7 @@ using System.Linq;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
@ -160,7 +160,7 @@ namespace osu.Game.Screens.Select
|
||||
Colour = Color4.Black,
|
||||
Alpha = 0.5f,
|
||||
},
|
||||
new FillFlowContainer<MetadataSegment>()
|
||||
new FillFlowContainer<MetadataSegment>
|
||||
{
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
@ -439,7 +439,7 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
Show();
|
||||
if (header.Text == "Tags")
|
||||
content.Children = value.Split(' ').Select(text => new OsuSpriteText
|
||||
content.ChildrenEnumerable = value.Split(' ').Select(text => new OsuSpriteText
|
||||
{
|
||||
Text = text,
|
||||
Font = "Exo2.0-Regular",
|
||||
|
@ -11,7 +11,6 @@ using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Beatmaps.Drawables;
|
||||
@ -21,6 +20,7 @@ using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.Objects.Types;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
@ -152,6 +152,7 @@ namespace osu.Game.Screens.Select
|
||||
// Zoomed-in and cropped beatmap background
|
||||
new BeatmapBackgroundSprite(beatmap)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
FillMode = FillMode.Fill,
|
||||
|
@ -8,7 +8,6 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
@ -16,6 +15,7 @@ using osu.Game.Screens.Select.Filter;
|
||||
using Container = osu.Framework.Graphics.Containers.Container;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Database;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
@ -67,7 +67,7 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
private readonly SearchTextBox searchTextBox;
|
||||
|
||||
protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || groupTabs.Contains(screenSpacePos) || sortTabs.Contains(screenSpacePos);
|
||||
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => base.ReceiveMouseInputAt(screenSpacePos) || groupTabs.ReceiveMouseInputAt(screenSpacePos) || sortTabs.ReceiveMouseInputAt(screenSpacePos);
|
||||
|
||||
public FilterControl()
|
||||
{
|
||||
@ -82,7 +82,6 @@ namespace osu.Game.Screens.Select
|
||||
new Container
|
||||
{
|
||||
Padding = new MarginPadding(20),
|
||||
AlwaysReceiveInput = true,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Width = 0.5f,
|
||||
Anchor = Anchor.TopRight,
|
||||
@ -109,7 +108,6 @@ namespace osu.Game.Screens.Select
|
||||
Direction = FillDirection.Horizontal,
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
AlwaysReceiveInput = true,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
groupTabs = new OsuTabControl<GroupMode>
|
||||
@ -130,7 +128,7 @@ namespace osu.Game.Screens.Select
|
||||
// Bottom = 5
|
||||
// },
|
||||
//},
|
||||
sortTabs = new OsuTabControl<SortMode>()
|
||||
sortTabs = new OsuTabControl<SortMode>
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Width = 0.5f,
|
||||
|
@ -8,7 +8,7 @@ using OpenTK.Input;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Screens.Menu;
|
||||
@ -124,7 +124,7 @@ namespace osu.Game.Screens.Select
|
||||
updateModeLight();
|
||||
}
|
||||
|
||||
protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || StartButton.Contains(screenSpacePos);
|
||||
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => base.ReceiveMouseInputAt(screenSpacePos) || StartButton.ReceiveMouseInputAt(screenSpacePos);
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
|
||||
|
||||
|
@ -6,14 +6,15 @@ using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
public class FooterButton : ClickableContainer
|
||||
public class FooterButton : OsuClickableContainer
|
||||
{
|
||||
private static readonly Vector2 shearing = new Vector2(0.15f, 0);
|
||||
|
||||
|
@ -31,6 +31,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
{
|
||||
rankSprite = new Sprite
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
FillMode = FillMode.Fit
|
||||
|
@ -12,6 +12,7 @@ using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Online.API;
|
||||
@ -74,7 +75,7 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
scrollContainer = new ScrollContainer
|
||||
scrollContainer = new OsuScrollContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
ScrollbarVisible = false,
|
||||
|
@ -5,7 +5,7 @@ using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
@ -13,10 +13,11 @@ using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Users;
|
||||
using osu.Framework;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Screens.Select.Leaderboards
|
||||
{
|
||||
public class LeaderboardScore : ClickableContainer, IStateful<Visibility>
|
||||
public class LeaderboardScore : OsuClickableContainer, IStateful<Visibility>
|
||||
{
|
||||
public static readonly float HEIGHT = 60;
|
||||
|
||||
|
@ -4,17 +4,18 @@
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Screens.Select.Options
|
||||
{
|
||||
public class BeatmapOptionsButton : ClickableContainer
|
||||
public class BeatmapOptionsButton : OsuClickableContainer
|
||||
{
|
||||
private const float width = 130;
|
||||
|
||||
@ -83,7 +84,7 @@ namespace osu.Game.Screens.Select.Options
|
||||
return false;
|
||||
}
|
||||
|
||||
protected override bool InternalContains(Vector2 screenSpacePos) => box.Contains(screenSpacePos);
|
||||
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => box.ReceiveMouseInputAt(screenSpacePos);
|
||||
|
||||
public BeatmapOptionsButton()
|
||||
{
|
||||
|
@ -5,7 +5,7 @@ using System;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
@ -14,7 +14,7 @@ using osu.Game.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Screens.Select.Options
|
||||
{
|
||||
public class BeatmapOptionsOverlay : FocusedOverlayContainer
|
||||
public class BeatmapOptionsOverlay : OsuFocusedOverlayContainer
|
||||
{
|
||||
private const float transition_duration = 500;
|
||||
private const float x_position = 0.2f;
|
||||
@ -70,7 +70,7 @@ namespace osu.Game.Screens.Select.Options
|
||||
Scale = new Vector2(1, 0),
|
||||
Colour = Color4.Black.Opacity(0.5f),
|
||||
},
|
||||
buttonsContainer = new ReverseDepthFillFlowContainer<BeatmapOptionsButton>
|
||||
buttonsContainer = new ReverseChildIDFillFlowContainer<BeatmapOptionsButton>
|
||||
{
|
||||
Height = height,
|
||||
RelativePositionAxes = Axes.X,
|
||||
|
@ -154,11 +154,11 @@ namespace osu.Game.Screens.Select
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(BeatmapDatabase beatmaps, AudioManager audio, DialogOverlay dialog, OsuGame osu, OsuColour colours)
|
||||
private void load(BeatmapDatabase beatmaps, AudioManager audio, DialogOverlay dialog, OsuGame osu, OsuColour colours, UserInputManager input)
|
||||
{
|
||||
if (Footer != null)
|
||||
{
|
||||
Footer.AddButton(@"random", colours.Green, SelectRandom, Key.F2);
|
||||
Footer.AddButton(@"random", colours.Green, () => triggerRandom(input), Key.F2);
|
||||
Footer.AddButton(@"options", colours.Blue, BeatmapOptions.ToggleVisibility, Key.F3);
|
||||
|
||||
BeatmapOptions.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, colours.Pink, promptDelete, Key.Number4, float.MaxValue);
|
||||
@ -209,7 +209,13 @@ namespace osu.Game.Screens.Select
|
||||
OnSelected();
|
||||
}
|
||||
|
||||
public void SelectRandom() => carousel.SelectRandom();
|
||||
private void triggerRandom(UserInputManager input)
|
||||
{
|
||||
if (input.CurrentState.Keyboard.ShiftPressed)
|
||||
carousel.SelectPreviousRandom();
|
||||
else
|
||||
carousel.SelectNextRandom();
|
||||
}
|
||||
|
||||
protected abstract void OnSelected();
|
||||
|
||||
@ -275,10 +281,13 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
database.BeatmapSetAdded -= onBeatmapSetAdded;
|
||||
database.BeatmapSetRemoved -= onBeatmapSetRemoved;
|
||||
if (database != null)
|
||||
{
|
||||
database.BeatmapSetAdded -= onBeatmapSetAdded;
|
||||
database.BeatmapSetRemoved -= onBeatmapSetRemoved;
|
||||
}
|
||||
|
||||
initialAddSetsTask.Cancel();
|
||||
initialAddSetsTask?.Cancel();
|
||||
}
|
||||
|
||||
private void changeBackground(WorkingBeatmap beatmap)
|
||||
|
@ -4,9 +4,9 @@
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
{
|
||||
|
Reference in New Issue
Block a user