Exemple #1
0
        private void DoItemsLists(Rect inRect, ref float curY)
        {
            CompTransporter transporter = this.Transporter;
            Rect            position    = new Rect(0f, curY, (inRect.width - 10f) / 2f, inRect.height);
            float           a           = 0f;

            GUI.BeginGroup(position);
            Widgets.ListSeparator(ref a, position.width, "ItemsToLoad".Translate());
            bool flag = false;

            if (transporter.leftToLoad != null)
            {
                for (int i = 0; i < transporter.leftToLoad.Count; i++)
                {
                    TransferableOneWay t = transporter.leftToLoad[i];
                    if (t.CountToTransfer > 0 && t.HasAnyThing)
                    {
                        flag = true;
                        this.DoThingRow(t.ThingDef, t.CountToTransfer, t.things, position.width, ref a, delegate(int x)
                        {
                            t.ForceTo(t.CountToTransfer - x);
                            this.EndJobForEveryoneHauling(t);
                        });
                    }
                }
            }
            if (!flag)
            {
                Widgets.NoneLabel(ref a, position.width, null);
            }
            GUI.EndGroup();
            Rect  position2 = new Rect((inRect.width + 10f) / 2f, curY, (inRect.width - 10f) / 2f, inRect.height);
            float b         = 0f;

            GUI.BeginGroup(position2);
            Widgets.ListSeparator(ref b, position2.width, "LoadedItems".Translate());
            bool flag2 = false;

            for (int j = 0; j < transporter.innerContainer.Count; j++)
            {
                Thing t = transporter.innerContainer[j];
                flag2 = true;
                ITab_TransporterContents.tmpSingleThing.Clear();
                ITab_TransporterContents.tmpSingleThing.Add(t);
                this.DoThingRow(t.def, t.stackCount, ITab_TransporterContents.tmpSingleThing, position2.width, ref b, delegate(int x)
                {
                    Thing thing;
                    GenDrop.TryDropSpawn(t.SplitOff(x), this.SelThing.Position, this.SelThing.Map, ThingPlaceMode.Near, out thing, null, null);
                });
                ITab_TransporterContents.tmpSingleThing.Clear();
            }
            if (!flag2)
            {
                Widgets.NoneLabel(ref b, position.width, null);
            }
            GUI.EndGroup();
            curY += Mathf.Max(a, b);
        }
 private void OnDropToLoadThing(TransferableOneWay t, int count)
 {
     t.ForceTo(t.CountToTransfer - count);
     EndJobForEveryoneHauling(t);
     foreach (Thing thing in t.things)
     {
         Pawn pawn = thing as Pawn;
         if (pawn != null)
         {
             RemovePawnFromLoadLord(pawn);
         }
     }
 }