コード例 #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, "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), new CaravanUIUtility.CaravanInfo(DestMassUsage, DestMassCapacity, cachedDestMassCapacityExplanation, DestTilesPerDay, cachedDestTilesPerDayExplanation, DestDaysWorthOfFood, DestForagedFoodPerDay, cachedDestForagedFoodPerDayExplanation, DestVisibility, cachedDestVisibilityExplanation), caravan.Tile, caravan.pather.Moving ? new int?(TicksToArrive) : null, -9999f, new Rect(12f, 35f, inRect.width - 24f, 40f));
            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));
            tabsList.Add(new TabRecord("FoodAndMedicineTab".Translate(), delegate
            {
                tab = Tab.FoodAndMedicine;
            }, tab == Tab.FoodAndMedicine));
            inRect.yMin += 119f;
            Widgets.DrawMenuSection(inRect);
            TabDrawer.DrawTabs(inRect, tabsList);
            inRect = inRect.ContractedBy(17f);
            GUI.BeginGroup(inRect);
            Rect rect2 = inRect.AtZero();

            DoBottomButtons(rect2);
            Rect inRect2 = rect2;

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

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

            case Tab.Items:
                itemsTransfer.OnGUI(inRect2, out anythingChanged);
                break;

            case Tab.FoodAndMedicine:
                foodAndMedicineTransfer.OnGUI(inRect2, out anythingChanged);
                break;
            }
            if (anythingChanged)
            {
                CountToTransferChanged();
            }
            GUI.EndGroup();
        }
コード例 #2
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, "SplitCaravan".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), new CaravanUIUtility.CaravanInfo?(new CaravanUIUtility.CaravanInfo(this.DestMassUsage, this.DestMassCapacity, this.cachedDestMassCapacityExplanation, this.DestTilesPerDay, this.cachedDestTilesPerDayExplanation, this.DestDaysWorthOfFood, this.DestForagedFoodPerDay, this.cachedDestForagedFoodPerDayExplanation, this.DestVisibility, this.cachedDestVisibilityExplanation, -1f, -1f, 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);
            Dialog_SplitCaravan.tabsList.Clear();
            Dialog_SplitCaravan.tabsList.Add(new TabRecord("PawnsTab".Translate(), delegate
            {
                this.tab = Dialog_SplitCaravan.Tab.Pawns;
            }, this.tab == Dialog_SplitCaravan.Tab.Pawns));
            Dialog_SplitCaravan.tabsList.Add(new TabRecord("ItemsTab".Translate(), delegate
            {
                this.tab = Dialog_SplitCaravan.Tab.Items;
            }, this.tab == Dialog_SplitCaravan.Tab.Items));
            inRect.yMin += 119f;
            Widgets.DrawMenuSection(inRect);
            TabDrawer.DrawTabs(inRect, Dialog_SplitCaravan.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_SplitCaravan.Tab tab = this.tab;
            if (tab != Dialog_SplitCaravan.Tab.Pawns)
            {
                if (tab == Dialog_SplitCaravan.Tab.Items)
                {
                    this.itemsTransfer.OnGUI(inRect2, out flag);
                }
            }
            else
            {
                this.pawnsTransfer.OnGUI(inRect2, out flag);
            }
            if (flag)
            {
                this.CountToTransferChanged();
            }
            GUI.EndGroup();
        }
コード例 #3
0
        public override GizmoResult GizmoOnGUI(Vector2 topLeft, float maxWidth)
        {
            if (!caravan.Spawned)
            {
                return(new GizmoResult(GizmoState.Clear));
            }
            Rect rect = new Rect(topLeft.x, topLeft.y, GetWidth(maxWidth), 75f);

            Widgets.DrawWindowBackground(rect);
            GUI.BeginGroup(rect);
            Rect          rect2         = rect.AtZero();
            int?          ticksToArrive = (caravan.pather.Moving ? new int?(CaravanArrivalTimeEstimator.EstimatedTicksToArrive(caravan, allowCaching: true)) : null);
            StringBuilder stringBuilder = new StringBuilder();

            CaravanUIUtility.DrawCaravanInfo(new CaravanUIUtility.CaravanInfo(tilesPerDay: TilesPerDayCalculator.ApproxTilesPerDay(caravan, stringBuilder), massUsage: caravan.MassUsage, massCapacity: caravan.MassCapacity, massCapacityExplanation: caravan.MassCapacityExplanation, tilesPerDayExplanation: stringBuilder.ToString(), daysWorthOfFood: caravan.DaysWorthOfFood, foragedFoodPerDay: caravan.forage.ForagedFoodPerDay, foragedFoodPerDayExplanation: caravan.forage.ForagedFoodPerDayExplanation, visibility: caravan.Visibility, visibilityExplanation: caravan.VisibilityExplanation), null, caravan.Tile, ticksToArrive, -9999f, rect2, lerpMassColor: true, null, multiline: true);
            GUI.EndGroup();
            GenUI.AbsorbClicksInRect(rect);
            return(new GizmoResult(GizmoState.Clear));
        }
コード例 #4
0
        public override GizmoResult GizmoOnGUI(Vector2 topLeft, float maxWidth)
        {
            if (!this.caravan.Spawned)
            {
                return(new GizmoResult(GizmoState.Clear));
            }
            Rect rect = new Rect(topLeft.x, topLeft.y, this.GetWidth(maxWidth), 75f);

            Widgets.DrawWindowBackground(rect);
            GUI.BeginGroup(rect);
            Rect          rect2         = rect.AtZero();
            int?          ticksToArrive = (!this.caravan.pather.Moving) ? null : new int?(CaravanArrivalTimeEstimator.EstimatedTicksToArrive(this.caravan, true));
            StringBuilder stringBuilder = new StringBuilder();
            float         tilesPerDay   = TilesPerDayCalculator.ApproxTilesPerDay(this.caravan, stringBuilder);

            CaravanUIUtility.DrawCaravanInfo(new CaravanUIUtility.CaravanInfo(this.caravan.MassUsage, this.caravan.MassCapacity, this.caravan.MassCapacityExplanation, tilesPerDay, stringBuilder.ToString(), this.caravan.DaysWorthOfFood, this.caravan.forage.ForagedFoodPerDay, this.caravan.forage.ForagedFoodPerDayExplanation, this.caravan.Visibility, this.caravan.VisibilityExplanation, -1f, -1f, null), null, this.caravan.Tile, ticksToArrive, -9999f, rect2, true, null, true);
            GUI.EndGroup();
            GenUI.AbsorbClicksInRect(rect);
            return(new GizmoResult(GizmoState.Clear));
        }