Ejemplo n.º 1
0
 /// <summary>
 /// Handles the colonist bar's display on a GUI call, accounting for
 /// hidden colonists. Original method: <see cref="ColonistBar.ColonistBarOnGUI"/>.
 /// </summary>
 /// <param name="colonistsToHighlight">The colonists to highlight on the colonist bar.</param>
 private static void ColonistBarOnGUI(List <Pawn> colonistsToHighlight)
 {
     if (ColonistBarUtility.ShouldBeVisible())
     {
         if (Event.current.type != EventType.Layout)
         {
             HandleOnGUI(colonistsToHighlight);
             const int currentGroup = -1;
             HandleGroupFrameClicks(currentGroup);
         }
         if (Event.current.type == EventType.Repaint)
         {
             colonistsToHighlight.Clear();
         }
     }
 }
        // Modified public method ColonistBar.MapColonistsOrCorpsesInScreenRect()
        private static List <Thing> MapColonistsOrCorpsesInScreenRect(Rect rect,
                                                                      List <Thing> tmpMapColonistsOrCorpsesInScreenRect)
        {
            tmpMapColonistsOrCorpsesInScreenRect.Clear();
            if (!ColonistBarUtility.ShouldBeVisible())
            {
                return(tmpMapColonistsOrCorpsesInScreenRect);
            }
            List <Thing> list = Find.ColonistBar.ColonistsOrCorpsesInScreenRect(rect);

            for (int i = 0; i < list.Count; i++)
            {
                if (list[i].Spawned)
                {
                    tmpMapColonistsOrCorpsesInScreenRect.Add(list[i]);
                }
            }
            return(tmpMapColonistsOrCorpsesInScreenRect);
        }
        // Original public method ColonistBar.ColonistOrCorpseAt()
        private static Thing ColonistOrCorpseAt(Vector2 pos)
        {
            if (!ColonistBarUtility.ShouldBeVisible())
            {
                return(null);
            }
            ColonistBar.Entry entry;
            if (!ColonistBarUtility.TryGetEntryAt(pos, out entry))
            {
                return(null);
            }
            Pawn  pawn = entry.pawn;
            Thing result;

            if (pawn != null && pawn.Dead && pawn.Corpse != null && pawn.Corpse.SpawnedOrAnyParentSpawned)
            {
                result = pawn.Corpse;
            }
            else
            {
                result = pawn;
            }
            return(result);
        }