From 971b7d95da037c0efd4c77c29d45833a9b5655a4 Mon Sep 17 00:00:00 2001 From: shoaib11120 Date: Mon, 27 Dec 2021 19:37:41 +0530 Subject: [PATCH] Callendar is now accessible --- stardew-access/Patches/DialoguePatcher.cs | 3 ++ stardew-access/Patches/MenuPatch.cs | 56 ++++++++--------------- 2 files changed, 23 insertions(+), 36 deletions(-) diff --git a/stardew-access/Patches/DialoguePatcher.cs b/stardew-access/Patches/DialoguePatcher.cs index 3d75a61..7113b5e 100644 --- a/stardew-access/Patches/DialoguePatcher.cs +++ b/stardew-access/Patches/DialoguePatcher.cs @@ -119,6 +119,9 @@ namespace stardew_access.Patches if (Game1.activeClickableMenu is LetterViewerMenu || Game1.activeClickableMenu is QuestLog) return; + if (Game1.activeClickableMenu is Billboard) + return; + StringBuilder toSpeak = new StringBuilder(); #region Add item count before title diff --git a/stardew-access/Patches/MenuPatch.cs b/stardew-access/Patches/MenuPatch.cs index f38cd71..495e232 100644 --- a/stardew-access/Patches/MenuPatch.cs +++ b/stardew-access/Patches/MenuPatch.cs @@ -19,43 +19,27 @@ namespace stardew_access.Patches if (!___dailyQuestBoard) { #region Callender - /*b.DrawString(Game1.dialogueFont, Utility.getSeasonNameFromNumber(Utility.getSeasonNumber(Game1.currentSeason)), new Vector2(xPositionOnScreen + 160, yPositionOnScreen + 80), Game1.textColor); - b.DrawString(Game1.dialogueFont, Game1.content.LoadString("Strings\\UI:Billboard_Year", Game1.year), new Vector2(xPositionOnScreen + 448, yPositionOnScreen + 80), Game1.textColor); - for (int i = 0; i < calendarDays.Count; i++) + for (int i = 0; i < __instance.calendarDays.Count; i++) + { + if (__instance.calendarDays[i].containsPoint(Game1.getMousePosition(true).X, Game1.getMousePosition(true).Y)) + { + string toSpeak = $"Day {i + 1}"; + + if (__instance.calendarDays[i].name.Length > 0) { - if (calendarDays[i].name.Length > 0) - { - if (calendarDays[i].name.Equals(nightMarketLocalized)) - { - Utility.drawWithShadow(b, Game1.mouseCursors, new Vector2(calendarDays[i].bounds.X + 12, (float)(calendarDays[i].bounds.Y + 60) - Game1.dialogueButtonScale / 2f), new Rectangle(346, 392, 8, 8), Color.White, 0f, Vector2.Zero, 4f, flipped: false, 1f); - } - else - { - Utility.drawWithShadow(b, billboardTexture, new Vector2(calendarDays[i].bounds.X + 40, (float)(calendarDays[i].bounds.Y + 56) - Game1.dialogueButtonScale / 2f), new Rectangle(1 + (int)(Game1.currentGameTime.TotalGameTime.TotalMilliseconds % 600.0 / 100.0) * 14, 398, 14, 12), Color.White, 0f, Vector2.Zero, 4f, flipped: false, 1f); - } - } - if (calendarDays[i].hoverText.Length > 0) - { - b.Draw(calendarDays[i].texture, new Vector2(calendarDays[i].bounds.X + 48, calendarDays[i].bounds.Y + 28), calendarDays[i].sourceRect, Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 1f); - } - if (_upcomingWeddings.ContainsKey(calendarDays[i])) - { - foreach (string item in _upcomingWeddings[calendarDays[i]]) - { - _ = item; - b.Draw(Game1.mouseCursors2, new Vector2(calendarDays[i].bounds.Right - 56, calendarDays[i].bounds.Top - 12), new Rectangle(112, 32, 16, 14), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 1f); - } - } - if (Game1.dayOfMonth > i + 1) - { - b.Draw(Game1.staminaRect, calendarDays[i].bounds, Color.Gray * 0.25f); - } - else if (Game1.dayOfMonth == i + 1) - { - int offset = (int)(4f * Game1.dialogueButtonScale / 8f); - IClickableMenu.drawTextureBox(b, Game1.mouseCursors, new Rectangle(379, 357, 3, 3), calendarDays[i].bounds.X - offset, calendarDays[i].bounds.Y - offset, calendarDays[i].bounds.Width + offset * 2, calendarDays[i].bounds.Height + offset * 2, Color.Blue, 4f, drawShadow: false); - } - }*/ + toSpeak += $", {__instance.calendarDays[i].name}"; + } + if (__instance.calendarDays[i].hoverText.Length > 0) + { + toSpeak += $", {__instance.calendarDays[i].hoverText}"; + } + + if (Game1.dayOfMonth == i + 1) + toSpeak += $", Current"; + + ScreenReader.sayWithChecker(toSpeak, true); + } + } #endregion } else