Exemplo n.º 1
0
        public JsonData DoJson()
        {
            JsonData json = new JsonData();

            if (m_tweens != null && m_tweens.Length > 0)
            {
                JsonData node;
                foreach (var tween in m_tweens)
                {
                    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["_PATH"] = JTweenUtils.GetTranPath(tween.Target).Replace(curPath, "");
                    }     // end if
                    json.Add(node);
                }
            }
            return(json);
        }
Exemplo n.º 2
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);
        }
Exemplo n.º 3
0
 /// <summary>
 /// 加载Json
 /// </summary>
 /// <param name="json"></param>
 public void JsonDo(IJsonNode json)
 {
     if (json.Contains("tweenType"))
     {
         m_tweenType = json.GetInt("tweenType");
     }
     // end if
     if (json.Contains("tweenElement"))
     {
         m_tweenElement = (JTweenElement)json.GetInt("tweenElement");
     }
     // end if
     if (json.Contains("name"))
     {
         m_name = json.GetString("name");
     }
     // end if
     if (json.Contains("delay"))
     {
         m_delay = json.GetFloat("delay");
     }
     // end if
     if (json.Contains("duration"))
     {
         m_duration = json.GetFloat("duration");
     }
     // end if
     if (json.Contains("snapping"))
     {
         m_isSnapping = json.GetBool("snapping");
     }
     // end if
     if (json.Contains("animCurve"))
     {
         m_animCurve = JTweenUtils.JsonAnimationCurve(json.GetNode("animCurve"));
     }
     // end if
     if (json.Contains("animEase"))
     {
         m_animEase = (Ease)json.GetInt("animEase");
     }
     // end if
     if (json.Contains("loopCount"))
     {
         m_loopCount = json.GetInt("loopCount");
     }
     // end if
     if (json.Contains("loopType"))
     {
         m_loopType = (LoopType)json.GetInt("loopType");
     }
     // end if
     JsonTo(json);
 }
Exemplo n.º 4
0
 /// <summary>
 /// 动效参数是否有效
 /// </summary>
 /// <param name="errorInfo"> 错误信息 </param>
 /// <returns></returns>
 public bool IsValid(out string errorInfo)
 {
     if (m_target == null) {
         errorInfo = "target is Null!!";
         return false;
     } // end if
     if (JTweenUtils.IsEqual(m_duration, 0)) {
         errorInfo = "duration is zero!!";
         return false;
     } // end if
     return CheckValid(out errorInfo);
 }
Exemplo n.º 5
0
 /// <summary>
 /// 加载Json
 /// </summary>
 /// <param name="json"></param>
 public void JsonDo(JsonData json)
 {
     if (json.Contains("tweenType")) m_tweenType = json["tweenType"].ToInt32();
     // end if
     if (json.Contains("tweenElement")) m_tweenElement = (JTweenElement)json["tweenElement"].ToInt32();
     // end if
     if (json.Contains("name")) m_name = json["name"].ToString();
     // end if
     if (json.Contains("duration")) m_duration = json["duration"].ToFloat();
     // end if
     if (json.Contains("snapping")) m_isSnapping = json["snapping"].ToBool();
     // end if
     if (json.Contains("animCurve")) m_animCurve = JTweenUtils.JsonAnimationCurve(json["animCurve"]);
     // end if
     if (json.Contains("animEase")) m_animEase = (Ease)json["animEase"].ToInt32();
     // end if
     if (json.Contains("loopCount")) m_loopCount = json["loopCount"].ToInt32();
     // end if
     if (json.Contains("loopType")) m_loopType = (LoopType)json["loopType"].ToInt32();
     // end if
     JsonTo(json);
 }
Exemplo n.º 6
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);
        }
Exemplo n.º 7
0
 /// <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;
 }