コード例 #1
0
        public AnimatedSkeleton(ISkeleton baseFrame, MtbSection mtbSection)
        {
            if (baseFrame == null)
            {
                throw new ArgumentNullException("baseFrame");
            }

            this.baseFrame  = baseFrame;
            this.IsLoaded   = false;
            this.Bones      = null;
            this.mtbSection = mtbSection;

            this.Fps             = mtbSection.Header.Float1;
            this.TotalFrames     = mtbSection.Header.AnimationLength;
            this.AnimationLength = this.TotalFrames / this.Fps;
        }
コード例 #2
0
        public PreviewAnimatedSkeleton(SkeletonSection skeleton) : base()
        {
            this.skeleton = skeleton;

            string skeletonFilePath = skeleton.GetParent <DatDigger.Sections.PwibSection>().FilePath;

            skeletonFilePath = System.IO.Path.GetDirectoryName(skeletonFilePath);
            skeletonFilePath = skeletonFilePath.Substring(0, skeletonFilePath.LastIndexOfAny(new char[] { '\\', '/' }));

            string animationFilePath = System.IO.Path.Combine(skeletonFilePath, "act/emp_emp/bid/base/0000");

            if (!System.IO.File.Exists(animationFilePath))
            {
                throw new System.InvalidOperationException("File " + animationFilePath + " does not exist");
            }

            var animFile = DatDigger.Sections.SectionLoader.OpenFile(animationFilePath);

            animationData = animFile.FindChild <MtbSection>(x => x.ResourceId == "cbnm_id0");
            if (animationData == null)
            {
                throw new System.InvalidOperationException("Cannot find cbnm_id0");
            }
        }