Ejemplo n.º 1
0
        public void DisplayInfo(SpriteBatch spriteBatch, SpriteFont font,
                                Vector2 startingPos, Color color, int wordWrapWidth)
        {
            List <String> infoText     = GetInfoText();
            float         deltaY       = 15;
            float         titleSpacing = 5;

            // Draw title
            spriteBatch.DrawString(font, infoText[0], new Vector2(startingPos.X,
                                                                  startingPos.Y) + Game.fontManager.FontOffset,
                                   color, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);

            // Draw item stats, skips title so starts at index 1
            for (int n = 1; n < infoText.Count; n++)
            {
                String text = infoText[n];
                if (n == infoText.Count - 1)
                {
                    text = "Description: " + infoText[n];
                    text = TextUtils.WordWrap(font, infoText[n], wordWrapWidth);
                }

                spriteBatch.DrawString(font, text, new Vector2(startingPos.X,
                                                               startingPos.Y + deltaY * n + titleSpacing) + Game.fontManager.FontOffset,
                                       color, 0, new Vector2(0, 0), 1.0f, SpriteEffects.None, 0.5f);
            }

            if (displaySprite != null)
            {
                float imageOffset = 192;
                spriteBatch.Draw(displaySprite.Texture, new Vector2(startingPos.X + imageOffset, startingPos.Y), displaySprite.SourceRectangle, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 1f);
            }
        }
        public override void Draw(SpriteBatch spriteBatch)
        {
            Sprite sprite;

            base.Draw(spriteBatch);

            for (int i = 0; i < options.Count; i++)
            {
                if (cursorIndex == i)
                {
                    spriteBatch.DrawString(Game.fontManager.GetFont(14), options[i],
                                           new Vector2(10, 10 + (i * 20)), FontManager.FontSelectColor1);
                }

                else
                {
                    spriteBatch.DrawString(Game.fontManager.GetFont(14), options[i],
                                           new Vector2(10, 10 + (i * 20)), Color.White);
                }
            }

            switch (options[cursorIndex].ToLower())
            {
            case "health":
            case "missions":
            case "shop":
            case "inventory":
                spriteBatch.DrawString(Game.fontManager.GetFont(14),
                                       TextUtils.WordWrap(Game.fontManager.GetFont(14), helpText[cursorIndex], WordWrapWidth),
                                       new Vector2(Game.ScreenCenter.X, 10), Color.White);
                break;

            case "back":
                break;

            default:
                TutorialImage tutImg;
                helpImages.TryGetValue(options[cursorIndex].ToLower(), out tutImg);
                sprite = Game.tutorialManager.GetImageFromEnum(tutImg);

                spriteBatch.Draw(sprite.Texture,
                                 new Vector2(Game.ScreenCenter.X + ImageXOffset, 10),
                                 sprite.SourceRectangle,
                                 Color.White,
                                 0f,
                                 Vector2.Zero,
                                 1f,
                                 SpriteEffects.None,
                                 1f);

                spriteBatch.DrawString(Game.fontManager.GetFont(14),
                                       TextUtils.WordWrap(Game.fontManager.GetFont(14), helpText[cursorIndex], WordWrapWidth),
                                       new Vector2(Game.ScreenCenter.X, 210), Color.White);
                break;
            }
        }
        public void MissionEvent()
        {
            BaseStateManager.TextBoxes.Clear();

            if (MissionManager.MissionEventBuffer.Count > 0)
            {
                SetPortraitFromText(MissionManager.MissionEventBuffer[0]);

                SetTextRectangle();

                if (MissionManager.MissionResponseBuffer.Count > 0)
                {
                    tempRect = BaseStateManager.ResponseTextRectangle;
                    BaseState.DisplayOverlay(OverlayType.Response);
                }

                BaseStateManager.TextBoxes.Add(TextUtils.CreateTextBox(BaseState.Game.fontManager.GetFont(14),
                                                                       tempRect,
                                                                       false, true,
                                                                       MissionManager.MissionEventBuffer[0]));

                MissionManager.MissionEventBuffer.RemoveAt(0);

                BaseStateManager.ButtonControl = ButtonControl.Confirm;

                if (MissionManager.MissionResponseBuffer.Count > 0)
                {
                    for (int i = 0; i < MissionManager.MissionResponseBuffer.Count; i++)
                    {
                        BaseStateManager.TextBoxes.Add(TextUtils.CreateTextBox(BaseState.Game.fontManager.GetFont(14),
                                                                               BaseStateManager.ResponseRectangles[i],
                                                                               true, false,
                                                                               TextUtils.WordWrap(BaseState.Game.fontManager.GetFont(14),
                                                                                                  MissionManager.MissionResponseBuffer[i],
                                                                                                  Game1.ScreenSize.X * 2 / 3)
                                                                               ));
                    }

                    BaseStateManager.ButtonControl = ButtonControl.Response;
                }
            }
        }
Ejemplo n.º 4
0
        public virtual void DisplayMissionInfo(SpriteBatch spriteBatch, SpriteFont font)
        {
            string tempString = "";

            spriteBatch.DrawString(font,
                                   MissionName,
                                   new Vector2(Game1.ScreenSize.X / 4, 50) + Game.fontManager.FontOffset,
                                   Game.fontManager.FontColor,
                                   0,
                                   font.MeasureString(MissionName) / 2,
                                   1.0f,
                                   SpriteEffects.None,
                                   0.5f);

            if (MissionState.Equals(StateOfMission.Active))
            {
                tempString = "[Objective] ";
            }

            else if (MissionState.Equals(StateOfMission.CompletedDead))
            {
                tempString = "[Completed] ";
            }

            else if (MissionState.Equals(StateOfMission.FailedDead))
            {
                tempString = "[Failed] ";
            }

            spriteBatch.DrawString(font,
                                   TextUtils.WordWrap(font, (tempString + CurrentObjectiveDescription), (Game1.ScreenSize.X / 2) - 60),
                                   new Vector2(30, 80) + Game.fontManager.FontOffset,
                                   Game.fontManager.FontColor,
                                   0,
                                   new Vector2(0, 0),
                                   1.0f,
                                   SpriteEffects.None,
                                   0.5f);
        }
Ejemplo n.º 5
0
 public void Update(GameTime gameTime)
 {
     if (textBuffer != null)
     {
         if (useScrolling && !scrollingFinished)
         {
             text = TextUtils.WordWrap(spriteFont,
                                       TextUtils.ScrollText(textBuffer,
                                                            flushScrollText,
                                                            out scrollingFinished),
                                       textBoxRect.Width);
         }
         else if (scrollingFinished)
         {
             TextUtils.RefreshTextScrollBuffer();
         }
         else
         {
             text = TextUtils.WordWrap(spriteFont, textBuffer, textBoxRect.Width);
         }
     }
 }
Ejemplo n.º 6
0
        public override void Update(GameTime gameTime, Vector2 canvasPosition)
        {
            base.Update(gameTime, canvasPosition);

            if (textBuffer.Count > 0)
            {
                if (useScrolling)
                {
                    text = TextUtils.WordWrap(font,
                                              TextUtils.ScrollText(textBuffer[0],
                                                                   flushScrollingText,
                                                                   out textScrollingFinished),
                                              containerWidth);
                }
                else
                {
                    text = TextUtils.WordWrap(font,
                                              textBuffer[0],
                                              containerWidth);
                }
            }
        }
Ejemplo n.º 7
0
        public void SetOutroType(OutroType outroType)
        {
            string        section    = "";
            int           paragraphs = 0;
            List <string> tempList   = new List <string>();

            switch (outroType)
            {
            case OutroType.GameOver:
                section    = "gameover";
                paragraphs = 1;
                ActiveSong = Music.none;
                scrolling  = true;
                break;

            case OutroType.RebelEnd:
                section    = "rebelending";
                paragraphs = 5;
                ActiveSong = Music.Outro;
                scrolling  = true;
                break;

            case OutroType.AllianceEnd:
                section    = "allianceending";
                paragraphs = 7;
                ActiveSong = Music.Outro;
                scrolling  = true;
                break;

            case OutroType.OnYourOwnEnd:
                section     = "onyourownending";
                paragraphs  = 8;
                ActiveSong  = Music.GoingOut;
                scrolling   = false;
                textTimer   = ParagraphTime;
                textColor   = new Color(0, 0, 0, 0);
                fadeOut     = false;
                currentLine = "";
                break;
            }

            for (int i = 1; i <= paragraphs; i++)
            {
                tempList.Add(section + i.ToString());
            }

            if (scrolling)
            {
                textBox.LoadFormattedText(section,
                                          tempList,
                                          null);
                textHeight = (int)spriteFont.MeasureString(TextUtils.WordWrap(spriteFont, textBox.GetText(), TextBoxWidth)).Y;
            }
            else
            {
                for (int i = 1; i <= paragraphs; i++)
                {
                    text.Add(outroFile.GetPropertyAsString(section, section + i, "I AM ERROR!"));
                }

                text.Add("The End");
            }
        }