public static void RenderObject(object o, Rectangle bounds, SpriteBatch spriteBatch, ScrollableSectionedPanel panel, Color TitleColor) { List <ReflectiveRenderer.RenderableField> fields = ReflectiveRenderer.GetRenderablesFromType(o.GetType(), o, 0); int entryLineHeight = ReflectiveRenderer.GetEntryLineHeight(); panel.PanelHeight = entryLineHeight; panel.NumberOfPanels = fields.Count; int pixelsPerIndentLevel = 20; panel.Draw((Action <int, Rectangle, SpriteBatch>)((i, dest, sb) => { int num = fields[i].IndentLevel * pixelsPerIndentLevel; dest.X += num; dest.Width -= num; if (fields[i].IsTitle) { TextItem.doFontLabelToSize(dest, fields[i].RenderedValue, GuiData.font, TitleColor, true, true); Rectangle destinationRectangle = new Rectangle(dest.X, dest.Y + dest.Height - 1, dest.Width, 1); sb.Draw(Utils.white, destinationRectangle, TitleColor); } else { string text1 = fields[i].VariableName + " :"; Vector2 vector2_1 = GuiData.smallfont.MeasureString(text1); sb.DrawString(GuiData.smallfont, text1, new Vector2((float)dest.X, (float)dest.Y), Color.Gray); string text2 = fields[i].RenderedValue; Vector2 vector2_2 = GuiData.smallfont.MeasureString(text2); if ((double)vector2_2.X > (double)(dest.Width - 20) || (double)vector2_2.Y > (double)dest.Height) { text2.Replace("\n", " "); text2 = text2.Substring(0, Math.Min(text2.Length, (int)((double)dest.Width / ((double)GuiData.ActiveFontConfig.tinyFontCharHeight + 2.0)))) + "..."; } Vector2 position = new Vector2((float)((double)dest.X + (double)vector2_1.X + 6.0), (float)dest.Y); if (ReflectiveRenderer.PreRenderForObject != null && sb.Name != "AltRTBatch") { ReflectiveRenderer.PreRenderForObject(position, fields[i].t, fields[i].RenderedValue); } sb.DrawString(GuiData.smallfont, text2, position, Color.White); } }), spriteBatch, bounds); ReflectiveRenderer.PreRenderForObject = (Action <Vector2, Type, string>)null; }
public void DrawSpecialCase(Vector2 currentPos, Rectangle totalArea, Type objType, string drawnValue, SpriteBatch sb) { if (!(sb.Name != "AltRTBatch") || !(objType == typeof(Neopal.PetType))) { return; } int num1 = Math.Min(ReflectiveRenderer.GetEntryLineHeight() * 6, totalArea.Width / 4); Texture2D sprite = this.PlaceholderSprite; Neopal.PetType petType = (Neopal.PetType)Enum.Parse(objType, drawnValue); if (this.WildcardAssets.ContainsKey((object)petType)) { sprite = this.WildcardAssets[(object)petType]; } Rectangle petDrawPos = new Rectangle(totalArea.X + totalArea.Width - num1 - 10, (int)currentPos.Y + 4, num1, num1); double num2 = (double)sprite.Height / (double)petDrawPos.Height; int val2 = totalArea.Y + totalArea.Height - petDrawPos.Y; int height = Math.Min(sprite.Height, (int)(num2 * (double)val2)); Rectangle?clip = new Rectangle?(new Rectangle(0, 0, sprite.Width, height)); petDrawPos.Height = Math.Min(petDrawPos.Height, val2); this.os.postFXDrawActions += (Action)(() => sb.Draw(sprite, petDrawPos, clip, Color.White)); }