Пример #1
0
        public static void ExportAnimation(GSPat.GSPatFile file, ImageListExporter images,
                                           Pat.Action action, int id)
        {
            {
                var eAnimation = new GSPat.Animation()
                {
                    AnimationID = id,
                    AttackLevel = 0,
                    CancelLevel = ExportCancelLevel(action.Segments[0].CancelLevel),
                    IsLoop      = action.Segments[0].IsLoop,
                    Type        = GSPat.AnimationType.Normal,
                };
                ExportFrames(eAnimation, action.Segments[0], images);
                file.Animations.Add(eAnimation);
            }

            for (int i = 1; i < action.Segments.Count; ++i)
            {
                var eAnimation = new GSPat.Animation()
                {
                    AnimationID = -2,
                    AttackLevel = 0,
                    CancelLevel = ExportCancelLevel(action.Segments[i].CancelLevel),
                    IsLoop      = action.Segments[i].IsLoop,
                    Type        = GSPat.AnimationType.Normal,
                };
                ExportFrames(eAnimation, action.Segments[i], images);
                file.Animations.Add(eAnimation);
            }
        }
Пример #2
0
 private void SetSelectedAnimation(GSPat.Animation animation)
 {
     _SelectedAnimation = animation;
     _CurrentFrameIndex = 0;
     _FrameCounter      = 0;
     _Images.Switch();
 }
Пример #3
0
        private void AddAnimation(GSPat.Animation a)
        {
            var item = new ListViewItem("Animation " + a.AnimationID);

            item.Tag = a;
            listView1.Items.Add(item);
        }
Пример #4
0
        private void AddFollowerAnimation(GSPat.Animation a, int id, int s)
        {
            var item = new ListViewItem("Animation " + id + ", Segment " + s);

            item.Tag = a;
            listView1.Items.Add(item);
        }
Пример #5
0
        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;
            }
        }
Пример #6
0
 private void listView2_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listView2.SelectedItems.Count == 0)
     {
         _SelectedAnimation = null;
     }
     else
     {
         SetSelectedAnimation(listView2.SelectedItems[0].Tag as GSPat.Animation);
     }
 }