Example #1
0
        public override IEnumerable <DiaOption> BargainChoices()
        {
            List <int> nums = new List <int> {
                Mathf.CeilToInt(needSilver * 0.75f), Mathf.CeilToInt(needSilver * 0.5f), Mathf.CeilToInt(needSilver * 0.25f)
            };

            for (int i = 0; i < 3; ++i)
            {
                if (i > 0 && nums[i] == nums[i - 1])
                {
                    continue;
                }
                DiaOption option = new DiaOption(String.Format("{0}x {1}", nums[i].ToString(), ThingDefOf.Silver.label));
                int       cur    = nums[i];//Fix: Lambda expression works wrong in for-loop before C# 5.0!!!
                option.link = DialogMaker_RaidNegotiation.BargainDetailNode(0.75f - i * 0.25f, () => { needSilver = cur; });
                yield return(option);
            }
            yield break;
        }
 public override IEnumerable <DiaOption> BargainChoices()
 {
     for (int i = 1; i <= 3; ++i)
     {
         if (Prisoners.Count < i)
         {
             break;
         }
         DiaOption option = new DiaOption("PES_RaidNeg_NegDeeper_Bargain_Option_Prisoner".Translate(i.ToString()));
         int       cur    = i;
         Action    action = delegate()
         {
             for (int j = 0; j < cur; ++j)
             {
                 Prisoners.Remove(Prisoners.RandomElement());
             }
         };
         option.link = DialogMaker_RaidNegotiation.BargainDetailNode(0.75f - i * 0.25f, action);
         yield return(option);
     }
 }