mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 02:42:54 +08:00
Refactor editor selection/blueprint components to be generic
This commit is contained in:
parent
2d17219c8f
commit
fca173225a
@ -4,7 +4,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
@ -13,6 +12,7 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
@ -50,7 +50,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
{
|
||||
Colour = Color4.Black,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 0.7f,
|
||||
Alpha = 0.9f,
|
||||
},
|
||||
new FillFlowContainer
|
||||
{
|
||||
@ -106,12 +106,23 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
|
||||
private IReadOnlyList<Drawable> createSkinSourceComponents()
|
||||
{
|
||||
var hudComponents = typeof(SkinnableHUDComponent).Assembly.GetTypes().Where(t => typeof(SkinnableHUDComponent).IsAssignableFrom(t)).ToArray();
|
||||
Drawable[] hudComponents = typeof(SkinnableHUDComponent).Assembly
|
||||
.GetTypes()
|
||||
.Where(t => typeof(SkinnableHUDComponent).IsAssignableFrom(t))
|
||||
.Where(t => !t.IsAbstract)
|
||||
.Select(t => Activator.CreateInstance(t) as Drawable)
|
||||
.ToArray();
|
||||
|
||||
List<Drawable> drawables = new List<Drawable>();
|
||||
|
||||
foreach (var component in hudComponents)
|
||||
{
|
||||
drawables.Add(new OsuSpriteText
|
||||
{
|
||||
Text = component.GetType().Name
|
||||
});
|
||||
drawables.AddRange(component.CreateSettingsControls());
|
||||
}
|
||||
|
||||
return drawables;
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public class SkinnableComboCounter : SkinnableDrawable, IComboCounter
|
||||
public class SkinnableComboCounter : SkinnableHUDComponent, IComboCounter
|
||||
{
|
||||
public Bindable<int> Current { get; } = new Bindable<int>();
|
||||
|
||||
|
@ -9,7 +9,7 @@ using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Screens.Play.HUD
|
||||
{
|
||||
public class SkinnableHealthDisplay : SkinnableDrawable, IHealthDisplay
|
||||
public class SkinnableHealthDisplay : SkinnableHUDComponent, IHealthDisplay
|
||||
{
|
||||
public Bindable<double> Current { get; } = new BindableDouble(1)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user