Ejemplo n.º 1
0
 private IEnumerable AccumulatePawnGCData(Dictionary <Pawn, string> keptPawns)
 {
     foreach (Pawn current in PawnsFinder.AllMapsWorldAndTemporary_AliveOrDead)
     {
         string criticalPawnReason = this.GetCriticalPawnReason(current);
         if (!criticalPawnReason.NullOrEmpty())
         {
             keptPawns[current] = criticalPawnReason;
             if (this.logDotgraph != null)
             {
                 this.logDotgraph.AppendLine(string.Format("{0} [label=<{0}<br/><font point-size=\"10\">{1}</font>> color=\"{2}\" shape=\"{3}\"];", new object[]
                 {
                     WorldPawnGC.DotgraphIdentifier(current),
                     criticalPawnReason,
                     (current.relations == null || !current.relations.everSeenByPlayer) ? "grey" : "black",
                     (!current.RaceProps.Humanlike) ? "box" : "oval"
                 }));
             }
         }
         else if (this.logDotgraph != null)
         {
             this.logDotgraph.AppendLine(string.Format("{0} [color=\"{1}\" shape=\"{2}\"];", WorldPawnGC.DotgraphIdentifier(current), (current.relations == null || !current.relations.everSeenByPlayer) ? "grey" : "black", (!current.RaceProps.Humanlike) ? "box" : "oval"));
         }
     }
     foreach (Pawn current2 in (from pawn in PawnsFinder.AllMapsWorldAndTemporary_Alive
                                where this.$this.AllowedAsStoryPawn(pawn) && !keptPawns.ContainsKey(pawn)
                                orderby pawn.records.StoryRelevance descending
                                select pawn).Take(20))
     {
         keptPawns[current2] = "StoryRelevant";
     }
     Pawn[] criticalPawns = keptPawns.Keys.ToArray <Pawn>();
     Pawn[] array         = criticalPawns;
     for (int i = 0; i < array.Length; i++)
     {
         Pawn pawn3 = array[i];
         this.AddAllRelationships(pawn3, keptPawns);
         yield return(null);
     }
     Pawn[] array2 = criticalPawns;
     for (int j = 0; j < array2.Length; j++)
     {
         Pawn pawn2 = array2[j];
         this.AddAllMemories(pawn2, keptPawns);
     }
 }
 public void AddAllMemories(Pawn pawn, Dictionary <Pawn, string> keptPawns)
 {
     if (pawn.needs == null || pawn.needs.mood == null || pawn.needs.mood.thoughts == null || pawn.needs.mood.thoughts.memories == null)
     {
         return;
     }
     foreach (Thought_Memory thought_Memory in pawn.needs.mood.thoughts.memories.Memories)
     {
         if (thought_Memory.otherPawn != null)
         {
             if (this.logDotgraph != null)
             {
                 string text = string.Format("{0}->{1} [label=<{2}> color=\"orange\"];", WorldPawnGC.DotgraphIdentifier(pawn), WorldPawnGC.DotgraphIdentifier(thought_Memory.otherPawn), thought_Memory.def);
                 if (!this.logDotgraphUniqueLinks.Contains(text))
                 {
                     this.logDotgraphUniqueLinks.Add(text);
                     this.logDotgraph.AppendLine(text);
                 }
             }
             if (!keptPawns.ContainsKey(thought_Memory.otherPawn))
             {
                 keptPawns[thought_Memory.otherPawn] = "Memory";
             }
         }
     }
 }
 public void AddAllRelationships(Pawn pawn, Dictionary <Pawn, string> keptPawns)
 {
     if (pawn.relations == null)
     {
         return;
     }
     foreach (Pawn pawn2 in pawn.relations.RelatedPawns)
     {
         if (this.logDotgraph != null)
         {
             string text = string.Format("{0}->{1} [label=<{2}> color=\"purple\"];", WorldPawnGC.DotgraphIdentifier(pawn), WorldPawnGC.DotgraphIdentifier(pawn2), pawn.GetRelations(pawn2).FirstOrDefault <PawnRelationDef>().ToString());
             if (!this.logDotgraphUniqueLinks.Contains(text))
             {
                 this.logDotgraphUniqueLinks.Add(text);
                 this.logDotgraph.AppendLine(text);
             }
         }
         if (!keptPawns.ContainsKey(pawn2))
         {
             keptPawns[pawn2] = "Relationship";
         }
     }
 }
Ejemplo n.º 4
0
        private IEnumerable AccumulatePawnGCData(Dictionary <Pawn, string> keptPawns)
        {
            _003CAccumulatePawnGCData_003Ec__Iterator0 _003CAccumulatePawnGCData_003Ec__Iterator = (_003CAccumulatePawnGCData_003Ec__Iterator0) /*Error near IL_0032: stateMachine*/;

            foreach (Pawn item in PawnsFinder.AllMapsWorldAndTemporary_AliveOrDead)
            {
                string criticalPawnReason = this.GetCriticalPawnReason(item);
                if (!criticalPawnReason.NullOrEmpty())
                {
                    keptPawns[item] = criticalPawnReason;
                    if (this.logDotgraph != null)
                    {
                        this.logDotgraph.AppendLine(string.Format("{0} [label=<{0}<br/><font point-size=\"10\">{1}</font>> color=\"{2}\" shape=\"{3}\"];", WorldPawnGC.DotgraphIdentifier(item), criticalPawnReason, (item.relations == null || !item.relations.everSeenByPlayer) ? "grey" : "black", (!item.RaceProps.Humanlike) ? "box" : "oval"));
                    }
                }
                else if (this.logDotgraph != null)
                {
                    this.logDotgraph.AppendLine(string.Format("{0} [color=\"{1}\" shape=\"{2}\"];", WorldPawnGC.DotgraphIdentifier(item), (item.relations == null || !item.relations.everSeenByPlayer) ? "grey" : "black", (!item.RaceProps.Humanlike) ? "box" : "oval"));
                }
            }
            foreach (Pawn item2 in (from pawn in PawnsFinder.AllMapsWorldAndTemporary_Alive
                                    where _003CAccumulatePawnGCData_003Ec__Iterator._0024this.AllowedAsStoryPawn(pawn) && !keptPawns.ContainsKey(pawn)
                                    orderby pawn.records.StoryRelevance descending
                                    select pawn).Take(20))
            {
                keptPawns[item2] = "StoryRelevant";
            }
            Pawn[] criticalPawns = keptPawns.Keys.ToArray();
            Pawn[] array         = criticalPawns;
            int    num           = 0;

            if (num < array.Length)
            {
                Pawn pawn2 = array[num];
                this.AddAllRelationships(pawn2, keptPawns);
                yield return((object)null);

                /*Error: Unable to find new state assignment for yield return*/;
            }
            Pawn[] array2 = criticalPawns;
            foreach (Pawn pawn3 in array2)
            {
                this.AddAllMemories(pawn3, keptPawns);
            }
        }