Beispiel #1
0
        public override void Load(Microsoft.Xna.Framework.Content.ContentManager Content)
        {
            gamePad = new GamePadMapper(PlayerIndex.One);

            titleDropInFont           = new DropInFont(Content.Load <SpriteFont>("Fonts\\JingJingTitle"), new Vector2(_viewPort.Width / 2, _viewPort.Height * 0.1f), new Vector2(_viewPort.Width / 2, _viewPort.Height * 0.1f), dropSpeed, "Game Mode", Color.CornflowerBlue);
            titleDropInFont.IsVisible = true;
            titleDropInFont.SetCenterAsOrigin();
            titleDropInFont.EnableShadow   = false;
            titleDropInFont.TintColor      = Color.Black;
            titleDropInFont.ShadowPosition = new Vector2(titleDropInFont.Position.X - 4, titleDropInFont.Position.Y + 4);
            titleDropInFont.ShadowColor    = Color.Gray;

            onePlayerBtn = new Button(Content.Load <Texture2D>("temp 1 player button"), new Vector2(0, 0), Color.White);
            onePlayerBtn.SetCenterAsOrigin();
            onePlayerBtn.Position = new Vector2(_viewPort.Width / 2, titleDropInFont.Position.Y + onePlayerBtn.Origin.Y * 2.5f);

            twoPlayersBtn = new Button(Content.Load <Texture2D>("temp 2 players button"), new Vector2(0, 0), Color.White);
            twoPlayersBtn.SetCenterAsOrigin();
            twoPlayersBtn.Position = new Vector2(_viewPort.Width / 2, onePlayerBtn.Position.Y + twoPlayersBtn.Origin.Y * 4);

            backBtn = new Button(Content.Load <Texture2D>("temp back button"), new Vector2(10, 10), Color.CornflowerBlue);
            backBtn.SetCenterAsOrigin();
            backBtn.Position = backBtn.Origin;

            _sprites.Add(titleDropInFont);
            _sprites.Add(onePlayerBtn);
            _sprites.Add(twoPlayersBtn);
            _sprites.Add(backBtn);
        }
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            bgSprite = new GameSprite(Content.Load <Texture2D>("bgImage"), Vector2.Zero, Color.White);
            bgSprite.ScaleToViewport(GraphicsDevice.Viewport);

            titleText1 = new DropInFont(Content.Load <SpriteFont>("GameFont"), new Vector2(viewport.HalfWidth(), -1000), screenSize / 2, new Vector2(0, 20), "Great Minds", Color.OrangeRed);
            titleText1.TargetPosition = new Vector2(titleText1.TargetPosition.X, titleText1.TargetPosition.Y - titleText1.Size.Y / 4);
            titleText1.SetCenterAsOrigin();
            titleText1.ShadowPosition = new Vector2(titleText1.Position.X - 4, titleText1.Position.Y + 4);
            titleText1.ShadowColor    = Color.Black;
            titleText1.StateChanged  += new EventHandler <StateEventArgs>(statefulFont_StateChanged);

            Vector2 titleText2Pos = new Vector2(titleText1.Position.X + titleText1.Size.X / 2, viewport.HalfHeight() + titleText1.Size.Y / 4);

            titleText2 = new FadingFont(Content.Load <SpriteFont>("GameFont"), titleText2Pos, Color.Orange);
            titleText2.Text.Append("Robotics");
            titleText2.FadeStep       /= 5f;
            titleText2.StateChanged   += new EventHandler <StateEventArgs>(titleText2_StateChanged);
            titleText2.Fade            = false;
            titleText2.Position       -= new Vector2(titleText2.Size.X / 2, 0);
            titleText2.ShadowPosition -= new Vector2(titleText2.Size.X / 2, 0);
            titleText2.SetCenterAsOrigin();

            titleText1.Text.Clear();
            titleText1.Text.Append("Great ");

            Vector2 titleText3Pos = new Vector2(titleText1.Position.X + titleText1.Size.X / 2, -2000);

            titleText3 = new DropInFont(Content.Load <SpriteFont>("GameFont"), titleText3Pos, screenSize / 2, new Vector2(0, 20), "Minds", Color.OrangeRed);
            titleText3.TargetPosition = titleText1.TargetPosition;
            titleText3.SetCenterAsOrigin();
            titleText3.ShadowPosition = new Vector2(titleText3.Position.X - 4, titleText3.Position.Y + 4);
            titleText3.ShadowColor    = Color.Black;
            titleText3.StateChanged  += new EventHandler <StateEventArgs>(statefulFont_StateChanged);
            titleText3.Tag            = GameTags.StartTitleFadeIn;

            Vector2 byPos = new Vector2(titleText1.Position.X - 100, -1000);

            by = new AccelDropInFont(Content.Load <SpriteFont>("GameFont"), byPos, screenSize / 2, new Vector2(0, 5), "By:", Color.Orange, new Vector2(0, 1.5f));
            by.TargetPosition = titleText1.TargetPosition - new Vector2(100, 100);
            by.SetCenterAsOrigin();
            by.ShadowPosition = new Vector2(by.Position.X - 4, by.Position.Y + 4);
            by.ShadowColor    = Color.Black;
            by.MaxDropSpeed   = new Vector2(15, 15);

            crashEffect = Content.Load <SoundEffect>("Crash");

            //Obtained from http://www.freesound.org/people/EdgardEdition/sounds/113095/
            coinsEffect = Content.Load <SoundEffect>("insertcoin");

            insertCoins = new ArcadeFont(Content.Load <SpriteFont>("ArcadeFont"), new Vector2(300, 400), Color.Red, Color.White, Color.Yellow, Color.Blue);
            insertCoins.ShadowPosition       = new Vector2(insertCoins.Position.X - 1, insertCoins.Position.Y + 1);
            insertCoins.ColorCyclesPerSecond = 15;  //Default is 10; smaller number blinks slower
            insertCoins.Text.Append("INSERT COINS");
            insertCoins.IsVisible = false;

            slidingText = new StatefulSequence <SlidingFont>(SlidingFont.FontState.Done, typeof(SlidingFont.FontState));

            Vector2 targetPos = new Vector2(505, 400);

            foreach (char letter in "COOL")
            {
                slidingText.Add(new SlidingFont(Content.Load <SpriteFont>("SlidingFont"), new Vector2(50, 350), targetPos, 2f, letter.ToString(), Color.Red)
                {
                    EnableShadow = false, IsVisible = false, TargetTolerance = 0.625f
                });
                targetPos.X += slidingText[slidingText.Count - 1].Size.X; //Magic # - bad idea
            }

            targetPos = new Vector2(505, 420);
            random    = new Random();

            foreach (char letter in "Effects!")
            {
                slidingText.Add(new SlidingFont(Content.Load <SpriteFont>("SlidingFont"), new Vector2(random.Next(0, GraphicsDevice.Viewport.Width), random.Next(0, GraphicsDevice.Viewport.Height)), targetPos, 1f + (float)random.NextDouble(), letter.ToString(), Color.Red)
                {
                    EnableShadow = false, IsVisible = false
                });
                targetPos.X += slidingText[slidingText.Count - 1].Size.X; //Magic # - bad idea
            }

            coolPanel           = new TexturePanel(Content.Load <Texture2D>("WavyEffect"), new Vector2(120, 60), Vector2.One * .5f, new Vector2(550, 425), new Color(60, 60, 60, 128));
            coolPanel.IsVisible = false;

            insertFive           = new AchievementPanel(0, Content.Load <SpriteFont>("SlidingFont"), Content.Load <SpriteFont>("ArcadeFont"), "Insert 5 coins", GraphicsDevice);
            insertFive.Condition = AchievementPanel.AreFiveCoinsInsert;

            donateHundred           = new AchievementPanel(0, Content.Load <SpriteFont>("SlidingFont"), Content.Load <SpriteFont>("ArcadeFont"), "Donate $100 to GMR", GraphicsDevice);
            donateHundred.Condition = AchievementPanel.AreHundredDollarsDonated;

            noCoinSpam           = new AchievementPanel(0, Content.Load <SpriteFont>("SlidingFont"), Content.Load <SpriteFont>("ArcadeFont"), "Don't insert coins for 30 seconds", GraphicsDevice);
            noCoinSpam.Position  = new Vector2(GraphicsDevice.Viewport.Width - noCoinSpam.Width, noCoinSpam.Position.Y);
            noCoinSpam.Condition = AchievementPanel.IsNoCoinsInsertedAtThirtySeconds;

            allAchievementsDone           = new AchievementPanel(0, Content.Load <SpriteFont>("SlidingFont"), Content.Load <SpriteFont>("ArcadeFont"), "Finish all achievements", GraphicsDevice);
            allAchievementsDone.Condition = delegate(GameTime gt) { return(standardAchievementsCompleted); };

            StatefulSequence <AchievementPanel> allAchievementPanels = new StatefulSequence <AchievementPanel>(AchievementPanel.PanelState.Done, typeof(AchievementPanel.PanelState));

            allAchievementPanels.Add(noCoinSpam);
            allAchievementPanels.Add(donateHundred);
            allAchievementPanels.Add(insertFive);

            allAchievementPanels.SequenceReachedMonitoredState += new StatefulSequence <AchievementPanel> .MonitoredStateReached(allAchievementPanels_SequenceReachedMonitoredState);

            slidingText.SequenceReachedMonitoredState += new StatefulSequence <SlidingFont> .MonitoredStateReached(slidingText_SequenceReachedMonitoredState);

            colorfulTypingText = new TypingFont(Content.Load <SpriteFont>("ArcadeFont"), new Vector2(200, 0), Color.Black, "Typing text here", TimeSpan.FromMilliseconds(200));
            colorfulTypingText.StateChanged   += new EventHandler <StateEventArgs>(typingText_StateChanged);
            colorfulTypingText.CharacterTyped += new EventHandler <TypingFont.CharacterTypedEventArgs>(typingText_CharacterTyped);
            colorfulTypingText.Tag             = "1";
            colorfulTypingText.Start();

            regularTypingText = new TypingFont(Content.Load <SpriteFont>("ArcadeFont"), new Vector2(400, 0), Color.Black, "... and more typing text here...", TimeSpan.FromMilliseconds(50));
            regularTypingText.StateChanged += new EventHandler <StateEventArgs>(typingText_StateChanged);
            regularTypingText.Tag           = "2";
        }
        public override void Load(Microsoft.Xna.Framework.Content.ContentManager Content)
        {
            gamePad = new GamePadMapper(PlayerIndex.One);

            ScreenState screenState;

            //TODO Change Button so it says "Start"
            //startButton = new Button(Content.Load<Texture2D>("temp play button"), new Vector2(_viewPort.Width / 2, _viewPort.Height / 2), Color.White);
            //startButton.SetCenterAsOrigin();

            infoFont = new FadingFont(Content.Load <SpriteFont>("Fonts\\SpriteFont1"), new Vector2(_viewPort.Width / 2, _viewPort.Height - 15), 0.1f, 1.0f, 0.01f, 1.0f, string.Format("Press any key to continue "), Color.White, false);
            infoFont.EnableShadow = false;
            infoFont.SetCenterAsOrigin();

            greatDropInFont           = new DropInFont(Content.Load <SpriteFont>("Fonts\\JingJingTitle"), new Vector2(_viewPort.Width / 2 - _viewPort.X, -1000), new Vector2(_viewPort.Width / 2 - _viewPort.X, _viewPort.Height * 0.1f), dropSpeed, "GreatMinds", Color.CornflowerBlue);
            greatDropInFont.IsVisible = true;
            greatDropInFont.SetCenterAsOrigin();
            greatDropInFont.EnableShadow   = false;
            greatDropInFont.TintColor      = Color.Black;
            greatDropInFont.ShadowPosition = new Vector2(greatDropInFont.Position.X - 4, greatDropInFont.Position.Y + 4);
            greatDropInFont.ShadowColor    = Color.Gray;
            greatDropInFont.StateChanged  += new EventHandler <StateEventArgs>(epicDropInFont_StateChanged);

            pDropInFont           = new DropInFont(Content.Load <SpriteFont>("Fonts\\JingJingTitle"), new Vector2(greatDropInFont.Origin.X + greatDropInFont.Position.X / 2.5f, -1000), new Vector2(greatDropInFont.Origin.X + greatDropInFont.Position.X / 2.5f, 100), dropSpeed, "P", Color.CornflowerBlue);
            pDropInFont.IsVisible = false;
            pDropInFont.SetCenterAsOrigin();
            pDropInFont.EnableShadow   = false;
            pDropInFont.TintColor      = Color.Black;
            pDropInFont.ShadowPosition = new Vector2(pDropInFont.Position.X - 4, pDropInFont.Position.Y + 4);
            pDropInFont.ShadowColor    = Color.Gray;
            pDropInFont.StateChanged  += new EventHandler <StateEventArgs>(pDropInFont_StateChanged);

            oDropInFont           = new DropInFont(Content.Load <SpriteFont>("Fonts\\JingJingTitle"), new Vector2(pDropInFont.Origin.X * 2.5f + pDropInFont.Position.X, -1000), new Vector2(pDropInFont.Origin.X * 2.5f + pDropInFont.Position.X, 100), dropSpeed, "O", Color.CornflowerBlue);
            oDropInFont.IsVisible = false;
            oDropInFont.SetCenterAsOrigin();
            oDropInFont.EnableShadow   = false;
            oDropInFont.TintColor      = Color.Black;
            oDropInFont.ShadowPosition = new Vector2(oDropInFont.Position.X - 4, oDropInFont.Position.Y + 4);
            oDropInFont.ShadowColor    = Color.Gray;
            oDropInFont.StateChanged  += new EventHandler <StateEventArgs>(oDropInFont_StateChanged);

            nDropInFont           = new DropInFont(Content.Load <SpriteFont>("Fonts\\JingJingTitle"), new Vector2(pDropInFont.Origin.X * 2.5f + oDropInFont.Position.X, -1000), new Vector2(pDropInFont.Origin.X * 2.5f + oDropInFont.Position.X, 100), dropSpeed, "N", Color.CornflowerBlue);
            nDropInFont.IsVisible = false;
            nDropInFont.SetCenterAsOrigin();
            nDropInFont.EnableShadow   = false;
            nDropInFont.TintColor      = Color.Black;
            nDropInFont.ShadowPosition = new Vector2(nDropInFont.Position.X - 4, nDropInFont.Position.Y + 4);
            nDropInFont.ShadowColor    = Color.Gray;
            nDropInFont.StateChanged  += new EventHandler <StateEventArgs>(nDropInFont_StateChanged);

            gDropInFont           = new DropInFont(Content.Load <SpriteFont>("Fonts\\JingJingTitle"), new Vector2(pDropInFont.Origin.X * 2.5f + nDropInFont.Position.X, -1000), new Vector2(pDropInFont.Origin.X * 2.5f + nDropInFont.Position.X, 100), dropSpeed, "G", Color.CornflowerBlue);
            gDropInFont.IsVisible = false;
            gDropInFont.SetCenterAsOrigin();
            gDropInFont.EnableShadow   = false;
            gDropInFont.TintColor      = Color.Black;
            gDropInFont.ShadowPosition = new Vector2(gDropInFont.Position.X - 4, gDropInFont.Position.Y + 4);
            gDropInFont.ShadowColor    = Color.Gray;
            gDropInFont.StateChanged  += new EventHandler <StateEventArgs>(gDropInFont_StateChanged);

            //_sprites.Add(startButton);
            _sprites.Add(infoFont);
            _sprites.Add(greatDropInFont);
            _sprites.Add(pDropInFont);
            _sprites.Add(oDropInFont);
            _sprites.Add(nDropInFont);
            _sprites.Add(gDropInFont);
        }