You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
KSP-Conformal-Decals/Source/ConformalDecals/ConformalDecalConfig.cs

37 lines
1.1 KiB
C#

using System.Collections.Generic;
using UnityEngine;
namespace ConformalDecals {
public static class ConformalDecalConfig {
private static List<string> _shaderBlacklist;
public static bool IsBlacklisted(Shader shader) {
return IsBlacklisted(shader.name);
}
public static bool IsBlacklisted(string shaderName) {
return _shaderBlacklist.Contains(shaderName);
}
private static void ParseConfig(ConfigNode node) {
foreach (var blacklist in node.GetNodes("SHADERBLACKLIST")) {
foreach (var shaderName in blacklist.GetValuesList("shader")) {
_shaderBlacklist.Add(shaderName);
}
}
}
public static void ModuleManagerPostLoad() {
_shaderBlacklist = new List<string>();
var configs = GameDatabase.Instance.GetConfigs("CONFORMALDECALS");
if (configs.Length > 0) {
Debug.Log("ConformalDecals: loading config");
foreach (var config in configs) {
ParseConfig(config.config);
}
}
}
}
}