コード例 #1
0
        /// <summary>
        /// Deserialize mono curve from string content.
        /// </summary>
        /// <param name="contents"></param>
        /// <returns></returns>
        protected override bool DeserializeCurve(string contents)
        {
            try
            {
                var anchors = ListJsonUtility.FromJson <HermiteAnchor>(contents);
                if (anchors == null)
                {
                    Debug.LogError("The anchors is null.");
                    return(false);
                }

                curve.anchors = anchors;
                curve.Rebuild();
                return(true);
            }
            catch (Exception ex)
            {
                Debug.LogErrorFormat("{0}\r\n{1}", ex.Message, ex.StackTrace);
                return(false);
            }
        }
コード例 #2
0
        /// <summary>
        /// Deserialize mono curve from string content.
        /// </summary>
        /// <param name="contents"></param>
        /// <returns></returns>
        protected override bool DeserializeCurve(string contents)
        {
            try
            {
                var anchors = ListJsonUtility.FromJson <BezierAnchor>(contents);
                if (anchors == null || anchors.Count < 2)
                {
                    Debug.LogError("The anchors is null or count is less than 2.");
                    return(false);
                }

                curve.from = anchors[0];
                curve.to   = anchors[1];
                curve.Rebuild();
                return(true);
            }
            catch (Exception ex)
            {
                Debug.LogErrorFormat("{0}\r\n{1}", ex.Message, ex.StackTrace);
                return(false);
            }
        }