示例#1
0
        public static Animation FromAnimationSave(AnimationChainSave animationSave)
        {
            //这个类没有构造函数,所以编译器自动会添加一个空的构造函数
            Animation toReturn = new Animation ();

            toReturn.Name = animationSave.Name;

            //读取frame(AnimationFrameSave)中的所有动画数据
            foreach (var frame in animationSave.Frames)
            {
                CCRect rectangle;

                rectangle = new CCRect (
                    frame.LeftCoordinate,
                    frame.TopCoordinate,
                    frame.RightCoordinate - frame.LeftCoordinate,
                    frame.BottomCoordinate - frame.TopCoordinate);

                var duration = TimeSpan.FromSeconds (frame.FrameLength);

                //toReturn.frames是一个frame的集合
                //每一个frame是动作的一步
                //AddFrame就是把读取到的frame添加到这个list里
                toReturn.AddFrame (rectangle, duration, flipHorizontal:frame.FlipHorizontal);
            }

            return toReturn;
        }
示例#2
0
		public static Animation FromAnimationSave(AnimationChainSave animationSave)
		{
			Animation toReturn = new Animation ();

			toReturn.Name = animationSave.Name;

			foreach (var frame in animationSave.Frames)
			{
				CCRect rectangle;

				rectangle = new CCRect (
					frame.LeftCoordinate, 
					frame.TopCoordinate, 
					frame.RightCoordinate - frame.LeftCoordinate, 
					frame.BottomCoordinate - frame.TopCoordinate);

				var duration = TimeSpan.FromSeconds (frame.FrameLength);

				toReturn.AddFrame (rectangle, duration, flipHorizontal:frame.FlipHorizontal);
			}

			return toReturn;
		}