Пример #1
0
 public override void DoWindowContents(Rect rect)
 {
     if (selPawns is null || selPawns.Count < 1)
     {
         Find.WindowStack.TryRemove(this, true);
         return;
     }
     if (Time.frameCount % RevalidateEveryFrame == 0)
     {
         for (int i = 0; i < this.options.Count; i++)
         {
             if (!this.options[i].Disabled && !FloatMenuMulti.StillValid(this.options[i], this.selPawns, this.clickedPawn))
             {
                 this.options[i].Disabled = true;
             }
         }
     }
     base.DoWindowContents(rect);
 }
Пример #2
0
        public void MultiplePawnFloatMenuOptions(List <Pawn> pawns)
        {
            List <FloatMenuOption> options = new List <FloatMenuOption>();
            FloatMenuOption        opt1    = new FloatMenuOption("BoardShipGroup".Translate(this.Pawn.LabelShort), delegate()
            {
                List <IntVec3> cells = this.Pawn.OccupiedRect().Cells.ToList();
                foreach (Pawn p in pawns)
                {
                    if (cells.Contains(p.Position))
                    {
                        continue;
                    }
                    Job job = new Job(JobDefOf_Ships.Board, this.parent);
                    p.jobs.TryTakeOrderedJob(job, JobTag.DraftedOrder);
                    ShipHandler handler = p.IsColonistPlayerControlled ? this.NextAvailableHandler : this.handlers.Find(x => x.role.handlingType == HandlingTypeFlags.None);
                    this.GiveLoadJob(p, handler);
                    this.ReserveSeat(p, handler);
                }
            }, MenuOptionPriority.Default, null, null, 0f, null, null);
            FloatMenuOption opt2 = new FloatMenuOption("BoardShipGroupFail".Translate(this.Pawn.LabelShort), null, MenuOptionPriority.Default, null, null, 0f, null, null);

            opt2.Disabled = true;
            int r = 0;

            foreach (ShipHandler h in this.handlers)
            {
                r += h.currentlyReserving.Count;
            }
            options.Add(pawns.Count + r > this.SeatsAvailable ? opt2 : opt1);

            FloatMenuMulti floatMenuMap = new FloatMenuMulti(options, pawns, this.Pawn, pawns[0].LabelCap, Verse.UI.MouseMapPosition())
            {
                givesColonistOrders = true
            };

            Find.WindowStack.Add(floatMenuMap);
        }