mirror of
https://github.com/ppy/osu
synced 2025-01-11 08:39:31 +00:00
Use With(s => ...)
extension for better readability
This commit is contained in:
parent
5759ffff6f
commit
ee9fa11d14
@ -137,19 +137,20 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
|
||||
public bool Winning
|
||||
{
|
||||
set => displayedSpriteText.Font = value
|
||||
set => updateFont(value);
|
||||
}
|
||||
|
||||
protected override OsuSpriteText CreateSpriteText() => base.CreateSpriteText().With(s =>
|
||||
{
|
||||
displayedSpriteText = s;
|
||||
displayedSpriteText.Spacing = new Vector2(-6);
|
||||
updateFont(false);
|
||||
});
|
||||
|
||||
private void updateFont(bool winning)
|
||||
=> displayedSpriteText.Font = winning
|
||||
? OsuFont.Torus.With(weight: FontWeight.Bold, size: 50, fixedWidth: true)
|
||||
: OsuFont.Torus.With(weight: FontWeight.Regular, size: 40, fixedWidth: true);
|
||||
}
|
||||
|
||||
protected override OsuSpriteText CreateSpriteText()
|
||||
{
|
||||
displayedSpriteText = base.CreateSpriteText();
|
||||
displayedSpriteText.Spacing = new Vector2(-6);
|
||||
Winning = false;
|
||||
|
||||
return displayedSpriteText;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -49,13 +49,11 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
|
||||
public override void Increment(double amount)
|
||||
=> Current.Value += amount;
|
||||
|
||||
protected override OsuSpriteText CreateSpriteText()
|
||||
protected override OsuSpriteText CreateSpriteText() => base.CreateSpriteText().With(s =>
|
||||
{
|
||||
var spriteText = base.CreateSpriteText();
|
||||
spriteText.Font = OsuFont.Torus.With(size: 20, fixedWidth: true);
|
||||
spriteText.Spacing = new Vector2(-2, 0);
|
||||
return spriteText;
|
||||
}
|
||||
s.Font = OsuFont.Torus.With(size: 20, fixedWidth: true);
|
||||
s.Spacing = new Vector2(-2, 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -44,13 +44,11 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
|
||||
|
||||
protected override Easing RollingEasing => AccuracyCircle.ACCURACY_TRANSFORM_EASING;
|
||||
|
||||
protected override OsuSpriteText CreateSpriteText()
|
||||
protected override OsuSpriteText CreateSpriteText() => base.CreateSpriteText().With(s =>
|
||||
{
|
||||
var spriteText = base.CreateSpriteText();
|
||||
spriteText.Font = OsuFont.Torus.With(size: 20, fixedWidth: true);
|
||||
spriteText.Spacing = new Vector2(-2, 0);
|
||||
return spriteText;
|
||||
}
|
||||
s.Font = OsuFont.Torus.With(size: 20, fixedWidth: true);
|
||||
s.Spacing = new Vector2(-2, 0);
|
||||
});
|
||||
|
||||
public override void Increment(int amount)
|
||||
=> Current.Value += amount;
|
||||
|
@ -28,16 +28,14 @@ namespace osu.Game.Screens.Ranking.Expanded
|
||||
|
||||
protected override string FormatCount(long count) => count.ToString("N0");
|
||||
|
||||
protected override OsuSpriteText CreateSpriteText()
|
||||
protected override OsuSpriteText CreateSpriteText() => base.CreateSpriteText().With(s =>
|
||||
{
|
||||
var spriteText = base.CreateSpriteText();
|
||||
spriteText.Anchor = Anchor.TopCentre;
|
||||
spriteText.Origin = Anchor.TopCentre;
|
||||
s.Anchor = Anchor.TopCentre;
|
||||
s.Origin = Anchor.TopCentre;
|
||||
|
||||
spriteText.Font = OsuFont.Torus.With(size: 60, weight: FontWeight.Light, fixedWidth: true);
|
||||
spriteText.Spacing = new Vector2(-5, 0);
|
||||
return spriteText;
|
||||
}
|
||||
s.Font = OsuFont.Torus.With(size: 60, weight: FontWeight.Light, fixedWidth: true);
|
||||
s.Spacing = new Vector2(-5, 0);
|
||||
});
|
||||
|
||||
public override void Increment(long amount)
|
||||
=> Current.Value += amount;
|
||||
|
Loading…
Reference in New Issue
Block a user