Allow fonts to disable certain unsupported styles

Also clean up some stuff
This commit is contained in:
2020-07-25 01:36:19 -07:00
parent 30870b263a
commit 1c776c0969
7 changed files with 130 additions and 50 deletions

View File

@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using ConformalDecals.Text;
using ConformalDecals.Util;
@ -95,17 +96,13 @@ namespace ConformalDecals {
var allFonts = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
foreach (var fontNode in node.GetNodes("FONT")) {
var name = ParseUtil.ParseString(fontNode, "name");
var title = ParseUtil.ParseString(fontNode, "title", true, name);
var style = ParseUtil.ParseInt(fontNode, "style", true);
var font = allFonts.First(o => o.name == name);
if (font == null) {
Debug.LogWarning($"[ConformalDecals] Could not found named {name}");
}
Debug.Log($"Adding font named {name}");
_fontList.Add(name, new DecalFont(title, font, (FontStyles) style));
try {
var font = new DecalFont(node, allFonts);
_fontList.Add(font.Name, font);
}
catch (Exception e) {
Debug.LogException(e);
}
}
}