コード例 #1
0
        private static void buildShaderSets()
        {
            ConfigNode[] shaderNodes = GameDatabase.Instance.GetConfigNodes("KSP_SHADER_DATA");
            ConfigNode   node;
            int          len = shaderNodes.Length;
            string       sName, iName;

            for (int i = 0; i < len; i++)
            {
                node  = shaderNodes[i];
                sName = node.GetStringValue("shader", "KSP/Diffuse");
                iName = node.GetStringValue("iconShader", "KSP/ScreenSpaceMask");
                Log.log("Loading shader icon replacement data for: " + sName + " :: " + iName);
                Shader shader = getShader(sName);
                if (shader == null)
                {
                    Log.exception("ERROR: Could not locate base Shader for name: " + sName + " while setting up icon shaders.");
                    continue;
                }
                Shader iconShader = getShader(iName);
                if (iconShader == null)
                {
                    Log.exception("ERROR: Could not locate icon Shader for name: " + iName + " while setting up icon shaders.");
                    continue;
                }
                IconShaderData data = new IconShaderData(shader, iconShader);
                iconShaders.Add(shader.name, data);
            }
        }
コード例 #2
0
        private static void buildShaderSets(Dictionary <string, Shader> dict)
        {
            ConfigNode[] shaderNodes = GameDatabase.Instance.GetConfigNodes("KSP_SHADER_DATA");
            ConfigNode   node;
            int          len = shaderNodes.Length;
            string       sName, iName;

            for (int i = 0; i < len; i++)
            {
                node  = shaderNodes[i];
                sName = node.GetStringValue("shader", "KSP/Diffuse");
                iName = node.GetStringValue("iconShader", "KSP/ScreenSpaceMask");
                MonoBehaviour.print("Loading shader icon replacement data for: " + sName + " :: " + iName);
                Shader         shader     = dict[sName];
                Shader         iconShader = dict[iName];
                IconShaderData data       = new IconShaderData(shader, iconShader);
                loadedShaders.Add(shader.name, data);
            }
        }