Esempio n. 1
0
        public virtual void LoadContent(ContentManager content, List <string> attributes, List <string> contents, InputManager input)
        {
            this.content  = new ContentManager(content.ServiceProvider, "Content");
            moveAnimation = new Animation();
            ssAnimation   = new SpriteSheetAnimation();
            for (int i = 0; i < attributes.Count; i++)
            {
                switch (attributes[i])
                {
                case "Health":
                    health = int.Parse(contents[i]);
                    break;

                case "Frames":
                    string[] frames = contents[i].Split(',');
                    moveAnimation.Frames = new Vector2(int.Parse(frames[0]), int.Parse(frames[1]));
                    break;

                case "Image":
                    image = this.content.Load <Texture2D>(contents[i]);
                    break;

                case "Position":
                    frames   = contents[i].Split(',');
                    position = new Vector2(int.Parse(frames[0]), int.Parse(frames[1]));
                    break;

                case "MoveSpeed":
                    moveSpeed = float.Parse(contents[i]);
                    break;

                case "Range":
                    range = int.Parse(contents[i]);
                    break;
                }
            }

            gravity          = 800f;
            velocity         = Vector2.Zero;
            syncTilePosition = false;
            activateGravity  = true;

            moveAnimation.LoadContent(content, image, "", position);
        }
Esempio n. 2
0
        public override void LoadContent(ContentManager content, InputManager input)
        {
            base.LoadContent(content, input);
            fileManager   = new FileManager();
            moveAnimation = new SpriteSheetAnimation();
            Vector2 tempFrames = Vector2.Zero;

            moveSpeed = 100f;

            fileManager.LoadContent("Load/Player.jxz", 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);
        }
Esempio n. 3
0
        public void LoadContent(ContentManager content, string id)
        {
            this.content   = new ContentManager(content.ServiceProvider, "Content");
            menuItems      = new List <string>();
            animationTypes = new List <string>();
            linkType       = new List <string>();
            linkID         = new List <string>();
            menuImages     = new List <Texture2D>();
            animation      = new List <Animation>();
            attributes     = new List <List <string> >();
            contents       = new List <List <string> >();
            itemNumber     = 0;
            fAnimation     = new FadeAnimation();
            ssAnimation    = new SpriteSheetAnimation();

            position = Vector2.Zero;

            fileManager = new FileManager();
            fileManager.LoadContent("Load/Menu.jxz", 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();
        }