public static int getWidthOfString(string s) { SpriteText.setUpCharacterMap(); int val1 = 0; int val2 = 0; for (int index = 0; index < s.Length; ++index) { if (!LocalizedContentManager.CurrentLanguageLatin) { FontChar fontChar; if (SpriteText._characterMap.TryGetValue(s[index], out fontChar)) { val1 += fontChar.XAdvance; } val2 = Math.Max(val1, val2); if ((int)s[index] == 94) { val1 = 0; } } else { val1 += 8 + SpriteText.getWidthOffsetForChar(s[index]); val2 = Math.Max(val1, val2); if ((int)s[index] == 94) { val1 = 0; } } } return((int)((double)val2 * (double)SpriteText.fontPixelZoom)); }
public static int getWidthOfString(string s) { SpriteText.setUpCharacterMap(); int num = 0; int num2 = 0; for (int i = 0; i < s.Length; i++) { if (!LocalizedContentManager.CurrentLanguageLatin) { FontChar fontChar; if (SpriteText._characterMap.TryGetValue(s[i], out fontChar)) { num += fontChar.XAdvance; } num2 = Math.Max(num, num2); if (s[i] == '^') { num = 0; } } else { num += 8 + SpriteText.getWidthOffsetForChar(s[i]); num2 = Math.Max(num, num2); if (s[i] == '^') { num = 0; } } } return((int)((float)num2 * SpriteText.fontPixelZoom)); }
public static int positionOfNextSpace(string s, int index, int currentXPosition, int accumulatedHorizontalSpaceBetweenCharacters) { SpriteText.setUpCharacterMap(); if (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.zh || LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.th) { FontChar fontChar; if (SpriteText._characterMap.TryGetValue(s[index], out fontChar)) { return(currentXPosition + (int)((float)fontChar.XAdvance * SpriteText.fontPixelZoom)); } return(currentXPosition + (int)((float)SpriteText.FontFile.Common.LineHeight * SpriteText.fontPixelZoom)); } else { if (LocalizedContentManager.CurrentLanguageCode != LocalizedContentManager.LanguageCode.ja) { for (int i = index; i < s.Length; i++) { if (!LocalizedContentManager.CurrentLanguageLatin) { if (s[i] == ' ') { return(currentXPosition); } FontChar fontChar2; if (SpriteText._characterMap.TryGetValue(s[i], out fontChar2)) { currentXPosition += (int)((float)fontChar2.XAdvance * SpriteText.fontPixelZoom); } else { currentXPosition += (int)((float)SpriteText.FontFile.Common.LineHeight * SpriteText.fontPixelZoom); } } else { if (s[i] == ' ') { return(currentXPosition); } currentXPosition += (int)(8f * SpriteText.fontPixelZoom + (float)accumulatedHorizontalSpaceBetweenCharacters + (float)(SpriteText.getWidthOffsetForChar(s[i]) + SpriteText.getWidthOffsetForChar(s[Math.Max(0, i - 1)])) * SpriteText.fontPixelZoom); accumulatedHorizontalSpaceBetweenCharacters = (int)(0f * SpriteText.fontPixelZoom); } } return(currentXPosition); } FontChar fontChar3; if (SpriteText._characterMap.TryGetValue(s[index], out fontChar3)) { return(currentXPosition + (int)((float)fontChar3.XAdvance * SpriteText.fontPixelZoom)); } return(currentXPosition + (int)((float)SpriteText.FontFile.Common.LineHeight * SpriteText.fontPixelZoom)); } }
public static int positionOfNextSpace(string s, int index, int currentXPosition, int accumulatedHorizontalSpaceBetweenCharacters) { SpriteText.setUpCharacterMap(); if (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.zh || LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.th) { FontChar fontChar; if (SpriteText._characterMap.TryGetValue(s[index], out fontChar)) { return(currentXPosition + (int)((double)fontChar.XAdvance * (double)SpriteText.fontPixelZoom)); } return(currentXPosition + (int)((double)SpriteText.FontFile.Common.LineHeight * (double)SpriteText.fontPixelZoom)); } if (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ja) { FontChar fontChar; if (SpriteText._characterMap.TryGetValue(s[index], out fontChar)) { return(currentXPosition + (int)((double)fontChar.XAdvance * (double)SpriteText.fontPixelZoom)); } return(currentXPosition + (int)((double)SpriteText.FontFile.Common.LineHeight * (double)SpriteText.fontPixelZoom)); } for (int index1 = index; index1 < s.Length; ++index1) { if (!LocalizedContentManager.CurrentLanguageLatin) { if ((int)s[index1] == 32) { return(currentXPosition); } FontChar fontChar; if (SpriteText._characterMap.TryGetValue(s[index1], out fontChar)) { currentXPosition += (int)((double)fontChar.XAdvance * (double)SpriteText.fontPixelZoom); } else { currentXPosition += (int)((double)SpriteText.FontFile.Common.LineHeight * (double)SpriteText.fontPixelZoom); } } else { if ((int)s[index1] == 32) { return(currentXPosition); } currentXPosition += (int)(8.0 * (double)SpriteText.fontPixelZoom + (double)accumulatedHorizontalSpaceBetweenCharacters + (double)(SpriteText.getWidthOffsetForChar(s[index1]) + SpriteText.getWidthOffsetForChar(s[Math.Max(0, index1 - 1)])) * (double)SpriteText.fontPixelZoom); accumulatedHorizontalSpaceBetweenCharacters = (int)(0.0 * (double)SpriteText.fontPixelZoom); } } return(currentXPosition); }
public static void drawString(SpriteBatch b, string s, int x, int y, int characterPosition = 999999, int width = -1, int height = 999999, float alpha = 1f, float layerDepth = 0.88f, bool junimoText = false, int drawBGScroll = -1, string placeHolderScrollWidthText = "", int color = -1) { SpriteText.setUpCharacterMap(); if (width == -1) { width = Game1.graphics.GraphicsDevice.Viewport.Width - x; if (drawBGScroll == 1) { width = SpriteText.getWidthOfString(s) * 2; } } if (SpriteText.fontPixelZoom < 4f) { y += (int)((4f - SpriteText.fontPixelZoom) * (float)Game1.pixelZoom); } Vector2 vector = new Vector2((float)x, (float)y); int num = 0; if (drawBGScroll != 1) { if (vector.X + (float)width > (float)(Game1.graphics.GraphicsDevice.Viewport.Width - Game1.pixelZoom)) { vector.X = (float)(Game1.graphics.GraphicsDevice.Viewport.Width - width - Game1.pixelZoom); } if (vector.X < 0f) { vector.X = 0f; } } if (drawBGScroll == 0 || drawBGScroll == 0) { b.Draw(Game1.mouseCursors, vector + new Vector2(-12f, -3f) * (float)Game1.pixelZoom, new Rectangle?(new Rectangle(325, 318, 12, 18)), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, layerDepth - 0.001f); b.Draw(Game1.mouseCursors, vector + new Vector2(0f, -3f) * (float)Game1.pixelZoom, new Rectangle?(new Rectangle(337, 318, 1, 18)), Color.White * alpha, 0f, Vector2.Zero, new Vector2((float)SpriteText.getWidthOfString((placeHolderScrollWidthText.Length > 0) ? placeHolderScrollWidthText : s), (float)Game1.pixelZoom), SpriteEffects.None, layerDepth - 0.001f); b.Draw(Game1.mouseCursors, vector + new Vector2((float)SpriteText.getWidthOfString((placeHolderScrollWidthText.Length > 0) ? placeHolderScrollWidthText : s), (float)(-3 * Game1.pixelZoom)), new Rectangle?(new Rectangle(338, 318, 12, 18)), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, layerDepth - 0.001f); if (placeHolderScrollWidthText.Length > 0) { if (drawBGScroll != 0) { x += SpriteText.getWidthOfString(placeHolderScrollWidthText) / 2 - SpriteText.getWidthOfString(s) / 2; } vector.X = (float)x; } vector.Y += (4f - SpriteText.fontPixelZoom) * (float)Game1.pixelZoom; } else if (drawBGScroll == 1) { b.Draw(Game1.mouseCursors, vector + new Vector2(-7f, -3f) * (float)Game1.pixelZoom, new Rectangle?(new Rectangle(324, 299, 7, 17)), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, layerDepth - 0.001f); b.Draw(Game1.mouseCursors, vector + new Vector2(0f, -3f) * (float)Game1.pixelZoom, new Rectangle?(new Rectangle(331, 299, 1, 17)), Color.White * alpha, 0f, Vector2.Zero, new Vector2((float)SpriteText.getWidthOfString((placeHolderScrollWidthText.Length > 0) ? placeHolderScrollWidthText : s), (float)Game1.pixelZoom), SpriteEffects.None, layerDepth - 0.001f); b.Draw(Game1.mouseCursors, vector + new Vector2((float)SpriteText.getWidthOfString((placeHolderScrollWidthText.Length > 0) ? placeHolderScrollWidthText : s), (float)(-3 * Game1.pixelZoom)), new Rectangle?(new Rectangle(332, 299, 7, 17)), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, layerDepth - 0.001f); b.Draw(Game1.mouseCursors, vector + new Vector2((float)(SpriteText.getWidthOfString((placeHolderScrollWidthText.Length > 0) ? placeHolderScrollWidthText : s) / 2), (float)(13 * Game1.pixelZoom)), new Rectangle?(new Rectangle(341, 308, 6, 5)), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, layerDepth - 0.0001f); if (placeHolderScrollWidthText.Length > 0) { x += SpriteText.getWidthOfString(placeHolderScrollWidthText) / 2 - SpriteText.getWidthOfString(s) / 2; vector.X = (float)x; } vector.Y += (4f - SpriteText.fontPixelZoom) * (float)Game1.pixelZoom; } else if (drawBGScroll == 2) { b.Draw(Game1.mouseCursors, vector + new Vector2(-3f, -3f) * (float)Game1.pixelZoom, new Rectangle?(new Rectangle(327, 281, 3, 17)), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, layerDepth - 0.001f); b.Draw(Game1.mouseCursors, vector + new Vector2(0f, -3f) * (float)Game1.pixelZoom, new Rectangle?(new Rectangle(330, 281, 1, 17)), Color.White * alpha, 0f, Vector2.Zero, new Vector2((float)(SpriteText.getWidthOfString((placeHolderScrollWidthText.Length > 0) ? placeHolderScrollWidthText : s) + Game1.pixelZoom), (float)Game1.pixelZoom), SpriteEffects.None, layerDepth - 0.001f); b.Draw(Game1.mouseCursors, vector + new Vector2((float)(SpriteText.getWidthOfString((placeHolderScrollWidthText.Length > 0) ? placeHolderScrollWidthText : s) + Game1.pixelZoom), (float)(-3 * Game1.pixelZoom)), new Rectangle?(new Rectangle(333, 281, 3, 17)), Color.White * alpha, 0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, layerDepth - 0.001f); if (placeHolderScrollWidthText.Length > 0) { x += SpriteText.getWidthOfString(placeHolderScrollWidthText) / 2 - SpriteText.getWidthOfString(s) / 2; vector.X = (float)x; } vector.Y += (4f - SpriteText.fontPixelZoom) * (float)Game1.pixelZoom; } s = s.Replace(Environment.NewLine, ""); if (!junimoText && (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ja || LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.zh || LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.th)) { vector.Y -= (4f - SpriteText.fontPixelZoom) * (float)Game1.pixelZoom; } s = s.Replace('♡', '<'); for (int i = 0; i < Math.Min(s.Length, characterPosition); i++) { if ((LocalizedContentManager.CurrentLanguageLatin || SpriteText.IsSpecialCharacter(s[i])) | junimoText) { float num2 = SpriteText.fontPixelZoom; if (SpriteText.IsSpecialCharacter(s[i]) | junimoText) { SpriteText.fontPixelZoom = 3f; } if (s[i] == '^') { vector.Y += 18f * SpriteText.fontPixelZoom; vector.X = (float)x; num = 0; } else { if (i > 0) { vector.X += 8f * SpriteText.fontPixelZoom + (float)num + (float)(SpriteText.getWidthOffsetForChar(s[i]) + SpriteText.getWidthOffsetForChar(s[i - 1])) * SpriteText.fontPixelZoom; } num = (int)(0f * SpriteText.fontPixelZoom); if (SpriteText.positionOfNextSpace(s, i, (int)vector.X, num) >= x + width - Game1.pixelZoom) { vector.Y += 18f * SpriteText.fontPixelZoom; num = 0; vector.X = (float)x; } bool flag = char.IsUpper(s[i]) || s[i] == 'ß'; Vector2 value = new Vector2(0f, (float)(-1 + ((!junimoText & flag) ? -3 : 0))); if (s[i] == 'Ç') { value.Y += 2f; } b.Draw((color != -1) ? SpriteText.coloredTexture : SpriteText.spriteTexture, vector + value * SpriteText.fontPixelZoom, new Rectangle?(SpriteText.getSourceRectForChar(s[i], junimoText)), ((SpriteText.IsSpecialCharacter(s[i]) | junimoText) ? Color.White : SpriteText.getColorFromIndex(color)) * alpha, 0f, Vector2.Zero, SpriteText.fontPixelZoom, SpriteEffects.None, layerDepth); SpriteText.fontPixelZoom = num2; } } else if (s[i] == '^') { vector.Y += (float)(SpriteText.FontFile.Common.LineHeight + 2) * SpriteText.fontPixelZoom; vector.X = (float)x; num = 0; } else { if (i > 0 && SpriteText.IsSpecialCharacter(s[i - 1])) { vector.X += 24f; } FontChar fontChar; if (SpriteText._characterMap.TryGetValue(s[i], out fontChar)) { Rectangle value2 = new Rectangle(fontChar.X, fontChar.Y, fontChar.Width, fontChar.Height); Texture2D texture = SpriteText.fontPages[fontChar.Page]; if (SpriteText.positionOfNextSpace(s, i, (int)vector.X, num) >= x + width - Game1.pixelZoom) { vector.Y += (float)(SpriteText.FontFile.Common.LineHeight + 2) * SpriteText.fontPixelZoom; num = 0; vector.X = (float)x; } Vector2 vector2 = new Vector2(vector.X + (float)fontChar.XOffset * SpriteText.fontPixelZoom, vector.Y + (float)fontChar.YOffset * SpriteText.fontPixelZoom); if (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ru) { Vector2 vector3 = new Vector2(-1f, 1f) * SpriteText.fontPixelZoom; b.Draw(texture, vector2 + vector3, new Rectangle?(value2), SpriteText.getColorFromIndex(color) * alpha * SpriteText.shadowAlpha, 0f, Vector2.Zero, SpriteText.fontPixelZoom, SpriteEffects.None, layerDepth); b.Draw(texture, vector2 + new Vector2(0f, vector3.Y), new Rectangle?(value2), SpriteText.getColorFromIndex(color) * alpha * SpriteText.shadowAlpha, 0f, Vector2.Zero, SpriteText.fontPixelZoom, SpriteEffects.None, layerDepth); b.Draw(texture, vector2 + new Vector2(vector3.X, 0f), new Rectangle?(value2), SpriteText.getColorFromIndex(color) * alpha * SpriteText.shadowAlpha, 0f, Vector2.Zero, SpriteText.fontPixelZoom, SpriteEffects.None, layerDepth); } b.Draw(texture, vector2, new Rectangle?(value2), SpriteText.getColorFromIndex(color) * alpha, 0f, Vector2.Zero, SpriteText.fontPixelZoom, SpriteEffects.None, layerDepth); vector.X += (float)fontChar.XAdvance * SpriteText.fontPixelZoom; } } } }
public static int getIndexOfSubstringBeyondHeight(string s, int width, int height) { Vector2 vector = default(Vector2); int num = 0; s = s.Replace(Environment.NewLine, ""); SpriteText.setUpCharacterMap(); if (!LocalizedContentManager.CurrentLanguageLatin) { for (int i = 0; i < s.Length; i++) { if (s[i] == '^') { vector.Y += (float)(SpriteText.FontFile.Common.LineHeight + 2) * SpriteText.fontPixelZoom; vector.X = 0f; num = 0; } else { FontChar fontChar; if (SpriteText._characterMap.TryGetValue(s[i], out fontChar)) { if (i > 0) { vector.X += (float)fontChar.XAdvance * SpriteText.fontPixelZoom; } if (SpriteText.positionOfNextSpace(s, i, (int)vector.X, num) >= width) { vector.Y += (float)(SpriteText.FontFile.Common.LineHeight + 2) * SpriteText.fontPixelZoom; num = 0; vector.X = 0f; } } if (vector.Y >= (float)height - (float)SpriteText.FontFile.Common.LineHeight * SpriteText.fontPixelZoom * 2f) { return(i - 1); } } } return(s.Length - 1); } for (int j = 0; j < s.Length; j++) { if (s[j] == '^') { vector.Y += 18f * SpriteText.fontPixelZoom; vector.X = 0f; num = 0; } else { if (j > 0) { vector.X += 8f * SpriteText.fontPixelZoom + (float)num + (float)(SpriteText.getWidthOffsetForChar(s[j]) + SpriteText.getWidthOffsetForChar(s[j - 1])) * SpriteText.fontPixelZoom; } num = (int)(0f * SpriteText.fontPixelZoom); if (SpriteText.positionOfNextSpace(s, j, (int)vector.X, num) >= width) { vector.Y += 18f * SpriteText.fontPixelZoom; num = 0; vector.X = 0f; } if (vector.Y >= (float)height - 16f * SpriteText.fontPixelZoom) { return(j - 1); } } } return(s.Length - 1); }
public static int getHeightOfString(string s, int widthConstraint = 999999) { if (s.Length == 0) { return(0); } Vector2 vector2 = new Vector2(); int accumulatedHorizontalSpaceBetweenCharacters = 0; s = s.Replace(Environment.NewLine, ""); SpriteText.setUpCharacterMap(); if (!LocalizedContentManager.CurrentLanguageLatin) { for (int index = 0; index < s.Length; ++index) { if ((int)s[index] == 94) { vector2.Y += (float)(SpriteText.FontFile.Common.LineHeight + 2) * SpriteText.fontPixelZoom; vector2.X = 0.0f; } else { if (SpriteText.positionOfNextSpace(s, index, (int)vector2.X, accumulatedHorizontalSpaceBetweenCharacters) >= widthConstraint) { vector2.Y += (float)(SpriteText.FontFile.Common.LineHeight + 2) * SpriteText.fontPixelZoom; accumulatedHorizontalSpaceBetweenCharacters = 0; vector2.X = 0.0f; } FontChar fontChar; if (SpriteText._characterMap.TryGetValue(s[index], out fontChar)) { vector2.X += (float)fontChar.XAdvance * SpriteText.fontPixelZoom; } } } return((int)((double)vector2.Y + (double)(SpriteText.FontFile.Common.LineHeight + 2) * (double)SpriteText.fontPixelZoom)); } for (int index = 0; index < s.Length; ++index) { if ((int)s[index] == 94) { vector2.Y += 18f * SpriteText.fontPixelZoom; vector2.X = 0.0f; accumulatedHorizontalSpaceBetweenCharacters = 0; } else { if (index > 0) { vector2.X += (float)(8.0 * (double)SpriteText.fontPixelZoom + (double)accumulatedHorizontalSpaceBetweenCharacters + (double)(SpriteText.getWidthOffsetForChar(s[index]) + SpriteText.getWidthOffsetForChar(s[index - 1])) * (double)SpriteText.fontPixelZoom); } accumulatedHorizontalSpaceBetweenCharacters = (int)(0.0 * (double)SpriteText.fontPixelZoom); if (SpriteText.positionOfNextSpace(s, index, (int)vector2.X, accumulatedHorizontalSpaceBetweenCharacters) >= widthConstraint) { vector2.Y += 18f * SpriteText.fontPixelZoom; accumulatedHorizontalSpaceBetweenCharacters = 0; vector2.X = 0.0f; } } } return((int)((double)vector2.Y + 16.0 * (double)SpriteText.fontPixelZoom)); }
public static void drawString(SpriteBatch b, string s, int x, int y, int characterPosition = 999999, int width = -1, int height = 999999, float alpha = 1f, float layerDepth = 0.88f, bool junimoText = false, int drawBGScroll = -1, string placeHolderScrollWidthText = "", int color = -1) { SpriteText.setUpCharacterMap(); if (width == -1) { width = Game1.graphics.GraphicsDevice.Viewport.Width - x; if (drawBGScroll == 1) { width = SpriteText.getWidthOfString(s) * 2; } } if ((double)SpriteText.fontPixelZoom < 4.0) { y += (int)((4.0 - (double)SpriteText.fontPixelZoom) * (double)Game1.pixelZoom); } Vector2 vector2_1 = new Vector2((float)x, (float)y); int accumulatedHorizontalSpaceBetweenCharacters = 0; if (drawBGScroll != 1) { if ((double)vector2_1.X + (double)width > (double)(Game1.graphics.GraphicsDevice.Viewport.Width - Game1.pixelZoom)) { vector2_1.X = (float)(Game1.graphics.GraphicsDevice.Viewport.Width - width - Game1.pixelZoom); } if ((double)vector2_1.X < 0.0) { vector2_1.X = 0.0f; } } if (drawBGScroll == 0 || drawBGScroll == 0) { b.Draw(Game1.mouseCursors, vector2_1 + new Vector2(-12f, -3f) * (float)Game1.pixelZoom, new Rectangle?(new Rectangle(325, 318, 12, 18)), Color.White * alpha, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, layerDepth - 1f / 1000f); b.Draw(Game1.mouseCursors, vector2_1 + new Vector2(0.0f, -3f) * (float)Game1.pixelZoom, new Rectangle?(new Rectangle(337, 318, 1, 18)), Color.White * alpha, 0.0f, Vector2.Zero, new Vector2((float)SpriteText.getWidthOfString(placeHolderScrollWidthText.Length > 0 ? placeHolderScrollWidthText : s), (float)Game1.pixelZoom), SpriteEffects.None, layerDepth - 1f / 1000f); b.Draw(Game1.mouseCursors, vector2_1 + new Vector2((float)SpriteText.getWidthOfString(placeHolderScrollWidthText.Length > 0 ? placeHolderScrollWidthText : s), (float)(-3 * Game1.pixelZoom)), new Rectangle?(new Rectangle(338, 318, 12, 18)), Color.White * alpha, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, layerDepth - 1f / 1000f); if (placeHolderScrollWidthText.Length > 0) { if (drawBGScroll != 0) { x += SpriteText.getWidthOfString(placeHolderScrollWidthText) / 2 - SpriteText.getWidthOfString(s) / 2; } vector2_1.X = (float)x; } vector2_1.Y += (4f - SpriteText.fontPixelZoom) * (float)Game1.pixelZoom; } else if (drawBGScroll == 1) { b.Draw(Game1.mouseCursors, vector2_1 + new Vector2(-7f, -3f) * (float)Game1.pixelZoom, new Rectangle?(new Rectangle(324, 299, 7, 17)), Color.White * alpha, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, layerDepth - 1f / 1000f); b.Draw(Game1.mouseCursors, vector2_1 + new Vector2(0.0f, -3f) * (float)Game1.pixelZoom, new Rectangle?(new Rectangle(331, 299, 1, 17)), Color.White * alpha, 0.0f, Vector2.Zero, new Vector2((float)SpriteText.getWidthOfString(placeHolderScrollWidthText.Length > 0 ? placeHolderScrollWidthText : s), (float)Game1.pixelZoom), SpriteEffects.None, layerDepth - 1f / 1000f); b.Draw(Game1.mouseCursors, vector2_1 + new Vector2((float)SpriteText.getWidthOfString(placeHolderScrollWidthText.Length > 0 ? placeHolderScrollWidthText : s), (float)(-3 * Game1.pixelZoom)), new Rectangle?(new Rectangle(332, 299, 7, 17)), Color.White * alpha, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, layerDepth - 1f / 1000f); b.Draw(Game1.mouseCursors, vector2_1 + new Vector2((float)(SpriteText.getWidthOfString(placeHolderScrollWidthText.Length > 0 ? placeHolderScrollWidthText : s) / 2), (float)(13 * Game1.pixelZoom)), new Rectangle?(new Rectangle(341, 308, 6, 5)), Color.White * alpha, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, layerDepth - 0.0001f); if (placeHolderScrollWidthText.Length > 0) { x += SpriteText.getWidthOfString(placeHolderScrollWidthText) / 2 - SpriteText.getWidthOfString(s) / 2; vector2_1.X = (float)x; } vector2_1.Y += (4f - SpriteText.fontPixelZoom) * (float)Game1.pixelZoom; } else if (drawBGScroll == 2) { b.Draw(Game1.mouseCursors, vector2_1 + new Vector2(-3f, -3f) * (float)Game1.pixelZoom, new Rectangle?(new Rectangle(327, 281, 3, 17)), Color.White * alpha, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, layerDepth - 1f / 1000f); b.Draw(Game1.mouseCursors, vector2_1 + new Vector2(0.0f, -3f) * (float)Game1.pixelZoom, new Rectangle?(new Rectangle(330, 281, 1, 17)), Color.White * alpha, 0.0f, Vector2.Zero, new Vector2((float)(SpriteText.getWidthOfString(placeHolderScrollWidthText.Length > 0 ? placeHolderScrollWidthText : s) + Game1.pixelZoom), (float)Game1.pixelZoom), SpriteEffects.None, layerDepth - 1f / 1000f); b.Draw(Game1.mouseCursors, vector2_1 + new Vector2((float)(SpriteText.getWidthOfString(placeHolderScrollWidthText.Length > 0 ? placeHolderScrollWidthText : s) + Game1.pixelZoom), (float)(-3 * Game1.pixelZoom)), new Rectangle?(new Rectangle(333, 281, 3, 17)), Color.White * alpha, 0.0f, Vector2.Zero, (float)Game1.pixelZoom, SpriteEffects.None, layerDepth - 1f / 1000f); if (placeHolderScrollWidthText.Length > 0) { x += SpriteText.getWidthOfString(placeHolderScrollWidthText) / 2 - SpriteText.getWidthOfString(s) / 2; vector2_1.X = (float)x; } vector2_1.Y += (4f - SpriteText.fontPixelZoom) * (float)Game1.pixelZoom; } s = s.Replace(Environment.NewLine, ""); if (!junimoText && (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ja || LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.zh || LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.th)) { vector2_1.Y -= (4f - SpriteText.fontPixelZoom) * (float)Game1.pixelZoom; } s = s.Replace('♡', '<'); for (int index = 0; index < Math.Min(s.Length, characterPosition); ++index) { if (((LocalizedContentManager.CurrentLanguageLatin ? 1 : (SpriteText.IsSpecialCharacter(s[index]) ? 1 : 0)) | (junimoText ? 1 : 0)) != 0) { float fontPixelZoom = SpriteText.fontPixelZoom; if (SpriteText.IsSpecialCharacter(s[index]) | junimoText) { SpriteText.fontPixelZoom = 3f; } if ((int)s[index] == 94) { vector2_1.Y += 18f * SpriteText.fontPixelZoom; vector2_1.X = (float)x; accumulatedHorizontalSpaceBetweenCharacters = 0; } else { if (index > 0) { vector2_1.X += (float)(8.0 * (double)SpriteText.fontPixelZoom + (double)accumulatedHorizontalSpaceBetweenCharacters + (double)(SpriteText.getWidthOffsetForChar(s[index]) + SpriteText.getWidthOffsetForChar(s[index - 1])) * (double)SpriteText.fontPixelZoom); } accumulatedHorizontalSpaceBetweenCharacters = (int)(0.0 * (double)SpriteText.fontPixelZoom); if (SpriteText.positionOfNextSpace(s, index, (int)vector2_1.X, accumulatedHorizontalSpaceBetweenCharacters) >= x + width - Game1.pixelZoom) { vector2_1.Y += 18f * SpriteText.fontPixelZoom; accumulatedHorizontalSpaceBetweenCharacters = 0; vector2_1.X = (float)x; } bool flag = char.IsUpper(s[index]) || (int)s[index] == 223; Vector2 vector2_2 = new Vector2(0.0f, (float)((!junimoText & flag ? -3 : 0) - 1)); if ((int)s[index] == 199) { vector2_2.Y += 2f; } b.Draw(color != -1 ? SpriteText.coloredTexture : SpriteText.spriteTexture, vector2_1 + vector2_2 * SpriteText.fontPixelZoom, new Rectangle?(SpriteText.getSourceRectForChar(s[index], junimoText)), (SpriteText.IsSpecialCharacter(s[index]) | junimoText ? Color.White : SpriteText.getColorFromIndex(color)) * alpha, 0.0f, Vector2.Zero, SpriteText.fontPixelZoom, SpriteEffects.None, layerDepth); SpriteText.fontPixelZoom = fontPixelZoom; } } else if ((int)s[index] == 94) { vector2_1.Y += (float)(SpriteText.FontFile.Common.LineHeight + 2) * SpriteText.fontPixelZoom; vector2_1.X = (float)x; accumulatedHorizontalSpaceBetweenCharacters = 0; } else { if (index > 0 && SpriteText.IsSpecialCharacter(s[index - 1])) { vector2_1.X += 24f; } FontChar fontChar; if (SpriteText._characterMap.TryGetValue(s[index], out fontChar)) { Rectangle rectangle = new Rectangle(fontChar.X, fontChar.Y, fontChar.Width, fontChar.Height); Texture2D fontPage = SpriteText.fontPages[fontChar.Page]; if (SpriteText.positionOfNextSpace(s, index, (int)vector2_1.X, accumulatedHorizontalSpaceBetweenCharacters) >= x + width - Game1.pixelZoom) { vector2_1.Y += (float)(SpriteText.FontFile.Common.LineHeight + 2) * SpriteText.fontPixelZoom; accumulatedHorizontalSpaceBetweenCharacters = 0; vector2_1.X = (float)x; } Vector2 position = new Vector2(vector2_1.X + (float)fontChar.XOffset * SpriteText.fontPixelZoom, vector2_1.Y + (float)fontChar.YOffset * SpriteText.fontPixelZoom); if (LocalizedContentManager.CurrentLanguageCode == LocalizedContentManager.LanguageCode.ru) { Vector2 vector2_2 = new Vector2(-1f, 1f) * SpriteText.fontPixelZoom; b.Draw(fontPage, position + vector2_2, new Rectangle?(rectangle), SpriteText.getColorFromIndex(color) * alpha * SpriteText.shadowAlpha, 0.0f, Vector2.Zero, SpriteText.fontPixelZoom, SpriteEffects.None, layerDepth); b.Draw(fontPage, position + new Vector2(0.0f, vector2_2.Y), new Rectangle?(rectangle), SpriteText.getColorFromIndex(color) * alpha * SpriteText.shadowAlpha, 0.0f, Vector2.Zero, SpriteText.fontPixelZoom, SpriteEffects.None, layerDepth); b.Draw(fontPage, position + new Vector2(vector2_2.X, 0.0f), new Rectangle?(rectangle), SpriteText.getColorFromIndex(color) * alpha * SpriteText.shadowAlpha, 0.0f, Vector2.Zero, SpriteText.fontPixelZoom, SpriteEffects.None, layerDepth); } b.Draw(fontPage, position, new Rectangle?(rectangle), SpriteText.getColorFromIndex(color) * alpha, 0.0f, Vector2.Zero, SpriteText.fontPixelZoom, SpriteEffects.None, layerDepth); vector2_1.X += (float)fontChar.XAdvance * SpriteText.fontPixelZoom; } } } }