コード例 #1
0
        private static Pat.Frame ImportFrame(Pat.Project proj, GSPat.GSPatFile pat, GSPat.Frame frame)
        {
            var hasIM = frame.ImageManipulation != null;

            return(new Pat.Frame
            {
                ImageID = AddImageToProject(proj, pat.Images[frame.SpriteID], frame).ImageID,
                OriginX = frame.OriginX,
                OriginY = frame.OriginY,
                ScaleX = hasIM ? frame.ImageManipulation.ScaleX : 100,
                ScaleY = hasIM ? frame.ImageManipulation.ScaleY : 100,
                Alpha = hasIM ? frame.ImageManipulation.Alpha / 255.0f : 1.0f,
                Red = hasIM ? frame.ImageManipulation.Red / 255.0f : 1.0f,
                Green = hasIM ? frame.ImageManipulation.Green / 255.0f : 1.0f,
                Blue = hasIM ? frame.ImageManipulation.Blue / 255.0f : 1.0f,
                Duration = frame.DisplayTime,
                //TODO check if rotation should be inversed
                Rotation = hasIM ? frame.ImageManipulation.Rotation : 0,
                PhysicalBox = ImportPhysicalBox(frame.PhysicsBox),
                HitBoxes = frame.HitBoxes.Select(ImportBox).ToList(),
                AttackBoxes = frame.AttackBoxes.Select(ImportBox).ToList(),
                Points = new List <FramePoint>()
                {
                    ImportPoint(frame.Point0),
                    ImportPoint(frame.Point1),
                    ImportPoint(frame.Point2),
                },
            });
        }
コード例 #2
0
        public static Project GenerateEmpty(string path, List <string> palList)
        {
            var proj = new Pat.Project()
            {
                Actions  = new List <Pat.Action>(),
                Images   = new List <Pat.FrameImage>(),
                Settings = new Pat.ProjectSettings
                {
                    ProjectName = "Untitled",
                    Directories = new List <Pat.ProjectDirectoryDesc>()
                    {
                        new Pat.ProjectDirectoryDesc()
                        {
                            Name  = "image",
                            Usage = Pat.ProjectDirectoryUsage.Image,
                            Path  = path,
                        }
                    },
                    Palettes = palList,
                },
            };

            proj.ImageList.SelectedPalette = 0;
            return(proj);
        }
コード例 #3
0
        private static List <Pat.AnimationSegment> ImportSegment(Pat.Project proj, GSPat.GSPatFile pat, int index, int segment)
        {
            var start = pat.Animations.FindLastIndex(a => a.AnimationID == index + pat.Animations[0].AnimationID);

            return(pat.Animations
                   .Skip(start + segment).Take(1)
                   .Select(a => ImportSegment(proj, pat, a)).ToList());
        }
コード例 #4
0
 public static AnimationSegment ImportSegment(Pat.Project proj, GSPat.GSPatFile pat, GSPat.Animation animation)
 {
     return(new AnimationSegment()
     {
         Damage = ImportDamageInfo(animation),
         CancelLevel = ImportCancelLevelEnum(animation.CancelLevel),
         IsLoop = animation.IsLoop,
         JumpCancellable = ImportCancellable(animation, 0x200000),
         SkillCancellable = ImportCancellable(animation, 0x20),
         Frames = animation.Frames.Select(f => ImportFrame(proj, pat, f)).ToList(),
     });
 }