public string GetFormattedString(GameObject parent_instance) { IAttributeFormatter attributeFormatter = null; Attribute attribute = Db.Get().Attributes.TryGet(AttributeId); if (!IsMultiplier) { if (attribute != null) { attributeFormatter = attribute.formatter; } else { attribute = Db.Get().BuildingAttributes.TryGet(AttributeId); if (attribute != null) { attributeFormatter = attribute.formatter; } } } string empty = string.Empty; empty = ((attributeFormatter != null) ? attributeFormatter.GetFormattedModifier(this, parent_instance) : ((!IsMultiplier) ? (empty + GameUtil.GetFormattedSimple(Value, GameUtil.TimeSlice.None, null)) : (empty + GameUtil.GetFormattedPercent(Value * 100f, GameUtil.TimeSlice.None)))); if (empty != null && empty.Length > 0 && empty[0] != '-') { empty = GameUtil.AddPositiveSign(empty, Value > 0f); } return(empty); }
public List <Descriptor> GetEffectDescriptions() { List <Descriptor> list = new List <Descriptor>(); if (decor != null && decorRadius != null) { float totalValue = decor.GetTotalValue(); float totalValue2 = decorRadius.GetTotalValue(); string arg = (!(baseDecor > 0f)) ? "consumed" : "produced"; string str = (!(baseDecor > 0f)) ? UI.BUILDINGEFFECTS.TOOLTIPS.DECORDECREASED : UI.BUILDINGEFFECTS.TOOLTIPS.DECORPROVIDED; str = str + "\n\n" + decor.GetAttributeValueTooltip(); string text = GameUtil.AddPositiveSign(totalValue.ToString(), totalValue > 0f); Descriptor item = new Descriptor(string.Format(UI.BUILDINGEFFECTS.DECORPROVIDED, arg, text, totalValue2), string.Format(str, text, totalValue2), Descriptor.DescriptorType.Effect, false); list.Add(item); } else if (baseDecor != 0f) { string arg2 = (!(baseDecor >= 0f)) ? "consumed" : "produced"; string format = (!(baseDecor >= 0f)) ? UI.BUILDINGEFFECTS.TOOLTIPS.DECORDECREASED : UI.BUILDINGEFFECTS.TOOLTIPS.DECORPROVIDED; string text2 = GameUtil.AddPositiveSign(baseDecor.ToString(), baseDecor > 0f); Descriptor item2 = new Descriptor(string.Format(UI.BUILDINGEFFECTS.DECORPROVIDED, arg2, text2, baseRadius), string.Format(format, text2, baseRadius), Descriptor.DescriptorType.Effect, false); list.Add(item2); } return(list); }
public string DescriptionFromAttribute(float value, GameObject go) { string text = (formatter != null) ? formatter.GetFormattedValue(value, formatter.DeltaTimeSlice, go) : ((attribute.formatter == null) ? GameUtil.GetFormattedSimple(value, GameUtil.TimeSlice.None, null) : attribute.formatter.GetFormattedValue(value, attribute.formatter.DeltaTimeSlice, go)); if (text != null) { text = GameUtil.AddPositiveSign(text, value > 0f); return(string.Format(description, text)); } return(null); }
private static void Postfix(CarePackageInfo ___info, ref string __result) { var a = Assets.GetPrefab(___info.id.ToTag())?.GetComponent <SpaceArtifact>()?.GetArtifactTier(); if (a != null) { var value = a.decorValues.amount; string decorString = GameUtil.AddPositiveSign(value.ToString(), value > 0f); __result = string.Concat(__result, "\n", string.Format(UI.BUILDINGEFFECTS.DECORPROVIDED, "", decorString, a.decorValues.radius)); } }
public List <Descriptor> GetEffectDescriptions() { List <Descriptor> list = new List <Descriptor>(); if (dB != null && dBRadius != null) { float totalValue = dB.GetTotalValue(); float totalValue2 = dBRadius.GetTotalValue(); string str = (noise <= 0) ? UI.BUILDINGEFFECTS.TOOLTIPS.NOISE_POLLUTION_DECREASE : UI.BUILDINGEFFECTS.TOOLTIPS.NOISE_POLLUTION_INCREASE; str = str + "\n\n" + dB.GetAttributeValueTooltip(); string arg = GameUtil.AddPositiveSign(totalValue.ToString(), totalValue > 0f); Descriptor item = new Descriptor(string.Format(UI.BUILDINGEFFECTS.NOISE_CREATED, arg, totalValue2), string.Format(str, arg, totalValue2), Descriptor.DescriptorType.Effect, false); list.Add(item); } else if (noise != 0) { string format = (noise < 0) ? UI.BUILDINGEFFECTS.TOOLTIPS.NOISE_POLLUTION_DECREASE : UI.BUILDINGEFFECTS.TOOLTIPS.NOISE_POLLUTION_INCREASE; string arg2 = GameUtil.AddPositiveSign(noise.ToString(), noise > 0); Descriptor item2 = new Descriptor(string.Format(UI.BUILDINGEFFECTS.NOISE_CREATED, arg2, radius), string.Format(format, arg2, radius), Descriptor.DescriptorType.Effect, false); list.Add(item2); } return(list); }
private void on_tooltip_consumable_info(IAssignableIdentity minion, GameObject widget_go, ToolTip tooltip) { tooltip.ClearMultiStringTooltip(); ConsumableInfoTableColumn consumableInfoTableColumn = GetWidgetColumn(widget_go) as ConsumableInfoTableColumn; TableRow widgetRow = GetWidgetRow(widget_go); EdiblesManager.FoodInfo foodInfo = consumableInfoTableColumn.consumable_info as EdiblesManager.FoodInfo; int num = 0; if (foodInfo != null) { int num2 = foodInfo.Quality; MinionIdentity minionIdentity = minion as MinionIdentity; if ((UnityEngine.Object)minionIdentity != (UnityEngine.Object)null) { AttributeInstance attributeInstance = minionIdentity.GetAttributes().Get(Db.Get().Attributes.FoodExpectation); num2 += Mathf.RoundToInt(attributeInstance.GetTotalValue()); } string effectForFoodQuality = Edible.GetEffectForFoodQuality(num2); Effect effect = Db.Get().effects.Get(effectForFoodQuality); foreach (AttributeModifier selfModifier in effect.SelfModifiers) { if (selfModifier.AttributeId == Db.Get().Attributes.QualityOfLife.Id) { num += Mathf.RoundToInt(selfModifier.Value); } } } switch (widgetRow.rowType) { case TableRow.RowType.Header: tooltip.AddMultiStringTooltip(consumableInfoTableColumn.consumable_info.ConsumableName, null); if (foodInfo != null) { tooltip.AddMultiStringTooltip(string.Format(UI.CONSUMABLESSCREEN.FOOD_AVAILABLE, GameUtil.GetFormattedCalories(WorldInventory.Instance.GetAmount(consumableInfoTableColumn.consumable_info.ConsumableId.ToTag()) * foodInfo.CaloriesPerUnit, GameUtil.TimeSlice.None, true)), null); tooltip.AddMultiStringTooltip(string.Format(UI.CONSUMABLESSCREEN.FOOD_QUALITY, GameUtil.AddPositiveSign(num.ToString(), num > 0)), null); tooltip.AddMultiStringTooltip("\n" + foodInfo.Description, null); } else { tooltip.AddMultiStringTooltip(string.Format(UI.CONSUMABLESSCREEN.FOOD_AVAILABLE, GameUtil.GetFormattedUnits(WorldInventory.Instance.GetAmount(consumableInfoTableColumn.consumable_info.ConsumableId.ToTag()), GameUtil.TimeSlice.None, true)), null); } break; case TableRow.RowType.Default: if (consumableInfoTableColumn.get_value_action(minion, widget_go) == ResultValues.True) { tooltip.AddMultiStringTooltip(string.Format(UI.CONSUMABLESSCREEN.NEW_MINIONS_FOOD_PERMISSION_ON, consumableInfoTableColumn.consumable_info.ConsumableName), null); } else { tooltip.AddMultiStringTooltip(string.Format(UI.CONSUMABLESSCREEN.NEW_MINIONS_FOOD_PERMISSION_OFF, consumableInfoTableColumn.consumable_info.ConsumableName), null); } break; case TableRow.RowType.Minion: case TableRow.RowType.StoredMinon: if (minion != null) { if (consumableInfoTableColumn.get_value_action(minion, widget_go) == ResultValues.True) { tooltip.AddMultiStringTooltip(string.Format(UI.CONSUMABLESSCREEN.FOOD_PERMISSION_ON, minion.GetProperName(), consumableInfoTableColumn.consumable_info.ConsumableName), null); } else { tooltip.AddMultiStringTooltip(string.Format(UI.CONSUMABLESSCREEN.FOOD_PERMISSION_OFF, minion.GetProperName(), consumableInfoTableColumn.consumable_info.ConsumableName), null); } if (foodInfo != null && (UnityEngine.Object)(minion as MinionIdentity) != (UnityEngine.Object)null) { tooltip.AddMultiStringTooltip(string.Format(UI.CONSUMABLESSCREEN.FOOD_QUALITY_VS_EXPECTATION, GameUtil.AddPositiveSign(num.ToString(), num > 0), minion.GetProperName()), null); } else if ((UnityEngine.Object)(minion as StoredMinionIdentity) != (UnityEngine.Object)null) { tooltip.AddMultiStringTooltip(string.Format(UI.CONSUMABLESSCREEN.CANNOT_ADJUST_PERMISSIONS, (minion as StoredMinionIdentity).GetStorageReason()), null); } } break; } }
public List <Descriptor> GetDescriptors(BuildingDef def) { List <Descriptor> list = null; if (movementSpeedMultiplier != 1f) { list = new List <Descriptor>(); Descriptor item = default(Descriptor); item.SetupDescriptor(string.Format(UI.BUILDINGEFFECTS.DUPLICANTMOVEMENTBOOST, GameUtil.AddPositiveSign(GameUtil.GetFormattedPercent(movementSpeedMultiplier * 100f - 100f, GameUtil.TimeSlice.None), movementSpeedMultiplier - 1f >= 0f)), string.Format(UI.BUILDINGEFFECTS.TOOLTIPS.DUPLICANTMOVEMENTBOOST, GameUtil.GetFormattedPercent(movementSpeedMultiplier * 100f - 100f, GameUtil.TimeSlice.None)), Descriptor.DescriptorType.Effect); list.Add(item); } return(list); }