public MyJson.IJsonNode Parser(Component com,NeedList list)
    {

        UITexture t = com as UITexture;
        var json = new MyJson.JsonNode_Object();


        if(t.mainTexture!=null)
        {
            string needtex = AtlasMgr.SaveTexture(t.mainTexture, System.IO.Path.Combine(Application.streamingAssetsPath, "nguitex"));
            json["mainTexture"] = new MyJson.JsonNode_ValueString(needtex);
            list.AddDependTexture(needtex);
            if(t.shader!=null)
            {
                string shader = t.shader.name;
                json["shader"] = new MyJson.JsonNode_ValueString(shader);
            }
        }
        else
        {
            Debug.LogWarning("不支持 导出使用材质的UITexture");
        }

        json["uvRect"] = new MyJson.JsonNode_ValueString(ComponentTypeConvert.RectToString(t.uvRect));
        ComponentParser.ParserWidget(json, t);

        return json;

    }
    public MyJson.IJsonNode Parser(Component com, NeedList list)
    {
        MeshRenderer t    = com as MeshRenderer;
        var          json = new MyJson.JsonNode_Object();

        json["castShadows"]    = new MyJson.JsonNode_ValueNumber(t.castShadows);
        json["receiveShadows"] = new MyJson.JsonNode_ValueNumber(t.receiveShadows);
        json["useLightProbes"] = new MyJson.JsonNode_ValueNumber(t.useLightProbes);
        int meshcount = t.sharedMaterials.Length;

        json["materials"] = new MyJson.JsonNode_Array();
        foreach (var m in t.sharedMaterials)
        {
            MyJson.JsonNode_Object matobj = new MyJson.JsonNode_Object();
            json["materials"].AddArrayValue(matobj);

            matobj.SetDictValue("name", m.name);
            matobj.SetDictValue("shader", m.shader.name);
            matobj.SetDictValue("shaderkeyword", new MyJson.JsonNode_Array());
            foreach (var shaderkey in m.shaderKeywords)
            {
                matobj["shaderkeyword"].AddArrayValue(shaderkey);
            }
            if (m.mainTexture != null)
            {
                string name = AssetMgr.SaveTexture(m.mainTexture, System.IO.Path.Combine(Application.streamingAssetsPath, "texture"));
                matobj.SetDictValue("maintex", name);
                list.AddDependTexture(name);
            }
        }
        return(json);
    }
Beispiel #3
0
    public MyJson.IJsonNode Parser(Component com, NeedList list)
    {
        UITexture t    = com as UITexture;
        var       json = new MyJson.JsonNode_Object();


        if (t.mainTexture != null)
        {
            string needtex = AtlasMgr.SaveTexture(t.mainTexture, System.IO.Path.Combine(Application.streamingAssetsPath, "nguitex"));
            json["mainTexture"] = new MyJson.JsonNode_ValueString(needtex);
            list.AddDependTexture(needtex);
            if (t.shader != null)
            {
                string shader = t.shader.name;
                json["shader"] = new MyJson.JsonNode_ValueString(shader);
            }
        }
        else
        {
            Debug.LogWarning("不支持 导出使用材质的UITexture");
        }

        json["uvRect"] = new MyJson.JsonNode_ValueString(ComponentTypeConvert.RectToString(t.uvRect));
        ComponentParser.ParserWidget(json, t);

        return(json);
    }
    public MyJson.IJsonNode Parser(Component com, NeedList list)
    {
        MeshRenderer t = com as MeshRenderer;
        var json = new MyJson.JsonNode_Object();
        json["castShadows"] = new MyJson.JsonNode_ValueNumber(t.castShadows);
        json["receiveShadows"] = new MyJson.JsonNode_ValueNumber(t.receiveShadows);
        json["useLightProbes"] = new MyJson.JsonNode_ValueNumber(t.useLightProbes);
        int meshcount = t.sharedMaterials.Length;

        json["materials"] = new MyJson.JsonNode_Array();
        foreach (var m in t.sharedMaterials)
        {
            MyJson.JsonNode_Object matobj = new MyJson.JsonNode_Object();
            json["materials"].AddArrayValue(matobj);

            matobj.SetDictValue("name", m.name);
            matobj.SetDictValue("shader", m.shader.name);
            matobj.SetDictValue("shaderkeyword", new MyJson.JsonNode_Array());
            foreach (var shaderkey in m.shaderKeywords)
            {
                matobj["shaderkeyword"].AddArrayValue(shaderkey);
            }
            if (m.mainTexture != null)
            {
                string name = AssetMgr.SaveTexture(m.mainTexture, System.IO.Path.Combine(Application.streamingAssetsPath, "texture"));
                matobj.SetDictValue("maintex", name);
                list.AddDependTexture(name);
            }
        }
        return json;
    }