예제 #1
0
        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.txt", attributes, contents);

            for (int i = 0; i < attributes.Count; i++)
            {
                for (int j = 0; j < attributes[i].Count; j++)
                {
                    switch(attributes[i][j])
                    {
                        default:
                        case "Image":
                            images.Add(this.content.Load<Texture2D>("SplashScreen/" + contents[i][j]));
                            animation.Add(new FadeAnimation());
                            break;
                        case "Sound": break;
                    }
                }
            }

            for (int i = 0; i < animation.Count; i++)
            {
                animation[i].LoadContent(content, images[i], "", Vector2.Zero);
                //in case image is different size than viewport
                // ImageWidth / 2 * scale - (imageWidth /2)
                // ImageHeight / 2 * scale - (imageHeight / 2)
                animation[i].Scale = 1f; //can scale images here in splash screen
                animation[i].IsActive = true;
            }
        }
예제 #2
0
 public void Initialize()
 {
     currentScreen = new SplashScreen();
     fade = new FadeAnimation();
     inputManager = new InputManager();
 }
예제 #3
0
        public void LoadContent(ContentManager content, string id)
        {
            this.content = new ContentManager(content.ServiceProvider, "Content");
            menuItems = new List<string>();
            menuImages = new List<Texture2D>();
            animation = new List<Animation>();
            animationTypes = new List<string>();
            attributes = new List<List<string>>();
            contents = new List<List<string>>();
            linkType = new List<string>();
            linkID = new List<string>();
            position = Vector2.Zero;
            fileManager = new FileManager();
            fAnimation = new FadeAnimation();
            ssAnimation = new SpriteSheetAnimation();
            itemNumber = 0;

            fileManager.LoadContent("Load/Menus.txt", 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();
        }