示例#1
0
        /// <summary>
        /// Loads a SkeletonSet from the given FilePath. Assumes the loading is from the ContentPaths.Dev.
        /// </summary>
        /// <param name="filePath">The file path.</param>
        /// <returns>The loaded SkeletonSet, or null if the SkeletonSet failed to load.</returns>
        public static SkeletonSet LoadSkeletonSet(string filePath)
        {
            var skeletonSetName = Path.GetFileNameWithoutExtension(filePath);
            var realFilePath    = SkeletonSet.GetFilePath(skeletonSetName, ContentPaths.Dev);

            // Make sure the file exists
            if (!File.Exists(realFilePath))
            {
                const string errmsg = "Failed to load SkeletonSet `{0}` from `{1}` - file does not exist.";
                var          err    = string.Format(errmsg, skeletonSetName, filePath);
                MessageBox.Show(err);
                return(null);
            }

            // Try to load the skeleton
            SkeletonSet ret;

            try
            {
                ret = new SkeletonSet(skeletonSetName, ContentPaths.Dev);
            }
            catch (Exception ex)
            {
                const string errmsg = "Failed to load SkeletonSet `{0}` from `{1}`:{2}{3})";
                var          err    = string.Format(errmsg, skeletonSetName, filePath, Environment.NewLine, ex);
                MessageBox.Show(err);
                return(null);
            }

            return(ret);
        }
示例#2
0
        /// <summary>
        /// Gets a SkeletonSet for the standing Skeleton.
        /// </summary>
        /// <returns>A SkeletonSet for the standing Skeleton.</returns>
        public static SkeletonSet GetStandingSkeletonSet()
        {
            var newSkeleton = new Skeleton(StandingSkeletonName, ContentPaths.Dev);
            var nFrame0     = new SkeletonFrame(StandingSkeletonName, newSkeleton);
            var newSet      = new SkeletonSet(new[] { nFrame0 });

            return(newSet);
        }