Exemplo n.º 1
0
 private void CheckRecacheEntries()
 {
     if (!entriesDirty)
     {
         return;
     }
     entriesDirty = false;
     cachedEntries.Clear();
     if (Find.PlaySettings.showColonistBar)
     {
         tmpMaps.Clear();
         tmpMaps.AddRange(Find.Maps);
         tmpMaps.SortBy((Map x) => !x.IsPlayerHome, (Map x) => x.uniqueID);
         int num = 0;
         for (int i = 0; i < tmpMaps.Count; i++)
         {
             tmpPawns.Clear();
             tmpPawns.AddRange(tmpMaps[i].mapPawns.FreeColonists);
             List <Thing> list = tmpMaps[i].listerThings.ThingsInGroup(ThingRequestGroup.Corpse);
             for (int j = 0; j < list.Count; j++)
             {
                 if (!list[j].IsDessicated())
                 {
                     Pawn innerPawn = ((Corpse)list[j]).InnerPawn;
                     if (innerPawn != null && innerPawn.IsColonist)
                     {
                         tmpPawns.Add(innerPawn);
                     }
                 }
             }
             List <Pawn> allPawnsSpawned = tmpMaps[i].mapPawns.AllPawnsSpawned;
             for (int k = 0; k < allPawnsSpawned.Count; k++)
             {
                 Corpse corpse = allPawnsSpawned[k].carryTracker.CarriedThing as Corpse;
                 if (corpse != null && !corpse.IsDessicated() && corpse.InnerPawn.IsColonist)
                 {
                     tmpPawns.Add(corpse.InnerPawn);
                 }
             }
             PlayerPawnsDisplayOrderUtility.Sort(tmpPawns);
             for (int l = 0; l < tmpPawns.Count; l++)
             {
                 cachedEntries.Add(new Entry(tmpPawns[l], tmpMaps[i], num));
             }
             if (!tmpPawns.Any())
             {
                 cachedEntries.Add(new Entry(null, tmpMaps[i], num));
             }
             num++;
         }
         tmpCaravans.Clear();
         tmpCaravans.AddRange(Find.WorldObjects.Caravans);
         tmpCaravans.SortBy((Caravan x) => x.ID);
         for (int m = 0; m < tmpCaravans.Count; m++)
         {
             if (!tmpCaravans[m].IsPlayerControlled)
             {
                 continue;
             }
             tmpPawns.Clear();
             tmpPawns.AddRange(tmpCaravans[m].PawnsListForReading);
             PlayerPawnsDisplayOrderUtility.Sort(tmpPawns);
             for (int n = 0; n < tmpPawns.Count; n++)
             {
                 if (tmpPawns[n].IsColonist)
                 {
                     cachedEntries.Add(new Entry(tmpPawns[n], null, num));
                 }
             }
             num++;
         }
     }
     drawer.Notify_RecachedEntries();
     tmpPawns.Clear();
     tmpMaps.Clear();
     tmpCaravans.Clear();
     drawLocsFinder.CalculateDrawLocs(cachedDrawLocs, out cachedScale);
 }
Exemplo n.º 2
0
 protected override IEnumerable <Pawn> LabelSortFunction(IEnumerable <Pawn> input)
 {
     return(PlayerPawnsDisplayOrderUtility.InOrder(input));
 }