Ejemplo n.º 1
0
            public override string toJson()
            {
                if (!allMeshs.Contains(sharedMesh))
                {
                    allMeshs.Add(sharedMesh);
                }
                if (!allMeshs.Contains(mesh))
                {
                    allMeshs.Add(mesh);
                }

                return("{\"mesh\":" + JsonEx.toJson(mesh) + ",\"sharedMesh\":" + JsonEx.toJson(sharedMesh) + "}");
            }
Ejemplo n.º 2
0
            public override string toJson()
            {
                string s = "{\"clips\":[";

                List <AnimationState> anims = new List <AnimationState>();

                foreach (AnimationState state in animation)
                {
                    anims.Add(state);
                }
                for (int i = 0; i < anims.Count; i++)
                {
                    var state = anims[i];
                    var clip  = state.clip;
                    s += "{\"name\":\"" + state.name + "\",\"clipName\":\"" + clip.name + "\",\"lenght\":" + clip.length + ",\"framerate\":" + clip.frameRate + ",\"speed\":" + state.speed
                         + ",\"weight\":" + state.weight + ",\"warpMode\":\"" + state.wrapMode.ToString() + "\",\"legacy\":\"" + (clip.legacy ? "true" : "false")
                         + "\",\"blendMode\":\"" + state.blendMode.ToString() + "\",\"bounds\":" + JsonEx.toJson(clip.localBounds) + "\"Events\":{";

                    for (int j = 0; j < clip.events.Length; j++)
                    {
                        var e = clip.events[j];
                        s += "{\"time\":" + e.time + "}";

                        if (j < clip.events.Length - 1)
                        {
                            s += ",";
                        }
                    }
                    s += "}}";



                    if (i < anims.Count - 1)
                    {
                        s += ",";
                    }
                }
                s += "]";

                if (animation.clip != null)
                {
                    var clip = animation.clip;
                    s += ",\"clip\":{\"name\":\"" + clip.name + "\",\"lenght\":" + clip.length + ",\"framerate\":" + clip.frameRate
                         + ",\"weight\":" + ",\"legacy\":\"" + (clip.legacy ? "true" : "false")
                         + "\",\"bounds\":" + JsonEx.toJson(clip.localBounds) + "\"Events\":{";

                    for (int j = 0; j < clip.events.Length; j++)
                    {
                        var e = clip.events[j];
                        s += "{\"time\":" + e.time + "}";

                        if (j < clip.events.Length - 1)
                        {
                            s += ",";
                        }
                    }
                    s += "}}";
                }
                s += ",\"animateOnlyIfVisible\":\"" + (animation.animateOnlyIfVisible ? "true" : "false") + "\"";
                s += ",\"animatePhysic\":\"" + (animation.animatePhysics ? "true" : "false") + "\"";
                s += ",\"cullingType\":\"" + animation.cullingType.ToString() + "\"";
                s += ",\"playing\":\"" + (animation.isPlaying ? "true" : "false") + "\"";
                s += ",\"clipCount\":" + animation.GetClipCount();
                s += ",\"bounds\":" + JsonEx.toJson(animation.localBounds);
                s += ",\"playAuto\":\"" + (animation.playAutomatically ? "true" : "false") + "\"";
                s += ",\"warpmode\":\"" + animation.wrapMode.ToString() + "\"";

                return(s + "}");
            }
Ejemplo n.º 3
0
            public override string toJson()
            {
                if (!allMeshs.Contains(sharedMesh))
                {
                    allMeshs.Add(sharedMesh);
                }

                string s = "{\"rootBone\":\"" + rootBoneName + "\",\"sharedMesh\":" + JsonEx.toJson(sharedMesh) + ",\"materials\":[";

                for (int i = 0; i < materials.Count; i++)
                {
                    s += materials[i].toJson();
                    if (i < materials.Count - 1)
                    {
                        s += ",";
                    }
                }
                s += "],\"bones\":[";
                for (int i = 0; i < boneNames.Count; i++)
                {
                    s += "\"" + boneNames[i] + "\"";
                    if (i < boneNames.Count - 1)
                    {
                        s += ",";
                    }
                }
                return(s + "]}");
            }