public void DrawTooltip(GameTime gameTime, RenderEnv env, StringLinker stringLinker) { if (tooltipTarget == null) { return; } StringResult sr; List <TextBlock> blocks = new List <TextBlock>(); Vector2 size = Vector2.Zero; switch (tooltipTarget.ObjectType) { case RenderObjectType.Mob: { LifePatch p = tooltipTarget as LifePatch; stringLinker.StringMob.TryGetValue(p.LifeID, out sr); Vector2 current = Vector2.Zero; blocks.Add(PrepareTextBlock(env.Fonts.TooltipTitleFont, sr == null ? "(null)" : sr.Name, ref current, Color.White)); current += new Vector2(4, 4); blocks.Add(PrepareTextBlock(env.Fonts.TooltipContentFont, "id:" + p.LifeID.ToString("d7"), ref current, Color.White)); size.X = Math.Max(size.X, current.X); current = new Vector2(0, current.Y + 16); LifeInfo info = p.LifeInfo; Vector2 size2; var blocks2 = TooltipHelper.Prepare(info, env.Fonts, out size2); for (int i = 0; i < blocks2.Length; i++) { blocks2[i].Position.Y += current.Y; blocks.Add(blocks2[i]); } size.X = Math.Max(size.X, size2.X); size.Y = current.Y + size2.Y; } break; case RenderObjectType.Npc: { LifePatch p = tooltipTarget as LifePatch; stringLinker.StringNpc.TryGetValue(p.LifeID, out sr); Vector2 current = Vector2.Zero; blocks.Add(PrepareTextBlock(env.Fonts.TooltipTitleFont, sr == null ? "(null)" : sr.Name, ref current, Color.White)); current += new Vector2(4, 4); blocks.Add(PrepareTextBlock(env.Fonts.TooltipContentFont, "id:" + p.LifeID.ToString("d7"), ref current, Color.White)); size.X = Math.Max(size.X, current.X); current = new Vector2(0, current.Y + 16); foreach (var kv in p.Actions) { if (kv.Value == p.Frames) { blocks.Add(PrepareTextLine(env.Fonts.TooltipContentFont, "action: " + kv.Key, ref current, Color.White, ref size.X)); } } size.Y = current.Y; } break; case RenderObjectType.Portal: { PortalPatch p = tooltipTarget as PortalPatch; Vector2 current = Vector2.Zero; blocks.Add(PrepareTextLine(env.Fonts.TooltipContentFont, "pName: " + p.PortalName, ref current, Color.White, ref size.X)); string pTypeName = GetPortalTypeString(p.PortalType); blocks.Add(PrepareTextLine(env.Fonts.TooltipContentFont, "pType: " + p.PortalType + (pTypeName == null ? null : (" (" + pTypeName + ")")), ref current, Color.White, ref size.X)); stringLinker.StringMap.TryGetValue(p.ToMap, out sr); blocks.Add(PrepareTextLine(env.Fonts.TooltipContentFont, "toMap: " + (sr == null ? "(null)" : sr.Name) + "(" + p.ToMap + ")", ref current, Color.White, ref size.X)); blocks.Add(PrepareTextLine(env.Fonts.TooltipContentFont, "toName: " + p.ToName, ref current, Color.White, ref size.X)); if (!string.IsNullOrEmpty(p.Script)) { blocks.Add(PrepareTextLine(env.Fonts.TooltipContentFont, "script: " + p.Script, ref current, Color.White, ref size.X)); } size.Y = current.Y; } break; } if (blocks.Count > 0) { size += new Vector2(26, 26); Vector2 origin = new Vector2(env.Input.MousePosition.X, env.Input.MousePosition.Y); origin.X = MathHelper.Clamp(origin.X, 0, Math.Max(0, env.Camera.Width - size.X)); origin.Y = MathHelper.Clamp(origin.Y, 0, Math.Max(0, env.Camera.Height - size.Y)); this.DrawFrame(env, origin, size); origin += new Vector2(13, 13); foreach (TextBlock block in blocks) { env.Sprite.DrawStringEx(block.Font, block.Text, block.Position, block.ForeColor, -origin); } } }