private void DoRow(Rect rect, TransferableOneWay trad, int index, float availableMass) { if (index % 2 == 1) { Widgets.DrawLightHighlight(rect); } Text.Font = GameFont.Small; GUI.BeginGroup(rect); float width = rect.width; int maxCount = trad.MaxCount; Rect rect2 = new Rect(width - 240f, 0f, 240f, rect.height); stoppingPoints.Clear(); if (availableMassGetter != null && (!(trad.AnyThing is Pawn) || includePawnsMassInMassUsage)) { float num = availableMass + GetMass(trad.AnyThing) * (float)trad.CountToTransfer; int threshold = ((!(num <= 0f)) ? Mathf.FloorToInt(num / GetMass(trad.AnyThing)) : 0); stoppingPoints.Add(new TransferableCountToTransferStoppingPoint(threshold, "M<", ">M")); } Pawn pawn = trad.AnyThing as Pawn; bool flag = pawn != null && (pawn.IsColonist || pawn.IsPrisonerOfColony); TransferableUIUtility.DoCountAdjustInterface(rect2, trad, index, 0, maxCount, flash: false, stoppingPoints, (playerPawnsReadOnly && flag) || readOnly); width -= 240f; if (drawMarketValue) { Rect rect3 = new Rect(width - 100f, 0f, 100f, rect.height); Text.Anchor = TextAnchor.MiddleLeft; DrawMarketValue(rect3, trad); width -= 100f; } if (drawMass) { Rect rect4 = new Rect(width - 100f, 0f, 100f, rect.height); Text.Anchor = TextAnchor.MiddleLeft; DrawMass(rect4, trad, availableMass); width -= 100f; } if (drawDaysUntilRot) { Rect rect5 = new Rect(width - 75f, 0f, 75f, rect.height); Text.Anchor = TextAnchor.MiddleLeft; DrawDaysUntilRot(rect5, trad); width -= 75f; } if (drawItemNutrition) { Rect rect6 = new Rect(width - 75f, 0f, 75f, rect.height); Text.Anchor = TextAnchor.MiddleLeft; DrawItemNutrition(rect6, trad); width -= 75f; } if (drawForagedFoodPerDay) { Rect rect7 = new Rect(width - 75f, 0f, 75f, rect.height); Text.Anchor = TextAnchor.MiddleLeft; if (!DrawGrazeability(rect7, trad)) { DrawForagedFoodPerDay(rect7, trad); } width -= 75f; } if (drawNutritionEatenPerDay) { Rect rect8 = new Rect(width - 75f, 0f, 75f, rect.height); Text.Anchor = TextAnchor.MiddleLeft; DrawNutritionEatenPerDay(rect8, trad); width -= 75f; } if (ShouldShowCount(trad)) { Rect rect9 = new Rect(width - 75f, 0f, 75f, rect.height); Widgets.DrawHighlightIfMouseover(rect9); Text.Anchor = TextAnchor.MiddleLeft; Rect rect10 = rect9; rect10.xMin += 5f; rect10.xMax -= 5f; Widgets.Label(rect10, maxCount.ToStringCached()); TooltipHandler.TipRegion(rect9, sourceCountDesc); } width -= 75f; if (drawEquippedWeapon) { Rect rect11 = new Rect(width - 30f, 0f, 30f, rect.height); Rect iconRect = new Rect(width - 30f, (rect.height - 30f) / 2f, 30f, 30f); DrawEquippedWeapon(rect11, iconRect, trad); width -= 30f; } TransferableUIUtility.DoExtraAnimalIcons(trad, rect, ref width); Rect idRect = new Rect(0f, 0f, width, rect.height); TransferableUIUtility.DrawTransferableInfo(trad, idRect, Color.white); GenUI.ResetLabelAlign(); GUI.EndGroup(); }
public static void DrawTradeableRow(Rect rect, Tradeable trad, int index) { if (index % 2 == 1) { Widgets.DrawLightHighlight(rect); } Text.Font = GameFont.Small; GUI.BeginGroup(rect); float num = rect.width; int num2 = trad.CountHeldBy(Transactor.Trader); if (num2 != 0) { Rect rect2 = new Rect(num - 75f, 0f, 75f, rect.height); if (Mouse.IsOver(rect2)) { Widgets.DrawHighlight(rect2); } Text.Anchor = TextAnchor.MiddleRight; Rect rect3 = rect2; rect3.xMin += 5f; rect3.xMax -= 5f; Widgets.Label(rect3, num2.ToStringCached()); TooltipHandler.TipRegion(rect2, "TraderCount".Translate()); Rect rect4 = new Rect(rect2.x - 100f, 0f, 100f, rect.height); Text.Anchor = TextAnchor.MiddleRight; TradeUI.DrawPrice(rect4, trad, TradeAction.PlayerBuys); } num -= 175f; Rect rect5 = new Rect(num - 240f, 0f, 240f, rect.height); if (trad.TraderWillTrade) { bool flash = Time.time - Dialog_Trade.lastCurrencyFlashTime < 1f && trad.IsCurrency; TransferableUIUtility.DoCountAdjustInterface(rect5, trad, index, trad.GetMinimumToTransfer(), trad.GetMaximumToTransfer(), flash, null, false); } else { TradeUI.DrawWillNotTradeIndication(rect5, trad); } num -= 240f; int num3 = trad.CountHeldBy(Transactor.Colony); if (num3 != 0) { Rect rect6 = new Rect(num - 100f, 0f, 100f, rect.height); Text.Anchor = TextAnchor.MiddleLeft; TradeUI.DrawPrice(rect6, trad, TradeAction.PlayerSells); Rect rect7 = new Rect(rect6.x - 75f, 0f, 75f, rect.height); if (Mouse.IsOver(rect7)) { Widgets.DrawHighlight(rect7); } Text.Anchor = TextAnchor.MiddleLeft; Rect rect8 = rect7; rect8.xMin += 5f; rect8.xMax -= 5f; Widgets.Label(rect8, num3.ToStringCached()); TooltipHandler.TipRegion(rect7, "ColonyCount".Translate()); } num -= 175f; TransferableUIUtility.DoExtraAnimalIcons(trad, rect, ref num); Rect idRect = new Rect(0f, 0f, num, rect.height); TransferableUIUtility.DrawTransferableInfo(trad, idRect, (!trad.TraderWillTrade) ? TradeUI.NoTradeColor : Color.white); GenUI.ResetLabelAlign(); GUI.EndGroup(); }