private void CalculateAndRecacheTransferables() { this.transferables = new List <TransferableOneWay>(); this.AddPawnsToTransferables(); this.AddItemsToTransferables(); this.AddContentsToTransferables(); IEnumerable <TransferableOneWay> enumerable = null; string text = null; string destinationLabel = null; string text2 = "FormCaravanColonyThingCountTip".Translate(); bool flag = true; IgnorePawnsInventoryMode ignorePawnInventoryMass = IgnorePawnsInventoryMode.IgnoreIfAssignedToUnload; bool flag2 = true; Func <float> availableMassGetter = () => this.MassCapacity - this.MassUsage; int tile = this.map.Tile; this.pawnsTransfer = new TransferableOneWayWidget(enumerable, text, destinationLabel, text2, flag, ignorePawnInventoryMass, flag2, availableMassGetter, 0f, false, tile, true, true, true, false, true, false, false); CaravanUIUtility.AddPawnsSections(this.pawnsTransfer, this.transferables); enumerable = from x in this.transferables where x.ThingDef.category != ThingCategory.Pawn select x; text2 = null; destinationLabel = null; text = "FormCaravanColonyThingCountTip".Translate(); flag2 = true; ignorePawnInventoryMass = IgnorePawnsInventoryMode.IgnoreIfAssignedToUnload; flag = true; availableMassGetter = (() => this.MassCapacity - this.MassUsage); tile = this.map.Tile; this.itemsTransfer = new TransferableOneWayWidget(enumerable, text2, destinationLabel, text, flag2, ignorePawnInventoryMass, flag, availableMassGetter, 0f, false, tile, true, false, false, true, false, true, false); this.CountToTransferChanged(); }
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(); }
public void OpenWindow(bool sound = true) { var dialog = PrepareDummyDialog(); if (!sound) { dialog.soundAppear = null; } CaravanUIUtility.CreateCaravanTransferableWidgets( transferables, out dialog.pawnsTransfer, out dialog.itemsTransfer, out dialog.travelSuppliesTransfer, "FormCaravanColonyThingCountTip".Translate(), dialog.IgnoreInventoryMode, () => dialog.MassCapacity - dialog.MassUsage, dialog.AutoStripSpawnedCorpses, dialog.CurrentTile, mapAboutToBeRemoved ); dialog.CountToTransferChanged(); Find.WindowStack.Add(dialog); }
/// <summary> /// Opens the dialog for a currently ongoing session. This should only be called /// when the dialog has been closed but the session still running. /// I.E. one player has closed the window without accepting/cancelling the session. /// </summary> public void OpenWindow(bool sound = true) { dialog = PrepareDialogProxy(); if (!sound) { dialog.soundAppear = null; } CaravanUIUtility.CreateCaravanTransferableWidgets( transferables, out dialog.pawnsTransfer, out dialog.itemsTransfer, out dialog.foodAndMedicineTransfer, "SplitCaravanThingCountTip".Translate(), IgnorePawnsInventoryMode.Ignore, () => dialog.DestMassCapacity - dialog.DestMassUsage, false, Caravan.Tile, false ); dialog.CountToTransferChanged(); Find.WindowStack.Add(dialog); }
private void CalculateAndRecacheTransferables() { this.transferables = new List <TransferableOneWay>(); this.AddItemsToTransferables(); IEnumerable <TransferableOneWay> enumerable = null; string text = null; string text2 = null; string text3 = "FormCaravanColonyThingCountTip".Translate(); bool flag = true; IgnorePawnsInventoryMode ignorePawnsInventoryMode = (IgnorePawnsInventoryMode)1; bool flag2 = true; Func <float> func = () => this.MassCapacity - this.MassUsage; int tile = this.map.Tile; this.pawnsTransfer = new TransferableOneWayWidget(enumerable, text, text2, text3, flag, ignorePawnsInventoryMode, flag2, func, 0f, false, tile, true, true, true, false, true, false, false); CaravanUIUtility.AddPawnsSections(this.pawnsTransfer, this.transferables); enumerable = from x in this.transferables where x.ThingDef.category != ThingCategory.Pawn select x; text3 = null; text2 = null; text = "FormCaravanColonyThingCountTip".Translate(); flag2 = true; ignorePawnsInventoryMode = (IgnorePawnsInventoryMode)1; flag = true; func = (() => this.MassCapacity - this.MassUsage); tile = this.map.Tile; this.itemsTransfer = new TransferableOneWayWidget(enumerable, text3, text2, text, flag2, ignorePawnsInventoryMode, flag, func, 0f, false, tile, true, false, false, true, false, true, false); this.CountToTransferChanged(); }
public override void DoWindowContents(Rect inRect) { 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.TransportersLabelFull })); Text.Font = GameFont.Small; Text.Anchor = TextAnchor.UpperLeft; Dialog_LoadShipCargo.tabsList.Clear(); Dialog_LoadShipCargo.tabsList.Add(new TabRecord("PawnsTab".Translate(), delegate { this.tab = Dialog_LoadShipCargo.Tab.Pawns; }, this.tab == Dialog_LoadShipCargo.Tab.Pawns)); Dialog_LoadShipCargo.tabsList.Add(new TabRecord("ItemsTab".Translate(), delegate { this.tab = Dialog_LoadShipCargo.Tab.Items; }, this.tab == Dialog_LoadShipCargo.Tab.Items)); inRect.yMin += 72f; Widgets.DrawMenuSection(inRect); TabDrawer.DrawTabs(inRect, Dialog_LoadShipCargo.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.First, this.DaysWorthOfFood.Second, this.EnvironmentAllowsEatingVirtualPlantsNow, true, 3.40282347E+38f); this.DrawPassengerCapacity(rect3); this.DoBottomButtons(rect2); Rect inRect2 = rect2; inRect2.yMax += 59f; bool flag = false; Dialog_LoadShipCargo.Tab tab = this.tab; if (tab != Dialog_LoadShipCargo.Tab.Pawns) { if (tab == Dialog_LoadShipCargo.Tab.Items) { this.itemsTransfer.OnGUI(inRect2, out flag); } } else { this.pawnsTransfer.OnGUI(inRect2, out 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(); }
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(); }
private void CalculateAndRecacheTransferables() { this.transferables = new List <TransferableOneWay>(); this.AddPawnsToTransferables(); this.AddItemsToTransferables(); this.pawnsTransfer = new TransferableOneWayWidget(null, Faction.OfPlayer.Name, this.TransportersLabelShort, "FormCaravanColonyThingCountTip".Translate(), true, false, true, () => this.MassCapacity - this.MassUsage, 24f, false, true); CaravanUIUtility.AddPawnsSections(this.pawnsTransfer, this.transferables); this.itemsTransfer = new TransferableOneWayWidget(from x in this.transferables where x.ThingDef.category != ThingCategory.Pawn select x, Faction.OfPlayer.Name, this.TransportersLabelShort, "FormCaravanColonyThingCountTip".Translate(), true, false, true, () => this.MassCapacity - this.MassUsage, 24f, false, true); this.CountToTransferChanged(); }
private void CalculateAndRecacheTransferables() { transferables = new List <TransferableOneWay>(); AddPawnsToTransferables(); AddItemsToTransferables(); pawnsTransfer = new TransferableOneWayWidget(null, Faction.OfPlayer.Name, TransportersLabelCap, "FormCaravanColonyThingCountTip".Translate(), true, IgnorePawnsInventoryMode.IgnoreIfAssignedToUnload, true, () => MassCapacity - MassUsage, 24f, false, map.Tile, true); CaravanUIUtility.AddPawnsSections(pawnsTransfer, transferables); itemsTransfer = new TransferableOneWayWidget(from x in transferables where x.ThingDef.category != ThingCategory.Pawn select x, Faction.OfPlayer.Name, TransportersLabelCap, "FormCaravanColonyThingCountTip".Translate(), true, IgnorePawnsInventoryMode.IgnoreIfAssignedToUnload, true, () => MassCapacity - MassUsage, 24f, false, map.Tile, true); CountToTransferChanged(); }
public void OpenWindow(bool sound = true) { Find.Selector.ClearSelection(); var dialog = PrepareDummyDialog(); if (!sound) { dialog.soundAppear = null; } dialog.doCloseX = true; CaravanUIUtility.CreateCaravanTransferableWidgets_NewTmp(transferables, out dialog.pawnsTransfer, out dialog.itemsTransfer, out dialog.foodAndMedicineTransfer, "FormCaravanColonyThingCountTip".Translate(), dialog.IgnoreInventoryMode, () => dialog.MassCapacity - dialog.MassUsage, dialog.AutoStripSpawnedCorpses, dialog.CurrentTile, mapAboutToBeRemoved); dialog.CountToTransferChanged(); Find.WindowStack.Add(dialog); }
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(); }