mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 23:12:56 +08:00
Merge branch 'master' into adjust-triangle-speed
This commit is contained in:
commit
b969398e2d
@ -0,0 +1,34 @@
|
||||
// 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 NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.UserInterfaceV2;
|
||||
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
public class TestSceneLabelledDropdown : OsuTestScene
|
||||
{
|
||||
[Test]
|
||||
public void TestLabelledDropdown()
|
||||
=> AddStep(@"create dropdown", () => Child = new LabelledDropdown<string>
|
||||
{
|
||||
Label = @"Countdown speed",
|
||||
Items = new[]
|
||||
{
|
||||
@"Half",
|
||||
@"Normal",
|
||||
@"Double"
|
||||
},
|
||||
Description = @"This is a description"
|
||||
});
|
||||
|
||||
[Test]
|
||||
public void TestLabelledEnumDropdown()
|
||||
=> AddStep(@"create dropdown", () => Child = new LabelledEnumDropdown<BeatmapSetOnlineStatus>
|
||||
{
|
||||
Label = @"Beatmap status",
|
||||
Description = @"This is a description"
|
||||
});
|
||||
}
|
||||
}
|
@ -1,14 +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.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Graphics.UserInterfaceV2;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Overlays;
|
||||
@ -131,25 +129,5 @@ namespace osu.Game.Tournament.Screens.Setup
|
||||
|
||||
resolution.Value = $"{ScreenSpaceDrawQuad.Width:N0}x{ScreenSpaceDrawQuad.Height:N0}";
|
||||
}
|
||||
|
||||
public class LabelledDropdown<T> : LabelledComponent<OsuDropdown<T>, T>
|
||||
{
|
||||
public LabelledDropdown()
|
||||
: base(true)
|
||||
{
|
||||
}
|
||||
|
||||
public IEnumerable<T> Items
|
||||
{
|
||||
get => Component.Items;
|
||||
set => Component.Items = value;
|
||||
}
|
||||
|
||||
protected override OsuDropdown<T> CreateComponent() => new OsuDropdown<T>
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Width = 0.5f,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
31
osu.Game/Graphics/UserInterfaceV2/LabelledDropdown.cs
Normal file
31
osu.Game/Graphics/UserInterfaceV2/LabelledDropdown.cs
Normal file
@ -0,0 +1,31 @@
|
||||
// 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 class LabelledDropdown<TItem> : LabelledComponent<OsuDropdown<TItem>, TItem>
|
||||
{
|
||||
public LabelledDropdown()
|
||||
: base(true)
|
||||
{
|
||||
}
|
||||
|
||||
public IEnumerable<TItem> Items
|
||||
{
|
||||
get => Component.Items;
|
||||
set => Component.Items = value;
|
||||
}
|
||||
|
||||
protected sealed override OsuDropdown<TItem> CreateComponent() => CreateDropdown().With(d =>
|
||||
{
|
||||
d.RelativeSizeAxes = Axes.X;
|
||||
d.Width = 0.5f;
|
||||
});
|
||||
|
||||
protected virtual OsuDropdown<TItem> CreateDropdown() => new OsuDropdown<TItem>();
|
||||
}
|
||||
}
|
14
osu.Game/Graphics/UserInterfaceV2/LabelledEnumDropdown.cs
Normal file
14
osu.Game/Graphics/UserInterfaceV2/LabelledEnumDropdown.cs
Normal file
@ -0,0 +1,14 @@
|
||||
// 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.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterfaceV2
|
||||
{
|
||||
public class LabelledEnumDropdown<TEnum> : LabelledDropdown<TEnum>
|
||||
where TEnum : struct, Enum
|
||||
{
|
||||
protected override OsuDropdown<TEnum> CreateDropdown() => new OsuEnumDropdown<TEnum>();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user