コード例 #1
0
    public static MaterialSound GetMaterialSound(Material material)
    {
        if (material == null)
        {
            return(MaterialSound.GENERIC);
        }
        string name;

        if (CustomTexture.IsCustomTexture(material))
        {
            name = CustomTexture.GetBaseMaterialName(material);
        }
        else
        {
            name = material.name;
        }
        MaterialInfo info;

        // special alternate materials for game
        if (materialInfos.TryGetValue("$" + name, out info))
        {
            return(info.sound);
        }
        if (materialInfos.TryGetValue(name, out info))
        {
            return(info.sound);
        }
        return(MaterialSound.GENERIC);
    }
コード例 #2
0
    private static MessagePackObjectDictionary WriteCustomTexture(Material material, bool overlay)
    {
        CustomTexture customTex    = new CustomTexture(material, overlay);
        var           materialDict = WritePropertiesObject(customTex, false);

        materialDict[FileKeys.CUSTOM_MATERIAL_NAME] = material.name;
        return(materialDict);
    }
コード例 #3
0
    private static MessagePackObjectDictionary WriteMaterial(Material material)
    {
        var materialDict = new MessagePackObjectDictionary();

        materialDict[FileKeys.MATERIAL_NAME] = material.name;
        string colorProp = CustomTexture.IsCustomTexture(material) ? null
            : ResourcesDirectory.MaterialColorProperty(material);

        if (colorProp != null)
        {
            materialDict[FileKeys.MATERIAL_COLOR] = WriteColor(material.GetColor(colorProp));
            materialDict[FileKeys.MATERIAL_COLOR_STYLE]
                = ResourcesDirectory.GetMaterialColorStyle(material).ToString();
        }
        return(materialDict);
    }
コード例 #4
0
    private Material ReadCustomTexture(MessagePackObjectDictionary texDict,
                                       Dictionary <string, Material> customTextureNames, bool overlay)
    {
        CustomTexture customTex = new CustomTexture(
            new Material(ReadWorldFile.MissingMaterial(overlay).shader), overlay);

        ReadPropertiesObject(texDict, customTex);
        Material mat = customTex.material;

        if (texDict.ContainsKey(FileKeys.CUSTOM_MATERIAL_NAME))
        {
            mat.name = texDict[FileKeys.CUSTOM_MATERIAL_NAME].AsString();
            customTextureNames[mat.name] = mat;
        }
        return(mat);
    }