private void RandomizeCurPawn()
        {
            if (!TutorSystem.AllowAction("RandomizePawn"))
            {
                return;
            }
            int num = 0;

            while (true)
            {
                this.curPawn = StartingPawnUtility.RandomizeInPlace(this.curPawn);
                num++;
                if (num > 15)
                {
                    break;
                }
                if (StartingPawnUtility.WorkTypeRequirementsSatisfied())
                {
                    goto Block_3;
                }
            }
            return;

Block_3:
            TutorSystem.Notify_Event("RandomizePawn");
        }
Exemple #2
0
        public override void PostWorldGenerate()
        {
            int num = 0;

            while (true)
            {
                StartingPawnUtility.ClearAllStartingPawns();
                for (int i = 0; i < this.pawnCount; i++)
                {
                    Find.GameInitData.startingPawns.Add(StartingPawnUtility.NewGeneratedStartingPawn());
                }
                num++;
                if (num > 20)
                {
                    break;
                }
                if (StartingPawnUtility.WorkTypeRequirementsSatisfied())
                {
                    goto Block_3;
                }
            }
            return;

Block_3:
            while (Find.GameInitData.startingPawns.Count < this.pawnChoiceCount)
            {
                Find.GameInitData.startingPawns.Add(StartingPawnUtility.NewGeneratedStartingPawn());
            }
            Find.GameInitData.startingPawnCount = this.pawnCount;
        }
 private void RandomizeCurPawn()
 {
     if (!TutorSystem.AllowAction("RandomizePawn"))
     {
         return;
     }
     do
     {
         this.curPawn = StartingPawnUtility.RandomizeInPlace(this.curPawn);
     }while (!StartingPawnUtility.WorkTypeRequirementsSatisfied());
     TutorSystem.Notify_Event("RandomizePawn");
 }
 private void RandomizeCurPawn()
 {
     if (TutorSystem.AllowAction("RandomizePawn"))
     {
         int num = 0;
         do
         {
             curPawn = StartingPawnUtility.RandomizeInPlace(curPawn);
             num++;
         }while (num <= 20 && !StartingPawnUtility.WorkTypeRequirementsSatisfied());
         TutorSystem.Notify_Event("RandomizePawn");
     }
 }
Exemple #5
0
        //private void RandomizeCurPawn()
        //{
        //    if (!TutorSystem.AllowAction("RandomizePawn"))
        //    {
        //        return;
        //    }
        //    int num = 0;
        //    do
        //    {
        //        this.curPawn = StartingPawnUtility.RandomizeInPlace(this.curPawn);
        //        num++;
        //        if (num <= 15)
        //        {
        //            continue;
        //        }
        //        return;
        //    }
        //    while (!StartingPawnUtility.WorkTypeRequirementsSatisfied());
        //    TutorSystem.Notify_Event("RandomizePawn");
        //}

        private IEnumerator RandomizeAllPawns()
        {
            // Temp variable to store generated pawns
            Pawn[] aPawns = new Pawn[0];

            // Try 15 times to generate pawn with WorkTypeRequirementsSatisfied?
            int num = 0;

            do
            {
                // Loop through current pawns and generate random in place
                foreach (Pawn p in Find.GameInitData.startingPawns)
                {
                    Pawn curpawn = new Pawn();

                    curpawn = StartingPawnUtility.RandomizeInPlace(p);

                    aPawns = aPawns.Concat(new Pawn[] { curpawn }).ToArray();
                }

                NewGameRules.ClearCurPawns();

                Find.GameInitData.startingPawns = aPawns.ToList();
                aPawns = new Pawn[0];

                lstCardRects            = new List <Rect>();
                lstPNC_Cards            = new List <PNC_Card>();
                lstPNC_CardsInOrder     = new List <PNC_Card>();
                templstPNC_CardsInOrder = new List <PNC_Card>();
                intCardNum = 0;

                PopulateCards(false);

                if (num > 10 && StartingPawnUtility.WorkTypeRequirementsSatisfied())
                {
                    yield break;
                }

                num++;
                if (num <= 15)
                {
                    yield return(new WaitForSeconds(.05f));

                    //Log.Message(num.ToString());
                    continue;
                }
                yield break;
            }while (num < 3);
        }
        // Token: 0x06004DA0 RID: 19872 RVA: 0x001A4DAC File Offset: 0x001A2FAC
        public override void PostWorldGenerate()
        {
            if (this.Pawns.NullOrEmpty())
            {
                base.PostWorldGenerate();
                return;
            }
            List <PawnKindDef> kinds = new List <PawnKindDef>();

            foreach (var item in this.Pawns)
            {
                for (int i = 0; i < item.count; i++)
                {
                    kinds.Add(item.kindDef);
                }
            }
            this.pawnCount = kinds.Count;
            Find.GameInitData.startingPawnCount = this.pawnCount;
            int num = 0;

            do
            {
                StartingPawnUtility.ClearAllStartingPawns();
                foreach (var item in kinds)
                {
                    //	Log.Message("Generating "+item);
                    Find.GameInitData.startingAndOptionalPawns.Add(SpecificStartingPawnUtility.NewGeneratedStartingPawn(item));
                }
                num++;
                if (num > 20)
                {
                    break;
                }
            }while (!StartingPawnUtility.WorkTypeRequirementsSatisfied());
IL_62:
            while (Find.GameInitData.startingAndOptionalPawns.Count < this.pawnChoiceCount)
            {
                foreach (var item in kinds)
                {
                    //	Log.Message("Generating " + item);
                    Find.GameInitData.startingAndOptionalPawns.Add(SpecificStartingPawnUtility.NewGeneratedStartingPawn(item));
                }
            }
            return;

            goto IL_62;
        }
        public override void PostWorldGenerate()
        {
            Find.GameInitData.startingPawnCount = pawnCount;
            int num = 0;

            do
            {
                StartingPawnUtility.ClearAllStartingPawns();
                for (int i = 0; i < pawnCount; i++)
                {
                    Find.GameInitData.startingAndOptionalPawns.Add(StartingPawnUtility.NewGeneratedStartingPawn());
                }
                num++;
            }while (num <= 20 && !StartingPawnUtility.WorkTypeRequirementsSatisfied());
            while (Find.GameInitData.startingAndOptionalPawns.Count < pawnChoiceCount)
            {
                Find.GameInitData.startingAndOptionalPawns.Add(StartingPawnUtility.NewGeneratedStartingPawn());
            }
        }
        public override void PostWorldLoad()
        {
            int num = 0;

            while (true)
            {
                //StartingPawnUtility.ClearAllStartingPawns();
                for (int i = 0; i < this.slaveCount; i++)
                {
                    Find.GameInitData.startingPawns.Add(ElderThingFaction.ScenPart_ConfigPage_ConfigureStartingSlaves.NewGeneratedStartingSlave());
                }
                num++;
                if (num > 20)
                {
                    break;
                }
                if (StartingPawnUtility.WorkTypeRequirementsSatisfied())
                {
                    return;
                }
            }
        }
        public override void PostWorldGenerate()
        {
            var num = 0;

            while (true)
            {
                //StartingPawnUtility.ClearAllStartingPawns();
                for (var i = 0; i < slaveCount; i++)
                {
                    Find.GameInitData.startingAndOptionalPawns.Add(NewGeneratedStartingSlave());
                }

                num++;
                if (num > 20)
                {
                    break;
                }

                if (StartingPawnUtility.WorkTypeRequirementsSatisfied())
                {
                    return;
                }
            }
        }