コード例 #1
0
        /// <summary>
        /// 转成Json
        /// </summary>
        public IJsonNode DoJson()
        {
            IJsonNode json = JsonHelper.CreateNode();

            if (m_tweenType != 0)
            {
                json.SetInt("tweenType", m_tweenType);
            }
            // end if
            json.SetInt("tweenElement", (int)m_tweenElement);
            if (!string.IsNullOrEmpty(m_name))
            {
                json.SetString("name", m_name);
            }
            // end if
            json.SetDouble("duration", Math.Round(m_duration, 4));
            if (m_delay > 0.00009f)
            {
                json.SetDouble("delay", Math.Round(m_delay, 4));
            }
            // end if
            json.SetBool("snapping", m_isSnapping);
            if (m_animCurve != null && m_animCurve.keys != null && m_animCurve.keys.Length > 0)
            {
                json.SetNode("animCurve", JTweenUtils.AnimationCurveJson(m_animCurve));
            }
            else
            {
                json.SetInt("animEase", (int)m_animEase);
            } // end if
            if (m_loopCount > 0)
            {
                json.SetInt("loopCount", m_loopCount);
                json.SetInt("loopType", (int)m_loopType);
            } // end if
            ToJson(ref json);
            return(json);
        }
コード例 #2
0
ファイル: JTweenBase.cs プロジェクト: seem-sky/AccountBook
 /// <summary>
 /// 转成Json
 /// </summary>
 public JsonData DoJson()
 {
     JsonData json = new JsonData();
     if (m_tweenType != 0) json["tweenType"] = m_tweenType;
     // end if
     json["tweenElement"] = (int)m_tweenElement;
     if (!string.IsNullOrEmpty(m_name)) json["name"] = m_name;
     // end if
     json["duration"] = Math.Round(m_duration, 4);
     if (m_delay > 0.01f) json["delay"] = Math.Round(m_delay, 4);
     // end if
     json["snapping"] = m_isSnapping;
     if (m_animCurve != null && m_animCurve.keys != null && m_animCurve.keys.Length > 0) {
         json["animCurve"] = JTweenUtils.AnimationCurveJson(m_animCurve);
     } else {
         json["animEase"] = (int)m_animEase;
     } // end if
     if (m_loopCount > 0) {
         json["loopCount"] = m_loopCount;
         json["loopType"] = (int)m_loopType;
     } // end if
     ToJson(ref json);
     return json;
 }