public void FactionTick()
 {
     this.CheckNaturalTendencyToReachGoodwillThreshold();
     this.kidnapped.KidnappedPawnsTrackerTick();
     for (int i = this.predatorThreats.Count - 1; i >= 0; i--)
     {
         PredatorThreat predatorThreat = this.predatorThreats[i];
         if (predatorThreat.Expired)
         {
             this.predatorThreats.RemoveAt(i);
             if (predatorThreat.predator.Spawned)
             {
                 predatorThreat.predator.Map.attackTargetsCache.UpdateTarget(predatorThreat.predator);
             }
         }
     }
     if (Find.TickManager.TicksGame % 1000 == 200 && this.IsPlayer)
     {
         if (NamePlayerFactionAndSettlementUtility.CanNameFactionNow())
         {
             List <Settlement> settlements = Find.WorldObjects.Settlements;
             if (Faction.< > f__mg$cache0 == null)
             {
                 Faction.< > f__mg$cache0 = new Predicate <Settlement>(NamePlayerFactionAndSettlementUtility.CanNameSettlementSoon);
             }
             Settlement settlement = settlements.Find(Faction.< > f__mg$cache0);
             if (settlement != null)
             {
                 Find.WindowStack.Add(new Dialog_NamePlayerFactionAndSettlement(settlement));
             }
             else
             {
                 Find.WindowStack.Add(new Dialog_NamePlayerFaction());
             }
         }
         else
         {
             List <Settlement> settlements2 = Find.WorldObjects.Settlements;
             if (Faction.< > f__mg$cache1 == null)
             {
                 Faction.< > f__mg$cache1 = new Predicate <Settlement>(NamePlayerFactionAndSettlementUtility.CanNameSettlementNow);
             }
             Settlement settlement2 = settlements2.Find(Faction.< > f__mg$cache1);
             if (settlement2 != null)
             {
                 if (NamePlayerFactionAndSettlementUtility.CanNameFactionSoon())
                 {
                     Find.WindowStack.Add(new Dialog_NamePlayerFactionAndSettlement(settlement2));
                 }
                 else
                 {
                     Find.WindowStack.Add(new Dialog_NamePlayerSettlement(settlement2));
                 }
             }
         }
     }
 }
Esempio n. 2
0
        public void FactionTick()
        {
            CheckNaturalTendencyToReachGoodwillThreshold();
            kidnapped.KidnappedPawnsTrackerTick();
            for (int num = predatorThreats.Count - 1; num >= 0; num--)
            {
                PredatorThreat predatorThreat = predatorThreats[num];
                if (predatorThreat.Expired)
                {
                    predatorThreats.RemoveAt(num);
                    if (predatorThreat.predator.Spawned)
                    {
                        predatorThreat.predator.Map.attackTargetsCache.UpdateTarget(predatorThreat.predator);
                    }
                }
            }
            if (Find.TickManager.TicksGame % 1000 != 200 || !IsPlayer)
            {
                return;
            }
            if (NamePlayerFactionAndSettlementUtility.CanNameFactionNow())
            {
                Settlement settlement = Find.WorldObjects.Settlements.Find((Settlement x) => NamePlayerFactionAndSettlementUtility.CanNameSettlementSoon(x));
                if (settlement != null)
                {
                    Find.WindowStack.Add(new Dialog_NamePlayerFactionAndSettlement(settlement));
                }
                else
                {
                    Find.WindowStack.Add(new Dialog_NamePlayerFaction());
                }
                return;
            }
            Settlement settlement2 = Find.WorldObjects.Settlements.Find((Settlement x) => NamePlayerFactionAndSettlementUtility.CanNameSettlementNow(x));

            if (settlement2 != null)
            {
                if (NamePlayerFactionAndSettlementUtility.CanNameFactionSoon())
                {
                    Find.WindowStack.Add(new Dialog_NamePlayerFactionAndSettlement(settlement2));
                }
                else
                {
                    Find.WindowStack.Add(new Dialog_NamePlayerSettlement(settlement2));
                }
            }
        }