49 lines
1.5 KiB
C#
49 lines
1.5 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace TKS.OutGame
|
|
{
|
|
/// <summary>
|
|
/// 이 물체 아래 모든 글자 = 게임 글꼴(테마 제목 글꼴 · PD 2026-11-19 「"업데이트 예정입니다." 와 같은 모든 안내 팝업 UI 의 폰트를 우리 게임 폰트로 통일」).
|
|
/// 팝업(OutGameRoot.ModalCustom)은 틀을 만든 뒤 호출 쪽이 내용을 채우므로, 켜져 있는 동안 캔버스를 그리기 직전마다 새로 생긴 글자도 맞춘다(이미 맞은 글자는 건너뜀).
|
|
/// </summary>
|
|
public class UiFontUnify : MonoBehaviour
|
|
{
|
|
readonly List<Text> buf = new List<Text>();
|
|
|
|
void OnEnable()
|
|
{
|
|
Canvas.willRenderCanvases += OnWillRender;
|
|
Apply();
|
|
}
|
|
|
|
void OnDisable()
|
|
{
|
|
Canvas.willRenderCanvases -= OnWillRender;
|
|
}
|
|
|
|
void OnWillRender()
|
|
{
|
|
Apply();
|
|
}
|
|
|
|
/// <summary>아래 글자 중 게임 글꼴이 아닌 것을 바꿈 · 바꾼 수.</summary>
|
|
public int Apply()
|
|
{
|
|
if (this == null) return 0;
|
|
var f = UISkin.TitleFont;
|
|
if (f == null) return 0;
|
|
GetComponentsInChildren(true, buf);
|
|
int n = 0;
|
|
foreach (var t in buf)
|
|
if (t.font != f)
|
|
{
|
|
UISkin.UseTitle(t);
|
|
n++;
|
|
}
|
|
return n;
|
|
}
|
|
}
|
|
}
|