Exemple #1
0
        public void SetCurrentToKeyFrame()
        {
            if (_LastSelected != null)
            {
                var grid         = (KeyFrameGrid)_LastSelected;
                var segmentIndex = grid.Segment;
                var frameIndex   = grid.Frame;
                if (frameIndex == 0)
                {
                    //already a key frame
                    return;
                }

                var action = _Parent.CurrentAction;
                if (action == null)
                {
                    return;
                }

                //split a segment
                var oldSegment = action.Segments[segmentIndex];
                var newSegment = new Pat.AnimationSegment()
                {
                    IsLoop = oldSegment.IsLoop,
                    Frames = oldSegment.Frames.Skip(frameIndex).ToList(),
                };
                oldSegment.Frames = oldSegment.Frames.Take(frameIndex).ToList();

                //TODO check cancellable data in oldSegment

                action.Segments.Insert(segmentIndex + 1, newSegment);

                RefreshList();
            }
        }
        public static void ExportFrames(GSPat.Animation toList, Pat.AnimationSegment fromList,
                                        ImageListExporter images)
        {
            toList.Frames = new List <GSPat.Frame>();
            var attackType  = fromList.Damage == null ? Pat.AttackType.None : fromList.Damage.AttackType;
            var damage      = fromList.Damage == null ? 0 : fromList.Damage.BaseDamage;
            var hitG        = fromList.Damage == null ? 0 : fromList.Damage.Knockback.Gravity;
            var se          = fromList.Damage == null ? 0 : fromList.Damage.SoundEffect;
            var hso         = fromList.Damage == null ? 0 : fromList.Damage.HitStop.Opponent;
            var hss         = fromList.Damage == null ? 0 : fromList.Damage.HitStop.Self;
            var hitX        = fromList.Damage == null ? 0 : fromList.Damage.Knockback.SpeedX;
            var hitY        = fromList.Damage == null ? 0 : fromList.Damage.Knockback.SpeedY;
            var cancelJump  = fromList.JumpCancellable == null ? Int32.MaxValue : fromList.JumpCancellable.StartFrom;
            var cancelSkill = fromList.SkillCancellable == null ? Int32.MaxValue : fromList.SkillCancellable.StartFrom;

            var frameTime = 0;

            foreach (var frame in fromList.Frames)
            {
                var img = images.GetImage(frame.ImageID);

                var eFrame = new GSPat.Frame()
                {
                    AttackBoxes     = ExportBoxs(frame.AttackBoxes),
                    AttackFlag      = 0,
                    AttackType      = (short)attackType,
                    Bind            = 0,
                    Damage          = (short)damage,
                    DisplayTime     = (short)frame.Duration,
                    HitBoxes        = ExportBoxs(frame.HitBoxes),
                    HitG            = (short)hitG,
                    HitSoundEffect  = (short)se,
                    HitstopOpponent = (short)hso,
                    HitstopSelf     = (short)hss,
                    HitVX           = (short)hitX,
                    HitVY           = (short)hitY,

                    //TODO
                    ImageManipulation = ExportIM(frame, img),

                    OriginX     = (short)frame.OriginX,
                    OriginY     = (short)frame.OriginY,
                    PhysicsBox  = ExportPhysical(frame.PhysicalBox),
                    Point0      = ExportPoint(frame.Points, 0),
                    Point1      = ExportPoint(frame.Points, 1),
                    Point2      = ExportPoint(frame.Points, 2),
                    SpriteID    = images.GetImageIntID(frame.ImageID),
                    StateFlag   = (frameTime >= cancelSkill ? 0x20 : 0) + (frameTime >= cancelJump ? 0x200000 : 0),
                    ViewHeight  = (short)img.H,
                    ViewOffsetX = (short)img.X,
                    ViewOffsetY = (short)img.Y,
                    ViewWidth   = (short)img.W,
                };
                toList.Frames.Add(eFrame);

                frameTime += frame.Duration;
            }
        }
Exemple #3
0
        private void ResetFrame(Pat.AnimationSegment segment, Pat.Frame frame)
        {
            CurrentSegment = segment;
            CurrentFrame   = frame;

            if (FrameReset != null)
            {
                FrameReset();
            }
        }