コード例 #1
0
        public IJsonNode DoJson()
        {
            IJsonNode json = JsonHelper.CreateNode();

            if (m_tweens != null && m_tweens.Length > 0)
            {
                IJsonNode node;
                for (int i = 0; i < m_tweens.Length; i++)
                {
                    JTweenBase tween = m_tweens[i];
                    node = tween.DoJson();
                    string curPath = JTweenUtils.GetTranPath(transform) + "/";
                    if (tween.Target != transform)
                    {
                        string targetPath = JTweenUtils.GetTranPath(tween.Target);
                        if (!targetPath.StartsWith(curPath))
                        {
                            Debug.LogErrorFormat("JTweenSequence DoJson target is not child! Path:{0}", targetPath);
                            continue;
                        } // end if
                        node.SetString("_PATH", JTweenUtils.GetTranPath(tween.Target).Replace(curPath, ""));
                    }     // end if
                    json.Add(node);
                }
            }
            return(json);
        }
コード例 #2
0
        protected override void ToJson(ref IJsonNode json)
        {
            json.SetNode("beginPosition", JTweenUtils.Vector3Json(m_beginPosition));
            IJsonNode pathJson = JsonHelper.CreateNode();

            for (int i = 0; i < m_toPath.Length; ++i)
            {
                pathJson.Add(JTweenUtils.Vector3Json(m_toPath[i]));
            } // end for
            json.SetNode("path", pathJson);
            json.SetInt("type", (int)m_pathType);
            json.SetInt("mode", (int)m_pathMode);
            json.SetInt("resolution", m_resolution);
            json.SetNode("gizmoColor", JTweenUtils.ColorJson(m_gizmoColor));
            json.SetBool("showGizmo", m_showGizmo);
        }
コード例 #3
0
        public static IJsonNode AnimationCurveJson(AnimationCurve arg)
        {
            IJsonNode ret      = JsonHelper.CreateNode();
            IJsonNode jsonKeys = JsonHelper.CreateNode();

            Keyframe[] keys = arg.keys;
            for (int i = 0, imax = keys.Length; i < imax; ++i)
            {
                Keyframe  k      = keys[i];
                IJsonNode oneKey = JsonHelper.CreateNode();
                ret.SetDouble("T", System.Math.Round(k.time, 4));
                ret.SetDouble("V", System.Math.Round(k.value, 4));
                ret.SetDouble("I", System.Math.Round(k.inTangent, 4));
                ret.SetDouble("O", System.Math.Round(k.outTangent, 4));
                ret.SetInt("M", k.tangentMode);
                jsonKeys.Add(oneKey);
            }
            ret.SetNode("keys", jsonKeys);
            ret.SetInt("pre", (int)arg.preWrapMode);
            ret.SetInt("post", (int)arg.postWrapMode);
            return(ret);
        }