public static void DrawCaravanInfo(CaravanInfo info, CaravanInfo?info2, int currentTile, int?ticksToArrive, float lastMassFlashTime, Rect rect, bool lerpMassColor = true, string extraDaysWorthOfFoodTipInfo = null, bool multiline = false) { tmpInfo.Clear(); TaggedString taggedString = info.massUsage.ToStringEnsureThreshold(info.massCapacity, 0) + " / " + info.massCapacity.ToString("F0") + " " + "kg".Translate(); TaggedString taggedString2 = info2.HasValue ? (info2.Value.massUsage.ToStringEnsureThreshold(info2.Value.massCapacity, 0) + " / " + info2.Value.massCapacity.ToString("F0") + " " + "kg".Translate()) : ((TaggedString)null); tmpInfo.Add(new TransferableUIUtility.ExtraInfo("Mass".Translate(), taggedString, GetMassColor(info.massUsage, info.massCapacity, lerpMassColor), GetMassTip(info.massUsage, info.massCapacity, info.massCapacityExplanation, info2.HasValue ? new float?(info2.Value.massUsage) : null, info2.HasValue ? new float?(info2.Value.massCapacity) : null, info2.HasValue ? info2.Value.massCapacityExplanation : null), taggedString2, info2.HasValue ? GetMassColor(info2.Value.massUsage, info2.Value.massCapacity, lerpMassColor) : Color.white, lastMassFlashTime)); if (info.extraMassUsage != -1f) { TaggedString taggedString3 = info.extraMassUsage.ToStringEnsureThreshold(info.extraMassCapacity, 0) + " / " + info.extraMassCapacity.ToString("F0") + " " + "kg".Translate(); TaggedString taggedString4 = info2.HasValue ? (info2.Value.extraMassUsage.ToStringEnsureThreshold(info2.Value.extraMassCapacity, 0) + " / " + info2.Value.extraMassCapacity.ToString("F0") + " " + "kg".Translate()) : ((TaggedString)null); tmpInfo.Add(new TransferableUIUtility.ExtraInfo("CaravanMass".Translate(), taggedString3, GetMassColor(info.extraMassUsage, info.extraMassCapacity, lerpMassColor: true), GetMassTip(info.extraMassUsage, info.extraMassCapacity, info.extraMassCapacityExplanation, info2.HasValue ? new float?(info2.Value.extraMassUsage) : null, info2.HasValue ? new float?(info2.Value.extraMassCapacity) : null, info2.HasValue ? info2.Value.extraMassCapacityExplanation : null), taggedString4, info2.HasValue ? GetMassColor(info2.Value.extraMassUsage, info2.Value.extraMassCapacity, lerpMassColor: true) : Color.white)); } string text = "CaravanMovementSpeedTip".Translate(); if (!info.tilesPerDayExplanation.NullOrEmpty()) { text = text + "\n\n" + info.tilesPerDayExplanation; } if (info2.HasValue && !info2.Value.tilesPerDayExplanation.NullOrEmpty()) { text = text + "\n\n-----\n\n" + info2.Value.tilesPerDayExplanation; } tmpInfo.Add(new TransferableUIUtility.ExtraInfo("CaravanMovementSpeed".Translate(), info.tilesPerDay.ToString("0.#") + " " + "TilesPerDay".Translate(), GenUI.LerpColor(TilesPerDayColor, info.tilesPerDay), text, info2.HasValue ? (info2.Value.tilesPerDay.ToString("0.#") + " " + "TilesPerDay".Translate()) : ((TaggedString)null), info2.HasValue ? GenUI.LerpColor(TilesPerDayColor, info2.Value.tilesPerDay) : Color.white)); tmpInfo.Add(new TransferableUIUtility.ExtraInfo("DaysWorthOfFood".Translate(), GetDaysWorthOfFoodLabel(info.daysWorthOfFood, multiline), GetDaysWorthOfFoodColor(info.daysWorthOfFood, ticksToArrive), "DaysWorthOfFoodTooltip".Translate() + extraDaysWorthOfFoodTipInfo + "\n\n" + VirtualPlantsUtility.GetVirtualPlantsStatusExplanationAt(currentTile, Find.TickManager.TicksAbs), info2.HasValue ? GetDaysWorthOfFoodLabel(info2.Value.daysWorthOfFood, multiline) : null, info2.HasValue ? GetDaysWorthOfFoodColor(info2.Value.daysWorthOfFood, ticksToArrive) : Color.white)); string text2 = info.foragedFoodPerDay.Second.ToString("0.#"); string text3 = info2.HasValue ? info2.Value.foragedFoodPerDay.Second.ToString("0.#") : null; TaggedString taggedString5 = "ForagedFoodPerDayTip".Translate(); taggedString5 += "\n\n" + info.foragedFoodPerDayExplanation; if (info2.HasValue) { taggedString5 += "\n\n-----\n\n" + info2.Value.foragedFoodPerDayExplanation; } if (info.foragedFoodPerDay.Second > 0f || (info2.HasValue && info2.Value.foragedFoodPerDay.Second > 0f)) { string text4 = multiline ? "\n" : " "; if (!info2.HasValue) { text2 = text2 + text4 + "(" + info.foragedFoodPerDay.First.label + ")"; } else { text3 = text3 + text4 + "(" + info2.Value.foragedFoodPerDay.First.label.Truncate(50f) + ")"; } } tmpInfo.Add(new TransferableUIUtility.ExtraInfo("ForagedFoodPerDay".Translate(), text2, Color.white, taggedString5, text3, Color.white)); string text5 = "CaravanVisibilityTip".Translate(); if (!info.visibilityExplanation.NullOrEmpty()) { text5 = text5 + "\n\n" + info.visibilityExplanation; } if (info2.HasValue && !info2.Value.visibilityExplanation.NullOrEmpty()) { text5 = text5 + "\n\n-----\n\n" + info2.Value.visibilityExplanation; } tmpInfo.Add(new TransferableUIUtility.ExtraInfo("Visibility".Translate(), info.visibility.ToStringPercent(), GenUI.LerpColor(VisibilityColor, info.visibility), text5, info2.HasValue ? info2.Value.visibility.ToStringPercent() : null, info2.HasValue ? GenUI.LerpColor(VisibilityColor, info2.Value.visibility) : Color.white)); TransferableUIUtility.DrawExtraInfo(tmpInfo, rect); }
public static void DrawCaravanInfo(CaravanInfo info, CaravanInfo?info2, int currentTile, int?ticksToArrive, float lastMassFlashTime, Rect rect, bool lerpMassColor = true, string extraDaysWorthOfFoodTipInfo = null, bool multiline = false) { tmpInfo.Clear(); string text = info.massUsage.ToStringEnsureThreshold(info.massCapacity, 0) + " / " + info.massCapacity.ToString("F0") + " " + "kg".Translate(); object obj2; if (info2.HasValue) { string[] obj = new string[5]; CaravanInfo value = info2.Value; float massUsage = value.massUsage; CaravanInfo value2 = info2.Value; obj[0] = massUsage.ToStringEnsureThreshold(value2.massCapacity, 0); obj[1] = " / "; CaravanInfo value3 = info2.Value; obj[2] = value3.massCapacity.ToString("F0"); obj[3] = " "; obj[4] = "kg".Translate(); obj2 = string.Concat(obj); } else { obj2 = null; } string text2 = (string)obj2; List <TransferableUIUtility.ExtraInfo> list = tmpInfo; string key = "Mass".Translate(); string value4 = text; Color massColor = GetMassColor(info.massUsage, info.massCapacity, lerpMassColor); float massUsage2 = info.massUsage; float massCapacity = info.massCapacity; string massCapacityExplanation = info.massCapacityExplanation; float? massUsage3; if (info2.HasValue) { CaravanInfo value5 = info2.Value; massUsage3 = value5.massUsage; } else { massUsage3 = null; } float?massCapacity2; if (info2.HasValue) { CaravanInfo value6 = info2.Value; massCapacity2 = value6.massCapacity; } else { massCapacity2 = null; } object massCapacity2Explanation; if (info2.HasValue) { CaravanInfo value7 = info2.Value; massCapacity2Explanation = value7.massCapacityExplanation; } else { massCapacity2Explanation = null; } string massTip = GetMassTip(massUsage2, massCapacity, massCapacityExplanation, massUsage3, massCapacity2, (string)massCapacity2Explanation); string secondValue = text2; Color secondColor; if (info2.HasValue) { CaravanInfo value8 = info2.Value; float massUsage4 = value8.massUsage; CaravanInfo value9 = info2.Value; secondColor = GetMassColor(massUsage4, value9.massCapacity, lerpMassColor); } else { secondColor = Color.white; } list.Add(new TransferableUIUtility.ExtraInfo(key, value4, massColor, massTip, secondValue, secondColor, lastMassFlashTime)); if (info.extraMassUsage != -1f) { string text3 = info.extraMassUsage.ToStringEnsureThreshold(info.extraMassCapacity, 0) + " / " + info.extraMassCapacity.ToString("F0") + " " + "kg".Translate(); object obj4; if (info2.HasValue) { string[] obj3 = new string[5]; CaravanInfo value10 = info2.Value; float extraMassUsage = value10.extraMassUsage; CaravanInfo value11 = info2.Value; obj3[0] = extraMassUsage.ToStringEnsureThreshold(value11.extraMassCapacity, 0); obj3[1] = " / "; CaravanInfo value12 = info2.Value; obj3[2] = value12.extraMassCapacity.ToString("F0"); obj3[3] = " "; obj3[4] = "kg".Translate(); obj4 = string.Concat(obj3); } else { obj4 = null; } string text4 = (string)obj4; List <TransferableUIUtility.ExtraInfo> list2 = tmpInfo; string key2 = "CaravanMass".Translate(); string value13 = text3; Color massColor2 = GetMassColor(info.extraMassUsage, info.extraMassCapacity, lerpMassColor: true); float extraMassUsage2 = info.extraMassUsage; float extraMassCapacity = info.extraMassCapacity; string extraMassCapacityExplanation = info.extraMassCapacityExplanation; float? massUsage5; if (info2.HasValue) { CaravanInfo value14 = info2.Value; massUsage5 = value14.extraMassUsage; } else { massUsage5 = null; } float?massCapacity3; if (info2.HasValue) { CaravanInfo value15 = info2.Value; massCapacity3 = value15.extraMassCapacity; } else { massCapacity3 = null; } object massCapacity2Explanation2; if (info2.HasValue) { CaravanInfo value16 = info2.Value; massCapacity2Explanation2 = value16.extraMassCapacityExplanation; } else { massCapacity2Explanation2 = null; } string massTip2 = GetMassTip(extraMassUsage2, extraMassCapacity, extraMassCapacityExplanation, massUsage5, massCapacity3, (string)massCapacity2Explanation2); string secondValue2 = text4; Color secondColor2; if (info2.HasValue) { CaravanInfo value17 = info2.Value; float extraMassUsage3 = value17.extraMassUsage; CaravanInfo value18 = info2.Value; secondColor2 = GetMassColor(extraMassUsage3, value18.extraMassCapacity, lerpMassColor: true); } else { secondColor2 = Color.white; } list2.Add(new TransferableUIUtility.ExtraInfo(key2, value13, massColor2, massTip2, secondValue2, secondColor2)); } string text5 = "CaravanMovementSpeedTip".Translate(); if (!info.tilesPerDayExplanation.NullOrEmpty()) { text5 = text5 + "\n\n" + info.tilesPerDayExplanation; } if (info2.HasValue) { CaravanInfo value19 = info2.Value; if (!value19.tilesPerDayExplanation.NullOrEmpty()) { string str = text5; CaravanInfo value20 = info2.Value; text5 = str + "\n\n-----\n\n" + value20.tilesPerDayExplanation; } } List <TransferableUIUtility.ExtraInfo> list3 = tmpInfo; string key3 = "CaravanMovementSpeed".Translate(); string value21 = info.tilesPerDay.ToString("0.#") + " " + "TilesPerDay".Translate(); Color color = GenUI.LerpColor(TilesPerDayColor, info.tilesPerDay); string tip = text5; object secondValue3; if (info2.HasValue) { CaravanInfo value22 = info2.Value; secondValue3 = value22.tilesPerDay.ToString("0.#") + " " + "TilesPerDay".Translate(); } else { secondValue3 = null; } Color secondColor3; if (info2.HasValue) { List <Pair <float, Color> > tilesPerDayColor = TilesPerDayColor; CaravanInfo value23 = info2.Value; secondColor3 = GenUI.LerpColor(tilesPerDayColor, value23.tilesPerDay); } else { secondColor3 = Color.white; } list3.Add(new TransferableUIUtility.ExtraInfo(key3, value21, color, tip, (string)secondValue3, secondColor3)); List <TransferableUIUtility.ExtraInfo> list4 = tmpInfo; string key4 = "DaysWorthOfFood".Translate(); string daysWorthOfFoodLabel = GetDaysWorthOfFoodLabel(info.daysWorthOfFood, multiline); Color daysWorthOfFoodColor = GetDaysWorthOfFoodColor(info.daysWorthOfFood, ticksToArrive); string tip2 = "DaysWorthOfFoodTooltip".Translate() + extraDaysWorthOfFoodTipInfo + "\n\n" + VirtualPlantsUtility.GetVirtualPlantsStatusExplanationAt(currentTile, Find.TickManager.TicksAbs); object secondValue4; if (info2.HasValue) { CaravanInfo value24 = info2.Value; secondValue4 = GetDaysWorthOfFoodLabel(value24.daysWorthOfFood, multiline); } else { secondValue4 = null; } Color secondColor4; if (info2.HasValue) { CaravanInfo value25 = info2.Value; secondColor4 = GetDaysWorthOfFoodColor(value25.daysWorthOfFood, ticksToArrive); } else { secondColor4 = Color.white; } list4.Add(new TransferableUIUtility.ExtraInfo(key4, daysWorthOfFoodLabel, daysWorthOfFoodColor, tip2, (string)secondValue4, secondColor4)); string text6 = info.foragedFoodPerDay.Second.ToString("0.#"); object obj5; if (info2.HasValue) { CaravanInfo value26 = info2.Value; obj5 = value26.foragedFoodPerDay.Second.ToString("0.#"); } else { obj5 = null; } string text7 = (string)obj5; string str2 = "ForagedFoodPerDayTip".Translate(); str2 = str2 + "\n\n" + info.foragedFoodPerDayExplanation; if (info2.HasValue) { string str3 = str2; CaravanInfo value27 = info2.Value; str2 = str3 + "\n\n-----\n\n" + value27.foragedFoodPerDayExplanation; } if (info.foragedFoodPerDay.Second > 0f) { goto IL_06ad; } if (info2.HasValue) { CaravanInfo value28 = info2.Value; if (value28.foragedFoodPerDay.Second > 0f) { goto IL_06ad; } } goto IL_076b; IL_06ad: string text8 = (!multiline) ? " " : "\n"; if (!info2.HasValue) { string text9 = text6; text6 = text9 + text8 + "(" + info.foragedFoodPerDay.First.label + ")"; } else { string text9 = text7; string[] obj6 = new string[5] { text9, text8, "(", null, null }; CaravanInfo value29 = info2.Value; obj6[3] = value29.foragedFoodPerDay.First.label.Truncate(50f); obj6[4] = ")"; text7 = string.Concat(obj6); } goto IL_076b; IL_076b: tmpInfo.Add(new TransferableUIUtility.ExtraInfo("ForagedFoodPerDay".Translate(), text6, Color.white, str2, text7, Color.white)); string text10 = "CaravanVisibilityTip".Translate(); if (!info.visibilityExplanation.NullOrEmpty()) { text10 = text10 + "\n\n" + info.visibilityExplanation; } if (info2.HasValue) { CaravanInfo value30 = info2.Value; if (!value30.visibilityExplanation.NullOrEmpty()) { string str4 = text10; CaravanInfo value31 = info2.Value; text10 = str4 + "\n\n-----\n\n" + value31.visibilityExplanation; } } List <TransferableUIUtility.ExtraInfo> list5 = tmpInfo; string key5 = "Visibility".Translate(); string value32 = info.visibility.ToStringPercent(); Color color2 = GenUI.LerpColor(VisibilityColor, info.visibility); string tip3 = text10; object secondValue5; if (info2.HasValue) { CaravanInfo value33 = info2.Value; secondValue5 = value33.visibility.ToStringPercent(); } else { secondValue5 = null; } Color secondColor5; if (info2.HasValue) { List <Pair <float, Color> > visibilityColor = VisibilityColor; CaravanInfo value34 = info2.Value; secondColor5 = GenUI.LerpColor(visibilityColor, value34.visibility); } else { secondColor5 = Color.white; } list5.Add(new TransferableUIUtility.ExtraInfo(key5, value32, color2, tip3, (string)secondValue5, secondColor5)); TransferableUIUtility.DrawExtraInfo(tmpInfo, rect); }
public static void DrawCaravanInfo(CaravanUIUtility.CaravanInfo info, CaravanUIUtility.CaravanInfo?info2, int currentTile, int?ticksToArrive, float lastMassFlashTime, Rect rect, bool lerpMassColor = true, string extraDaysWorthOfFoodTipInfo = null, bool multiline = false) { CaravanUIUtility.tmpInfo.Clear(); string value = string.Concat(new string[] { info.massUsage.ToStringEnsureThreshold(info.massCapacity, 0), " / ", info.massCapacity.ToString("F0"), " ", "kg".Translate() }); string secondValue = (!info2.HasValue) ? null : string.Concat(new string[] { info2.Value.massUsage.ToStringEnsureThreshold(info2.Value.massCapacity, 0), " / ", info2.Value.massCapacity.ToString("F0"), " ", "kg".Translate() }); CaravanUIUtility.tmpInfo.Add(new TransferableUIUtility.ExtraInfo("Mass".Translate(), value, CaravanUIUtility.GetMassColor(info.massUsage, info.massCapacity, lerpMassColor), CaravanUIUtility.GetMassTip(info.massUsage, info.massCapacity, info.massCapacityExplanation, (!info2.HasValue) ? null : new float?(info2.Value.massUsage), (!info2.HasValue) ? null : new float?(info2.Value.massCapacity), (!info2.HasValue) ? null : info2.Value.massCapacityExplanation), secondValue, (!info2.HasValue) ? Color.white : CaravanUIUtility.GetMassColor(info2.Value.massUsage, info2.Value.massCapacity, lerpMassColor), lastMassFlashTime)); if (info.extraMassUsage != -1f) { string value2 = string.Concat(new string[] { info.extraMassUsage.ToStringEnsureThreshold(info.extraMassCapacity, 0), " / ", info.extraMassCapacity.ToString("F0"), " ", "kg".Translate() }); string secondValue2 = (!info2.HasValue) ? null : string.Concat(new string[] { info2.Value.extraMassUsage.ToStringEnsureThreshold(info2.Value.extraMassCapacity, 0), " / ", info2.Value.extraMassCapacity.ToString("F0"), " ", "kg".Translate() }); CaravanUIUtility.tmpInfo.Add(new TransferableUIUtility.ExtraInfo("CaravanMass".Translate(), value2, CaravanUIUtility.GetMassColor(info.extraMassUsage, info.extraMassCapacity, true), CaravanUIUtility.GetMassTip(info.extraMassUsage, info.extraMassCapacity, info.extraMassCapacityExplanation, (!info2.HasValue) ? null : new float?(info2.Value.extraMassUsage), (!info2.HasValue) ? null : new float?(info2.Value.extraMassCapacity), (!info2.HasValue) ? null : info2.Value.extraMassCapacityExplanation), secondValue2, (!info2.HasValue) ? Color.white : CaravanUIUtility.GetMassColor(info2.Value.extraMassUsage, info2.Value.extraMassCapacity, true), -9999f)); } string text = "CaravanMovementSpeedTip".Translate(); if (!info.tilesPerDayExplanation.NullOrEmpty()) { text = text + "\n\n" + info.tilesPerDayExplanation; } if (info2.HasValue && !info2.Value.tilesPerDayExplanation.NullOrEmpty()) { text = text + "\n\n-----\n\n" + info2.Value.tilesPerDayExplanation; } CaravanUIUtility.tmpInfo.Add(new TransferableUIUtility.ExtraInfo("CaravanMovementSpeed".Translate(), info.tilesPerDay.ToString("0.#") + " " + "TilesPerDay".Translate(), GenUI.LerpColor(CaravanUIUtility.TilesPerDayColor, info.tilesPerDay), text, (!info2.HasValue) ? null : (info2.Value.tilesPerDay.ToString("0.#") + " " + "TilesPerDay".Translate()), (!info2.HasValue) ? Color.white : GenUI.LerpColor(CaravanUIUtility.TilesPerDayColor, info2.Value.tilesPerDay), -9999f)); CaravanUIUtility.tmpInfo.Add(new TransferableUIUtility.ExtraInfo("DaysWorthOfFood".Translate(), CaravanUIUtility.GetDaysWorthOfFoodLabel(info.daysWorthOfFood, multiline), CaravanUIUtility.GetDaysWorthOfFoodColor(info.daysWorthOfFood, ticksToArrive), "DaysWorthOfFoodTooltip".Translate() + extraDaysWorthOfFoodTipInfo + "\n\n" + VirtualPlantsUtility.GetVirtualPlantsStatusExplanationAt(currentTile, Find.TickManager.TicksAbs), (!info2.HasValue) ? null : CaravanUIUtility.GetDaysWorthOfFoodLabel(info2.Value.daysWorthOfFood, multiline), (!info2.HasValue) ? Color.white : CaravanUIUtility.GetDaysWorthOfFoodColor(info2.Value.daysWorthOfFood, ticksToArrive), -9999f)); string text2 = info.foragedFoodPerDay.Second.ToString("0.#"); string text3 = (!info2.HasValue) ? null : info2.Value.foragedFoodPerDay.Second.ToString("0.#"); string text4 = "ForagedFoodPerDayTip".Translate(); text4 = text4 + "\n\n" + info.foragedFoodPerDayExplanation; if (info2.HasValue) { text4 = text4 + "\n\n-----\n\n" + info2.Value.foragedFoodPerDayExplanation; } if (info.foragedFoodPerDay.Second > 0f || (info2.HasValue && info2.Value.foragedFoodPerDay.Second > 0f)) { string text5 = (!multiline) ? " " : "\n"; if (!info2.HasValue) { string text6 = text2; text2 = string.Concat(new string[] { text6, text5, "(", info.foragedFoodPerDay.First.label, ")" }); } else { string text6 = text3; text3 = string.Concat(new string[] { text6, text5, "(", info2.Value.foragedFoodPerDay.First.label.Truncate(50f, null), ")" }); } } CaravanUIUtility.tmpInfo.Add(new TransferableUIUtility.ExtraInfo("ForagedFoodPerDay".Translate(), text2, Color.white, text4, text3, Color.white, -9999f)); string text7 = "CaravanVisibilityTip".Translate(); if (!info.visibilityExplanation.NullOrEmpty()) { text7 = text7 + "\n\n" + info.visibilityExplanation; } if (info2.HasValue && !info2.Value.visibilityExplanation.NullOrEmpty()) { text7 = text7 + "\n\n-----\n\n" + info2.Value.visibilityExplanation; } CaravanUIUtility.tmpInfo.Add(new TransferableUIUtility.ExtraInfo("Visibility".Translate(), info.visibility.ToStringPercent(), GenUI.LerpColor(CaravanUIUtility.VisibilityColor, info.visibility), text7, (!info2.HasValue) ? null : info2.Value.visibility.ToStringPercent(), (!info2.HasValue) ? Color.white : GenUI.LerpColor(CaravanUIUtility.VisibilityColor, info2.Value.visibility), -9999f)); TransferableUIUtility.DrawExtraInfo(CaravanUIUtility.tmpInfo, rect); }