mirror of
https://github.com/drewcassidy/KSP-Conformal-Decals.git
synced 2024-09-01 18:23:54 +00:00
Compare commits
2 Commits
35fce78616
...
fc6820d73b
Author | SHA1 | Date | |
---|---|---|---|
fc6820d73b | |||
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) {
|
||||
@ -113,12 +111,8 @@ namespace ConformalDecals {
|
||||
var colors = new[] {color, color, color, color};
|
||||
|
||||
var tex = new Texture2D(width, height, TextureFormat.RGBA32, false);
|
||||
for (var x = 0; x <= width; x++) {
|
||||
for (var y = 0; y < height; y++) {
|
||||
tex.SetPixels32(colors);
|
||||
}
|
||||
}
|
||||
|
||||
tex.SetPixels32(colors);
|
||||
tex.Apply();
|
||||
|
||||
return tex;
|
||||
@ -132,7 +126,7 @@ namespace ConformalDecals {
|
||||
var configs = GameDatabase.Instance.GetConfigs("CONFORMALDECALS");
|
||||
|
||||
if (configs.Length > 0) {
|
||||
Logging.Log("loading config");
|
||||
Logging.Log("Loading config");
|
||||
foreach (var config in configs) {
|
||||
ParseConfig(config.config);
|
||||
}
|
||||
|
@ -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