Replace copy-constructor/method with extension method

This commit is contained in:
smoogipoo
2019-02-20 19:32:30 +09:00
parent dbfa95b9e7
commit 4db5531e4b
40 changed files with 66 additions and 68 deletions

View File

@ -82,7 +82,7 @@ namespace osu.Game.Graphics.UserInterface
public BreadcrumbTabItem(T value) : base(value)
{
Text.Font = OsuFont.GetFont(Text.Font, size: 18);
Text.Font = Text.Font.With(size: 18);
Text.Margin = new MarginPadding { Vertical = 8 };
Padding = new MarginPadding { Right = padding + item_chevron_size };
Add(Chevron = new SpriteIcon

View File

@ -199,7 +199,7 @@ namespace osu.Game.Graphics.UserInterface
public float TextSize
{
get => spriteText.Font.Size;
set => spriteText.Font = OsuFont.GetFont(spriteText.Font, size: value);
set => spriteText.Font = spriteText.Font.With(size: value);
}
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => backgroundContainer.ReceivePositionalInputAt(screenSpacePos);

View File

@ -173,7 +173,7 @@ namespace osu.Game.Graphics.UserInterface
new HoverClickSounds()
};
Active.BindValueChanged(val => Text.Font = OsuFont.GetFont(Text.Font, weight: val ? FontWeight.Bold : FontWeight.Medium), true);
Active.BindValueChanged(val => Text.Font = Text.Font.With(weight: val ? FontWeight.Bold : FontWeight.Medium), true);
}
protected override void OnActivated() => fadeActive();

View File

@ -59,7 +59,7 @@ namespace osu.Game.Graphics.UserInterface
new HoverClickSounds()
};
Active.BindValueChanged(val => Text.Font = OsuFont.GetFont(Text.Font, weight: val ? FontWeight.Bold : FontWeight.Medium), true);
Active.BindValueChanged(val => Text.Font = Text.Font.With(weight: val ? FontWeight.Bold : FontWeight.Medium), true);
}
[BackgroundDependencyLoader]

View File

@ -22,7 +22,7 @@ namespace osu.Game.Graphics.UserInterface
public PercentageCounter()
{
DisplayedCountSpriteText.Font = OsuFont.GetFont(DisplayedCountSpriteText.Font, fixedWidth: true);
DisplayedCountSpriteText.Font = DisplayedCountSpriteText.Font.With(fixedWidth: true);
Current.Value = DisplayedCount = 1.0f;
}

View File

@ -65,7 +65,7 @@ namespace osu.Game.Graphics.UserInterface
public float TextSize
{
get => DisplayedCountSpriteText.Font.Size;
set => DisplayedCountSpriteText.Font = OsuFont.GetFont(DisplayedCountSpriteText.Font, size: value);
set => DisplayedCountSpriteText.Font = DisplayedCountSpriteText.Font.With(size: value);
}
public Color4 AccentColour

View File

@ -28,7 +28,7 @@ namespace osu.Game.Graphics.UserInterface
/// <param name="leading">How many leading zeroes the counter will have.</param>
public ScoreCounter(uint leading = 0)
{
DisplayedCountSpriteText.Font = OsuFont.GetFont(DisplayedCountSpriteText.Font, fixedWidth: true);
DisplayedCountSpriteText.Font = DisplayedCountSpriteText.Font.With(fixedWidth: true);
LeadingZeroes = leading;
}