mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Add preset column to solo mod select overlay
This commit is contained in:
@ -137,7 +137,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
AddUntilStep("any column dimmed", () => this.ChildrenOfType<ModColumn>().Any(column => !column.Active.Value));
|
AddUntilStep("any column dimmed", () => this.ChildrenOfType<ModColumn>().Any(column => !column.Active.Value));
|
||||||
|
|
||||||
ModColumn lastColumn = null;
|
ModSelectColumn lastColumn = null;
|
||||||
|
|
||||||
AddAssert("last column dimmed", () => !this.ChildrenOfType<ModColumn>().Last().Active.Value);
|
AddAssert("last column dimmed", () => !this.ChildrenOfType<ModColumn>().Last().Active.Value);
|
||||||
AddStep("request scroll to last column", () =>
|
AddStep("request scroll to last column", () =>
|
||||||
|
@ -11,12 +11,14 @@ using osu.Framework.Audio.Sample;
|
|||||||
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.Cursor;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Audio;
|
using osu.Game.Audio;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Graphics.Cursor;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
@ -72,6 +74,11 @@ namespace osu.Game.Overlays.Mods
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual bool AllowCustomisation => true;
|
protected virtual bool AllowCustomisation => true;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the column with available mod presets should be shown.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual bool ShowPresets => false;
|
||||||
|
|
||||||
protected virtual ModColumn CreateModColumn(ModType modType) => new ModColumn(modType, false);
|
protected virtual ModColumn CreateModColumn(ModType modType) => new ModColumn(modType, false);
|
||||||
|
|
||||||
protected virtual IReadOnlyList<Mod> ComputeNewModsFromSelection(IReadOnlyList<Mod> oldSelection, IReadOnlyList<Mod> newSelection) => newSelection;
|
protected virtual IReadOnlyList<Mod> ComputeNewModsFromSelection(IReadOnlyList<Mod> oldSelection, IReadOnlyList<Mod> newSelection) => newSelection;
|
||||||
@ -139,7 +146,10 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
MainAreaContent.AddRange(new Drawable[]
|
MainAreaContent.AddRange(new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
new OsuContextMenuContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Child = new PopoverContainer
|
||||||
{
|
{
|
||||||
Padding = new MarginPadding
|
Padding = new MarginPadding
|
||||||
{
|
{
|
||||||
@ -166,13 +176,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
AutoSizeAxes = Axes.X,
|
AutoSizeAxes = Axes.X,
|
||||||
Margin = new MarginPadding { Horizontal = 70 },
|
Margin = new MarginPadding { Horizontal = 70 },
|
||||||
Padding = new MarginPadding { Bottom = 10 },
|
Padding = new MarginPadding { Bottom = 10 },
|
||||||
Children = new[]
|
ChildrenEnumerable = createColumns()
|
||||||
{
|
|
||||||
createModColumnContent(ModType.DifficultyReduction),
|
|
||||||
createModColumnContent(ModType.DifficultyIncrease),
|
|
||||||
createModColumnContent(ModType.Automation),
|
|
||||||
createModColumnContent(ModType.Conversion),
|
|
||||||
createModColumnContent(ModType.Fun)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -282,6 +286,23 @@ namespace osu.Game.Overlays.Mods
|
|||||||
column.DeselectAll();
|
column.DeselectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private IEnumerable<ColumnDimContainer> createColumns()
|
||||||
|
{
|
||||||
|
if (ShowPresets)
|
||||||
|
{
|
||||||
|
yield return new ColumnDimContainer(new ModPresetColumn
|
||||||
|
{
|
||||||
|
Margin = new MarginPadding { Right = 10 }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
yield return createModColumnContent(ModType.DifficultyReduction);
|
||||||
|
yield return createModColumnContent(ModType.DifficultyIncrease);
|
||||||
|
yield return createModColumnContent(ModType.Automation);
|
||||||
|
yield return createModColumnContent(ModType.Conversion);
|
||||||
|
yield return createModColumnContent(ModType.Fun);
|
||||||
|
}
|
||||||
|
|
||||||
private ColumnDimContainer createModColumnContent(ModType modType)
|
private ColumnDimContainer createModColumnContent(ModType modType)
|
||||||
{
|
{
|
||||||
var column = CreateModColumn(modType).With(column =>
|
var column = CreateModColumn(modType).With(column =>
|
||||||
@ -290,12 +311,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
column.Margin = new MarginPadding { Right = 10 };
|
column.Margin = new MarginPadding { Right = 10 };
|
||||||
});
|
});
|
||||||
|
|
||||||
return new ColumnDimContainer(column)
|
return new ColumnDimContainer(column);
|
||||||
{
|
|
||||||
AutoSizeAxes = Axes.X,
|
|
||||||
RelativeSizeAxes = Axes.Y,
|
|
||||||
RequestScroll = col => columnScroll.ScrollIntoView(col, extraScroll: 140),
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createLocalMods()
|
private void createLocalMods()
|
||||||
@ -594,6 +610,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Manages horizontal scrolling of mod columns, along with the "active" states of each column based on visibility.
|
/// Manages horizontal scrolling of mod columns, along with the "active" states of each column based on visibility.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Cached]
|
||||||
internal class ColumnScrollContainer : OsuScrollContainer<ColumnFlowContainer>
|
internal class ColumnScrollContainer : OsuScrollContainer<ColumnFlowContainer>
|
||||||
{
|
{
|
||||||
public ColumnScrollContainer()
|
public ColumnScrollContainer()
|
||||||
@ -668,12 +685,21 @@ namespace osu.Game.Overlays.Mods
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private OsuColour colours { get; set; } = null!;
|
private OsuColour colours { get; set; } = null!;
|
||||||
|
|
||||||
public ColumnDimContainer(ModColumn column)
|
public ColumnDimContainer(ModSelectColumn column)
|
||||||
{
|
{
|
||||||
|
AutoSizeAxes = Axes.X;
|
||||||
|
RelativeSizeAxes = Axes.Y;
|
||||||
|
|
||||||
Child = Column = column;
|
Child = Column = column;
|
||||||
column.Active.BindTo(Active);
|
column.Active.BindTo(Active);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(ColumnScrollContainer columnScroll)
|
||||||
|
{
|
||||||
|
RequestScroll = col => columnScroll.ScrollIntoView(col, extraScroll: 140);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
@ -313,7 +313,7 @@ namespace osu.Game.Screens.Select
|
|||||||
(new FooterButtonOptions(), BeatmapOptions)
|
(new FooterButtonOptions(), BeatmapOptions)
|
||||||
};
|
};
|
||||||
|
|
||||||
protected virtual ModSelectOverlay CreateModSelectOverlay() => new UserModSelectOverlay();
|
protected virtual ModSelectOverlay CreateModSelectOverlay() => new SoloModSelectOverlay();
|
||||||
|
|
||||||
protected virtual void ApplyFilterToCarousel(FilterCriteria criteria)
|
protected virtual void ApplyFilterToCarousel(FilterCriteria criteria)
|
||||||
{
|
{
|
||||||
@ -927,5 +927,10 @@ namespace osu.Game.Screens.Select
|
|||||||
return base.OnHover(e);
|
return base.OnHover(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class SoloModSelectOverlay : UserModSelectOverlay
|
||||||
|
{
|
||||||
|
protected override bool ShowPresets => true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user