Esempio n. 1
0
        public override void DoWindowContents(Rect inRect)
        {
            Rect rect = new Rect(0f, 0f, inRect.width, 35f);

            Text.Font   = GameFont.Medium;
            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.Label(rect, "DockCaravan".Translate());
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;
            CaravanUIUtility.DrawCaravanInfo(new CaravanUIUtility.CaravanInfo(this.SourceMassUsage, this.SourceMassCapacity, this.cachedSourceMassCapacityExplanation, this.SourceTilesPerDay,
                                                                              this.cachedSourceTilesPerDayExplanation, this.SourceDaysWorthOfFood, this.SourceForagedFoodPerDay, this.cachedSourceForagedFoodPerDayExplanation, this.SourceVisibility,
                                                                              this.cachedSourceVisibilityExplanation, -1f, -1f, null), null, this.caravan.Tile, (!this.caravan.pather.Moving) ? null : new int?(this.TicksToArrive), -9999f,
                                             new Rect(12f, 35f, inRect.width - 24f, 40f), true, null, false);
            inRect.yMin += 119f;
            Widgets.DrawMenuSection(inRect);
            TabDrawer.DrawTabs(inRect, new List <TabRecord>()
            {
                new TabRecord("ItemsTab".Translate(), null, true)
            }, 200f);
            inRect = inRect.ContractedBy(17f);
            GUI.BeginGroup(inRect);
            Rect rect2 = inRect.AtZero();

            this.DoBottomButtons(rect2);
            Rect inRect2 = rect2;

            inRect2.yMax -= 59f;
            this.itemsTransfer.OnGUI(inRect2, out bool flag);
            if (flag)
            {
                this.CountToTransferChanged();
            }
            GUI.EndGroup();
        }
        /// <summary>
        /// Override of Dialog_SplitCaravan.DoWindowContents that calls into this dialog's DoBottomButtons.
        /// This was needed because Dialog_SplitCaravan.DoBottomButtons isn't virtual, but needed to be overridden.
        /// </summary>
        public override void DoWindowContents(Rect inRect)
        {
            if (session == null)
            {
                Close();
            }
            else if (session.uiDirty)
            {
                CountToTransferChanged();

                session.uiDirty = false;
            }

            Rect rect = new Rect(0f, 0f, inRect.width, 35f);

            Text.Font   = GameFont.Medium;
            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.Label(rect, "SplitCaravan".Translate());
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;
            CaravanUIUtility.DrawCaravanInfo(new CaravanUIUtility.CaravanInfo(SourceMassUsage, SourceMassCapacity, cachedSourceMassCapacityExplanation, SourceTilesPerDay, cachedSourceTilesPerDayExplanation, SourceDaysWorthOfFood, SourceForagedFoodPerDay, cachedSourceForagedFoodPerDayExplanation, SourceVisibility, cachedSourceVisibilityExplanation, -1f, -1f, null), new CaravanUIUtility.CaravanInfo(DestMassUsage, DestMassCapacity, cachedDestMassCapacityExplanation, DestTilesPerDay, cachedDestTilesPerDayExplanation, DestDaysWorthOfFood, DestForagedFoodPerDay, cachedDestForagedFoodPerDayExplanation, DestVisibility, cachedDestVisibilityExplanation, -1f, -1f, null), caravan.Tile, (!caravan.pather.Moving) ? null : new int?(TicksToArrive), -9999f, new Rect(12f, 35f, inRect.width - 24f, 40f), true, null, false);
            tabsList.Clear();
            tabsList.Add(new TabRecord("PawnsTab".Translate(), delegate
            {
                tab = Tab.Pawns;
            }, tab == Tab.Pawns));
            tabsList.Add(new TabRecord("ItemsTab".Translate(), delegate
            {
                tab = Tab.Items;
            }, tab == Tab.Items));
            inRect.yMin += 119f;
            Widgets.DrawMenuSection(inRect);
            TabDrawer.DrawTabs(inRect, tabsList, 200f);
            inRect = inRect.ContractedBy(17f);
            GUI.BeginGroup(inRect);
            Rect rect2 = inRect.AtZero();

            DoBottomButtons(rect2);
            Rect inRect2 = rect2;

            inRect2.yMax -= 59f;
            bool flag = false;

            switch (tab)
            {
            case Tab.Pawns:
                pawnsTransfer.OnGUI(inRect2, out flag);
                break;

            case Tab.Items:
                itemsTransfer.OnGUI(inRect2, out flag);
                break;
            }
            if (flag)
            {
                CountToTransferChanged();
            }
            GUI.EndGroup();
        }
Esempio n. 3
0
        public override void DoWindowContents(Rect inRect)
        {
            Rect rect = new Rect(0f, 0f, inRect.width, 35f);

            Text.Font   = GameFont.Medium;
            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.Label(rect, "LoadTransporters".Translate(new object[]
            {
                this.TransportersLabel
            }));
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;
            CaravanUIUtility.DrawCaravanInfo(new CaravanUIUtility.CaravanInfo(this.MassUsage, this.MassCapacity, string.Empty, this.TilesPerDay, this.cachedTilesPerDayExplanation, this.DaysWorthOfFood, this.ForagedFoodPerDay, this.cachedForagedFoodPerDayExplanation, this.Visibility, this.cachedVisibilityExplanation, -1, -1, this.cachedCaravanMassCapacityExplanation), null, this.map.Tile, null, this.lastMassFlashTime, new Rect(12f, 35f, inRect.width - 24f, 40f), false, null, false);
            Dialog_LoadShip.tabsList.Clear();
            Dialog_LoadShip.tabsList.Add(new TabRecord("PawnsTab".Translate(), delegate
            {
                this.tab = Dialog_LoadShip.Tab.Pawns;
            }, this.tab == Dialog_LoadShip.Tab.Pawns));
            Dialog_LoadShip.tabsList.Add(new TabRecord("ItemsTab".Translate(), delegate
            {
                this.tab = Dialog_LoadShip.Tab.Items;
            }, this.tab == Dialog_LoadShip.Tab.Items));
            inRect.yMin += 119f;
            Widgets.DrawMenuSection(inRect);
            TabDrawer.DrawTabs(inRect, Dialog_LoadShip.tabsList, 200f);
            inRect = inRect.ContractedBy(17f);
            GUI.BeginGroup(inRect);
            Rect rect2 = inRect.AtZero();

            this.DoBottomButtons(rect2);
            Rect inRect2 = rect2;

            inRect2.yMax -= 59f;
            bool flag = false;

            Dialog_LoadShip.Tab tab = this.tab;
            if (tab != Dialog_LoadShip.Tab.Pawns)
            {
                if (tab == Dialog_LoadShip.Tab.Items)
                {
                    this.itemsTransfer.OnGUI(inRect2, out flag);
                }
            }
            else
            {
                this.pawnsTransfer.OnGUI(inRect2, out flag);
            }
            if (flag)
            {
                this.CountToTransferChanged();
            }
            GUI.EndGroup();
        }
        public override void DoWindowContents(Rect inRect)
        {
            Rect rect = new Rect(0f, 0f, inRect.width, 35f);

            Text.Font   = GameFont.Medium;
            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.Label(rect, "LoadTransporters".Translate(new object[]
            {
                this.TransportersLabel
            }));
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;
            CaravanUIUtility.DrawCaravanInfo(
                new CaravanUIUtility.CaravanInfo(this.MassUsage, this.MassCapacity, "", this.TilesPerDay,
                                                 this.cachedTilesPerDayExplanation, this.DaysWorthOfFood, this.ForagedFoodPerDay,
                                                 this.cachedForagedFoodPerDayExplanation, this.Visibility, this.cachedVisibilityExplanation), null,
                this.map.Tile, null, this.lastMassFlashTime, new Rect(12f, 35f, inRect.width - 24f, 40f), false, null,
                false);
            Dialog_LoadTransportersPawn.tabsList.Clear();
            Dialog_LoadTransportersPawn.tabsList.Add(new TabRecord("PawnsTab".Translate(),
                                                                   delegate { this.tab = Dialog_LoadTransportersPawn.Tab.Pawns; },
                                                                   this.tab == Dialog_LoadTransportersPawn.Tab.Pawns));
            Dialog_LoadTransportersPawn.tabsList.Add(new TabRecord("ItemsTab".Translate(),
                                                                   delegate { this.tab = Dialog_LoadTransportersPawn.Tab.Items; },
                                                                   this.tab == Dialog_LoadTransportersPawn.Tab.Items));
            inRect.yMin += 119f;
            Widgets.DrawMenuSection(inRect);
            TabDrawer.DrawTabs(inRect, Dialog_LoadTransportersPawn.tabsList, 200f);
            inRect = inRect.ContractedBy(17f);
            GUI.BeginGroup(inRect);
            Rect rect2 = inRect.AtZero();

            this.DoBottomButtons(rect2);
            Rect inRect2 = rect2;

            inRect2.yMax -= 59f;
            bool flag = false;

            Dialog_LoadTransportersPawn.Tab tab = this.tab;
            if (tab != Dialog_LoadTransportersPawn.Tab.Pawns)
            {
                if (tab == Dialog_LoadTransportersPawn.Tab.Items)
                {
                    this.itemsTransfer.OnGUI(inRect2, out flag);
                }
            }
            else
            {
                this.pawnsTransfer.OnGUI(inRect2, out flag);
            }
            if (flag)
            {
                this.CountToTransferChanged();
            }
            GUI.EndGroup();
//            Rect rect = new Rect(0f, 0f, inRect.width, 40f);
//            Text.Font = GameFont.Medium;
//            Text.Anchor = TextAnchor.MiddleCenter;
//            Widgets.Label(rect, "LoadTransporters".Translate(new object[]
//            {
//                this.TransportersLabel
//            }));
//            Text.Font = GameFont.Small;
//            Text.Anchor = TextAnchor.UpperLeft;
//            Dialog_LoadTransportersPawn.tabsList.Clear();
//            Dialog_LoadTransportersPawn.tabsList.Add(new TabRecord("PawnsTab".Translate(), delegate
//            {
//                this.tab = Dialog_LoadTransportersPawn.Tab.Pawns;
//            }, this.tab == Dialog_LoadTransportersPawn.Tab.Pawns));
//            //Dialog_LoadTransportersPawn.tabsList.Add(new TabRecord("ItemsTab".Translate(), delegate
//            //{
//            //    this.tab = Dialog_LoadTransportersPawn.Tab.Items;
//            //}, this.tab == Dialog_LoadTransportersPawn.Tab.Items));
//            inRect.yMin += 72f;
//            Widgets.DrawMenuSection(inRect);
//            TabDrawer.DrawTabs(inRect, Dialog_LoadTransportersPawn.tabsList);
//            inRect = inRect.ContractedBy(17f);
//            GUI.BeginGroup(inRect);
//            Rect rect2 = inRect.AtZero();
//            Rect rect3 = rect2;
//            rect3.xMin += rect2.width - this.pawnsTransfer.TotalNumbersColumnsWidths;
//            rect3.y += 32f;
//            TransferableUIUtility.DrawMassInfo(rect3, this.MassUsage, this.MassCapacity, "TransportersMassUsageTooltip".Translate(), this.lastMassFlashTime, true);
//            //CaravanUIUtility.DrawDaysWorthOfFoodInfo(new Rect(rect3.x, rect3.y + 22f, rect3.width, rect3.height), this.DaysWorthOfFood, true);
//            this.DoBottomButtons(rect2);
//            Rect inRect2 = rect2;
//            inRect2.yMax -= 59f;
//            bool flag = false;
//            Dialog_LoadTransportersPawn.Tab tab = this.tab;
//            if (tab != Dialog_LoadTransportersPawn.Tab.Pawns)
//            {
//                if (tab == Dialog_LoadTransportersPawn.Tab.Items)
//                {
//                    this.itemsTransfer.OnGUI(inRect2, out flag);
//                }
//            }
//            else
//            {
//                this.pawnsTransfer.OnGUI(inRect2, out flag);
//            }
//            if (flag)
//            {
//                this.CountToTransferChanged();
//            }
//            GUI.EndGroup();
        }