mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 09:13:21 +08:00
Move font local
This commit is contained in:
parent
ee9d82f0fe
commit
9e4f2c7eb9
@ -176,7 +176,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
|||||||
X = (flip ? -1 : 1) * 90,
|
X = (flip ? -1 : 1) * 90,
|
||||||
Y = -10,
|
Y = -10,
|
||||||
Colour = colour,
|
Colour = colour,
|
||||||
Font = OsuFont.GetFont(typeface: Typeface.Aquatico, weight: FontWeight.Regular, size: 20),
|
Font = TournamentFont.GetFont(typeface: TournamentTypeface.Aquatico, weight: FontWeight.Regular, size: 20),
|
||||||
Origin = anchor,
|
Origin = anchor,
|
||||||
Anchor = anchor,
|
Anchor = anchor,
|
||||||
},
|
},
|
||||||
@ -219,7 +219,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
|||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Colour = Color4.White,
|
Colour = Color4.White,
|
||||||
Text = match.NewValue.Grouping.Value?.Name.Value ?? "Unknown Grouping",
|
Text = match.NewValue.Grouping.Value?.Name.Value ?? "Unknown Grouping",
|
||||||
Font = OsuFont.GetFont(typeface: Typeface.Aquatico, weight: FontWeight.Regular, size: 18),
|
Font = TournamentFont.GetFont(typeface: TournamentTypeface.Aquatico, weight: FontWeight.Regular, size: 18),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -122,8 +122,8 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
|||||||
public bool Winning
|
public bool Winning
|
||||||
{
|
{
|
||||||
set => DisplayedCountSpriteText.Font = value
|
set => DisplayedCountSpriteText.Font = value
|
||||||
? OsuFont.GetFont(typeface: Typeface.Aquatico, weight: FontWeight.Regular, size: 60)
|
? TournamentFont.GetFont(typeface: TournamentTypeface.Aquatico, weight: FontWeight.Regular, size: 60)
|
||||||
: OsuFont.GetFont(typeface: Typeface.Aquatico, weight: FontWeight.Light, size: 40);
|
: TournamentFont.GetFont(typeface: TournamentTypeface.Aquatico, weight: FontWeight.Light, size: 40);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -200,7 +200,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
|||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = team?.FullName.ToUpper() ?? "???",
|
Text = team?.FullName.ToUpper() ?? "???",
|
||||||
Font = OsuFont.GetFont(Typeface.Aquatico, 40, FontWeight.Light),
|
Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 40, FontWeight.Light),
|
||||||
Colour = Color4.Black,
|
Colour = Color4.Black,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
@ -208,7 +208,7 @@ namespace osu.Game.Tournament.Screens.TeamIntro
|
|||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = teamName.ToUpper(),
|
Text = teamName.ToUpper(),
|
||||||
Font = OsuFont.GetFont(Typeface.Aquatico, 20, FontWeight.Regular),
|
Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 20, FontWeight.Regular),
|
||||||
Colour = colour,
|
Colour = colour,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
|
@ -127,7 +127,7 @@ namespace osu.Game.Tournament.Screens.TeamWin
|
|||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Colour = col,
|
Colour = col,
|
||||||
Text = "WINNER",
|
Text = "WINNER",
|
||||||
Font = OsuFont.GetFont(Typeface.Aquatico, 15, FontWeight.Regular),
|
Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 15, FontWeight.Regular),
|
||||||
},
|
},
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
@ -135,7 +135,7 @@ namespace osu.Game.Tournament.Screens.TeamWin
|
|||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Colour = col,
|
Colour = col,
|
||||||
Text = pairing.Grouping.Value?.Name.Value ?? "Unknown Grouping",
|
Text = pairing.Grouping.Value?.Name.Value ?? "Unknown Grouping",
|
||||||
Font = OsuFont.GetFont(Typeface.Aquatico, 50, FontWeight.Light),
|
Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 50, FontWeight.Light),
|
||||||
Spacing = new Vector2(10, 0),
|
Spacing = new Vector2(10, 0),
|
||||||
},
|
},
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
@ -144,7 +144,7 @@ namespace osu.Game.Tournament.Screens.TeamWin
|
|||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Colour = col,
|
Colour = col,
|
||||||
Text = pairing.Date.Value.ToUniversalTime().ToString("dd MMMM HH:mm UTC"),
|
Text = pairing.Date.Value.ToUniversalTime().ToString("dd MMMM HH:mm UTC"),
|
||||||
Font = OsuFont.GetFont(Typeface.Aquatico, 20, FontWeight.Light),
|
Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 20, FontWeight.Light),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -204,7 +204,7 @@ namespace osu.Game.Tournament.Screens.TeamWin
|
|||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = team?.FullName.ToUpper() ?? "???",
|
Text = team?.FullName.ToUpper() ?? "???",
|
||||||
Font = OsuFont.GetFont(Typeface.Aquatico, 40, FontWeight.Light),
|
Font = TournamentFont.GetFont(TournamentTypeface.Aquatico, 40, FontWeight.Light),
|
||||||
Colour = Color4.Black,
|
Colour = Color4.Black,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
|
70
osu.Game.Tournament/TournamentFont.cs
Normal file
70
osu.Game.Tournament/TournamentFont.cs
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
// 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.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Tournament
|
||||||
|
{
|
||||||
|
public static class TournamentFont
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The default font size.
|
||||||
|
/// </summary>
|
||||||
|
public const float DEFAULT_FONT_SIZE = 16;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves a <see cref="FontUsage"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="typeface">The font typeface.</param>
|
||||||
|
/// <param name="size">The size of the text in local space. For a value of 16, a single line will have a height of 16px.</param>
|
||||||
|
/// <param name="weight">The font weight.</param>
|
||||||
|
/// <param name="italics">Whether the font is italic.</param>
|
||||||
|
/// <param name="fixedWidth">Whether all characters should be spaced the same distance apart.</param>
|
||||||
|
/// <returns>The <see cref="FontUsage"/>.</returns>
|
||||||
|
public static FontUsage GetFont(TournamentTypeface typeface = TournamentTypeface.Aquatico, float size = DEFAULT_FONT_SIZE, FontWeight weight = FontWeight.Medium, bool italics = false, bool fixedWidth = false)
|
||||||
|
=> new FontUsage(GetFamilyString(typeface), size, GetWeightString(typeface, weight), italics, fixedWidth);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the string representation of a <see cref="TournamentTypeface"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="typeface">The <see cref="TournamentTypeface"/>.</param>
|
||||||
|
/// <returns>The string representation.</returns>
|
||||||
|
public static string GetFamilyString(TournamentTypeface typeface)
|
||||||
|
{
|
||||||
|
switch (typeface)
|
||||||
|
{
|
||||||
|
case TournamentTypeface.Aquatico:
|
||||||
|
return "Aquatico";
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the string representation of a <see cref="FontWeight"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="typeface">The <see cref="TournamentTypeface"/>.</param>
|
||||||
|
/// <param name="weight">The <see cref="FontWeight"/>.</param>
|
||||||
|
/// <returns>The string representation of <paramref name="weight"/> in the specified <paramref name="typeface"/>.</returns>
|
||||||
|
public static string GetWeightString(TournamentTypeface typeface, FontWeight weight)
|
||||||
|
=> GetWeightString(GetFamilyString(typeface), weight);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Retrieves the string representation of a <see cref="FontWeight"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="family">The family string.</param>
|
||||||
|
/// <param name="weight">The <see cref="FontWeight"/>.</param>
|
||||||
|
/// <returns>The string representation of <paramref name="weight"/> in the specified <paramref name="family"/>.</returns>
|
||||||
|
public static string GetWeightString(string family, FontWeight weight)
|
||||||
|
{
|
||||||
|
string weightString = weight.ToString();
|
||||||
|
|
||||||
|
// Only exo has an explicit "regular" weight, other fonts do not
|
||||||
|
if (weight == FontWeight.Regular && family != GetFamilyString(TournamentTypeface.Aquatico) && family != GetFamilyString(TournamentTypeface.Aquatico))
|
||||||
|
weightString = string.Empty;
|
||||||
|
|
||||||
|
return weightString;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,7 +2,9 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Cursor;
|
using osu.Game.Graphics.Cursor;
|
||||||
using osu.Game.Tournament.Screens;
|
using osu.Game.Tournament.Screens;
|
||||||
|
|
||||||
@ -23,4 +25,30 @@ namespace osu.Game.Tournament
|
|||||||
MenuCursorContainer.Cursor.Alpha = 0;
|
MenuCursorContainer.Cursor.Alpha = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class TournamentFontExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a new <see cref="FontUsage"/> by applying adjustments to this <see cref="FontUsage"/>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="usage">The base <see cref="FontUsage"/>.</param>
|
||||||
|
/// <param name="typeface">The font typeface. If null, the value is copied from this <see cref="FontUsage"/>.</param>
|
||||||
|
/// <param name="size">The text size. If null, the value is copied from this <see cref="FontUsage"/>.</param>
|
||||||
|
/// <param name="weight">The font weight. If null, the value is copied from this <see cref="FontUsage"/>.</param>
|
||||||
|
/// <param name="italics">Whether the font is italic. If null, the value is copied from this <see cref="FontUsage"/>.</param>
|
||||||
|
/// <param name="fixedWidth">Whether all characters should be spaced apart the same distance. If null, the value is copied from this <see cref="FontUsage"/>.</param>
|
||||||
|
/// <returns>The resulting <see cref="FontUsage"/>.</returns>
|
||||||
|
public static FontUsage With(this FontUsage usage, TournamentTypeface? typeface = null, float? size = null, FontWeight? weight = null, bool? italics = null, bool? fixedWidth = null)
|
||||||
|
{
|
||||||
|
string familyString = typeface != null ? TournamentFont.GetFamilyString(typeface.Value) : usage.Family;
|
||||||
|
string weightString = weight != null ? TournamentFont.GetWeightString(familyString, weight.Value) : usage.Weight;
|
||||||
|
|
||||||
|
return usage.With(familyString, size, weightString, italics, fixedWidth);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum TournamentTypeface
|
||||||
|
{
|
||||||
|
Aquatico
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,9 +45,6 @@ namespace osu.Game.Graphics
|
|||||||
|
|
||||||
case Typeface.Venera:
|
case Typeface.Venera:
|
||||||
return "Venera";
|
return "Venera";
|
||||||
|
|
||||||
case Typeface.Aquatico:
|
|
||||||
return "Aquatico";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -73,7 +70,7 @@ namespace osu.Game.Graphics
|
|||||||
string weightString = weight.ToString();
|
string weightString = weight.ToString();
|
||||||
|
|
||||||
// Only exo has an explicit "regular" weight, other fonts do not
|
// Only exo has an explicit "regular" weight, other fonts do not
|
||||||
if (weight == FontWeight.Regular && family != GetFamilyString(Typeface.Exo) && family != GetFamilyString(Typeface.Aquatico))
|
if (weight == FontWeight.Regular && family != GetFamilyString(Typeface.Exo))
|
||||||
weightString = string.Empty;
|
weightString = string.Empty;
|
||||||
|
|
||||||
return weightString;
|
return weightString;
|
||||||
@ -105,7 +102,6 @@ namespace osu.Game.Graphics
|
|||||||
{
|
{
|
||||||
Exo,
|
Exo,
|
||||||
Venera,
|
Venera,
|
||||||
Aquatico // tournament use only
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum FontWeight
|
public enum FontWeight
|
||||||
|
Loading…
Reference in New Issue
Block a user