Esempio n. 1
0
 private void DrawPaused(SpriteBatch sb)
 {
     sb.Draw(PersistentContent.GetTexture("Blank"), Main.ScreenBound, new Color(Color.Black, 0.8f));
     sb.DrawString(PersistentContent.GetFont("Large"), "Paused", new Vector2(30, 0), Color.White);
     sb.DrawString(PersistentContent.GetFont("Normal"), "Press the shooting button to continue.", new Vector2(30, 100), Color.White);
     sb.DrawString(PersistentContent.GetFont("Normal"), "Press Q to forfeit the game and to return to Title.", new Vector2(30, 150), Color.White);
     sb.Draw(PersistentContent.GetTexture("Comic"), new Rectangle(112, 300, 800, 200), Color.White);
 }
Esempio n. 2
0
        /// <summary>
        /// Draw whatever that the slide wants.
        /// </summary>
        /// <param name="sb"></param>
        public override void DrawMiddle(SpriteBatch sb)
        {
            if (Instructions.Count > 0)
            {
                if (CurrentBackground != null)
                {
                    sb.Draw(CurrentBackground, Main.ScreenBound, Color.White);

                    if (InstructionIndex < Instructions.Count && Instructions[InstructionIndex] is Texture2D)
                    {
                        sb.Draw(PersistentContent.GetTexture("Blank"), Main.ScreenBound, new Color(Color.Black, AlphaCounter));
                    }
                }
                else
                {
                    sb.Draw(PersistentContent.GetTexture("Blank"), Main.ScreenBound, Color.Black);
                }

                if (CurrentText != "")
                {
                    sb.Draw(PersistentContent.GetTexture("Blank"), new Rectangle(0,
                                                                                 (int)((Main.SCREEN_HEIGHT - PersistentContent.GetFont("Slide").MeasureString(CurrentText).Y) / 2),
                                                                                 Main.SCREEN_WIDTH, (int)PersistentContent.GetFont("Slide").MeasureString(CurrentText).Y),
                            new Color(Color.Black, 0.8f * AlphaCounter2));

                    sb.DrawString(PersistentContent.GetFont("Slide"), CurrentText,
                                  new Vector2((Main.SCREEN_WIDTH - PersistentContent.GetFont("Slide").MeasureString(CurrentText).X) / 2,
                                              (Main.SCREEN_HEIGHT - PersistentContent.GetFont("Slide").MeasureString(CurrentText).Y) / 2),
                                  new Color(Color.White, AlphaCounter2));
                }

                if (CurrentSelection != null)
                {
                    if (CurrentSelection.Question != null || CurrentSelection.Question != "")
                    {
                        sb.Draw(PersistentContent.GetTexture("Blank"), new Rectangle(0, 50,
                                                                                     Main.SCREEN_WIDTH, (int)PersistentContent.GetFont("Selection").MeasureString(CurrentSelection.Question).Y),
                                new Color(Color.Black, 0.8f * AlphaCounter2));

                        sb.DrawString(PersistentContent.GetFont("Selection"), CurrentSelection.Question,
                                      new Vector2((Main.SCREEN_WIDTH - PersistentContent.GetFont("Selection").MeasureString(CurrentSelection.Question).X) / 2, 50),
                                      Color.White * AlphaCounter2);
                    }

                    sb.Draw(PersistentContent.GetTexture("Blank"), new Rectangle(0, Main.SCREEN_HEIGHT - (int)CurrentSelection.Height - 50,
                                                                                 Main.SCREEN_WIDTH, (int)CurrentSelection.Height),
                            new Color(Color.Black, 0.8f * AlphaCounter2));

                    CurrentSelection.Draw(sb, (Main.SCREEN_WIDTH - (int)CurrentSelection.Width) / 2,
                                          Main.SCREEN_HEIGHT - (int)CurrentSelection.Height - 50);
                }
            }
        }
Esempio n. 3
0
        public override void DrawMiddle(SpriteBatch sb)
        {
            sb.Draw(PersistentContent.GetTexture("SaveLoad"), Main.ScreenBound, Color.White);
            sb.Draw(PersistentContent.GetTexture("Blank"), new Rectangle(0, (int)(Main.SCREEN_HEIGHT - LogsSelection.Height - 30),
                                                                         Main.SCREEN_WIDTH, (int)LogsSelection.Height), new Color(Color.Black, 0.8f));
            LogsSelection.Draw(sb, 0, (int)(Main.SCREEN_HEIGHT - LogsSelection.Height - 30));

            sb.Draw(PersistentContent.GetTexture("Blank"), new Rectangle(0, 30, Main.SCREEN_WIDTH,
                                                                         PersistentContent.GetFont("Selection").LineSpacing), new Color(Color.Black, 0.8f));

            if (SaveMode)
            {
                sb.DrawString(PersistentContent.GetFont("Selection"), "Select a Log to Save to", new Vector2(10, 30), Color.White);

                if (LogsSelection.SelectedIndex < 8 &&
                    Properties.Settings.Default.Logs[LogsSelection.SelectedIndex] != "0")
                {
                    sb.Draw(PersistentContent.GetTexture("Blank"), new Rectangle(0, 30 + PersistentContent.GetFont("Selection").LineSpacing,
                                                                                 Main.SCREEN_WIDTH, PersistentContent.GetFont("Selection").LineSpacing), Color.White);
                    sb.DrawString(PersistentContent.GetFont("Selection"), "Warning: Overwriting will occur!",
                                  new Vector2(10, 30 + PersistentContent.GetFont("Selection").LineSpacing), Color.Red);
                }
            }
            else
            {
                sb.DrawString(PersistentContent.GetFont("Selection"), "Select a Log to Begin/Continue from", new Vector2(10, 30), Color.White);

                if (LogsSelection.SelectedIndex == 8)
                {
                    sb.Draw(PersistentContent.GetTexture("Blank"), new Rectangle(0, 30 + PersistentContent.GetFont("Selection").LineSpacing,
                                                                                 Main.SCREEN_WIDTH, PersistentContent.GetFont("Selection").LineSpacing), Color.White);
                    sb.DrawString(PersistentContent.GetFont("Selection"), "Warning: Only for crash recovery!",
                                  new Vector2(10, 30 + PersistentContent.GetFont("Selection").LineSpacing), Color.Red);
                }
                else if (LogsSelection.SelectedIndex < 8)
                {
                    if (Properties.Settings.Default.Logs[LogsSelection.SelectedIndex] == "0")
                    {
                        sb.Draw(PersistentContent.GetTexture("Blank"), new Rectangle(0, 30 + PersistentContent.GetFont("Selection").LineSpacing,
                                                                                     Main.SCREEN_WIDTH, PersistentContent.GetFont("Selection").LineSpacing), Color.White);
                        sb.DrawString(PersistentContent.GetFont("Selection"), "Warning: An empty log cannot be loaded.",
                                      new Vector2(10, 30 + PersistentContent.GetFont("Selection").LineSpacing), Color.Red);
                    }
                }
            }
        }
Esempio n. 4
0
        public override void DrawInitial(SpriteBatch sb)
        {
            sb.Draw(PersistentContent.GetTexture("SaveLoad"), Main.ScreenBound, Color.White);
            sb.Draw(PersistentContent.GetTexture("Blank"), new Rectangle(0, (int)(Main.SCREEN_HEIGHT - LogsSelection.Height - 30),
                                                                         Main.SCREEN_WIDTH, (int)LogsSelection.Height), new Color(Color.Black, 0.8f * alpha));
            LogsSelection.Draw(sb, 0, (int)(Main.SCREEN_HEIGHT - LogsSelection.Height - 30));

            sb.Draw(PersistentContent.GetTexture("Blank"), new Rectangle(0, 30, Main.SCREEN_WIDTH,
                                                                         PersistentContent.GetFont("Selection").LineSpacing), new Color(Color.Black, 0.8f * alpha));

            if (SaveMode)
            {
                sb.DrawString(PersistentContent.GetFont("Selection"), "Select a Log to Save to", new Vector2(10, 30),
                              new Color(Color.White, alpha));
            }
            else
            {
                sb.DrawString(PersistentContent.GetFont("Selection"), "Select a Log to Begin/Continue from", new Vector2(10, 30),
                              new Color(Color.White, alpha));
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Update the slide.
 /// </summary>
 /// <param name="gt"></param>
 /// <returns></returns>
 public override bool UpdateMiddle(GameTime gt)
 {
     if (InstructionIndex >= Instructions.Count)
     {
         InstructionIndex--;
         return(true);
     }
     else
     {
         if (Instructions[InstructionIndex] is Action)
         {
             Action a = (Action)Instructions[InstructionIndex];
             InstructionIndex++;
             a.Invoke();
         }
         else if (Instructions[InstructionIndex] is State.State)
         {
             Main.ChangeCurrentState((State.State)Instructions[InstructionIndex]);
         }
         else if (Instructions[InstructionIndex] is Texture2D)
         {
             if (AlphaCounter > 0)
             {
                 AlphaCounter     -= 0.05f;
                 CurrentBackground = (Texture2D)Instructions[InstructionIndex];
             }
             else
             {
                 if (UpdateWithInput())
                 {
                     AlphaCounter = 1;
                 }
             }
         }
         else if (Instructions[InstructionIndex] is String)
         {
             if (AlphaCounter2 < 1)
             {
                 AlphaCounter2 += 0.1f;
                 CurrentText    = WrapText(PersistentContent.GetFont("Slide"), (string)Instructions[InstructionIndex],
                                           900);
             }
             else
             {
                 if (UpdateWithInput())
                 {
                     CurrentText   = "";
                     AlphaCounter2 = 0;
                 }
             }
         }
         else if (Instructions[InstructionIndex] is Selection)
         {
             if (CurrentSelection == null)
             {
                 CurrentSelection = (Selection)Instructions[InstructionIndex];
                 if (CurrentSelection.Question != null)
                 {
                     CurrentSelection.Question = WrapText(PersistentContent.GetFont("Normal"),
                                                          CurrentSelection.Question, 900);
                 }
                 CurrentText = "";
             }
             else
             {
                 if (AlphaCounter2 < 1)
                 {
                     AlphaCounter2 += 0.1f;
                 }
                 else
                 {
                     CurrentSelection.Update();
                     LastSelectionIndex = CurrentSelection.SelectedIndex;
                     if (UpdateWithInput())
                     {
                         CurrentSelection = null;
                         AlphaCounter2    = 0;
                     }
                 }
             }
         }
         else if (Instructions[InstructionIndex] is SoundEffect)
         {
             CurrentBackgroundMusic = new SoundEffectInstance(
                 (SoundEffect)Instructions[InstructionIndex]);
             CurrentBackgroundMusic.IsLooped = false;
             CurrentBackgroundMusic.Play();
             InstructionIndex++;
         }
         else if (Instructions[InstructionIndex] is Soundtrack)
         {
             Soundtrack s = (Soundtrack)Instructions[InstructionIndex];
             s.Play(Main.SongPlayer);
             InstructionIndex++;
         }
         else if (Instructions[InstructionIndex] is Tuple <object, Type> )
         {
             Tuple <object, Type> t = (Tuple <object, Type>)Instructions[InstructionIndex];
             if (t.Item1 == null)
             {
                 if (t.Item2 == typeof(SoundEffect))
                 {
                     CurrentBackgroundMusic.Stop();
                     InstructionIndex++;
                 }
                 else if (t.Item2 == typeof(Texture2D))
                 {
                     CurrentBackground = null;
                     if (UpdateWithInput())
                     {
                         AlphaCounter = 1;
                     }
                 }
             }
             else
             {
                 throw new SlideException("The slide instruction type is not supported!");
             }
         }
         else
         {
             throw new SlideException("The slide instruction type is not supported!");
         }
         return(false);
     }
 }
Esempio n. 6
0
        public override void DrawMiddle(SpriteBatch sb)
        {
            // Draw the background.
            BackgroundDraw(sb);

            // Draw the projectiles.
            if (Waves != null)
            {
                try
                {
                    foreach (Projectile p in Waves[currentWaveNo])
                    {
                        sb.Draw(p, new Color(p.Color.R, (int)(p.Color.G * p.HP / p.MaxHP), (int)(p.Color.B * p.HP / p.MaxHP)));
                    }
                }
                catch { }
            }

            // Draw the player projectiles.
            foreach (Projectile p in PlayerProjectiles)
            {
                sb.Draw(p);
            }

            // Draw the player.
            if (!Recovering)
            {
                sb.Draw(Player);
            }
            else
            {
                sb.Draw(Player, new Color(Player.Color, 0.4f));
            }

            // Draw the effects.
            foreach (Sprite.AnimatedSprite a in Effects)
            {
                sb.Draw(a);
            }

            // Draw the HUD background:
            sb.Draw(PersistentContent.GetTexture("Blank"), new Rectangle(0, 0, Main.SCREEN_WIDTH, 30),
                    new Color(Color.Black, 0.5f));
            sb.Draw(PersistentContent.GetTexture("Blank"), new Rectangle(0, Main.SCREEN_HEIGHT - 30, Main.SCREEN_WIDTH,
                                                                         30), new Color(Color.Black, 0.5f));

            // Draw HP Bar:
            sb.DrawString(PersistentContent.GetFont("Normal"), "HP", new Vector2(5, -5), Color.White);
            sb.Draw(PersistentContent.GetTexture("Blank"), new Rectangle(45, 12, 300, 10), Color.Gray);
            sb.Draw(PersistentContent.GetTexture("Blank"), new Rectangle(45, 12,
                                                                         (int)(300 * Player.HP / Player.MaxHP), 10), Color.LimeGreen);

            // Draw PP Bar:
            sb.DrawString(PersistentContent.GetFont("Normal"), "PP", new Vector2(400, -5), Color.White);
            sb.Draw(PersistentContent.GetTexture("Blank"), new Rectangle(440, 12, 300, 10), Color.Gray);
            sb.Draw(PersistentContent.GetTexture("Blank"), new Rectangle(440, 12,
                                                                         (int)(300 * Player.PP / Player.MaxPP), 10), Color.Yellow);

            // Draw Progress Bar:
            sb.DrawString(PersistentContent.GetFont("Normal"), "Waves", new Vector2(10, Main.SCREEN_HEIGHT -
                                                                                    PersistentContent.GetFont("Normal").LineSpacing), Color.White);
            sb.Draw(PersistentContent.GetTexture("Blank"), new Rectangle(95, Main.SCREEN_HEIGHT - 20,
                                                                         Main.SCREEN_WIDTH - 400, 10), Color.Gray);
            if (!Endless)
            {
                if (currentWaveNo < Waves.Count)
                {
                    sb.Draw(PersistentContent.GetTexture("Blank"), new Rectangle(95, Main.SCREEN_HEIGHT - 20,
                                                                                 (int)((Main.SCREEN_WIDTH - 400) * currentWaveNo / (Waves.Count)), 10), Color.White);
                }
                else
                {
                    sb.Draw(PersistentContent.GetTexture("Blank"), new Rectangle(95, Main.SCREEN_HEIGHT - 20,
                                                                                 Main.SCREEN_WIDTH - 400, 10), Color.White);
                }
            }

            // Draw the quick tip:
            sb.DrawString(PersistentContent.GetFont("Normal"), "Esc: Pause + Comic", new Vector2(735, Main.SCREEN_HEIGHT -
                                                                                                 PersistentContent.GetFont("Normal").LineSpacing), Color.White);

            if (TransitionAlpha > 0)
            {
                sb.Draw(PersistentContent.GetTexture("Blank"), Main.ScreenBound, new Color(Color.Black, TransitionAlpha));
            }

            if (Paused)
            {
                DrawPaused(sb);
            }
        }