public bool TryGetEntryAt(Vector2 pos, out EntryKF entry) { List <Vector2> drawLocs = this._cachedDrawLocs; List <EntryKF> entries = this.Entries; Vector2 size = ColonistBar_KF.FullSize; for (int i = 0; i < drawLocs.Count; i++) { Rect rect = new Rect(drawLocs[i].x, drawLocs[i].y, size.x, size.y); if (rect.Contains(pos)) { entry = entries[i]; return(true); } } entry = default(EntryKF); return(false); }
public static bool ColonistBarOnGUI_Prefix() { if (!Visible) { return(false); } if (Event.current.type != EventType.Layout) { List <EntryKF> entries = BarHelperKF.Entries; int num = -1; bool showGroupFrames = BarHelperKF.ShowGroupFrames; for (int i = 0; i < BarHelperKF.DrawLocs.Count; i++) { Rect rect = new Rect( BarHelperKF.DrawLocs[i].x, BarHelperKF.DrawLocs[i].y, FullSize.x, FullSize.y + SpacingLabel); EntryKF entry = entries[i]; bool flag = num != entry.Group; num = entry.Group; if (entry.GroupCount > 0) { // Pawn can be null, click extends group Drawer.HandleClicks(rect, entry.Pawn, entry.Group); } if (Event.current.type == EventType.Repaint) { if (flag && showGroupFrames) { Drawer.DrawGroupFrame(entry.Group); } if (entry.Pawn != null) { Drawer.DrawColonist(rect, entry.Pawn, entry.Map); } else { Drawer.DrawEmptyFrame(rect, entry.Map, entry.GroupCount); } } } num = -1; if (showGroupFrames) { for (int j = 0; j < BarHelperKF.DrawLocs.Count; j++) { EntryKF entry2 = entries[j]; int entry2Group = entry2.Group; bool flag2 = num != entry2Group; num = entry2Group; if (flag2) { Drawer.HandleGroupFrameClicks(entry2Group); } } } } return(false); }