public void LoadContent(string entityType, ContentManager Content, string fileName, string identifier, InputManager input) { this.input = input; entities = new List<Entity>(); attributes = new List<List<string>>(); contents = new List<List<string>>(); fileManager = new FileManager(); if (identifier == String.Empty) fileManager.LoadContent(fileName, attributes, contents); else fileManager.LoadContent(fileName, attributes, contents, identifier); for (int i = 0; i < attributes.Count; i++) { Type newClass = Type.GetType("WindowsGame2." + entityType); entities.Add((Entity)Activator.CreateInstance(newClass)); entities[i].LoadContent(Content, attributes[i], contents[i], this.input); } }
public void LoadContent(ContentManager content, string mapID) { this.content = new ContentManager(content.ServiceProvider, "Content"); fileManager = new FileManager(); tile = new List<Vector2>(); layer = new List<List<Vector2>>(); tileMap = new List<List<List<Vector2>>>(); attributes = new List<List<string>>(); contents = new List<List<string>>(); fileManager.LoadContent("Load/Maps/" + mapID + ".k", attributes, contents, "Layers"); for(int i = 0; i < attributes.Count; i++) { for(int j = 0; j < attributes[i].Count; j++) { switch (attributes[i][j]) { case "TileSet": tileSet = this.content.Load<Texture2D>("TileSets/" + contents[i][j]); break; case "TileDimensions": String[] split = contents[i][j].Split(','); tileDimensions = new Vector2(int.Parse(split[0]), int.Parse(split[1])); break; case "StartLayer": for (int k = 0; k < contents[i].Count; k++) { split = contents[i][k].Split(','); tile.Add(new Vector2(int.Parse(split[0]), int.Parse(split[1]))); } if (tile.Count > 0) layer.Add(tile); tile = new List<Vector2>(); break; case "EndLayer": if (layer.Count > 0) tileMap.Add(layer); layer = new List<List<Vector2>>(); break; } } } }
public void LoadContent(ContentManager content, string mapID) { fileManager = new FileManager(); attributes = new List<List<string>>(); contents = new List<List<string>>(); collisionMap = new List<List<string>>(); row = new List<string>(); fileManager.LoadContent("Load/Maps/" + mapID + ".k", attributes, contents, "Collision"); for (int i = 0; i < contents.Count; i++) { for (int j = 0; j < contents[i].Count; j++) { row.Add(contents[i][j]); } collisionMap.Add(row); row = new List<string>(); } }
public override void LoadContent(ContentManager Content, InputManager inputManager) { base.LoadContent(Content, inputManager); if (font == null) font = this.content.Load<SpriteFont>("Font1"); imageNumber = 0; fileManager = new FileManager(); animation = new List<Animation>(); fAnimation = new FadeAnimation(); images = new List<Texture2D>(); fileManager.LoadContent("Load/Splash.k", attributes, contents); for(int i = 0; i < attributes.Count; i++) { for(int j = 0; j < attributes[i].Count; j++) { switch(attributes[i][j]) { case "Image": images.Add(this.content.Load<Texture2D>(contents[i][j])); animation.Add(new FadeAnimation()); break; } } } for (int i = 0; i < animation.Count; i++) { //imageWidth / 2 * scale - imageWidth rescaled screen so now no scaling is needed //imageHeight / 2 * scale - imageHeight animation[i].LoadContent(content, images[i], "", new Vector2(0, 0)); animation[i].Scale = 1.25f; animation[i].IsActive = true; } }
public void LoadContent(ContentManager content, string id) { this.content = new ContentManager(content.ServiceProvider, "Content"); menuItems = new List<string>(); animationTypes = new List<string>(); menuImages = new List<Texture2D>(); animation = new List<Animation>(); attributes = new List<List<string>>(); contents = new List<List<string>>(); linkType = new List<string>(); linkID = new List<string>(); itemNumber = 0; fAnimation = new FadeAnimation(); ssAnimation = new SpriteSheetAnimation(); position = Vector2.Zero; fileManager = new FileManager(); fileManager.LoadContent("Load/Menus.k", attributes, contents, id); for (int i = 0; i < attributes.Count; i++) { for (int j = 0; j < attributes[i].Count; j++) { switch(attributes[i][j]) { case "Font": font = this.content.Load<SpriteFont>(contents[i][j]); break; case "Item": menuItems.Add(contents[i][j]); break; case "Image": menuImages.Add(this.content.Load<Texture2D>(contents[i][j])); break; case "Axis": axis = int.Parse(contents[i][j]); break; case "Position": string[] temp = contents[i][j].Split(' '); position = new Vector2(float.Parse(temp[0]), float.Parse(temp[1])); break; case "Source": temp = contents[i][j].Split(' '); source = new Rectangle(int.Parse(temp[0]), int.Parse(temp[1]), int.Parse(temp[2]), int.Parse(temp[3])); break; case "Animation": animationTypes.Add(contents[i][j]); break; case "Align": align = contents[i][j]; break; case "LinkType": linkType.Add(contents[i][j]); break; case "LinkID": linkID.Add(contents[i][j]); break; } } } SetMenuItems(); SetAnimations(); }