mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 07:42:57 +08:00
commit
9c4ff6d935
@ -25,7 +25,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
AddStep("create component", () =>
|
||||
{
|
||||
LabelledComponent component;
|
||||
LabelledComponent<Drawable> component;
|
||||
|
||||
Child = new Container
|
||||
{
|
||||
@ -33,7 +33,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
Origin = Anchor.Centre,
|
||||
Width = 500,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Child = component = padded ? (LabelledComponent)new PaddedLabelledComponent() : new NonPaddedLabelledComponent(),
|
||||
Child = component = padded ? (LabelledComponent<Drawable>)new PaddedLabelledComponent() : new NonPaddedLabelledComponent(),
|
||||
};
|
||||
|
||||
component.Label = "a sample component";
|
||||
@ -41,7 +41,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
});
|
||||
}
|
||||
|
||||
private class PaddedLabelledComponent : LabelledComponent
|
||||
private class PaddedLabelledComponent : LabelledComponent<Drawable>
|
||||
{
|
||||
public PaddedLabelledComponent()
|
||||
: base(true)
|
||||
@ -57,7 +57,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
};
|
||||
}
|
||||
|
||||
private class NonPaddedLabelledComponent : LabelledComponent
|
||||
private class NonPaddedLabelledComponent : LabelledComponent<Drawable>
|
||||
{
|
||||
public NonPaddedLabelledComponent()
|
||||
: base(false)
|
||||
|
@ -89,7 +89,7 @@ namespace osu.Game.Tournament.Screens
|
||||
};
|
||||
}
|
||||
|
||||
private class ActionableInfo : LabelledComponent
|
||||
private class ActionableInfo : LabelledComponent<Drawable>
|
||||
{
|
||||
private OsuButton button;
|
||||
|
||||
|
@ -11,7 +11,8 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Setup.Components.LabelledComponents
|
||||
{
|
||||
public abstract class LabelledComponent : CompositeDrawable
|
||||
public abstract class LabelledComponent<T> : CompositeDrawable
|
||||
where T : Drawable
|
||||
{
|
||||
protected const float CONTENT_PADDING_VERTICAL = 10;
|
||||
protected const float CONTENT_PADDING_HORIZONTAL = 15;
|
||||
@ -20,15 +21,15 @@ namespace osu.Game.Screens.Edit.Setup.Components.LabelledComponents
|
||||
/// <summary>
|
||||
/// The component that is being displayed.
|
||||
/// </summary>
|
||||
protected readonly Drawable Component;
|
||||
protected readonly T Component;
|
||||
|
||||
private readonly OsuTextFlowContainer labelText;
|
||||
private readonly OsuTextFlowContainer descriptionText;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="LabelledComponent"/>.
|
||||
/// Creates a new <see cref="LabelledComponent{T}"/>.
|
||||
/// </summary>
|
||||
/// <param name="padded">Whether the component should be padded or should be expanded to the bounds of this <see cref="LabelledComponent"/>.</param>
|
||||
/// <param name="padded">Whether the component should be padded or should be expanded to the bounds of this <see cref="LabelledComponent{T}"/>.</param>
|
||||
protected LabelledComponent(bool padded)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
@ -127,6 +128,6 @@ namespace osu.Game.Screens.Edit.Setup.Components.LabelledComponents
|
||||
/// Creates the component that should be displayed.
|
||||
/// </summary>
|
||||
/// <returns>The component.</returns>
|
||||
protected abstract Drawable CreateComponent();
|
||||
protected abstract T CreateComponent();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user