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