mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 15:16:38 +09:00
Use dropdown in BeatmapSearchFilterRow
This commit is contained in:
@ -7,6 +7,7 @@ using NUnit.Framework;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.BeatmapListing;
|
using osu.Game.Overlays.BeatmapListing;
|
||||||
@ -26,11 +27,11 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
[Cached]
|
[Cached]
|
||||||
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
|
private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Blue);
|
||||||
|
|
||||||
private readonly FillFlowContainer resizableContainer;
|
private readonly ReverseChildIDFillFlowContainer<Drawable> resizableContainer;
|
||||||
|
|
||||||
public TestSceneBeatmapSearchFilter()
|
public TestSceneBeatmapSearchFilter()
|
||||||
{
|
{
|
||||||
Add(resizableContainer = new FillFlowContainer
|
Add(resizableContainer = new ReverseChildIDFillFlowContainer<Drawable>
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
|
@ -51,15 +51,13 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
{
|
{
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Anchor = Anchor.CentreLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
Font = OsuFont.GetFont(size: 10),
|
Font = OsuFont.GetFont(size: 10),
|
||||||
Text = headerName.ToUpper()
|
Text = headerName.ToUpper()
|
||||||
},
|
},
|
||||||
CreateFilter().With(f =>
|
CreateFilter().With(f =>
|
||||||
{
|
{
|
||||||
f.Anchor = Anchor.CentreLeft;
|
|
||||||
f.Origin = Anchor.CentreLeft;
|
|
||||||
f.Current = current;
|
f.Current = current;
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -74,7 +72,12 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
{
|
{
|
||||||
public BeatmapSearchFilter()
|
public BeatmapSearchFilter()
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
Anchor = Anchor.BottomLeft;
|
||||||
|
Origin = Anchor.BottomLeft;
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
Height = 15;
|
||||||
|
|
||||||
|
TabContainer.Spacing = new Vector2(10, 0);
|
||||||
|
|
||||||
if (typeof(T).IsEnum)
|
if (typeof(T).IsEnum)
|
||||||
{
|
{
|
||||||
@ -83,16 +86,16 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Dropdown<T> CreateDropdown() => null;
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OverlayColourProvider colourProvider)
|
||||||
|
{
|
||||||
|
((FilterDropdown)Dropdown).AccentColour = colourProvider.Light2;
|
||||||
|
}
|
||||||
|
|
||||||
|
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(value);
|
||||||
|
|
||||||
protected override TabFillFlowContainer CreateTabFlow() => new TabFillFlowContainer
|
|
||||||
{
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Spacing = new Vector2(10),
|
|
||||||
};
|
|
||||||
|
|
||||||
protected class FilterTabItem : TabItem<T>
|
protected class FilterTabItem : TabItem<T>
|
||||||
{
|
{
|
||||||
protected virtual float TextSize => 13;
|
protected virtual float TextSize => 13;
|
||||||
@ -106,6 +109,8 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
: base(value)
|
: base(value)
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
|
Anchor = Anchor.BottomLeft;
|
||||||
|
Origin = Anchor.BottomLeft;
|
||||||
AddRangeInternal(new Drawable[]
|
AddRangeInternal(new Drawable[]
|
||||||
{
|
{
|
||||||
text = new OsuSpriteText
|
text = new OsuSpriteText
|
||||||
@ -148,6 +153,23 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
|
|
||||||
private Color4 getStateColour() => IsHovered ? colourProvider.Light1 : colourProvider.Light3;
|
private Color4 getStateColour() => IsHovered ? colourProvider.Light1 : colourProvider.Light3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class FilterDropdown : OsuTabDropdown<T>
|
||||||
|
{
|
||||||
|
protected override DropdownHeader CreateHeader() => new FilterHeader
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
Origin = Anchor.TopRight
|
||||||
|
};
|
||||||
|
|
||||||
|
private class FilterHeader : OsuTabDropdownHeader
|
||||||
|
{
|
||||||
|
public FilterHeader()
|
||||||
|
{
|
||||||
|
Background.Height = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user