public override void LoadContent(ContentManager content, InputManager inputManager)
 {
     base.LoadContent(content, inputManager);
     player      = new Player();
     map         = new Map();
     deathScreen = new DeathScreen();
     player.LoadContent(content, inputManager);
     map.LoadContent(content, map, $"Map{id}");
     loaded     = true;
     background = content.Load <Texture2D>("background");
     if (random)
     {
         loaded = true;
     }
 }
Beispiel #2
0
        public void LoadContent(ContentManager content, string id)
        {
            //variable instantiation
            this.content   = new ContentManager(content.ServiceProvider, "Content");
            menuItems      = new List <string>();
            menuImages     = new List <Texture2D>();
            animationTypes = new List <string>();
            animation      = new List <List <Animation> >();
            attributes     = new List <List <string> >();
            contents       = new List <List <string> >();
            linkType       = new List <string>();
            linkID         = new List <string>();
            player         = new Player();
            deathScreen    = new DeathScreen();
            itemNumber     = 0;
            screen         = 1;
            position       = Vector2.Zero;
            fileManager    = new FileManager();
            game           = new Game1();
            //Het laden van attributes en contents van de menu
            fileManager.LoadContent($"Load/Menus{screen}.vke", attributes, contents);

            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 "Position":
                        string[] temp = contents[i][j].Split(' ');
                        position = new Vector2(float.Parse(temp[0]), float.Parse(temp[1]));
                        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();
        }