コード例 #1
0
ファイル: MainMenu.cs プロジェクト: kevincos/PuzzleBox
        public void Draw()
        {
            Game.spriteBatch.Draw(background, new Rectangle(0, 0, Game.screenSizeX, Game.screenSizeY), Color.White);
            Game.spriteBatch.Draw(header, new Rectangle(headerX, headerY, headerWidth, headerHeight), Color.White);

            for (int i = 0; i < optionList.Count; i++)
            {
                if (i == selectedIndex)
                {
                    PuzzleNode p = new PuzzleNode(Game.jellyBlue);
                    p.screenX = optionListX - 25;
                    p.screenY = optionListY + optionHeight / 2 + i * optionGap;
                    if (state == MainMenuState.ANIMATEDOWN)
                    {
                        p.screenY -= (int)(optionGap * (1f - (float)animateTime / (float)250));
                    }
                    if (state == MainMenuState.ANIMATEUP)
                    {
                        p.screenY += (int)(optionGap * (1f - (float)animateTime / (float)250));
                    }

                    p.distance = 50;
                    p.scale    = 1f;
                    OrbRenderer.DrawOrb(p, State.READY, 0f);
                    Game.spriteBatch.DrawString(Game.menuFont, optionList[i].optionText, new Vector2(optionListX, optionListY + i * optionGap), Color.LightGreen);
                }
                else
                {
                    Game.spriteBatch.DrawString(Game.menuFont, optionList[i].optionText, new Vector2(optionListX, optionListY + i * optionGap), Color.White);
                }
            }
            if (state == MainMenuState.DOCTORIN)
            {
                JellyfishRenderer.DrawJellyfish(doctorX + 800 - 600 * animateTime / 250, doctorY, 100, JellyfishRenderer.nurseJellyfish, .75f, SpriteEffects.FlipHorizontally);
                JellyfishRenderer.DrawJellyfish(doctorX + 600 - 600 * animateTime / 250, doctorY, 100, JellyfishRenderer.doctorJellyfish, .75f, SpriteEffects.FlipHorizontally);
            }
            else if (state == MainMenuState.DOCTOROUT)
            {
                JellyfishRenderer.DrawJellyfish(doctorX + 200 + 600 * animateTime / 250, doctorY, 100, JellyfishRenderer.nurseJellyfish, .75f, SpriteEffects.FlipHorizontally);
                JellyfishRenderer.DrawJellyfish(doctorX + 600 * animateTime / 250, doctorY, 100, JellyfishRenderer.doctorJellyfish, .75f, SpriteEffects.FlipHorizontally);
            }
            else
            {
                JellyfishRenderer.DrawJellyfish(doctorX + 200, doctorY, 100, JellyfishRenderer.nurseJellyfish, .75f, SpriteEffects.FlipHorizontally);
                JellyfishRenderer.DrawJellyfish(doctorX, doctorY, 100, JellyfishRenderer.doctorJellyfish, .75f, SpriteEffects.FlipHorizontally);
            }
            if (state == MainMenuState.READY)
            {
                JellyfishRenderer.DrawSpeechBubble2(speechX, speechY, 100, SpriteEffects.FlipHorizontally);
                Game.spriteBatch.DrawString(Game.spriteFont, optionList[selectedIndex].optionString, new Vector2(speechX - 255, speechY + 5), Color.Black);
            }
            Game.spriteBatch.DrawString(Game.spriteFont, "Created by Kevin Costello. Artwork by Rachel K Sreebny", new Vector2(creditsX, creditsY), Color.LightGray, 0, Vector2.Zero, .75f, SpriteEffects.None, 0);
            Game.spriteBatch.DrawString(Game.spriteFont, "Music by Kevin MacLeod", new Vector2(creditsX + 95, creditsY + 22), Color.LightGray, 0, Vector2.Zero, .75f, SpriteEffects.None, 0);
        }
コード例 #2
0
ファイル: Rubric.cs プロジェクト: kevincos/PuzzleBox
        public void Draw()
        {
            if (enabled)
            {
                Game.spriteBatch.Draw(plus, new Rectangle(635, 70, 32, 32), Color.White);
                Game.spriteBatch.Draw(plus, new Rectangle(675, 70, 32, 32), Color.White);
                Game.spriteBatch.Draw(minus, new Rectangle(635, 105, 32, 32), Color.White);
                Game.spriteBatch.Draw(minus, new Rectangle(675, 105, 32, 32), Color.White);
                Game.spriteBatch.Draw(minus, new Rectangle(675, 140, 32, 32), Color.White);
                Game.spriteBatch.Draw(plus, new Rectangle(675, 175, 32, 32), Color.White);
                Game.spriteBatch.Draw(plus, new Rectangle(675, 210, 32, 32), Color.White);
                Game.spriteBatch.Draw(plus, new Rectangle(675, 245, 32, 32), Color.White);
                for (int j = 0; j < 6; j++)
                {
                    PuzzleNode p;
                    if (j == 0)
                    {
                        p = new PuzzleNode(Color.Blue);
                    }
                    else if (j == 1)
                    {
                        p = new PuzzleNode(Color.Yellow);
                    }
                    else if (j == 2)
                    {
                        p = new PuzzleNode(Color.Red);
                    }
                    else if (j == 3)
                    {
                        p = new PuzzleNode(Color.Green);
                    }
                    else if (j == 4)
                    {
                        p = new PuzzleNode(Color.Magenta);
                    }
                    else
                    {
                        p = new PuzzleNode(Color.Orange);
                    }

                    p.screenX = 740;
                    p.screenY = 85 + j * 35;

                    p.distance = 50;
                    p.scale    = 1f;
                    OrbRenderer.DrawOrb(p, State.READY, 0f);
                }
            }
        }
コード例 #3
0
        public void Draw()
        {
            Game.spriteBatch.Draw(background, new Rectangle(0, 0, Game.screenSizeX, Game.screenSizeY), Color.White);
            Game.spriteBatch.Draw(header, new Rectangle(headerX, headerY, headerWidth, headerHeight), Color.White);
            JellyfishRenderer.DrawJellyfish(doctorX + 200, doctorY, 100, JellyfishRenderer.nurseJellyfish, .75f, SpriteEffects.FlipHorizontally);
            JellyfishRenderer.DrawJellyfish(doctorX, doctorY, 100, JellyfishRenderer.doctorJellyfish, .75f, SpriteEffects.FlipHorizontally);

            for (int i = 0; i < optionList.Count; i++)
            {
                if (i == selectedIndex)
                {
                    PuzzleNode p = new PuzzleNode(Game.jellyBlue);
                    p.screenX = optionListX - 25;
                    p.screenY = optionListY + optionHeight / 2 + i * optionGap;
                    if (state == MenuState.AnimateDown)
                    {
                        p.screenY -= (int)(optionGap * (1f - (float)animationTime / (float)maxAnimationTime));
                    }
                    if (state == MenuState.AnimateUp)
                    {
                        p.screenY += (int)(optionGap * (1f - (float)animationTime / (float)maxAnimationTime));
                    }

                    p.distance = 50;
                    p.scale    = 1f;
                    OrbRenderer.DrawOrb(p, State.READY, 0f);
                    Game.spriteBatch.DrawString(Game.menuFont, optionList[i].optionText, new Vector2(optionListX, optionListY + i * optionGap), Color.LightGreen);
                }
                else
                {
                    Game.spriteBatch.DrawString(Game.menuFont, optionList[i].optionText, new Vector2(optionListX, optionListY + i * optionGap), Color.White);
                }
                if (optionList[i].type == MenuType.SoundToggle)
                {
                    if (Game.gameSettings.soundEffectsEnabled)
                    {
                        Game.spriteBatch.DrawString(Game.menuFont, "On", new Vector2(optionListX + 300, optionListY + i * optionGap), Color.White);
                    }
                    else
                    {
                        Game.spriteBatch.DrawString(Game.menuFont, "Off", new Vector2(optionListX + 300, optionListY + i * optionGap), Color.White);
                    }
                }
                if (optionList[i].type == MenuType.HelpToggle)
                {
                    if (Game.gameSettings.displayControls)
                    {
                        Game.spriteBatch.DrawString(Game.menuFont, "On", new Vector2(optionListX + 300, optionListY + i * optionGap), Color.White);
                    }
                    else
                    {
                        Game.spriteBatch.DrawString(Game.menuFont, "Off", new Vector2(optionListX + 300, optionListY + i * optionGap), Color.White);
                    }
                }
                if (optionList[i].type == MenuType.FullScreenToggle)
                {
                    if (Game.gameSettings.fullScreen)
                    {
                        Game.spriteBatch.DrawString(Game.menuFont, "On", new Vector2(optionListX + 300, optionListY + i * optionGap), Color.White);
                    }
                    else
                    {
                        Game.spriteBatch.DrawString(Game.menuFont, "Off", new Vector2(optionListX + 300, optionListY + i * optionGap), Color.White);
                    }
                }
                if (optionList[i].type == MenuType.WideScreenToggle)
                {
                    if (Game.gameSettings.wideScreen)
                    {
                        Game.spriteBatch.DrawString(Game.menuFont, "On", new Vector2(optionListX + 300, optionListY + i * optionGap), Color.White);
                    }
                    else
                    {
                        Game.spriteBatch.DrawString(Game.menuFont, "Off", new Vector2(optionListX + 300, optionListY + i * optionGap), Color.White);
                    }
                }
                if (optionList[i].type == MenuType.MusicToggle)
                {
                    if (Game.gameSettings.musicEnabled)
                    {
                        Game.spriteBatch.DrawString(Game.menuFont, "On", new Vector2(optionListX + 300, optionListY + i * optionGap), Color.White);
                    }
                    else
                    {
                        Game.spriteBatch.DrawString(Game.menuFont, "Off", new Vector2(optionListX + 300, optionListY + i * optionGap), Color.White);
                    }
                }
            }
            if (scoreX != -1)
            {
                String message = "Score: " + score;
                Game.spriteBatch.DrawString(Game.spriteFont, message, new Vector2(scoreX, scoreY), Color.LightGreen);
            }
        }
コード例 #4
0
ファイル: GameOverMenu.cs プロジェクト: kevincos/PuzzleBox
        public void Draw()
        {
            Game.spriteBatch.Draw(background, new Rectangle(0, 0, Game.screenSizeX, Game.screenSizeY), Color.White);
            Game.spriteBatch.Draw(header, new Rectangle(headerX, headerY, headerWidth, headerHeight), Color.White);
            for (int i = 0; i < optionList.Count; i++)
            {
                if (i == selectedIndex && state != GameOverMenuState.INITIALS)
                {
                    PuzzleNode p = new PuzzleNode(Game.jellyBlue);
                    p.screenX = optionListX - 25;
                    p.screenY = optionListY + optionHeight / 2 + i * optionGap;
                    if (state == GameOverMenuState.ANIMATEDOWN)
                    {
                        p.screenY -= (int)(optionGap * (1f - (float)animateTime / (float)250));
                    }
                    if (state == GameOverMenuState.ANIMATEUP)
                    {
                        p.screenY += (int)(optionGap * (1f - (float)animateTime / (float)250));
                    }

                    p.distance = 50;
                    p.scale    = 1f;
                    OrbRenderer.DrawOrb(p, State.READY, 0f);
                    Game.spriteBatch.DrawString(Game.menuFont, optionList[i].optionText, new Vector2(optionListX, optionListY + i * optionGap), Color.LightGreen);
                }
                else
                {
                    Game.spriteBatch.DrawString(Game.menuFont, optionList[i].optionText, new Vector2(optionListX, optionListY + i * optionGap), Color.White);
                }
            }
            if (state == GameOverMenuState.DOCTORIN)
            {
                JellyfishRenderer.DrawJellyfish(doctorX + 800 - 600 * animateTime / 250, doctorY, 100, JellyfishRenderer.nurseJellyfish, .75f, SpriteEffects.FlipHorizontally);
                JellyfishRenderer.DrawJellyfish(doctorX + 600 - 600 * animateTime / 250, doctorY, 100, JellyfishRenderer.doctorJellyfish, .75f, SpriteEffects.FlipHorizontally);
            }
            else if (state == GameOverMenuState.DOCTOROUT)
            {
                JellyfishRenderer.DrawJellyfish(doctorX + 200 + 600 * animateTime / 250, doctorY, 100, JellyfishRenderer.nurseJellyfish, .75f, SpriteEffects.FlipHorizontally);
                JellyfishRenderer.DrawJellyfish(doctorX + 600 * animateTime / 250, doctorY, 100, JellyfishRenderer.doctorJellyfish, .75f, SpriteEffects.FlipHorizontally);
            }
            else
            {
                JellyfishRenderer.DrawJellyfish(doctorX + 200, doctorY, 100, JellyfishRenderer.nurseJellyfish, .75f, SpriteEffects.FlipHorizontally);
                JellyfishRenderer.DrawJellyfish(doctorX, doctorY, 100, JellyfishRenderer.doctorJellyfish, .75f, SpriteEffects.FlipHorizontally);
            }
            if (Game.currentSettings.mode == GameMode.Puzzle)
            {
                TimeSpan t = new TimeSpan(0, 0, 0, 0, score);
                Game.spriteBatch.DrawString(Game.spriteFont, string.Format("TIME: {0}:{1:D2}", t.Minutes, t.Seconds), new Vector2(scoreX, scoreY), Color.LightGreen, 0, Vector2.Zero, 1.6f, SpriteEffects.None, 0);
                for (int i = 0; i < 3; i++)
                {
                    Game.spriteBatch.Draw(emptyStar,
                                          new Rectangle(scoreX + 75 * i, scoreY + 50, 64, 64), Color.White);
                }
                Game.spriteBatch.Draw(star,
                                      new Rectangle(scoreX, scoreY + 50, 64, 64), Color.White);
                if (score <= Game.currentSettings.two_star)
                {
                    Game.spriteBatch.Draw(star,
                                          new Rectangle(scoreX + 75, scoreY + 50, 64, 64), Color.White);
                }
                if (score <= Game.currentSettings.three_star)
                {
                    Game.spriteBatch.Draw(star,
                                          new Rectangle(scoreX + 150, scoreY + 50, 64, 64), Color.White);
                }
            }
            else
            {
                Game.spriteBatch.DrawString(Game.spriteFont, "SCORE:" + score, new Vector2(scoreX, scoreY), Color.LightGreen, 0, Vector2.Zero, 1.6f, SpriteEffects.None, 0);
                for (int i = 0; i < 3; i++)
                {
                    Game.spriteBatch.Draw(emptyStar,
                                          new Rectangle(scoreX + 75 * i, scoreY + 50, 64, 64), Color.White);
                }
                Game.spriteBatch.Draw(star,
                                      new Rectangle(scoreX, scoreY + 50, 64, 64), Color.White);
                if (score >= Game.currentSettings.two_star)
                {
                    Game.spriteBatch.Draw(star,
                                          new Rectangle(scoreX + 75, scoreY + 50, 64, 64), Color.White);
                }
                if (score >= Game.currentSettings.three_star)
                {
                    Game.spriteBatch.Draw(star,
                                          new Rectangle(scoreX + 150, scoreY + 50, 64, 64), Color.White);
                }
            }

            if (levelData != null)
            {
                Game.spriteBatch.DrawString(Game.spriteFont, "High Scores", new Vector2(highScoreX, highScoreY), Color.LightGreen, 0, Vector2.Zero, 1.6f, SpriteEffects.None, 0);
                for (int i = 1; i < 6; i++)
                {
                    if (i - 1 == rank)
                    {
                        if (Game.currentSettings.mode == GameMode.Puzzle)
                        {
                            TimeSpan t = new TimeSpan(0, 0, 0, 0, levelData.highScores[i - 1]);
                            Game.spriteBatch.DrawString(Game.spriteFont, string.Format("{0}: {1}:{2:D2}", levelData.playerNames[i - 1], t.Minutes, t.Seconds), new Vector2(highScoreX, highScoreY + highScoreLine * (i + 1) + 4), Color.White, 0, Vector2.Zero, 1.5f, SpriteEffects.None, 0);
                        }
                        else
                        {
                            Game.spriteBatch.DrawString(Game.spriteFont, i + ": " + levelData.playerNames[i - 1] + " - " + levelData.highScores[i - 1], new Vector2(highScoreX, highScoreY + highScoreLine * (i + 1) + 4), Color.White, 0, Vector2.Zero, 1.5f, SpriteEffects.None, 0);
                        }
                    }
                    else
                    {
                        if (Game.currentSettings.mode == GameMode.Puzzle)
                        {
                            TimeSpan t = new TimeSpan(0, 0, 0, 0, levelData.highScores[i - 1]);
                            Game.spriteBatch.DrawString(Game.spriteFont, string.Format("{0}: {1}:{2:D2}", levelData.playerNames[i - 1], t.Minutes, t.Seconds), new Vector2(highScoreX, highScoreY + highScoreLine * (i + 1) + 5), Color.LightGreen, 0, Vector2.Zero, 1.4f, SpriteEffects.None, 0);
                        }
                        else
                        {
                            Game.spriteBatch.DrawString(Game.spriteFont, i + ": " + levelData.playerNames[i - 1] + " - " + levelData.highScores[i - 1], new Vector2(highScoreX, highScoreY + highScoreLine * (i + 1) + 5), Color.LightGreen, 0, Vector2.Zero, 1.4f, SpriteEffects.None, 0);
                        }
                    }
                }
            }

            if (currentCharacter > 2 || rank == -1)
            {
                JellyfishRenderer.DrawSpeechBubble2(speechX, speechY, 100, SpriteEffects.FlipHorizontally);
                Game.spriteBatch.DrawString(Game.spriteFont, congratulationsMessage, new Vector2(speechX - 260, speechY), Color.Black);
            }

            if (rank != -1 && currentCharacter <= 2)
            {
                JellyfishRenderer.DrawSpeechBubble2(speechX, speechY, 100, SpriteEffects.FlipHorizontally);
                Game.spriteBatch.DrawString(Game.spriteFont, "Way to go! You got a high score! Please enter", new Vector2(speechX - 260, speechY), Color.Black);
                Game.spriteBatch.DrawString(Game.spriteFont, "your initials: ", new Vector2(speechX - 260, speechY + 25), Color.Black);
                Game.spriteBatch.DrawString(Game.spriteFont, "" + initials[2], new Vector2(speechX - 70, speechY + 25), Color.Black, 0, Vector2.Zero, 1f, SpriteEffects.None, 0);
                Game.spriteBatch.DrawString(Game.spriteFont, "" + initials[1], new Vector2(speechX - 95, speechY + 25), Color.Black, 0, Vector2.Zero, 1f, SpriteEffects.None, 0);
                Game.spriteBatch.DrawString(Game.spriteFont, "" + initials[0], new Vector2(speechX - 120, speechY + 25), Color.Black, 0, Vector2.Zero, 1f, SpriteEffects.None, 0);
                Game.spriteBatch.DrawString(Game.spriteFont, "^", new Vector2(speechX - 120 + 25 * currentCharacter, speechY + 45), Color.Black, 0, Vector2.Zero, 1f, SpriteEffects.None, 0);
            }
        }