mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Move and rename the base component class
This commit is contained in:
@ -23,7 +23,7 @@ using osu.Game.Resources.Localisation.Web;
|
||||
namespace osu.Game.Skinning.Components
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public partial class BeatmapAttributeText : DefaultTextSkinComponent
|
||||
public partial class BeatmapAttributeText : FontAdjustableSkinComponent
|
||||
{
|
||||
[SettingSource("Attribute", "The attribute to be displayed.")]
|
||||
public Bindable<BeatmapAttribute> Attribute { get; } = new Bindable<BeatmapAttribute>(BeatmapAttribute.StarRating);
|
||||
|
@ -1,34 +0,0 @@
|
||||
// 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 osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Skinning.Components
|
||||
{
|
||||
/// <summary>
|
||||
/// Skin element that contains text and have ability to control its font.
|
||||
/// </summary>
|
||||
public abstract partial class DefaultTextSkinComponent : Container, ISkinnableDrawable
|
||||
{
|
||||
public bool UsesFixedAnchor { get; set; }
|
||||
|
||||
[SettingSource("Font", "Font to use.")]
|
||||
public Bindable<Typeface> Font { get; } = new Bindable<Typeface>(Typeface.Torus);
|
||||
|
||||
protected abstract void SetFont(FontUsage font);
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
Font.BindValueChanged(e =>
|
||||
{
|
||||
FontUsage f = OsuFont.GetFont(e.NewValue, weight: e.NewValue == Typeface.Venera ? FontWeight.Bold : FontWeight.Regular);
|
||||
SetFont(f);
|
||||
}, true);
|
||||
}
|
||||
}
|
||||
}
|
@ -12,7 +12,7 @@ using osu.Game.Graphics.Sprites;
|
||||
namespace osu.Game.Skinning.Components
|
||||
{
|
||||
[UsedImplicitly]
|
||||
public partial class TextElement : DefaultTextSkinComponent
|
||||
public partial class TextElement : FontAdjustableSkinComponent
|
||||
{
|
||||
[SettingSource("Text", "The text to be displayed.")]
|
||||
public Bindable<string> Text { get; } = new Bindable<string>("Circles!");
|
||||
|
Reference in New Issue
Block a user