private static void postfixReceiveLeftClick(DayTimeMoneyBox __instance, Int32 x, Int32 y) { if (!Game1.options.zoomButtons) { return; } if (__instance.zoomInButton.containsPoint(x, y) && Game1.options.desiredBaseZoomLevel < CONST_MAX_VALUE_FLT) { Int32 zoom = (Int32)Math.Round(Game1.options.desiredBaseZoomLevel * 100f); zoom -= zoom % 5; Game1.options.desiredBaseZoomLevel = Math.Min(CONST_MAX_VALUE, zoom + 5) / 100f; Game1.forceSnapOnNextViewportUpdate = true; Game1.playSound("drumkit6"); } else if (__instance.zoomOutButton.containsPoint(x, y) && Game1.options.desiredBaseZoomLevel > CONST_MIN_VALUE_FLT) { Int32 zoom = (Int32)Math.Round(Game1.options.desiredBaseZoomLevel * 100f); zoom -= zoom % 5; Game1.options.desiredBaseZoomLevel = Math.Max(CONST_MIN_VALUE, zoom - 5) / 100f; Game1.forceSnapOnNextViewportUpdate = true; Program.gamePtr.refreshWindowSettings(); Game1.playSound("drumkit6"); } }
public static bool Prefix(DayTimeMoneyBox __instance, SpriteBatch b, int overrideX, int overrideY) { if (!Config.EnableMod || Game1.player is null) { return(true); } long moocha = GetTotalMoolah(); AccessTools.Method(typeof(DayTimeMoneyBox), "updatePosition").Invoke(__instance, new object[] { }); b.Draw(Game1.mouseCursors, ((overrideY != -1) ? new Vector2((overrideX == -1) ? __instance.position.X : ((float)overrideX), (float)(overrideY - 172)) : __instance.position) + new Vector2((float)(28 + ((__instance.moneyShakeTimer > 0) ? Game1.random.Next(-3, 4) : 0)), (float)(172 + ((__instance.moneyShakeTimer > 0) ? Game1.random.Next(-3, 4) : 0))), new Rectangle?(new Rectangle(340, 472, 65, 17)), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.9f); int extraDigits = moocha.ToString().Length - 8; if (extraDigits > 0) { b.Draw(Game1.mouseCursors, ((overrideY != -1) ? new Vector2((overrideX == -1) ? __instance.position.X : ((float)overrideX), (float)(overrideY - 172)) : __instance.position) + new Vector2((float)(28 + ((__instance.moneyShakeTimer > 0) ? Game1.random.Next(-3, 4) : 0)) - (extraDigits) * 24, (float)(172 + ((__instance.moneyShakeTimer > 0) ? Game1.random.Next(-3, 4) : 0))), new Rectangle?(new Rectangle(340, 472, 11, 17)), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.9f); for (int i = 0; i < extraDigits; i++) { b.Draw(Game1.mouseCursors, ((overrideY != -1) ? new Vector2((overrideX == -1) ? __instance.position.X : ((float)overrideX), (float)(overrideY - 172)) : __instance.position) + new Vector2((float)(68 + ((__instance.moneyShakeTimer > 0) ? Game1.random.Next(-3, 4) : 0)) - (i + 1) * 24, (float)(180 + ((__instance.moneyShakeTimer > 0) ? Game1.random.Next(-3, 4) : 0))), new Rectangle?(new Rectangle(356, 474, 6, 15)), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.9f); } } DrawMoneyDial(__instance.moneyDial, b, ((overrideY != -1) ? new Vector2((overrideX == -1) ? __instance.position.X : ((float)overrideX), (float)(overrideY - 172)) : __instance.position) + new Vector2((float)(68 + ((__instance.moneyShakeTimer > 0) ? Game1.random.Next(-3, 4) : 0)), (float)(196 + ((__instance.moneyShakeTimer > 0) ? Game1.random.Next(-3, 4) : 0))), moocha); if (__instance.moneyShakeTimer > 0) { __instance.moneyShakeTimer -= Game1.currentGameTime.ElapsedGameTime.Milliseconds; } return(false); }
/********* ** Private methods *********/ /// <summary>The method invoked after a new day starts.</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event data.</param> private void TimeEvents_AfterDayStarted(object sender, EventArgs e) { if (!Game1.onScreenMenus.OfType <Clock>().Any()) { DayTimeMoneyBox timeBox = Game1.onScreenMenus.OfType <DayTimeMoneyBox>().First(); Game1.onScreenMenus.Add(new Clock(timeBox)); } }
/********* ** Private methods *********/ /// <summary>Raised after the game begins a new day (including when the player loads a save).</summary> /// <param name="sender">The event sender.</param> /// <param name="e">The event data.</param> private void OnDayStarted(object sender, DayStartedEventArgs e) { if (!Game1.onScreenMenus.OfType <Clock>().Any()) { DayTimeMoneyBox timeBox = Game1.onScreenMenus.OfType <DayTimeMoneyBox>().First(); Game1.onScreenMenus.Add(new Clock(timeBox, ModConfig)); } }
private static bool BeforeDayTimeMoneyBoxReceiveLeftClick(DayTimeMoneyBox __instance, int x, int y) { if (Game1.currentLocation is not null && ClickToMoveManager.GetOrCreate(Game1.currentLocation).ClickHoldActive) { return(false); } if (Game1.player.visibleQuestCount > 0 && __instance.questButton.containsPoint(x, y) && Game1.player.CanMove && !Game1.dialogueUp && !Game1.eventUp && Game1.farmEvent is null) { ClickToMoveManager.GetOrCreate(Game1.currentLocation).Reset(); ClickToMoveManager.OnScreenButtonClicked = true; } else if (Game1.options.zoomButtons && (__instance.zoomInButton.containsPoint(x, y) || __instance.zoomOutButton.containsPoint(x, y))) { ClickToMoveManager.GetOrCreate(Game1.currentLocation).Reset(); ClickToMoveManager.OnScreenButtonClicked = true; } return(true); }
public static bool drawFromDecom(SpriteBatch b, ref DayTimeMoneyBox __instance, ref Rectangle ___sourceRect, ref string ___hoverText) { if (Game1.timeOfDay % 100 > 10 && !is24Hour) { return(true); } TimeSpan elapsedGameTime; string str; float obj = 0; float obj1 = 0; bool totalMilliseconds; string str1; string str2; SpriteFont font = (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ko ? Game1.smallFont : Game1.dialogueFont); __instance.position = new Vector2((float)(Game1.viewport.Width - 300), 8f); if (Game1.isOutdoorMapSmallerThanViewport()) { __instance.position = new Vector2(Math.Min(__instance.position.X, (float)(-Game1.viewport.X + Game1.currentLocation.map.Layers[0].LayerWidth * 64 - 300)), 8f); } Utility.makeSafe(ref __instance.position, 300, 284); __instance.xPositionOnScreen = (int)__instance.position.X; __instance.yPositionOnScreen = (int)__instance.position.Y; __instance.questButton.bounds = new Rectangle(__instance.xPositionOnScreen + 212, __instance.yPositionOnScreen + 240, 44, 46); __instance.zoomOutButton = new ClickableTextureComponent(new Rectangle(__instance.xPositionOnScreen + 92, __instance.yPositionOnScreen + 244, 28, 32), Game1.mouseCursors, new Rectangle(177, 345, 7, 8), 4f, false); __instance.zoomInButton = new ClickableTextureComponent(new Rectangle(__instance.xPositionOnScreen + 124, __instance.yPositionOnScreen + 244, 28, 32), Game1.mouseCursors, new Rectangle(184, 345, 7, 8), 4f, false); if (__instance.timeShakeTimer > 0) { int num = __instance.timeShakeTimer; elapsedGameTime = Game1.currentGameTime.ElapsedGameTime; __instance.timeShakeTimer = num - elapsedGameTime.Milliseconds; } if (__instance.questPulseTimer > 0) { int num1 = __instance.questPulseTimer; elapsedGameTime = Game1.currentGameTime.ElapsedGameTime; __instance.questPulseTimer = num1 - elapsedGameTime.Milliseconds; } if (__instance.whenToPulseTimer >= 0) { int num2 = __instance.whenToPulseTimer; elapsedGameTime = Game1.currentGameTime.ElapsedGameTime; __instance.whenToPulseTimer = num2 - elapsedGameTime.Milliseconds; if (__instance.whenToPulseTimer <= 0) { __instance.whenToPulseTimer = 3000; if (Game1.player.hasNewQuestActivity()) { __instance.questPulseTimer = 1000; } } } b.Draw(Game1.mouseCursors, __instance.position, new Rectangle?(___sourceRect), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.9f); if (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ja) { str = string.Concat(new object[] { Game1.dayOfMonth, "日 (", Game1.shortDayDisplayNameFromDayOfSeason(Game1.dayOfMonth), ")" }); } else { str = (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.zh ? string.Concat(new object[] { Game1.shortDayDisplayNameFromDayOfSeason(Game1.dayOfMonth), " ", Game1.dayOfMonth, "日" }) : string.Concat(Game1.shortDayDisplayNameFromDayOfSeason(Game1.dayOfMonth), ". ", Game1.dayOfMonth)); } string dateText = str; Vector2 daySize = font.MeasureString(dateText); Vector2 dayPosition = new Vector2((float)___sourceRect.X * 0.55f - daySize.X / 2f, (float)___sourceRect.Y * (LocalizedContentManager.CurrentLanguageLatin ? 0.1f : 0.1f) - daySize.Y / 2f); Utility.drawTextWithShadow(b, dateText, font, __instance.position + dayPosition, Game1.textColor, 1f, -1f, -1, -1, 1f, 3); b.Draw(Game1.mouseCursors, __instance.position + new Vector2(212f, 68f), new Rectangle?(new Rectangle(406, 441 + Utility.getSeasonNumber(Game1.currentSeason) * 8, 12, 8)), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.9f); b.Draw(Game1.mouseCursors, __instance.position + new Vector2(116f, 68f), new Rectangle?(new Rectangle(317 + 12 * Game1.weatherIcon, 421, 12, 8)), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.9f); string zeroPad = (Game1.timeOfDay % 100 < 10 ? "0" : ""); string hours = (Game1.timeOfDay / 100 % 12 == 0 ? "12" : string.Concat(Game1.timeOfDay / 100 % 12)); switch (LocalizedContentManager.CurrentLanguageCode) { case LocalizedContentManager.LanguageCode.en: case LocalizedContentManager.LanguageCode.ko: case LocalizedContentManager.LanguageCode.it: { if (is24Hour) { hours = string.Concat(Game1.timeOfDay / 100 % 24); hours = (Game1.timeOfDay / 100 % 24 <= 9 ? string.Concat("0", hours) : hours); } else { hours = (Game1.timeOfDay / 100 % 12 == 0 ? "12" : string.Concat(Game1.timeOfDay / 100 % 12)); } break; } case LocalizedContentManager.LanguageCode.ja: { hours = (Game1.timeOfDay / 100 % 12 == 0 ? "0" : string.Concat(Game1.timeOfDay / 100 % 12)); break; } case LocalizedContentManager.LanguageCode.ru: case LocalizedContentManager.LanguageCode.pt: case LocalizedContentManager.LanguageCode.es: case LocalizedContentManager.LanguageCode.de: case LocalizedContentManager.LanguageCode.th: case LocalizedContentManager.LanguageCode.fr: case LocalizedContentManager.LanguageCode.tr: case LocalizedContentManager.LanguageCode.hu: { hours = string.Concat(Game1.timeOfDay / 100 % 24); hours = (Game1.timeOfDay / 100 % 24 <= 9 ? string.Concat("0", hours) : hours); break; } case LocalizedContentManager.LanguageCode.zh: { if (Game1.timeOfDay / 100 % 24 == 0) { str2 = "00"; } else { str2 = (Game1.timeOfDay / 100 % 12 == 0 ? "12" : string.Concat(Game1.timeOfDay / 100 % 12)); } hours = str2; break; } } string timeText = string.Concat(new object[] { hours, ":", zeroPad, Game1.timeOfDay % 100 }); if (!is24Hour) { if (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.en || LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.it) { timeText = string.Concat(timeText, " ", (Game1.timeOfDay < 1200 || Game1.timeOfDay >= 2400 ? Game1.content.LoadString("Strings\\StringsFromCSFiles:DayTimeMoneyBox.cs.10370") : Game1.content.LoadString("Strings\\StringsFromCSFiles:DayTimeMoneyBox.cs.10371"))); } else if (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ko) { timeText = string.Concat(timeText, (Game1.timeOfDay < 1200 || Game1.timeOfDay >= 2400 ? Game1.content.LoadString("Strings\\StringsFromCSFiles:DayTimeMoneyBox.cs.10370") : Game1.content.LoadString("Strings\\StringsFromCSFiles:DayTimeMoneyBox.cs.10371"))); } else if (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ja) { timeText = (Game1.timeOfDay < 1200 || Game1.timeOfDay >= 2400 ? string.Concat(Game1.content.LoadString("Strings\\StringsFromCSFiles:DayTimeMoneyBox.cs.10370"), " ", timeText) : string.Concat(Game1.content.LoadString("Strings\\StringsFromCSFiles:DayTimeMoneyBox.cs.10371"), " ", timeText)); } else if (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.zh) { if (Game1.timeOfDay < 600 || Game1.timeOfDay >= 2400) { str1 = string.Concat("凌晨 ", timeText); } else if (Game1.timeOfDay < 1200) { str1 = string.Concat(Game1.content.LoadString("Strings\\StringsFromCSFiles:DayTimeMoneyBox.cs.10370"), " ", timeText); } else if (Game1.timeOfDay < 1300) { str1 = string.Concat("中午 ", timeText); } else { str1 = (Game1.timeOfDay < 1900 ? string.Concat(Game1.content.LoadString("Strings\\StringsFromCSFiles:DayTimeMoneyBox.cs.10371"), " ", timeText) : string.Concat("晚上 ", timeText)); } timeText = str1; } } Vector2 txtSize = font.MeasureString(timeText); float x = (float)___sourceRect.X * 0.55f - txtSize.X / 2f; if (__instance.timeShakeTimer > 0) { obj = Game1.random.Next(-2, 3); } float single = x + obj; float y = (float)___sourceRect.Y * (LocalizedContentManager.CurrentLanguageLatin ? 0.31f : 0.31f) - txtSize.Y / 2f; if (__instance.timeShakeTimer > 0) { obj1 = Game1.random.Next(-2, 3); } Vector2 timePosition = new Vector2(single, y + obj1); if (Game1.shouldTimePass() || Game1.fadeToBlack) { totalMilliseconds = true; } else { elapsedGameTime = Game1.currentGameTime.TotalGameTime; totalMilliseconds = elapsedGameTime.TotalMilliseconds % 2000 > 1000; } bool nofade = totalMilliseconds; Utility.drawTextWithShadow(b, timeText, font, __instance.position + timePosition, (Game1.timeOfDay >= 2400 ? Color.Red : Game1.textColor * (nofade ? 1f : 0.5f)), 1f, -1f, -1, -1, 1f, 3); int adjustedTime = (int)((float)(Game1.timeOfDay - Game1.timeOfDay % 100) + (float)(Game1.timeOfDay % 100 / 10) * 16.66f); if (Game1.player.visibleQuestCount > 0) { __instance.questButton.draw(b); if (__instance.questPulseTimer > 0) { float scaleMult = 1f / ((float)Math.Max(300f, (float)Math.Abs(__instance.questPulseTimer % 1000 - 500)) / 500f); b.Draw(Game1.mouseCursors, new Vector2((float)(__instance.questButton.bounds.X + 24), (float)(__instance.questButton.bounds.Y + 32)) + (scaleMult > 1f ? new Vector2((float)Game1.random.Next(-1, 2), (float)Game1.random.Next(-1, 2)) : Vector2.Zero), new Rectangle?(new Rectangle(395, 497, 3, 8)), Color.White, 0f, new Vector2(2f, 4f), 4f * scaleMult, SpriteEffects.None, 0.99f); } } if (Game1.options.zoomButtons) { __instance.zoomInButton.draw(b, Color.White * (Game1.options.zoomLevel >= 1.25f ? 0.5f : 1f), 1f, 0); __instance.zoomOutButton.draw(b, Color.White * (Game1.options.zoomLevel <= 0.75f ? 0.5f : 1f), 1f, 0); } __instance.drawMoneyBox(b, -1, -1); if (!___hoverText.Equals("") && __instance.isWithinBounds(Game1.getOldMouseX(), Game1.getOldMouseY())) { IClickableMenu.drawHoverText(b, ___hoverText, Game1.dialogueFont, 0, 0, -1, null, -1, null, null, 0, -1, -1, -1, -1, 1f, null, null); } b.Draw(Game1.mouseCursors, __instance.position + new Vector2(88f, 88f), new Rectangle?(new Rectangle(324, 477, 7, 19)), Color.White, (float)(3.14159265358979 + Math.Min(3.14159265358979, (double)(((float)adjustedTime + (float)Game1.gameTimeInterval / 7000f * 16.6f - 600f) / 2000f) * 3.14159265358979)), new Vector2(3f, 17f), 4f, SpriteEffects.None, 0.9f); return(false); }
/********* ** Public methods *********/ public Clock(DayTimeMoneyBox timeBox, ClockConfig OurConfig) { TimeBox = timeBox; ModConfig = OurConfig; }
/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="timeBox">The game's time box to change.</param> public Clock(DayTimeMoneyBox timeBox) { this.TimeBox = timeBox; }
static bool UpdatePosition_Prefix(DayTimeMoneyBox __instance) { try { var mode = Mod?.Config?.ClockMode; if (!mode.HasValue || mode.Value == ClockAlignMode.Default) { return(true); } Alignment?alignment = mode.Value == ClockAlignMode.ByTheme ? Mod !.BaseTheme?.DayTimeAlignment : Mod !.Config.ClockAlignment; int?offsetX = Mod?.BaseTheme?.DayTimeOffsetX; int?offsetY = Mod?.BaseTheme?.DayTimeOffsetY; if (alignment.HasValue || offsetX.HasValue || offsetY.HasValue) { Alignment align = alignment ?? Alignment.None; int offX = offsetX ?? 0; int offY = offsetY ?? 8; int posX; int posY; if (align.HasFlag(Alignment.Left)) { posX = offX; } else if (align.HasFlag(Alignment.Center)) { posX = (Game1.uiViewport.Width - 300) / 2 + offX; } else { posX = Game1.uiViewport.Width - 300 - offX; if (Game1.isOutdoorMapSmallerThanViewport()) { posX = Math.Min( posX, -Game1.uiViewport.X + Game1.currentLocation.map.Layers[0].LayerWidth * 64 - 300 - offX ); } } if (align.HasFlag(Alignment.Middle)) { posY = (Game1.uiViewport.Height - 284) / 2 + offY; } else if (align.HasFlag(Alignment.Bottom)) { posY = Game1.uiViewport.Height - 284 - offY; } else { posY = offY; } Utility.makeSafe(ref posX, ref posY, 300, 284); // Check if the position changed, and do an early exit if // possible to avoid doing extra work. if (posX == __instance.position.X && posY == __instance.position.Y) { return(false); } __instance.position = new Vector2(posX, posY); __instance.xPositionOnScreen = posX; __instance.yPositionOnScreen = posY; __instance.questButton.bounds = new Rectangle( posX + 212, posY + 240, 44, 46 ); __instance.zoomOutButton.bounds = new Rectangle( posX + 92, posY + 244, 28, 32 ); __instance.zoomInButton.bounds = new Rectangle( posX + 124, posY + 244, 28, 32 ); return(false); } } catch (Exception ex) { Monitor?.LogOnce($"An error occurred in UpdatePosition_Prefix. Details:\n{ex}", LogLevel.Error); } return(true); }
public static bool drawFromDecom(SpriteBatch b, ref DayTimeMoneyBox __instance, ref Rectangle ___sourceRect, ref string ____hoverText, ref int ____lastDayOfMonth, ref string ____lastDayOfMonthString, ref StringBuilder ____dateText) { if (!____hoverText.Equals("") && __instance.isWithinBounds(Game1.getOldMouseX(), Game1.getOldMouseY())) { IClickableMenu.drawHoverText(b, "Journal (F)\nRight Click to Change Clock", Game1.dialogueFont, 0, 0, -1, null, -1, null, null, 0, -1, -1, -1, -1, 1f, null, null); } SpriteFont spriteFont = (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ko) ? Game1.smallFont : Game1.dialogueFont; __instance.position = new Vector2(Game1.uiViewport.Width - 300, 8f); if (Game1.isOutdoorMapSmallerThanViewport()) { __instance.position = new Vector2(Math.Min(__instance.position.X, -Game1.uiViewport.X + Game1.currentLocation.map.Layers[0].LayerWidth * 64 - 300), 8f); } Utility.makeSafe(ref __instance.position, 300, 284); __instance.xPositionOnScreen = (int)__instance.position.X; __instance.yPositionOnScreen = (int)__instance.position.Y; __instance.questButton.bounds = new Rectangle(__instance.xPositionOnScreen + 212, __instance.yPositionOnScreen + 240, 44, 46); __instance.zoomOutButton.bounds = new Rectangle(__instance.xPositionOnScreen + 92, __instance.yPositionOnScreen + 244, 28, 32); __instance.zoomInButton.bounds = new Rectangle(__instance.xPositionOnScreen + 124, __instance.yPositionOnScreen + 244, 28, 32); if (__instance.timeShakeTimer > 0) { __instance.timeShakeTimer -= Game1.currentGameTime.ElapsedGameTime.Milliseconds; } if (__instance.questPulseTimer > 0) { __instance.questPulseTimer -= Game1.currentGameTime.ElapsedGameTime.Milliseconds; } if (__instance.whenToPulseTimer >= 0) { __instance.whenToPulseTimer -= Game1.currentGameTime.ElapsedGameTime.Milliseconds; if (__instance.whenToPulseTimer <= 0) { __instance.whenToPulseTimer = 3000; if (Game1.player.hasNewQuestActivity()) { __instance.questPulseTimer = 1000; } } } b.Draw(Game1.mouseCursors, __instance.position, ___sourceRect, Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.9f); if (Game1.dayOfMonth != ____lastDayOfMonth) { ____lastDayOfMonth = Game1.dayOfMonth; ____lastDayOfMonthString = Game1.shortDayDisplayNameFromDayOfSeason(____lastDayOfMonth); } ____dateText.Clear(); if (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ja) { ____dateText.AppendEx(Game1.dayOfMonth); ____dateText.Append("日 ("); ____dateText.Append(____lastDayOfMonthString); ____dateText.Append(")"); } else if (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.zh) { ____dateText.Append(____lastDayOfMonthString); ____dateText.Append(" "); ____dateText.AppendEx(Game1.dayOfMonth); ____dateText.Append("日"); } else if (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.mod) { ____dateText.Append(LocalizedContentManager.CurrentModLanguage.ClockDateFormat.Replace("[DAY_OF_WEEK]", ____lastDayOfMonthString).Replace("[DAY_OF_MONTH]", Game1.dayOfMonth.ToString())); } else { ____dateText.Append(____lastDayOfMonthString); ____dateText.Append(". "); ____dateText.AppendEx(Game1.dayOfMonth); } Vector2 vector = spriteFont.MeasureString(____dateText); Vector2 value = new Vector2((float)___sourceRect.X * 0.55f - vector.X / 2f, (float)___sourceRect.Y * (LocalizedContentManager.CurrentLanguageLatin ? 0.1f : 0.1f) - vector.Y / 2f); Utility.drawTextWithShadow(b, ____dateText, spriteFont, __instance.position + value, Game1.textColor); b.Draw(Game1.mouseCursors, __instance.position + new Vector2(212f, 68f), new Rectangle(406, 441 + Utility.getSeasonNumber(Game1.currentSeason) * 8, 12, 8), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.9f); b.Draw(Game1.mouseCursors, __instance.position + new Vector2(116f, 68f), new Rectangle(317 + 12 * Game1.weatherIcon, 421, 12, 8), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.9f); _padZeros.Clear(); string zeroPad = (Game1.timeOfDay % 100) < 10 && (Game1.timeOfDay % 100) > 0 ? "0" : ""; string hours = (Game1.timeOfDay / 100 % 12 == 0 ? "12" : string.Concat(Game1.timeOfDay / 100 % 12)); if (Game1.timeOfDay % 100 == 0) { _padZeros.Append("0"); } _hours.Clear(); switch (LocalizedContentManager.CurrentLanguageCode) { case LocalizedContentManager.LanguageCode.zh: if (Game1.timeOfDay / 100 % 24 == 0) { _hours.Append("00"); } else if (Game1.timeOfDay / 100 % 12 == 0) { _hours.Append("12"); } else { _hours.AppendEx(Game1.timeOfDay / 100 % 12); } break; case LocalizedContentManager.LanguageCode.ru: case LocalizedContentManager.LanguageCode.pt: case LocalizedContentManager.LanguageCode.es: case LocalizedContentManager.LanguageCode.de: case LocalizedContentManager.LanguageCode.th: case LocalizedContentManager.LanguageCode.fr: case LocalizedContentManager.LanguageCode.tr: case LocalizedContentManager.LanguageCode.hu: _temp.Clear(); _temp.AppendEx(Game1.timeOfDay / 100 % 24); if (Game1.timeOfDay / 100 % 24 <= 9) { _hours.Append("0"); } _hours.AppendEx(_temp); break; default: if (Is24Hour) { hours = string.Concat(Game1.timeOfDay / 100 % 24); hours = (Game1.timeOfDay / 100 % 24 <= 9 ? string.Concat("0", hours) : hours); _hours.Append(hours); } else { if (Game1.timeOfDay / 100 % 12 == 0) { if (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ja) { _hours.Append("0"); } else { _hours.Append("12"); } } else { _hours.AppendEx(Game1.timeOfDay / 100 % 12); } } break; } _timeText.Clear(); _timeText.AppendEx(_hours); _timeText.Append(":"); _timeText.Append(zeroPad); _timeText.AppendEx(Game1.timeOfDay % 100); _timeText.AppendEx(_padZeros); if (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.en || LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.it) { _timeText.Append(" "); if (Game1.timeOfDay < 1200 || Game1.timeOfDay >= 2400) { _timeText.Append(_amString); } else { _timeText.Append(_pmString); } } else if (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ko) { if (Game1.timeOfDay < 1200 || Game1.timeOfDay >= 2400) { _timeText.Append(_amString); } else { _timeText.Append(_pmString); } } else if (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ja) { _temp.Clear(); _temp.AppendEx(_timeText); _timeText.Clear(); if (Game1.timeOfDay < 1200 || Game1.timeOfDay >= 2400) { _timeText.Append(_amString); _timeText.Append(" "); _timeText.AppendEx(_temp); } else { _timeText.Append(_pmString); _timeText.Append(" "); _timeText.AppendEx(_temp); } } else if (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.zh) { _temp.Clear(); _temp.AppendEx(_timeText); _timeText.Clear(); if (Game1.timeOfDay < 600 || Game1.timeOfDay >= 2400) { _timeText.Append("凌晨 "); _timeText.AppendEx(_temp); } else if (Game1.timeOfDay < 1200) { _timeText.Append(_amString); _timeText.Append(" "); _timeText.AppendEx(_temp); } else if (Game1.timeOfDay < 1300) { _timeText.Append("中午 "); _timeText.AppendEx(_temp); } else if (Game1.timeOfDay < 1900) { _timeText.Append(_pmString); _timeText.Append(" "); _timeText.AppendEx(_temp); } else { _timeText.Append("晚上 "); _timeText.AppendEx(_temp); } } else if (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.mod) { _timeText.Clear(); _timeText.Append(LocalizedContentManager.FormatTimeString(Game1.timeOfDay, LocalizedContentManager.CurrentModLanguage.ClockTimeFormat)); } Vector2 vector2 = spriteFont.MeasureString(_timeText); Vector2 value2 = new Vector2((float)___sourceRect.X * 0.55f - vector2.X / 2f + (float)((__instance.timeShakeTimer > 0) ? Game1.random.Next(-2, 3) : 0), (float)___sourceRect.Y * (LocalizedContentManager.CurrentLanguageLatin ? 0.31f : 0.31f) - vector2.Y / 2f + (float)((__instance.timeShakeTimer > 0) ? Game1.random.Next(-2, 3) : 0)); bool flag = Game1.shouldTimePass() || Game1.fadeToBlack || Game1.currentGameTime.TotalGameTime.TotalMilliseconds % 2000.0 > 1000.0; Utility.drawTextWithShadow(b, _timeText, spriteFont, __instance.position + value2, (Game1.timeOfDay >= 2400) ? Color.Red : (Game1.textColor * (flag ? 1f : 0.5f))); int num = (int)((float)(Game1.timeOfDay - Game1.timeOfDay % 100) + (float)(Game1.timeOfDay % 100 / 10) * 16.66f); if (Game1.player.visibleQuestCount > 0) { __instance.questButton.draw(b); if (__instance.questPulseTimer > 0) { float num2 = 1f / (Math.Max(300f, Math.Abs(__instance.questPulseTimer % 1000 - 500)) / 500f); b.Draw(Game1.mouseCursors, new Vector2(__instance.questButton.bounds.X + 24, __instance.questButton.bounds.Y + 32) + ((num2 > 1f) ? new Vector2(Game1.random.Next(-1, 2), Game1.random.Next(-1, 2)) : Vector2.Zero), new Rectangle(395, 497, 3, 8), Color.White, 0f, new Vector2(2f, 4f), 4f * num2, SpriteEffects.None, 0.99f); } if (__instance.questPingTimer > 0) { b.Draw(Game1.mouseCursors, new Vector2(Game1.dayTimeMoneyBox.questButton.bounds.Left - 16, Game1.dayTimeMoneyBox.questButton.bounds.Bottom + 8), new Rectangle(128 + ((__instance.questPingTimer / 200 % 2 != 0) ? 16 : 0), 208, 16, 16), Color.White, 0f, Vector2.Zero, 4f, SpriteEffects.None, 0.9f); } } if (Game1.options.zoomButtons) { __instance.zoomInButton.draw(b, Color.White * ((Game1.options.desiredBaseZoomLevel >= 2f) ? 0.5f : 1f), 1f); __instance.zoomOutButton.draw(b, Color.White * ((Game1.options.desiredBaseZoomLevel <= 0.75f) ? 0.5f : 1f), 1f); } __instance.drawMoneyBox(b); if (_hoverText.Length > 0 && __instance.isWithinBounds(Game1.getOldMouseX(), Game1.getOldMouseY())) { IClickableMenu.drawHoverText(b, _hoverText, Game1.dialogueFont); } b.Draw(Game1.mouseCursors, __instance.position + new Vector2(88f, 88f), new Rectangle(324, 477, 7, 19), Color.White, (float)(Math.PI + Math.Min(Math.PI, (double)(((float)num + (float)Game1.gameTimeInterval / 7000f * 16.6f - 600f) / 2000f) * Math.PI)), new Vector2(3f, 17f), 4f, SpriteEffects.None, 0.9f); return(false); }