コード例 #1
0
        public void Draw(SpriteBatch batch)
        {
            #region Draw
            //Draw background
            batch.Draw(SpritesDirectory.GetSprite("CombatBackground"),
                       new Rectangle(0, 0, (SpritesDirectory.width), (int)(SpritesDirectory.height * 1.25)),
                       Color.White);

            //Draw the player and enemies
            player.Draw(batch);
            if (floor != null && floor.Count > 0)
            {
                floor.Peek().Draw(batch);
            }

            //---------Draw player Stats---------
            string[] stats = player.GetStats();
            //Background
            batch.Draw(SpritesDirectory.GetSprite("Button"),
                       new Rectangle((int)(SpritesDirectory.width * .0125),
                                     (int)(SpritesDirectory.height * (1 / 64.0)),
                                     (int)(SpritesDirectory.width * .15),
                                     (int)(SpritesDirectory.height * ((4 + (5 * stats.Length)) / 128.0))),//.14583
                       Color.White);

            for (int k = 0; k < stats.Length; k++)
            {
                batch.DrawString(SpritesDirectory.GetFont("Arial12"),
                                 stats[k],
                                 new Vector2((int)(SpritesDirectory.width * .03125),
                                             (int)(SpritesDirectory.height * ((4 + (5 * k)) / 128.0) + (3 / 128.0))),//.03125
                                 Color.White);
            }
            //Draw based on the PlayState
            switch (state)
            {
            case PlayState.PlayerInput:

                foreach (Button ab in abilityButton)
                {
                    ab.Draw(batch);
                }

                //Draw stats of enemy being hovered over
                for (int k = 4; k > -1; k--)
                {
                    if (floor.Peek()[k] != null && floor.Peek()[k].Selected(mouseCurrent))
                    {
                        stats = floor.Peek()[k].GetStats();
                        batch.Draw(SpritesDirectory.GetSprite("Button"),
                                   new Rectangle((int)(SpritesDirectory.width * (64 / 80.0)), //670
                                                 (int)(SpritesDirectory.height * (1 / 64.0)), //7.5
                                                 (int)(SpritesDirectory.width * .1875),       //150
                                                 (int)(SpritesDirectory.height * ((4 + (5 * stats.Length)) / 128.0))),
                                   Color.White);

                        for (int j = 0; j < stats.Length; j++)
                        {
                            batch.DrawString(SpritesDirectory.GetFont("Arial12"),
                                             stats[j],
                                             new Vector2((int)(SpritesDirectory.width * (65 / 80.0)),
                                                         (int)(SpritesDirectory.height * ((4 + (5 * j)) / 128.0) + (3 / 128.0))),
                                             Color.White);
                        }
                    }
                }
                break;

            case PlayState.PlayerAttack:
                break;

            case PlayState.EnemyTurn:
                break;

            case PlayState.CombatEnd:

                //If the player won the combat
                if (player.IsActive)
                {
                    droppedHat.Draw(batch, null, 0);
                    description.Text = string.Format("You defeated the enemy and got: {0}!", droppedHat.Name);
                    if (droppedHat.HasAbility)
                    {
                        description.Text = string.Format("Please select an ability to replace.");
                        //Ability 1 Button
                        abilityButton[0].Draw(batch);
                        //Ability 2 Button
                        abilityButton[1].Draw(batch);
                        //Ability 3 Button
                        abilityButton[2].Draw(batch);
                        //Ability 4 Button
                        abilityButton[3].Draw(batch);
                        //New Ability Button
                        newAbilityButton.Draw(batch);
                    }
                }
                //If the player lost the combat
                else
                {
                    description.Text = string.Format("You were defeated :(");
                }
                description.Text = description.Text + "Press ENTER to continue";
                break;

            case PlayState.SafeRoom:
                safeRoom.Draw(batch);
                break;
            }


            //Draw textbox
            if (description.IsVisible)
            {
                description.Draw(batch);
            }
            #endregion
        }