コード例 #1
0
        /// <summary>Deep creates a test AvatarDefinition</summary>
        /// <param name="resourceLibrary">Library in which to create resources</param>
        /// <returns>Created AvatarDefinition identifier</returns>
        public static string DeepCreateTestAvatarDefinition(IResourceLibrary resourceLibrary)
        {
            var avatar = CreateTestAvatarDefinition();

            resourceLibrary.AddResource(avatar);

            var content  = "<AvatarResource>{0}</AvatarResource>".FormatInvariant(avatar.ResourceId);
            var resource = new GenericNativeResource <string>(avatar.ResourceId, content);

            resourceLibrary.AddResource(resource);

            return(avatar.Id);
        }
コード例 #2
0
        /// <summary>Deep creates a test EntityDefinition</summary>
        /// <param name="resourceLibrary">Library in which to create resources</param>
        /// <returns>Created EntityDefinition identifier</returns>
        public static string DeepCreateTestEntityDefinition(IResourceLibrary resourceLibrary)
        {
            var entity = CreateTestEntityDefinition(
                NewResourceId(),
                DeepCreateTestAvatarDefinition(resourceLibrary));

            resourceLibrary.AddResource(entity);
            return(entity.Id);
        }
コード例 #3
0
        /// <summary>Deep creates a test GameDefinition</summary>
        /// <remarks>Creates a test game definition and all referenced resources</remarks>
        /// <param name="resourceLibrary">Library in which to create resources</param>
        /// <param name="numEntities">Number of entities to create</param>
        /// <param name="numLevels">Number of levels to create</param>
        /// <returns>Created game definition identifier</returns>
        public static string DeepCreateTestGameDefinition(
            IResourceLibrary resourceLibrary,
            int numEntities,
            int numLevels)
        {
            var levelIds = Enumerable.Range(0, numLevels)
                           .Select(i =>
                                   DeepCreateTestLevelDefinition(resourceLibrary, numEntities))
                           .ToArray();
            var game = CreateTestGameDefinition(NewResourceId(), levelIds);

            resourceLibrary.AddResource(game.GetTextResource());
            return(game.Id);
        }
コード例 #4
0
        /// <summary>Deep creates a test LevelDefinition</summary>
        /// <param name="resourceLibrary">Library in which to create resources</param>
        /// <param name="numEntities">Number of entities to create</param>
        /// <returns>Created LevelDefinition identifier</returns>
        public static string DeepCreateTestLevelDefinition(
            IResourceLibrary resourceLibrary,
            int numEntities)
        {
            var entityIds = Enumerable.Range(0, numEntities).Select(i =>
                                                                    DeepCreateTestEntityDefinition(resourceLibrary))
                            .ToArray();
            var level = CreateTestLevelDefinition(
                NewResourceId(),
                entityIds);

            resourceLibrary.AddResource(level);
            return(level.Id);
        }