mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Fix flag aspect ratio and font instantiation
This commit is contained in:
parent
35fce78616
commit
9dc98a6f9d
Binary file not shown.
@ -50,8 +50,6 @@ namespace ConformalDecals {
|
||||
|
||||
public static IEnumerable<DecalFont> Fonts => _fontList.Values;
|
||||
|
||||
public static DecalFont FallbackFont { get; private set; }
|
||||
|
||||
public static bool IsBlacklisted(Shader shader) {
|
||||
return IsBlacklisted(shader.name);
|
||||
}
|
||||
@ -96,7 +94,7 @@ namespace ConformalDecals {
|
||||
|
||||
foreach (var fontNode in node.GetNodes("FONT")) {
|
||||
try {
|
||||
var font = new DecalFont(fontNode, allFonts);
|
||||
var font = DecalFont.Parse(fontNode, allFonts);
|
||||
_fontList.Add(font.Name, font);
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
@ -83,7 +83,7 @@ namespace ConformalDecals {
|
||||
}
|
||||
|
||||
protected override void UpdateTextures() {
|
||||
_flagTextureProperty ??= materialProperties.AddOrGetTextureProperty("_Decal");
|
||||
_flagTextureProperty ??= materialProperties.AddOrGetTextureProperty("_Decal", true);
|
||||
|
||||
base.UpdateTextures();
|
||||
if (useCustomFlag) {
|
||||
|
@ -46,21 +46,25 @@ namespace ConformalDecals.Text {
|
||||
public bool SmallCapsMask => (_fontStyleMask & FontStyles.SmallCaps) != 0;
|
||||
|
||||
|
||||
public DecalFont(ConfigNode node, IEnumerable<TMP_FontAsset> fontAssets) {
|
||||
public static DecalFont Parse(ConfigNode node, IEnumerable<TMP_FontAsset> fontAssets) {
|
||||
if (node == null) throw new ArgumentNullException(nameof(node));
|
||||
if (fontAssets == null) throw new ArgumentNullException(nameof(fontAssets));
|
||||
|
||||
var font = ScriptableObject.CreateInstance<DecalFont>();
|
||||
|
||||
var name = ParseUtil.ParseString(node, "name");
|
||||
_fontAsset = fontAssets.First(o => o.name == name);
|
||||
if (FontAsset == null) {
|
||||
var fontAsset = fontAssets.First(o => o.name == name);
|
||||
if (fontAsset == null) {
|
||||
throw new FormatException($"Could not find font asset named {name}");
|
||||
}
|
||||
|
||||
_title = ParseUtil.ParseString(node, "title", true, name);
|
||||
_fontStyle = (FontStyles) ParseUtil.ParseInt(node, "style", true);
|
||||
_fontStyleMask = (FontStyles) ParseUtil.ParseInt(node, "styleMask", true);
|
||||
}
|
||||
font._fontAsset = fontAsset;
|
||||
font._title = ParseUtil.ParseString(node, "title", true, name);
|
||||
font._fontStyle = (FontStyles) ParseUtil.ParseInt(node, "style", true);
|
||||
font._fontStyleMask = (FontStyles) ParseUtil.ParseInt(node, "styleMask", true);
|
||||
|
||||
return font;
|
||||
}
|
||||
|
||||
public void SetupSample(TMP_Text tmp) {
|
||||
if (tmp == null) throw new ArgumentNullException(nameof(tmp));
|
||||
|
Loading…
Reference in New Issue
Block a user