Example #1
0
 public static Vector2 mapToVector2(Hashtable map)
 {
     if (map == null)
     {
         return(Vector2.zero);
     }
     return(new Vector2(
                (float)(MapEx.getDouble(map, "x")),
                (float)(MapEx.getDouble(map, "y"))));
 }
Example #2
0
        public static Color mapToColor(Hashtable map)
        {
            Color c = new Color(
                (float)(MapEx.getDouble(map, "r")),
                (float)(MapEx.getDouble(map, "g")),
                (float)(MapEx.getDouble(map, "b")),
                (float)(MapEx.getDouble(map, "a"))
                );

            return(c);
        }
Example #3
0
        /// <summary>
        /// Gets the animation curve.创建动画曲线
        /// </summary>
        /// <returns>
        /// The animation curve.
        /// </returns>
        /// <param name='list'>
        /// List.
        /// </param>
        /// <param name='postWrapMode'>
        /// Post wrap mode.
        /// </param>
        /// <param name='preWrapMode'>
        /// Pre wrap mode.
        /// </param>
        public static AnimationCurve getAnimationCurve(ArrayList list, WrapMode postWrapMode, WrapMode preWrapMode)
        {
            if (list == null || list.Count <= 0)
            {
                return(null);
            }
            int len = list.Count;

            Keyframe[] ks = new Keyframe[len];
            for (int i = 0; i < len; i++)
            {
                Hashtable m          = (Hashtable)list[i];
                float     inTangent  = (float)MapEx.getDouble(m, "inTangent");
                float     outTangent = (float)MapEx.getDouble(m, "outTangent");
                float     time       = (float)MapEx.getDouble(m, "time");
                float     value      = (float)MapEx.getDouble(m, "value");
                ks[i] = new Keyframe(time, value, inTangent, outTangent);
            }
            AnimationCurve curve = new AnimationCurve(ks);

            curve.preWrapMode  = preWrapMode;
            curve.postWrapMode = postWrapMode;
            return(curve);
        }