예제 #1
0
 public override void draw(SpriteBatch b)
 {
     b.Draw(Game1.fadeToBlackRect, Game1.graphics.GraphicsDevice.Viewport.Bounds, Color.Black * 0.75f);
     SpriteText.drawStringWithScrollCenteredAt(b, Game1.content.LoadString("Strings\\StringsFromCSFiles:QuestLog.cs.11373"), xPositionOnScreen + base.width / 2, yPositionOnScreen - 64);
     IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 373, 18, 18), xPositionOnScreen, yPositionOnScreen, base.width, height, Color.White, 4f);
     if (questPage == -1)
     {
         for (int k = 0; k < questLogButtons.Count; k++)
         {
             if (pages.Count() > 0 && pages[currentPage].Count() > k)
             {
                 IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(384, 396, 15, 15), questLogButtons[k].bounds.X, questLogButtons[k].bounds.Y, questLogButtons[k].bounds.Width, questLogButtons[k].bounds.Height, questLogButtons[k].containsPoint(Game1.getOldMouseX(), Game1.getOldMouseY()) ? Color.Wheat : Color.White, 4f, drawShadow: false);
                 if (pages[currentPage][k].ShouldDisplayAsNew() || pages[currentPage][k].ShouldDisplayAsComplete())
                 {
                     Utility.drawWithShadow(b, Game1.mouseCursors, new Vector2(questLogButtons[k].bounds.X + 64 + 4, questLogButtons[k].bounds.Y + 44), new Rectangle(pages[currentPage][k].ShouldDisplayAsComplete() ? 341 : 317, 410, 23, 9), Color.White, 0f, new Vector2(11f, 4f), 4f + Game1.dialogueButtonScale * 10f / 250f, flipped: false, 0.99f);
                 }
                 else
                 {
                     Utility.drawWithShadow(b, Game1.mouseCursors, new Vector2(questLogButtons[k].bounds.X + 32, questLogButtons[k].bounds.Y + 28), pages[currentPage][k].IsTimedQuest() ? new Rectangle(410, 501, 9, 9) : new Rectangle(395 + (pages[currentPage][k].IsTimedQuest() ? 3 : 0), 497, 3, 8), Color.White, 0f, Vector2.Zero, 4f, flipped: false, 0.99f);
                 }
                 pages[currentPage][k].IsTimedQuest();
                 SpriteText.drawString(b, pages[currentPage][k].GetName(), questLogButtons[k].bounds.X + 128 + 4, questLogButtons[k].bounds.Y + 20);
             }
         }
     }
     else
     {
         SpriteText.drawStringHorizontallyCenteredAt(b, _shownQuest.GetName(), xPositionOnScreen + base.width / 2 + ((_shownQuest.IsTimedQuest() && _shownQuest.GetDaysLeft() > 0) ? (Math.Max(32, SpriteText.getWidthOfString(_shownQuest.GetName()) / 3) - 32) : 0), yPositionOnScreen + 32);
         if (_shownQuest.IsTimedQuest() && _shownQuest.GetDaysLeft() > 0)
         {
             Utility.drawWithShadow(b, Game1.mouseCursors, new Vector2(xPositionOnScreen + 32, yPositionOnScreen + 48 - 8), new Rectangle(410, 501, 9, 9), Color.White, 0f, Vector2.Zero, 4f, flipped: false, 0.99f);
             Utility.drawTextWithShadow(b, Game1.parseText((pages[currentPage][questPage].GetDaysLeft() > 1) ? Game1.content.LoadString("Strings\\StringsFromCSFiles:QuestLog.cs.11374", pages[currentPage][questPage].GetDaysLeft()) : Game1.content.LoadString("Strings\\StringsFromCSFiles:Quest_FinalDay"), Game1.dialogueFont, base.width - 128), Game1.dialogueFont, new Vector2(xPositionOnScreen + 80, yPositionOnScreen + 48 - 8), Game1.textColor);
         }
         string    description         = Game1.parseText(_shownQuest.GetDescription(), Game1.dialogueFont, base.width - 128);
         Rectangle cached_scissor_rect = b.GraphicsDevice.ScissorRectangle;
         Vector2   description_size    = Game1.dialogueFont.MeasureString(description);
         Rectangle scissor_rect        = default(Rectangle);
         scissor_rect.X      = xPositionOnScreen + 32;
         scissor_rect.Y      = yPositionOnScreen + 96;
         scissor_rect.Height = yPositionOnScreen + height - 32 - scissor_rect.Y;
         scissor_rect.Width  = base.width - 64;
         _scissorRectHeight  = scissor_rect.Height;
         scissor_rect        = Utility.ConstrainScissorRectToScreen(scissor_rect);
         b.End();
         b.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, new RasterizerState
         {
             ScissorTestEnable = true
         });
         Game1.graphics.GraphicsDevice.ScissorRectangle = scissor_rect;
         Utility.drawTextWithShadow(b, description, Game1.dialogueFont, new Vector2(xPositionOnScreen + 64, (float)yPositionOnScreen - scrollAmount + 96f), Game1.textColor);
         float yPos = (float)(yPositionOnScreen + 96) + description_size.Y + 32f - scrollAmount;
         if (_shownQuest.ShouldDisplayAsComplete())
         {
             b.End();
             b.GraphicsDevice.ScissorRectangle = cached_scissor_rect;
             b.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
             SpriteText.drawString(b, Game1.content.LoadString("Strings\\StringsFromCSFiles:QuestLog.cs.11376"), xPositionOnScreen + 32 + 4, rewardBox.bounds.Y + 21 + 4);
             rewardBox.draw(b);
             if (HasMoneyReward())
             {
                 b.Draw(Game1.mouseCursors, new Vector2(rewardBox.bounds.X + 16, (float)(rewardBox.bounds.Y + 16) - Game1.dialogueButtonScale / 2f), new Rectangle(280, 410, 16, 16), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 1f);
                 SpriteText.drawString(b, Game1.content.LoadString("Strings\\StringsFromCSFiles:LoadGameMenu.cs.11020", _shownQuest.GetMoneyReward()), xPositionOnScreen + 448, rewardBox.bounds.Y + 21 + 4);
             }
         }
         else
         {
             for (int j = 0; j < _objectiveText.Count; j++)
             {
                 if (_shownQuest != null)
                 {
                     _ = (_shownQuest is SpecialOrder);
                 }
                 string parsed_text         = Game1.parseText(_objectiveText[j], width: base.width - 192, whichFont: Game1.dialogueFont);
                 bool   display_as_complete = false;
                 if (_shownQuest != null && _shownQuest is SpecialOrder)
                 {
                     display_as_complete = (_shownQuest as SpecialOrder).objectives[j].IsComplete();
                 }
                 if (!display_as_complete)
                 {
                     Utility.drawWithShadow(b, Game1.mouseCursors, new Vector2((float)(xPositionOnScreen + 96) + 8f * Game1.dialogueButtonScale / 10f, yPos), new Rectangle(412, 495, 5, 4), Color.White, (float)Math.PI / 2f, Vector2.Zero);
                 }
                 Color text_color = Color.DarkBlue;
                 if (display_as_complete)
                 {
                     text_color = Game1.unselectedOptionColor;
                 }
                 Utility.drawTextWithShadow(b, parsed_text, Game1.dialogueFont, new Vector2(xPositionOnScreen + 128, yPos - 8f), text_color);
                 yPos += Game1.dialogueFont.MeasureString(parsed_text).Y;
                 if (_shownQuest != null && _shownQuest is SpecialOrder)
                 {
                     OrderObjective order_objective = (_shownQuest as SpecialOrder).objectives[j];
                     if (order_objective.GetMaxCount() > 1 && order_objective.ShouldShowProgress())
                     {
                         Color dark_bar_color = Color.DarkRed;
                         Color bar_color      = Color.Red;
                         if (order_objective.GetCount() >= order_objective.GetMaxCount())
                         {
                             bar_color      = Color.LimeGreen;
                             dark_bar_color = Color.Green;
                         }
                         int       inset = 64;
                         int       objective_count_draw_width = 160;
                         int       notches = 4;
                         Rectangle bar_background_source  = new Rectangle(0, 224, 47, 12);
                         Rectangle bar_notch_source       = new Rectangle(47, 224, 1, 12);
                         int       bar_horizontal_padding = 3;
                         int       bar_vertical_padding   = 3;
                         int       slice_width            = 5;
                         string    objective_count_text   = order_objective.GetCount() + "/" + order_objective.GetMaxCount();
                         int       max_text_width         = (int)Game1.dialogueFont.MeasureString(order_objective.GetMaxCount() + "/" + order_objective.GetMaxCount()).X;
                         int       count_text_width       = (int)Game1.dialogueFont.MeasureString(objective_count_text).X;
                         int       text_draw_position     = xPositionOnScreen + base.width - inset - count_text_width;
                         int       max_text_draw_position = xPositionOnScreen + base.width - inset - max_text_width;
                         Utility.drawTextWithShadow(b, objective_count_text, Game1.dialogueFont, new Vector2(text_draw_position, yPos), Color.DarkBlue);
                         Rectangle bar_draw_position = new Rectangle(xPositionOnScreen + inset, (int)yPos, base.width - inset * 2 - objective_count_draw_width, bar_background_source.Height * 4);
                         if (bar_draw_position.Right > max_text_draw_position - 16)
                         {
                             int adjustment = bar_draw_position.Right - (max_text_draw_position - 16);
                             bar_draw_position.Width -= adjustment;
                         }
                         b.Draw(Game1.mouseCursors2, new Rectangle(bar_draw_position.X, bar_draw_position.Y, slice_width * 4, bar_draw_position.Height), new Rectangle(bar_background_source.X, bar_background_source.Y, slice_width, bar_background_source.Height), Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.5f);
                         b.Draw(Game1.mouseCursors2, new Rectangle(bar_draw_position.X + slice_width * 4, bar_draw_position.Y, bar_draw_position.Width - 2 * slice_width * 4, bar_draw_position.Height), new Rectangle(bar_background_source.X + slice_width, bar_background_source.Y, bar_background_source.Width - 2 * slice_width, bar_background_source.Height), Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.5f);
                         b.Draw(Game1.mouseCursors2, new Rectangle(bar_draw_position.Right - slice_width * 4, bar_draw_position.Y, slice_width * 4, bar_draw_position.Height), new Rectangle(bar_background_source.Right - slice_width, bar_background_source.Y, slice_width, bar_background_source.Height), Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.5f);
                         float quest_progress = (float)order_objective.GetCount() / (float)order_objective.GetMaxCount();
                         if (order_objective.GetMaxCount() < notches)
                         {
                             notches = order_objective.GetMaxCount();
                         }
                         bar_draw_position.X     += 4 * bar_horizontal_padding;
                         bar_draw_position.Width -= 4 * bar_horizontal_padding * 2;
                         for (int i = 1; i < notches; i++)
                         {
                             b.Draw(Game1.mouseCursors2, new Vector2((float)bar_draw_position.X + (float)bar_draw_position.Width * ((float)i / (float)notches), bar_draw_position.Y), bar_notch_source, Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.5f);
                         }
                         bar_draw_position.Y      += 4 * bar_vertical_padding;
                         bar_draw_position.Height -= 4 * bar_vertical_padding * 2;
                         Rectangle rect = new Rectangle(bar_draw_position.X, bar_draw_position.Y, (int)((float)bar_draw_position.Width * quest_progress) - 4, bar_draw_position.Height);
                         b.Draw(Game1.staminaRect, rect, null, bar_color, 0f, Vector2.Zero, SpriteEffects.None, (float)rect.Y / 10000f);
                         rect.X     = rect.Right;
                         rect.Width = 4;
                         b.Draw(Game1.staminaRect, rect, null, dark_bar_color, 0f, Vector2.Zero, SpriteEffects.None, (float)rect.Y / 10000f);
                         yPos += (float)((bar_background_source.Height + 4) * 4);
                     }
                 }
                 _contentHeight = yPos + scrollAmount - (float)scissor_rect.Y;
             }
             b.End();
             b.GraphicsDevice.ScissorRectangle = cached_scissor_rect;
             b.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null);
             if (_shownQuest.CanBeCancelled())
             {
                 cancelQuestButton.draw(b);
             }
             if (NeedsScroll())
             {
                 if (scrollAmount > 0f)
                 {
                     b.Draw(Game1.staminaRect, new Rectangle(scissor_rect.X, scissor_rect.Top, scissor_rect.Width, 4), Color.Black * 0.15f);
                 }
                 if (scrollAmount < _contentHeight - _scissorRectHeight)
                 {
                     b.Draw(Game1.staminaRect, new Rectangle(scissor_rect.X, scissor_rect.Bottom - 4, scissor_rect.Width, 4), Color.Black * 0.15f);
                 }
             }
         }
     }
     if (NeedsScroll())
     {
         upArrow.draw(b);
         downArrow.draw(b);
         scrollBar.draw(b);
     }
     if (currentPage < pages.Count - 1 && questPage == -1)
     {
         forwardButton.draw(b);
     }
     if (currentPage > 0 || questPage != -1)
     {
         backButton.draw(b);
     }
     base.draw(b);
     Game1.mouseCursorTransparency = 1f;
     drawMouse(b);
     if (hoverText.Length > 0)
     {
         IClickableMenu.drawHoverText(b, hoverText, Game1.dialogueFont);
     }
 }