Ejemplo n.º 1
0
        public override void LoadContent(ContentManager content, InputManager inputManager)
        {
            base.LoadContent(content, inputManager);
            fileManager = new FileManager();
            moveAnimation = new SpriteSheetAnimation();
            Vector2 tempFrames = Vector2.Zero;

            fileManager.LoadContent("Load/Player.cme", attributes, contents);
            for (int i=0; i < attributes.Count; i++)
            {
                for (int j = 0; j < attributes[i].Count; j++)
                {
                    switch (attributes[i][j])
                    {
                        case "Health":
                            health = int.Parse(contents[i][j]);
                            break;
                        case "Frames":
                            string[] frames = contents[i][j].Split(' ');
                            tempFrames = new Vector2(int.Parse(frames[0]), int.Parse(frames[1]));
                            break;
                        case "Image":
                            image = this.content.Load<Texture2D>(contents[i][j]);
                            break;
                        case "Position":
                            frames = contents[i][j].Split(' ');
                            position = new Vector2(int.Parse(frames[0]), int.Parse(frames[1]));
                            break;
                    }
                }
            }

            moveAnimation.LoadContent(content, image, "", position);
        }
Ejemplo n.º 2
0
        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 + ".cme", attributes, contents, "Layers");

            for(int i = 0; i < attributes.Count; i++)
            {
                for (int j = 0; j < attributes[i].Count; i++)
                {
                    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][j].Split(',');
                                tile.Add(new Vector2(int.Parse(split[0]), int.Parse(split[1])));
                            }
                            break;
                        case "EndLayer":
                            if (layer.Count > 0)
                                tileMap.Add(layer);
                            layer = new List<List<Vector2>>();
                            break;
                    }
                }
                if (tile > 0)
                    layer.Add(tile);
                tile = new List<Vector2>();

            }
        }
Ejemplo n.º 3
0
        public override void LoadContent(ContentManager Content, InputManager inputManager)
        {
            base.LoadContent(Content, inputManager);
            if (font == null)
                font = content.Load<SpriteFont>("Fonts/Header");
            if (Menu == null)
                Menu = content.Load<SpriteFont>("Fonts/Menu");
            imageNumber = 0;
            fileManager = new FileManager();
            fade = new List<FadeAnimation>();
            images = new List<Texture2D>();

            fileManager.LoadContent("Load/splash.cme", 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(content.Load<Texture2D>(contents[i][j]));
                            fade.Add(new FadeAnimation());
                            break;
                       // case "Sound":
                       //     sounds.Add(content.Load<SoundEffect>(contents[i][j]));
                       //     break;
                    }
                }
            }
            for (int i = 0; i < fade.Count; i++)
            {
                //ImageWidth / 2 * scale - (imageWidth / 2)
                //ImageHeight / 2 * scale - (imageHeight / 2)
                fade[i].LoadContent(content, images[i], "", Vector2.Zero);

                fade[i].Scale = 1.0f;
                fade[i].IsActive = true;
            }
        }
Ejemplo n.º 4
0
 public override void UnloadContent()
 {
     base.UnloadContent();
     fileManager = null;
 }
Ejemplo n.º 5
0
        public void LoadContent(ContentManager content, string id)
        {
            this.content = new ContentManager(content.ServiceProvider, "Content");
            menuImages = new List<Texture2D>();
            animationTypes = new List<string>();
            menuItems = new List<string>();
            animation = new List<List<Animation>>();
            attributes = new List<List<string>>();
            contents = new List<List<string>>();
            linkID = new List<string>();
            linkType = new List<string>();
            itemNumber = 0;
            position = Vector2.Zero;
            fileManager = new FileManager();
            fileManager.LoadContent("Load/menu.cme", 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();
            SetAnimantions();
        }
Ejemplo n.º 6
0
 public void UnloadContent()
 {
     content.Unload();
     fileManager = null;
     position = Vector2.Zero;
     animation.Clear();
     menuItems.Clear();
     menuImages.Clear();
     animationTypes.Clear();
 }