mirror of
https://github.com/ppy/osu.git
synced 2026-05-16 22:24:11 +08:00
e2681c4163
- Below 20 custom sample sets, they are shown as ternary buttons. - Above 20 custom sample sets, they are shown in a dropdown (yes there are actual cases of this as I've been informed by the NAT; one example being https://osu.ppy.sh/beatmapsets/1018061#osu/2197383) As a bonus, to make determining what the heck is actually changing when adjusting these controls, the full set of applicable sounds now plays on adding/removing additions, changing their banks, as well as changing the custom set (if any). For now there are no user-facing controls to add the samples to the map yourself, you have to know how to name the `.wav`s and edit-externally them in yourself. *For now.*
42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
// 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 osu.Framework.Graphics;
|
|
using osu.Game.Graphics.UserInterface;
|
|
|
|
namespace osu.Game.Graphics.UserInterfaceV2
|
|
{
|
|
public partial class LabelledDropdown<TItem> : LabelledComponent<OsuDropdown<TItem>, TItem>
|
|
{
|
|
public LabelledDropdown(bool padded)
|
|
: base(padded)
|
|
{
|
|
}
|
|
|
|
public IEnumerable<TItem> Items
|
|
{
|
|
get => Component.Items;
|
|
set => Component.Items = value;
|
|
}
|
|
|
|
public float DropdownWidth
|
|
{
|
|
get => Component.Width;
|
|
set => Component.Width = value;
|
|
}
|
|
|
|
protected sealed override OsuDropdown<TItem> CreateComponent() => CreateDropdown().With(d =>
|
|
{
|
|
d.RelativeSizeAxes = Axes.X;
|
|
});
|
|
|
|
protected virtual OsuDropdown<TItem> CreateDropdown() => new Dropdown();
|
|
|
|
private partial class Dropdown : OsuDropdown<TItem>
|
|
{
|
|
protected override DropdownMenu CreateMenu() => base.CreateMenu().With(menu => menu.MaxHeight = 200);
|
|
}
|
|
}
|
|
}
|