Ejemplo n.º 1
0
        /// <summary>
        /// Used to draw in the Player class
        /// </summary>
        /// <param name="spriteBatch">From the monogame framework used to draw</param>
        public override void Draw(SpriteBatch spriteBatch)
        {
            //Draws the Statement choices when the preperationfase is over and the game is running
            if (!GameWorld.gameOver && !GameWorld.isPreparing)
            {
                for (int i = 0; i < stateArray.Length; i++)
                {
                    if (stateArray[i] != null)
                    {
                        stateArray[i].Draw(spriteBatch);
                    }
                }
            }
            //Only draw if the player has a negotiatingtrick
            if (negotiatingTrick != null)
            {
                negotiatingTrick.Draw(spriteBatch);
            }
#if DEBUG
            spriteBatch.DrawString(GameWorld.font, "Salary: " + salary.ToString() + "kr.", new Vector2(700, 0), Color.Gold, 0, Vector2.Zero, 1, SpriteEffects.None, 1.0f);
#endif
            //Writes out the choices the player has made, when the negotiation is over
            //if (GameWorld.gameOver)
            //{
            //    Vector2 textPos = new Vector2(10, 30);

            //    string textString = string.Empty;

            //    foreach (string str in keys)
            //    {
            //        if (honestDic.ContainsKey(str))
            //        {
            //            textString += honestDic[str].StatementText + Environment.NewLine + Environment.NewLine;
            //        }
            //        if (humorousDic.ContainsKey(str))
            //        {
            //            textString += humorousDic[str].StatementText + Environment.NewLine + Environment.NewLine;
            //        }
            //        if (sneakyDic.ContainsKey(str))
            //        {
            //            textString += sneakyDic[str].StatementText + Environment.NewLine + Environment.NewLine;
            //        }
            //    }
            //    spriteBatch.DrawString(GameWorld.font, textString, textPos, Color.Black, 0, Vector2.Zero, 1, SpriteEffects.None, layer);
            //}

            //base.Draw(spriteBatch);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Gray);

            // TODO: Add your drawing code here
            spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend);

            //Draws what needs to be drawn only during the preparing phase.
            if (isPreparing)
            {
                union.Draw(spriteBatch);
                colleague.Draw(spriteBatch);
                noTrick.Draw(spriteBatch);

                spriteBatch.Draw(introText, new Vector2(20, 20), new Rectangle(0, 0, 320, 460), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0.99f);
                spriteBatch.DrawString(introFont, introString, new Vector2(30, 30), Color.Black, 0, Vector2.Zero, 1, SpriteEffects.None, 1.0f);
            }

            //Only draws the negotiator when the game isn't over and has switched to the end screen.
            if (endTimer.ElapsedMilliseconds < 4000)
            {
                Negotiator.Instance.Draw(spriteBatch);
            }

            Player.Instance.Draw(spriteBatch);

            //Within this region is everything that gets drawn when the game ends.
            #region Game over

            if (gameOver)
            {
                //Makes string for writing out the salary.
                string endTextSalary = "Du forhandlede dig frem til " + Player.Instance.Salary + "kr, hvilket er en forskel på " + (Player.Instance.Salary - 35000) + "kr i forhold til din forrige løn.";

                if (Player.Instance.NegotiatingTrick != null)
                {
                    if (!Player.Instance.NegotiatingTrick.IsTradeUnion && !Player.Instance.NegotiatingTrick.Used)
                    {
                        endTextSalary += Environment.NewLine + Environment.NewLine + "Men hvis du havde været medlem af en fagforening, ville du normalvis kunne få omkring 42000kr.";
                    }
                    else if (Player.Instance.NegotiatingTrick.IsTradeUnion && !Player.Instance.NegotiatingTrick.Used)
                    {
                        endTextSalary += Environment.NewLine + Environment.NewLine + "Men hvis du havde brugt din fagforening, kunne du have fået flere penge.";
                    }
                    else
                    {
                        endTextSalary += Environment.NewLine + Environment.NewLine + "Godt du havde tilmeldt dig en fagforening samt benyttet dig af den!";
                    }
                }

                //Draws the end screen four seconds after the game ends.
                if (endTimer.ElapsedMilliseconds >= 4000)
                {
                    //Draws out the salarytext and graph.
                    spriteBatch.DrawString(font, endTextSalary, new Vector2(windowWitdh / 2 - font.MeasureString(endTextSalary).X / 2, statisticText.Height + 100), Color.Gold, 0, Vector2.Zero, 1, SpriteEffects.None, 1.0f);
                    spriteBatch.Draw(statisticText, new Vector2(windowWitdh / 2 - (statisticText.Width) / 2, 80), new Rectangle(0, 0, 689, 457), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 1.0f);

                    //Draws the twitter and facebook sharebuttons.
                    spriteBatch.Draw(fbIcon, new Vector2(20, Window.ClientBounds.Height - (fbIcon.Height * 0.25f) - 20), new Rectangle(0, 0, 300, 258), Color.White, 0, Vector2.Zero, 0.25f, SpriteEffects.None, 1.0f);
                    spriteBatch.Draw(tIcon, new Vector2(20 + (fbIcon.Width * 0.25f) + 20, Window.ClientBounds.Height - (tIcon.Height * 0.25f) - 20), new Rectangle(0, 0, 300, 258), Color.White, 0, Vector2.Zero, 0.25f, SpriteEffects.None, 1.0f);

                    //Draws for the internet link and accompanying.
                    spriteBatch.Draw(statisticLinkText, new Vector2(windowWitdh - statisticLinkText.Width - 20, Window.ClientBounds.Height - statisticLinkText.Height - 20), new Rectangle(0, 0, 100, 25), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 1.0f);
                    spriteBatch.DrawString(mediumFont, "Tryk på logoet!", new Vector2(windowWitdh - mediumFont.MeasureString("Tryk på logoet!").X - 20, Window.ClientBounds.Height - statisticLinkText.Height - 20 - mediumFont.MeasureString("R").Y), Color.Gold, 0, Vector2.Zero, 1, SpriteEffects.None, 1.0f);
                }
            }

            #endregion
            spriteBatch.End();

            base.Draw(gameTime);
        }