Refactor Asset Loading

This commit is contained in:
copecone committed 2026-10-05 14:50:21 +09:00
1 parent 6c0347609d
commit b15903f1e0
9 files changed
+102 -162

No files matched your search

+2 -36
View File
@@ -30,39 +30,6 @@ internal class DebugMonitorUI : MonoBehaviour
private RectTransform _fillRect = null!;
private TextMeshProUGUI _progressText = null!;
private static TMP_FontAsset GetNanumSquareNeoBdFontAsset()
{
TMP_FontAsset? font = null;
if (RenderMod.FontBundle != null)
{
try
{
font = RenderMod.FontBundle.LoadAsset<TMP_FontAsset>("NanumSquareNeoOTF-Bd SDF");
}
catch
{
// Loading failed
}
}
// Fallback: Use game's own font or built-in TMP SDF font if AssetBundle loading fails
if (font == null)
{
font = RDString.fontData.fontTMP;
}
if (font == null)
{
// ReSharper disable once Unity.UnknownResource
font = Resources.Load<TMP_FontAsset>("Fonts & Materials/LiberationSans SDF");
}
if (font != null) return font;
var fonts = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
if (fonts.Length > 0) font = fonts[0];
return font!;
}
private void Start()
{
// Set UI layer (5)
@@ -112,8 +79,7 @@ internal class DebugMonitorUI : MonoBehaviour
_text.overflowMode = TextOverflowModes.Overflow;
// Load and apply font
var font = GetNanumSquareNeoBdFontAsset();
_text.font = font;
_text.font = ModAssets.NanumSquareNeoNormal;
var textRect = textObj.GetComponent<RectTransform>();
textRect.anchorMin = Vector2.zero;
@@ -166,7 +132,7 @@ internal class DebugMonitorUI : MonoBehaviour
_progressText.richText = true;
_progressText.fontSize = BarTextFontSize;
_progressText.alignment = TextAlignmentOptions.Center;
_progressText.font = font;
_progressText.font = ModAssets.NanumSquareNeoNormal;
_progressText.color = BarTextColor;
// Add progress bar text outline for readability