private JSONObject WriteMaterial(Material material)
    {
        JSONObject materialObject = new JSONObject();

        if (ResourcesDirectory.IsCustomMaterial(material))
        {
            materialObject["mode"]  = ResourcesDirectory.GetCustomMaterialColorMode(material).ToString();
            materialObject["color"] = WriteColor(material.color);
            materialObject["alpha"] = ResourcesDirectory.GetCustomMaterialIsTransparent(material);
        }
        else
        {
            materialObject["name"] = material.name;
        }
        return(materialObject);
    }
Beispiel #2
0
    private static MessagePackObjectDictionary WriteMaterial(Material material, bool specifyAlphaMode)
    {
        var materialDict = new MessagePackObjectDictionary();

        if (ResourcesDirectory.IsCustomMaterial(material))
        {
            materialDict[FileKeys.MATERIAL_MODE]  = ResourcesDirectory.GetCustomMaterialColorMode(material).ToString();
            materialDict[FileKeys.MATERIAL_COLOR] = WriteColor(material.color);
            if (specifyAlphaMode)
            {
                materialDict[FileKeys.MATERIAL_ALPHA] = ResourcesDirectory.GetCustomMaterialIsTransparent(material);
            }
        }
        else
        {
            materialDict[FileKeys.MATERIAL_NAME] = material.name;
        }
        return(materialDict);
    }