/// <summary> /// Gets all nearest pigeons /// </summary> /// <param name="loc"></param> /// <param name="squareDim"></param> /// <returns></returns> private Vector3[] GetNearestPigeons(PointF loc, float squareDim) { return(RemainingPigeons .Where(vect => IsPointInSquare(new PointF(vect.X, vect.Y), loc, squareDim) && viewRemainingPigeonsMenuItem.Checked) .Union(CollectedPigeons.Where(vect => IsPointInSquare(new PointF(vect.X, vect.Y), loc, squareDim) && viewCollectedPigeonsMenuItem.Checked)) .ToArray()); }
private void ToolTipTimer_OnTick(object sender, EventArgs e) { if (!ToolTipsEnabled) { if (ToolTipVisible) { ToolTipVisible = false; } return; } Vector3[] nearest = GetNearestPigeons(MapCoordinates, BlipSize * 2); if (nearest.Length == 0) { if (ToolTipVisible) { ToolTipVisible = false; } return; } if (ToolTipVisible) { return; } string desc = ""; for (int i = 0; i < nearest.Length; i++) { // Append index (if necessary) if (nearest.Length > 1) { desc += (i + 1) + ") "; } // Append description bool hasDesc = AllPigeons.TryGetValue(nearest[i], out string s); bool isCollected = CollectedPigeons.Contains(nearest[i]); if (isCollected) { desc += "(exterminated)\n"; } if (hasDesc && !string.IsNullOrEmpty(s)) { desc += s; } else { desc += "(no information available)"; } // Add a blank line (if necessary) if (nearest.Length > 1 && i != nearest.Length - 1) { desc += "\n\n"; } } ToolTipText = desc; ToolTipVisible = true; }