Esempio n. 1
0
    public AssetConfiguration(StreamReader reader)
    {
        assets = new List <Asset>();

        string line = string.Empty;

        while ((line = reader.ReadLine()) != null)
        {
            if (line.Contains(VerySimpleXml.EndNode(nodeName)))
            {
                break;
            }

            //Name
            if (line.Contains(VerySimpleXml.StartNode(nameNodeName)))
            {
                name = VerySimpleXml.NodeValue(line, nameNodeName);
            }

            //////////
            //ASSETS//

            //Audio asset
            if (line.Contains(VerySimpleXml.StartNode(AudioAsset.nodeName)))
            {
                assets.Add(new AudioAsset(reader));
            }

            //Texture asset
            if (line.Contains(VerySimpleXml.StartNode(TextureAsset.nodeName)))
            {
                assets.Add(new TextureAsset(reader));
            }
        }
    }
    public TextureAsset(StreamReader reader)
    {
        string line = string.Empty;

        while ((line = reader.ReadLine()) != null)
        {
            if (line.Contains(VerySimpleXml.EndNode(nodeName)))
            {
                break;
            }

            //Name
            if (line.Contains(VerySimpleXml.StartNode(nameNodeName)))
            {
                name = VerySimpleXml.NodeValue(line, nameNodeName);
            }

            //Path
            if (line.Contains(VerySimpleXml.StartNode(pathNodeName)))
            {
                guid = AssetDatabase.AssetPathToGUID(VerySimpleXml.NodeValue(line, pathNodeName));
            }

            if (line.Contains(VerySimpleXml.StartNode(guidNodeName)))
            {
                guid = VerySimpleXml.NodeValue(line, guidNodeName);
            }

            //IMPORT SETTINGS
            if (line.Contains(VerySimpleXml.StartNode("anisoLevel")))
            {
                anisoLevel = int.Parse(VerySimpleXml.NodeValue(line, "anisoLevel"));
            }

            if (line.Contains(VerySimpleXml.StartNode("borderMipmap")))
            {
                borderMipmap = bool.Parse(VerySimpleXml.NodeValue(line, "borderMipmap"));
            }

            if (line.Contains(VerySimpleXml.StartNode("convertToNormalmap")))
            {
                convertToNormalmap = bool.Parse(VerySimpleXml.NodeValue(line, "convertToNormalmap"));
            }

            if (line.Contains(VerySimpleXml.StartNode("correctGamma")))
            {
                generateMipsInLinearSpace = bool.Parse(VerySimpleXml.NodeValue(line, "correctGamma"));
            }

            if (line.Contains(VerySimpleXml.StartNode("fadeout")))
            {
                fadeout = bool.Parse(VerySimpleXml.NodeValue(line, "fadeout"));
            }

            if (line.Contains(VerySimpleXml.StartNode("filterMode")))
            {
                filterMode = (FilterMode)System.Enum.Parse(typeof(FilterMode), VerySimpleXml.NodeValue(line, "filterMode"));
            }

            if (line.Contains(VerySimpleXml.StartNode("generateCubemap")))
            {
                generateCubemap = (TextureImporterGenerateCubemap)System.Enum.Parse(typeof(TextureImporterGenerateCubemap), VerySimpleXml.NodeValue(line, "generateCubemap"));
            }

            if (line.Contains(VerySimpleXml.StartNode("grayscaleToAlpha")))
            {
                grayscaleToAlpha = bool.Parse(VerySimpleXml.NodeValue(line, "grayscaleToAlpha"));
            }

            if (line.Contains(VerySimpleXml.StartNode("heightmapScale")))
            {
                heightmapScale = float.Parse(VerySimpleXml.NodeValue(line, "heightmapScale"));
            }

            if (line.Contains(VerySimpleXml.StartNode("isReadable")))
            {
                isReadable = bool.Parse(VerySimpleXml.NodeValue(line, "isReadable"));
            }

            if (line.Contains(VerySimpleXml.StartNode("lightmap")))
            {
                lightmap = bool.Parse(VerySimpleXml.NodeValue(line, "lightmap"));
            }

            if (line.Contains(VerySimpleXml.StartNode("maxTextureSize")))
            {
                maxTextureSize = int.Parse(VerySimpleXml.NodeValue(line, "maxTextureSize"));
            }

            if (line.Contains(VerySimpleXml.StartNode("mipMapBias")))
            {
                mipMapBias = float.Parse(VerySimpleXml.NodeValue(line, "mipMapBias"));
            }

            if (line.Contains(VerySimpleXml.StartNode("mipmapEnabled")))
            {
                mipmapEnabled = bool.Parse(VerySimpleXml.NodeValue(line, "mipmapEnabled"));
            }

            if (line.Contains(VerySimpleXml.StartNode("mipmapFadeDistanceEnd")))
            {
                mipmapFadeDistanceEnd = int.Parse(VerySimpleXml.NodeValue(line, "mipmapFadeDistanceEnd"));
            }

            if (line.Contains(VerySimpleXml.StartNode("mipmapFadeDistanceStart")))
            {
                mipmapFadeDistanceStart = int.Parse(VerySimpleXml.NodeValue(line, "mipmapFadeDistanceStart"));
            }

            if (line.Contains(VerySimpleXml.StartNode("mipmapFilter")))
            {
                mipmapFilter = (TextureImporterMipFilter)System.Enum.Parse(typeof(TextureImporterMipFilter), VerySimpleXml.NodeValue(line, "mipmapFilter"));
            }

            if (line.Contains(VerySimpleXml.StartNode("normalmap")))
            {
                normalmap = bool.Parse(VerySimpleXml.NodeValue(line, "normalmap"));
            }

            if (line.Contains(VerySimpleXml.StartNode("normalmapFilter")))
            {
                normalmapFilter = (TextureImporterNormalFilter)System.Enum.Parse(typeof(TextureImporterNormalFilter), VerySimpleXml.NodeValue(line, "normalmapFilter"));
            }

            if (line.Contains(VerySimpleXml.StartNode("npotScale")))
            {
                npotScale = (TextureImporterNPOTScale)System.Enum.Parse(typeof(TextureImporterNPOTScale), VerySimpleXml.NodeValue(line, "npotScale"));
            }

            if (line.Contains(VerySimpleXml.StartNode("textureFormat")))
            {
                textureFormat = (TextureImporterFormat)System.Enum.Parse(typeof(TextureImporterFormat), VerySimpleXml.NodeValue(line, "textureFormat"));
            }

            if (line.Contains(VerySimpleXml.StartNode("textureType")))
            {
                textureType = (TextureImporterType)System.Enum.Parse(typeof(TextureImporterType), VerySimpleXml.NodeValue(line, "textureType"));
            }

            if (line.Contains(VerySimpleXml.StartNode("wrapMode")))
            {
                wrapMode = (TextureWrapMode)System.Enum.Parse(typeof(TextureWrapMode), VerySimpleXml.NodeValue(line, "wrapMode"));
            }
        }
    }
Esempio n. 3
0
    public AudioAsset(StreamReader reader)
    {
        string line = string.Empty;

        while ((line = reader.ReadLine()) != null)
        {
            if (line.Contains(VerySimpleXml.EndNode(nodeName)))
            {
                break;
            }

            //Name
            if (line.Contains(VerySimpleXml.StartNode(nameNodeName)))
            {
                name = VerySimpleXml.NodeValue(line, nameNodeName);
            }

            //Path
            if (line.Contains(VerySimpleXml.StartNode(pathNodeName)))
            {
                guid = AssetDatabase.AssetPathToGUID(VerySimpleXml.NodeValue(line, pathNodeName));
            }

            if (line.Contains(VerySimpleXml.StartNode(guidNodeName)))
            {
                guid = VerySimpleXml.NodeValue(line, guidNodeName);
            }

            //IMPORT SETTINGS
            if (line.Contains(VerySimpleXml.StartNode("compressionBitrate")))
            {
                compressionBitrate = int.Parse(VerySimpleXml.NodeValue(line, "compressionBitrate"));
            }

            if (line.Contains(VerySimpleXml.StartNode("forceToMono")))
            {
                forceToMono = bool.Parse(VerySimpleXml.NodeValue(line, "forceToMono"));
            }

            if (line.Contains(VerySimpleXml.StartNode("format")))
            {
                format = (AudioImporterFormat)System.Enum.Parse(typeof(AudioImporterFormat), VerySimpleXml.NodeValue(line, "format"));
            }

            if (line.Contains(VerySimpleXml.StartNode("hardware")))
            {
                hardware = bool.Parse(VerySimpleXml.NodeValue(line, "hardware"));
            }

            if (line.Contains(VerySimpleXml.StartNode("loadType")))
            {
                loadType = (AudioImporterLoadType)System.Enum.Parse(typeof(AudioImporterLoadType), VerySimpleXml.NodeValue(line, "loadType"));
            }

            if (line.Contains(VerySimpleXml.StartNode("loopable")))
            {
                loopable = bool.Parse(VerySimpleXml.NodeValue(line, "loopable"));
            }

            if (line.Contains(VerySimpleXml.StartNode("threeD")))
            {
                threeD = bool.Parse(VerySimpleXml.NodeValue(line, "threeD"));
            }
        }
    }