// Recompile at 2025-05-13 오전 2:18:27 // Copyright (c) Pixel Crushers. All rights reserved. using System.Collections; using System.Collections.Generic; using UnityEngine; namespace PixelCrushers { /// /// Specifies fonts to use for different languages. Used by SetLocalizedFont /// and LocalizeUI. /// public class LocalizedFonts : ScriptableObject { [System.Serializable] public class FontForLanguage { public string language; public Font font; #if TMP_PRESENT public TMPro.TMP_FontAsset textMeshProFont; #endif [Tooltip("Scale this language's font size relative to initial font's size. (0.5 scales to half size, 2.0 scales to double size.)")] public float scaleRelativeToInitialFont = 1f; } public Font defaultFont; #if TMP_PRESENT public TMPro.TMP_FontAsset defaultTextMeshProFont; #endif public List fontsForLanguages = new List(); /// /// Returns the font for a specified language, or default font if none. /// public Font GetFont(string language) { var record = fontsForLanguages.Find(x => string.Equals(x.language, language)); return (record != null && record.font != null) ? record.font : defaultFont; } #if TMP_PRESENT /// /// Returns the TextMesh Pro font for a specified language, or default TextMesh Pro font if none. /// public TMPro.TMP_FontAsset GetTextMeshProFont(string language) { var record = fontsForLanguages.Find(x => string.Equals(x.language, language)); return (record != null && record.textMeshProFont != null) ? record.textMeshProFont : defaultTextMeshProFont; } #endif public float GetFontScale(string language) { var record = fontsForLanguages.Find(x => string.Equals(x.language, language)); return (record != null && record.font != null) ? record.scaleRelativeToInitialFont : 1; } } }