public override void LoadContent() { Assets.InitializeScores(Assets.Levels); _background = ScreenManager.ContentManager.Load<Texture2D>(Assets.MAIN_BACKGROUND); UpdateScreen(); ScreenManager.Camera.ProjectionUpdated += UpdateScreen; //Create Highscore scrollable panle and add text object into it. //Color ForegroundColor = new Color(143, 76, 44), HighlighColor = Color.Black;// = new Color(201, 156, 120); Color ForegroundColor = new Color(201, 156, 120), HighlighColor = Color.Black; pnl = new ScrollingPanelControl(); int i = 10; pnl.AddChild(new TextControl("HIGHSCORE", ScreenManager.SpriteFonts.GameSpriteFont, HighlighColor, new Vector2(_viewport.Width / 2 - ScreenManager.SpriteFonts.GameSpriteFont.MeasureString("HIGHSCORE").X / 2 - 4, i - 4))); pnl.AddChild(new TextControl("HIGHSCORE", ScreenManager.SpriteFonts.GameSpriteFont, HighlighColor, new Vector2(_viewport.Width / 2 - ScreenManager.SpriteFonts.GameSpriteFont.MeasureString("HIGHSCORE").X / 2 + 4, i +4))); pnl.AddChild(new TextControl("HIGHSCORE", ScreenManager.SpriteFonts.GameSpriteFont, ForegroundColor, new Vector2(_viewport.Width / 2 - ScreenManager.SpriteFonts.GameSpriteFont.MeasureString("HIGHSCORE").X / 2, i))); i += 20; foreach (Level item in Assets.Levels) { if (Assets.GetLevelScore(item.LevelName).Count > 0) { i += 45; pnl.AddChild(new TextControl(item.LevelName, ScreenManager.SpriteFonts.GameSpriteMediumFont, HighlighColor, new Vector2(10 - 1, i - 1))); pnl.AddChild(new TextControl(item.LevelName, ScreenManager.SpriteFonts.GameSpriteMediumFont, HighlighColor, new Vector2(10 + 1, i + 1))); pnl.AddChild(new TextControl(item.LevelName, ScreenManager.SpriteFonts.GameSpriteMediumFont, ForegroundColor, new Vector2(10, i))); i += 5; } foreach (HighScoreEntry entry in Assets.GetLevelScore(item.LevelName)) { i += 29; pnl.AddChild(new TextControl(entry.Name, ScreenManager.SpriteFonts.GameSpriteSmallFont, HighlighColor, new Vector2(50 - 1, i - 1))); pnl.AddChild(new TextControl(entry.Name, ScreenManager.SpriteFonts.GameSpriteSmallFont, HighlighColor, new Vector2(50 + 1, i + 1))); pnl.AddChild(new TextControl(entry.Name, ScreenManager.SpriteFonts.GameSpriteSmallFont, ForegroundColor, new Vector2(50, i))); pnl.AddChild(new TextControl(entry.Score.ToString(), ScreenManager.SpriteFonts.GameSpriteSmallFont, HighlighColor, new Vector2(400 - 1, i - 1))); pnl.AddChild(new TextControl(entry.Score.ToString(), ScreenManager.SpriteFonts.GameSpriteSmallFont, HighlighColor, new Vector2(400 + 1, i + 1))); pnl.AddChild(new TextControl(entry.Score.ToString(), ScreenManager.SpriteFonts.GameSpriteSmallFont, ForegroundColor, new Vector2(400, i))); pnl.AddChild(new TextControl(string.Format("{0:dd MMM yyyy}", entry.Date), ScreenManager.SpriteFonts.GameSpriteSmallFont, HighlighColor, new Vector2(_viewport.Width - ScreenManager.SpriteFonts.GameSpriteSmallFont.MeasureString(string.Format("{0:dd MMM yyyy}", entry.Date)).X - 10 - 1, i - 1))); pnl.AddChild(new TextControl(string.Format("{0:dd MMM yyyy}", entry.Date), ScreenManager.SpriteFonts.GameSpriteSmallFont, HighlighColor, new Vector2(_viewport.Width - ScreenManager.SpriteFonts.GameSpriteSmallFont.MeasureString(string.Format("{0:dd MMM yyyy}", entry.Date)).X - 10 + 1, i + 1))); pnl.AddChild(new TextControl(string.Format("{0:dd MMM yyyy}", entry.Date), ScreenManager.SpriteFonts.GameSpriteSmallFont, ForegroundColor, new Vector2(_viewport.Width - ScreenManager.SpriteFonts.GameSpriteSmallFont.MeasureString(string.Format("{0:dd MMM yyyy}", entry.Date)).X - 10, i))); } } //Moving Clouds List<Texture2D> lst = new List<Texture2D>(); lst.Add(ScreenManager.ContentManager.Load<Texture2D>(Assets.BG_CLOUDS)); _clouds = new ParallaxBackground(lst, ParallaxDirection.Horizontal) { Height = ScreenManager.GraphicsDevice.Viewport.Height, Width = ScreenManager.GraphicsDevice.Viewport.Width }; base.LoadContent(); }
private void CreateParallaxBG() { //Background List<Texture2D> lst = new List<Texture2D>(); foreach (string item in this.CurrentLevel.Backgrounds) { lst.Add(ScreenManager.ContentManager.Load<Texture2D>(item)); } _background = new ParallaxBackground(lst, ParallaxDirection.Horizontal) { Height = ScreenManager.GraphicsDevice.Viewport.Height, Width = ScreenManager.GraphicsDevice.Viewport.Width, Position = this._backgroundPosition }; //Moving Clouds lst = new List<Texture2D>(); lst.Add(ScreenManager.ContentManager.Load<Texture2D>(Assets.BG_CLOUDS)); _clouds = new ParallaxBackground(lst, ParallaxDirection.Horizontal) { Height = ScreenManager.GraphicsDevice.Viewport.Height, Width = ScreenManager.GraphicsDevice.Viewport.Width }; }
private void LoadTextures() { _background = _content.Load<Texture2D>(Assets.MAIN_BACKGROUND); _logo = _content.Load<Texture2D>(Assets.GAME_LOGO); _startGameNormal = _content.Load<Texture2D>(Assets.STARTGAME_NORMAL); _startGameClicked = _content.Load<Texture2D>(Assets.STARTGAME_CLICKED); _instructionsNormal = _content.Load<Texture2D>(Assets.INSTRUCTIONS_NORMAL); _instructionsClicked = _content.Load<Texture2D>(Assets.INSTRUCTIONS_CLICKED); _highScoreNormal = _content.Load<Texture2D>(Assets.HIGHSCORE_NORMAL); _highScoreClicked = _content.Load<Texture2D>(Assets.HIGHSCORE_CLICKED); //Moving Clouds List<Texture2D> lst = new List<Texture2D>(); lst.Add(ScreenManager.ContentManager.Load<Texture2D>(Assets.BG_CLOUDS)); _clouds = new ParallaxBackground(lst, ParallaxDirection.Horizontal) { Height = ScreenManager.GraphicsDevice.Viewport.Height, Width = ScreenManager.GraphicsDevice.Viewport.Width }; }