public UniqueDraw ( bool justCheckingString, |
||
justCheckingString | bool | |
size | ||
spriteBatch | ||
position | ||
color | Microsoft.Xna.Framework.Color | |
scale | float | |
Результат | bool |
public static Vector2 GetStringSize(DynamicSpriteFont font, TextSnippet[] snippets, Vector2 baseScale, float maxWidth = -1f) { Vector2 vec; // ISSUE: explicit reference operation ((Vector2)@vec).\u002Ector((float)Main.mouseX, (float)Main.mouseY); Vector2 zero = Vector2.get_Zero(); Vector2 minimum = zero; Vector2 vector2_1 = minimum; float x = (float)font.MeasureString(" ").X; float num1 = 0.0f; for (int index1 = 0; index1 < snippets.Length; ++index1) { TextSnippet snippet = snippets[index1]; snippet.Update(); float scale = snippet.Scale; Vector2 size; if (snippet.UniqueDraw(true, out size, (SpriteBatch)null, (Vector2)null, (Color)null, 1f)) { // ISSUE: explicit reference operation // ISSUE: variable of a reference type __Null& local = @minimum.X; // ISSUE: cast to a reference type // ISSUE: explicit reference operation double num2 = (double) ^ (float&)local + size.X * baseScale.X * (double)scale;
public static Vector2 DrawColorCodedString(SpriteBatch spriteBatch, DynamicSpriteFont font, TextSnippet[] snippets, Vector2 position, Color baseColor, float rotation, Vector2 origin, Vector2 baseScale, out int hoveredSnippet, float maxWidth, bool ignoreColors = false) { int num1 = -1; Vector2 vec = new Vector2((float)Main.mouseX, (float)Main.mouseY); Vector2 vector2_1 = position; Vector2 vector2_2 = vector2_1; float x = font.MeasureString(" ").X; Color color = baseColor; float num2 = 0.0f; for (int index1 = 0; index1 < snippets.Length; ++index1) { TextSnippet snippet = snippets[index1]; snippet.Update(); if (!ignoreColors) { color = snippet.GetVisibleColor(); } float scale = snippet.Scale; Vector2 size; if (snippet.UniqueDraw(false, out size, spriteBatch, vector2_1, color, scale)) { if (vec.Between(vector2_1, vector2_1 + size)) { num1 = index1; } vector2_1.X += size.X * baseScale.X * scale; vector2_2.X = Math.Max(vector2_2.X, vector2_1.X); } else { string[] strArray1 = snippet.Text.Split('\n'); foreach (string str in strArray1) { char[] chArray = new char[1] { ' ' }; string[] strArray2 = str.Split(chArray); for (int index2 = 0; index2 < strArray2.Length; ++index2) { if (index2 != 0) { vector2_1.X += x * baseScale.X * scale; } if ((double)maxWidth > 0.0) { float num3 = font.MeasureString(strArray2[index2]).X *baseScale.X *scale; if ((double)vector2_1.X - (double)position.X + (double)num3 > (double)maxWidth) { vector2_1.X = position.X; vector2_1.Y += (float)font.get_LineSpacing() * num2 * baseScale.Y; vector2_2.Y = Math.Max(vector2_2.Y, vector2_1.Y); num2 = 0.0f; } } if ((double)num2 < (double)scale) { num2 = scale; } DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, font, strArray2[index2], vector2_1, color, rotation, origin, baseScale * snippet.Scale * scale, SpriteEffects.None, 0.0f); Vector2 vector2_3 = font.MeasureString(strArray2[index2]); if (vec.Between(vector2_1, vector2_1 + vector2_3)) { num1 = index1; } vector2_1.X += vector2_3.X * baseScale.X * scale; vector2_2.X = Math.Max(vector2_2.X, vector2_1.X); } if (strArray1.Length > 1) { vector2_1.Y += (float)font.get_LineSpacing() * num2 * baseScale.Y; vector2_1.X = position.X; vector2_2.Y = Math.Max(vector2_2.Y, vector2_1.Y); num2 = 0.0f; } } } } hoveredSnippet = num1; return(vector2_2); }
public static Vector2 GetStringSize(DynamicSpriteFont font, TextSnippet[] snippets, Vector2 baseScale, float maxWidth = -1f) { Vector2 vec = new Vector2((float)Main.mouseX, (float)Main.mouseY); Vector2 zero = Vector2.Zero; Vector2 minimum = zero; Vector2 vector2_1 = minimum; float x = font.MeasureString(" ").X; float num1 = 0.0f; for (int index1 = 0; index1 < snippets.Length; ++index1) { TextSnippet snippet = snippets[index1]; snippet.Update(); float scale = snippet.Scale; Vector2 size; if (snippet.UniqueDraw(true, out size, (SpriteBatch)null, new Vector2(), new Color(), 1f)) { minimum.X += size.X * baseScale.X * scale; vector2_1.X = Math.Max(vector2_1.X, minimum.X); vector2_1.Y = Math.Max(vector2_1.Y, minimum.Y + size.Y); } else { string[] strArray1 = snippet.Text.Split('\n'); foreach (string str in strArray1) { char[] chArray = new char[1] { ' ' }; string[] strArray2 = str.Split(chArray); for (int index2 = 0; index2 < strArray2.Length; ++index2) { if (index2 != 0) { minimum.X += x * baseScale.X * scale; } if ((double)maxWidth > 0.0) { float num2 = font.MeasureString(strArray2[index2]).X *baseScale.X *scale; if ((double)minimum.X - (double)zero.X + (double)num2 > (double)maxWidth) { minimum.X = zero.X; minimum.Y += (float)font.get_LineSpacing() * num1 * baseScale.Y; vector2_1.Y = Math.Max(vector2_1.Y, minimum.Y); num1 = 0.0f; } } if ((double)num1 < (double)scale) { num1 = scale; } Vector2 vector2_2 = font.MeasureString(strArray2[index2]); vec.Between(minimum, minimum + vector2_2); minimum.X += vector2_2.X * baseScale.X * scale; vector2_1.X = Math.Max(vector2_1.X, minimum.X); vector2_1.Y = Math.Max(vector2_1.Y, minimum.Y + vector2_2.Y); } if (strArray1.Length > 1) { minimum.X = zero.X; minimum.Y += (float)font.get_LineSpacing() * num1 * baseScale.Y; vector2_1.Y = Math.Max(vector2_1.Y, minimum.Y); num1 = 0.0f; } } } } return(vector2_1); }
public static Vector2 DrawColorCodedString(SpriteBatch spriteBatch, SpriteFont font, TextSnippet[] snippets, Vector2 position, Color baseColor, float rotation, Vector2 origin, Vector2 baseScale, out int hoveredSnippet, float maxWidth, bool ignoreColors = false) { int num = -1; Vector2 vec = new Vector2(Main.mouseX, Main.mouseY); Vector2 vector = position; Vector2 result = vector; float x = font.MeasureString(" ").X; Color color = baseColor; float num2 = 1f; float num3 = 0f; for (int i = 0; i < snippets.Length; i++) { TextSnippet textSnippet = snippets[i]; textSnippet.Update(); if (!ignoreColors) { color = textSnippet.GetVisibleColor(); } num2 = textSnippet.Scale; Vector2 size; if (textSnippet.UniqueDraw(false, out size, spriteBatch, vector, color, num2)) { if (vec.Between(vector, vector + size)) { num = i; } vector.X += size.X * baseScale.X * num2; result.X = Math.Max(result.X, vector.X); continue; } string[] array = textSnippet.Text.Split('\n'); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Split(' '); for (int k = 0; k < array3.Length; k++) { if (k != 0) { vector.X += x * baseScale.X * num2; } if (maxWidth > 0f) { float num4 = font.MeasureString(array3[k]).X *baseScale.X *num2; if (vector.X - position.X + num4 > maxWidth) { vector.X = position.X; vector.Y += (float)font.LineSpacing * num3 * baseScale.Y; result.Y = Math.Max(result.Y, vector.Y); num3 = 0f; } } if (num3 < num2) { num3 = num2; } spriteBatch.DrawString(font, array3[k], vector, color, rotation, origin, baseScale * textSnippet.Scale * num2, SpriteEffects.None, 0f); Vector2 value = font.MeasureString(array3[k]); if (vec.Between(vector, vector + value)) { num = i; } vector.X += value.X * baseScale.X * num2; result.X = Math.Max(result.X, vector.X); } if (array.Length > 1) { vector.Y += (float)font.LineSpacing * num3 * baseScale.Y; vector.X = position.X; result.Y = Math.Max(result.Y, vector.Y); num3 = 0f; } } } hoveredSnippet = num; return(result); }
// Token: 0x06000C59 RID: 3161 RVA: 0x003D892C File Offset: 0x003D6B2C public static Vector2 GetStringSize(DynamicSpriteFont font, TextSnippet[] snippets, Vector2 baseScale, float maxWidth = -1f) { Vector2 vec = new Vector2((float)Main.mouseX, (float)Main.mouseY); Vector2 zero = Vector2.Zero; Vector2 vector = zero; Vector2 vector2 = vector; float x = font.MeasureString(" ").X; float num = 0f; for (int i = 0; i < snippets.Length; i++) { TextSnippet textSnippet = snippets[i]; textSnippet.Update(); float scale = textSnippet.Scale; Vector2 vector3; if (textSnippet.UniqueDraw(true, out vector3, null, default(Vector2), default(Color), 1f)) { vector.X += vector3.X * baseScale.X * scale; vector2.X = Math.Max(vector2.X, vector.X); vector2.Y = Math.Max(vector2.Y, vector.Y + vector3.Y); } else { string[] array = textSnippet.Text.Split(new char[] { '\n' }); string[] array2 = array; for (int j = 0; j < array2.Length; j++) { string[] array3 = array2[j].Split(new char[] { ' ' }); for (int k = 0; k < array3.Length; k++) { if (k != 0) { vector.X += x * baseScale.X * scale; } if (maxWidth > 0f) { float num2 = font.MeasureString(array3[k]).X *baseScale.X *scale; if (vector.X - zero.X + num2 > maxWidth) { vector.X = zero.X; vector.Y += (float)font.LineSpacing * num * baseScale.Y; vector2.Y = Math.Max(vector2.Y, vector.Y); num = 0f; } } if (num < scale) { num = scale; } Vector2 vector4 = font.MeasureString(array3[k]); vec.Between(vector, vector + vector4); vector.X += vector4.X * baseScale.X * scale; vector2.X = Math.Max(vector2.X, vector.X); vector2.Y = Math.Max(vector2.Y, vector.Y + vector4.Y); } if (array.Length > 1) { vector.X = zero.X; vector.Y += (float)font.LineSpacing * num * baseScale.Y; vector2.Y = Math.Max(vector2.Y, vector.Y); num = 0f; } } } } return(vector2); }
// Token: 0x06000C5B RID: 3163 RVA: 0x003D8C40 File Offset: 0x003D6E40 public static Vector2 DrawColorCodedString(SpriteBatch spriteBatch, DynamicSpriteFont font, TextSnippet[] snippets, Vector2 position, Color baseColor, float rotation, Vector2 origin, Vector2 baseScale, out int hoveredSnippet, float maxWidth, bool ignoreColors = false) { int num = -1; Vector2 vec = new Vector2((float)Main.mouseX, (float)Main.mouseY); Vector2 vector = position; Vector2 vector2 = vector; float x = font.MeasureString(" ").X; Color color = baseColor; float num2 = 0f; for (int i = 0; i < snippets.Length; i++) { TextSnippet textSnippet = snippets[i]; textSnippet.Update(); if (!ignoreColors) { color = textSnippet.GetVisibleColor(); } float scale = textSnippet.Scale; Vector2 vector3; if (textSnippet.UniqueDraw(false, out vector3, spriteBatch, vector, color, scale)) { if (vec.Between(vector, vector + vector3)) { num = i; } vector.X += vector3.X * baseScale.X * scale; vector2.X = Math.Max(vector2.X, vector.X); } else { string[] array = textSnippet.Text.Split(new char[] { '\n' }); string[] array2 = array; for (int j = 0; j < array2.Length; j++) { string[] array3 = array2[j].Split(new char[] { ' ' }); for (int k = 0; k < array3.Length; k++) { if (k != 0) { vector.X += x * baseScale.X * scale; } if (maxWidth > 0f) { float num3 = font.MeasureString(array3[k]).X *baseScale.X *scale; if (vector.X - position.X + num3 > maxWidth) { vector.X = position.X; vector.Y += (float)font.LineSpacing * num2 * baseScale.Y; vector2.Y = Math.Max(vector2.Y, vector.Y); num2 = 0f; } } if (num2 < scale) { num2 = scale; } spriteBatch.DrawString(font, array3[k], vector, color, rotation, origin, baseScale * textSnippet.Scale * scale, SpriteEffects.None, 0f); Vector2 vector4 = font.MeasureString(array3[k]); if (vec.Between(vector, vector + vector4)) { num = i; } vector.X += vector4.X * baseScale.X * scale; vector2.X = Math.Max(vector2.X, vector.X); } if (array.Length > 1) { vector.Y += (float)font.LineSpacing * num2 * baseScale.Y; vector.X = position.X; vector2.Y = Math.Max(vector2.Y, vector.Y); num2 = 0f; } } } } hoveredSnippet = num; return(vector2); }
public static Vector2 DrawColorCodedString(SpriteBatch spriteBatch, DynamicSpriteFont font, TextSnippet[] snippets, Vector2 position, Color baseColor, float rotation, Vector2 origin, Vector2 baseScale, out int hoveredSnippet, float maxWidth, bool ignoreColors = false) { int num1 = -1; Vector2 vec; // ISSUE: explicit reference operation ((Vector2)@vec).\u002Ector((float)Main.mouseX, (float)Main.mouseY); Vector2 vector2_1 = position; Vector2 vector2_2 = vector2_1; float x = (float)font.MeasureString(" ").X; Color color = baseColor; float num2 = 0.0f; for (int index1 = 0; index1 < snippets.Length; ++index1) { TextSnippet snippet = snippets[index1]; snippet.Update(); if (!ignoreColors) { color = snippet.GetVisibleColor(); } float scale = snippet.Scale; Vector2 size; if (snippet.UniqueDraw(false, out size, spriteBatch, vector2_1, color, scale)) { if (vec.Between(vector2_1, Vector2.op_Addition(vector2_1, size))) { num1 = index1; } // ISSUE: explicit reference operation // ISSUE: variable of a reference type Vector2& local = @vector2_1; // ISSUE: explicit reference operation double num3 = (^ local).X + size.X * baseScale.X * (double)scale; // ISSUE: explicit reference operation (^ local).X = (__Null)num3; vector2_2.X = (__Null)(double)Math.Max((float)vector2_2.X, (float)vector2_1.X); } else { string[] strArray1 = snippet.Text.Split('\n'); foreach (string str in strArray1) { char[] chArray = new char[1] { ' ' }; string[] strArray2 = str.Split(chArray); for (int index2 = 0; index2 < strArray2.Length; ++index2) { if (index2 != 0) { // ISSUE: explicit reference operation // ISSUE: variable of a reference type Vector2& local = @vector2_1; // ISSUE: explicit reference operation double num3 = (^ local).X + (double)x * baseScale.X * (double)scale; // ISSUE: explicit reference operation (^ local).X = (__Null)num3; } if ((double)maxWidth > 0.0) { float num3 = (float)(font.MeasureString(strArray2[index2]).X *baseScale.X) * scale; if (vector2_1.X - position.X + (double)num3 > (double)maxWidth) { vector2_1.X = position.X; // ISSUE: explicit reference operation // ISSUE: variable of a reference type Vector2& local = @vector2_1; // ISSUE: explicit reference operation double num4 = (^ local).Y + (double)font.get_LineSpacing() * (double)num2 * baseScale.Y; // ISSUE: explicit reference operation (^ local).Y = (__Null)num4; vector2_2.Y = (__Null)(double)Math.Max((float)vector2_2.Y, (float)vector2_1.Y); num2 = 0.0f; } } if ((double)num2 < (double)scale) { num2 = scale; } DynamicSpriteFontExtensionMethods.DrawString(spriteBatch, font, strArray2[index2], vector2_1, color, rotation, origin, Vector2.op_Multiply(Vector2.op_Multiply(baseScale, snippet.Scale), scale), (SpriteEffects)0, 0.0f); Vector2 vector2_3 = font.MeasureString(strArray2[index2]); if (vec.Between(vector2_1, Vector2.op_Addition(vector2_1, vector2_3))) { num1 = index1; } // ISSUE: explicit reference operation // ISSUE: variable of a reference type Vector2& local1 = @vector2_1; // ISSUE: explicit reference operation double num5 = (^ local1).X + vector2_3.X * baseScale.X * (double)scale; // ISSUE: explicit reference operation (^ local1).X = (__Null)num5; vector2_2.X = (__Null)(double)Math.Max((float)vector2_2.X, (float)vector2_1.X); } if (strArray1.Length > 1) { // ISSUE: explicit reference operation // ISSUE: variable of a reference type Vector2& local = @vector2_1; // ISSUE: explicit reference operation double num3 = (^ local).Y + (double)font.get_LineSpacing() * (double)num2 * baseScale.Y; // ISSUE: explicit reference operation (^ local).Y = (__Null)num3; vector2_1.X = position.X; vector2_2.Y = (__Null)(double)Math.Max((float)vector2_2.Y, (float)vector2_1.Y); num2 = 0.0f; } } } } hoveredSnippet = num1; return(vector2_2); }
public static Vector2 GetStringSize(DynamicSpriteFont font, TextSnippet[] snippets, Vector2 baseScale, float maxWidth = -1f) { Vector2 vec; // ISSUE: explicit reference operation ((Vector2)@vec).\u002Ector((float)Main.mouseX, (float)Main.mouseY); Vector2 zero = Vector2.get_Zero(); Vector2 minimum = zero; Vector2 vector2_1 = minimum; float x = (float)font.MeasureString(" ").X; float num1 = 0.0f; for (int index1 = 0; index1 < snippets.Length; ++index1) { TextSnippet snippet = snippets[index1]; snippet.Update(); float scale = snippet.Scale; Vector2 size; if (snippet.UniqueDraw(true, out size, (SpriteBatch)null, (Vector2)null, (Color)null, 1f)) { // ISSUE: explicit reference operation // ISSUE: variable of a reference type Vector2& local = @minimum; // ISSUE: explicit reference operation double num2 = (^ local).X + size.X * baseScale.X * (double)scale; // ISSUE: explicit reference operation (^ local).X = (__Null)num2; vector2_1.X = (__Null)(double)Math.Max((float)vector2_1.X, (float)minimum.X); vector2_1.Y = (__Null)(double)Math.Max((float)vector2_1.Y, (float)(minimum.Y + size.Y)); } else { string[] strArray1 = snippet.Text.Split('\n'); foreach (string str in strArray1) { char[] chArray = new char[1] { ' ' }; string[] strArray2 = str.Split(chArray); for (int index2 = 0; index2 < strArray2.Length; ++index2) { if (index2 != 0) { // ISSUE: explicit reference operation // ISSUE: variable of a reference type Vector2& local = @minimum; // ISSUE: explicit reference operation double num2 = (^ local).X + (double)x * baseScale.X * (double)scale; // ISSUE: explicit reference operation (^ local).X = (__Null)num2; } if ((double)maxWidth > 0.0) { float num2 = (float)(font.MeasureString(strArray2[index2]).X *baseScale.X) * scale; if (minimum.X - zero.X + (double)num2 > (double)maxWidth) { minimum.X = zero.X; // ISSUE: explicit reference operation // ISSUE: variable of a reference type Vector2& local = @minimum; // ISSUE: explicit reference operation double num3 = (^ local).Y + (double)font.get_LineSpacing() * (double)num1 * baseScale.Y; // ISSUE: explicit reference operation (^ local).Y = (__Null)num3; vector2_1.Y = (__Null)(double)Math.Max((float)vector2_1.Y, (float)minimum.Y); num1 = 0.0f; } } if ((double)num1 < (double)scale) { num1 = scale; } Vector2 vector2_2 = font.MeasureString(strArray2[index2]); vec.Between(minimum, Vector2.op_Addition(minimum, vector2_2)); // ISSUE: explicit reference operation // ISSUE: variable of a reference type Vector2& local1 = @minimum; // ISSUE: explicit reference operation double num4 = (^ local1).X + vector2_2.X * baseScale.X * (double)scale; // ISSUE: explicit reference operation (^ local1).X = (__Null)num4; vector2_1.X = (__Null)(double)Math.Max((float)vector2_1.X, (float)minimum.X); vector2_1.Y = (__Null)(double)Math.Max((float)vector2_1.Y, (float)(minimum.Y + vector2_2.Y)); } if (strArray1.Length > 1) { minimum.X = zero.X; // ISSUE: explicit reference operation // ISSUE: variable of a reference type Vector2& local = @minimum; // ISSUE: explicit reference operation double num2 = (^ local).Y + (double)font.get_LineSpacing() * (double)num1 * baseScale.Y; // ISSUE: explicit reference operation (^ local).Y = (__Null)num2; vector2_1.Y = (__Null)(double)Math.Max((float)vector2_1.Y, (float)minimum.Y); num1 = 0.0f; } } } } return(vector2_1); }