示例#1
0
        public void WriteToJson(IResMgr resmgr, GameObject node, Component component, MyJson.JsonNode_Object json)
        {
            SkinnedMeshRenderer ic = component as SkinnedMeshRenderer;

            //json["type"] = new MyJson.JsonNode_ValueString(this.comptype.Name.ToLower());//必须的一行
            //放到外面去了

            //材质
            MyJson.JsonNode_Array mats = new MyJson.JsonNode_Array();

            json["mats"] = mats;

            foreach (var m in ic.sharedMaterials)
            {
                string hash = resmgr.SaveMat(m);
                mats.Add(new MyJson.JsonNode_ValueString(hash));
            }

            //bounds
            json["center"] = new MyJson.JsonNode_ValueString(StringHelper.ToString(ic.localBounds.center));
            json["size"]   = new MyJson.JsonNode_ValueString(StringHelper.ToString(ic.localBounds.size));

            //mesh
            json["mesh"] = new MyJson.JsonNode_ValueString(resmgr.SaveMesh(ic.sharedMesh));

            json["rootboneobj"] = new MyJson.JsonNode_ValueNumber(ic.rootBone.gameObject.GetInstanceID());
            MyJson.JsonNode_Array bones = new MyJson.JsonNode_Array();
            foreach (var b in ic.bones)
            {
                bones.Add(new MyJson.JsonNode_ValueNumber(b.gameObject.GetInstanceID()));
            }
            json["boneobjs"] = bones;
            ic.rootBone.GetInstanceID();
        }
        public void WriteToJson(IResMgr resmgr, GameObject node, Component component, MyJson.JsonNode_Object json)
        {
            SkinnedMeshRenderer ic = component as SkinnedMeshRenderer;
            //json["type"] = new MyJson.JsonNode_ValueString(this.comptype.Name.ToLower());//必须的一行
            //放到外面去了

            //材质
            MyJson.JsonNode_Array mats = new MyJson.JsonNode_Array();

            json["mats"] = mats;

            foreach (var m in ic.sharedMaterials)
            {
                string hash = resmgr.SaveMat(m);
                mats.Add(new MyJson.JsonNode_ValueString(hash));
            }

            //bounds
            json["center"] = new MyJson.JsonNode_ValueString(StringHelper.ToString(ic.localBounds.center));
            json["size"] = new MyJson.JsonNode_ValueString(StringHelper.ToString(ic.localBounds.size));

            //mesh
            json["mesh"] = new MyJson.JsonNode_ValueString(resmgr.SaveMesh(ic.sharedMesh));

            json["rootboneobj"] = new MyJson.JsonNode_ValueNumber(ic.rootBone.gameObject.GetInstanceID());
            MyJson.JsonNode_Array bones = new MyJson.JsonNode_Array();
            foreach (var b in ic.bones)
            {
                bones.Add(new MyJson.JsonNode_ValueNumber(b.gameObject.GetInstanceID()));
            }
            json["boneobjs"] = bones;
            ic.rootBone.GetInstanceID();
        }
        public void WriteToJson(IResMgr resmgr, GameObject node, Component component, MyJson.JsonNode_Object json)
        {
            MeshRenderer ic = component as MeshRenderer;
            //json["type"] = new MyJson.JsonNode_ValueString(this.comptype.Name.ToLower());//必须的一行
            //放到外面去了

            MyJson.JsonNode_Array mats = new MyJson.JsonNode_Array();

            json["mats"] = mats;
#if UNITY_EDITOR
            foreach (var m in ic.sharedMaterials)
            {
                string hash = resmgr.SaveMat(m);
                mats.Add(new MyJson.JsonNode_ValueString(hash));
            }
#else
            foreach (var m in ic.materials)
            {
                string hash = resmgr.SaveMat(m);
                mats.Add(new MyJson.JsonNode_ValueString(hash));
            }
#endif

        }
示例#4
0
        public void WriteToJson(IResMgr resmgr, GameObject node, Component component, MyJson.JsonNode_Object json)
        {
            MeshRenderer ic = component as MeshRenderer;

            //json["type"] = new MyJson.JsonNode_ValueString(this.comptype.Name.ToLower());//必须的一行
            //放到外面去了

            MyJson.JsonNode_Array mats = new MyJson.JsonNode_Array();

            json["mats"] = mats;
#if UNITY_EDITOR
            foreach (var m in ic.sharedMaterials)
            {
                string hash = resmgr.SaveMat(m);
                mats.Add(new MyJson.JsonNode_ValueString(hash));
            }
#else
            foreach (var m in ic.materials)
            {
                string hash = resmgr.SaveMat(m);
                mats.Add(new MyJson.JsonNode_ValueString(hash));
            }
#endif
        }