private void RefreshPopulationCount() { float propertyValue = this.City.GetPropertyValue(SimulationProperties.Population); float propertyValue2 = this.City.GetPropertyValue(SimulationProperties.PopulationBonus); this.PopulationCount.Text = GuiFormater.FormatGui(propertyValue, false, true, false, 1) + " + " + GuiFormater.FormatGui(propertyValue2, false, true, false, 1); }
public void SetupPortrait(Kaiju kaiju, Empire playerEmpire) { this.Kaiju = kaiju; if (this.Portrait != null) { IGuiPanelHelper guiPanelHelper = Services.GetService <global::IGuiService>().GuiPanelHelper; Diagnostics.Assert(guiPanelHelper != null, "Unable to access GuiPanelHelper"); Texture2D image; if (guiPanelHelper.TryGetTextureFromIcon(this.KaijuGuiElement, global::GuiPanel.IconSize.Large, out image)) { this.Portrait.Image = image; } } Amplitude.Unity.Gui.IGuiService service = Services.GetService <global::IGuiService>(); Diagnostics.Assert(service != null); KaijuTameCost kaijuTameCost = KaijuCouncil.GetKaijuTameCost(); this.CostGroup.Visible = this.Kaiju.IsWild(); KaijuCouncil agency = this.Kaiju.KaijuEmpire.GetAgency <KaijuCouncil>(); this.CostValue.Text = GuiFormater.FormatGui(kaijuTameCost.GetValue(playerEmpire), false, true, false, 0) + service.FormatSymbol(ELCPUtilities.UseELCPSymbiosisBuffs ? agency.ELCPResourceName : kaijuTameCost.ResourceName); if (this.Background != null) { this.Background.TintColor = this.Kaiju.Empire.Color; } this.AgeTransform.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString(KaijuTechPortrait.PortraitClickTooltip); }
private void RefreshPopulationGrowth() { float propertyValue = this.City.GetPropertyValue(SimulationProperties.Population); float propertyValue2 = this.City.GetPropertyValue(SimulationProperties.CityGrowthStock); float propertyValue3 = this.City.GetPropertyValue(SimulationProperties.NetCityGrowth); DepartmentOfTheInterior agency = this.City.Empire.GetAgency <DepartmentOfTheInterior>(); float num; float num2; agency.GetGrowthLimits(propertyValue, out num, out num2); this.GaugePopulation.PercentRight = Mathf.Clamp((propertyValue2 - num) / (num2 - num) * 100f, 0f, 100f); float num3 = Mathf.Round(100f * propertyValue3 / (num2 - num)); if (num3 > 0f) { this.GaugeProgress.Visible = true; this.GaugeProgress.GetComponent <AgePrimitiveImage>().TintColor = this.GrowingPopulationColor; this.GaugeProgress.PercentLeft = this.GaugePopulation.PercentRight; this.GaugeProgress.PercentRight = Mathf.Min(100f, this.GaugeProgress.PercentLeft + num3); this.NextPopulationTurns.Text = GuiFormater.FormatGui((float)Mathf.Max(1, Mathf.CeilToInt((num2 - propertyValue2) / propertyValue3)), false, true, false, 1); } else if (num3 < 0f) { this.GaugeProgress.Visible = true; this.GaugeProgress.GetComponent <AgePrimitiveImage>().TintColor = this.LosingPopulationColor; this.GaugeProgress.PercentRight = this.GaugePopulation.PercentRight; this.GaugeProgress.PercentLeft = Mathf.Max(0f, this.GaugeProgress.PercentRight + num3); this.NextPopulationTurns.Text = GuiFormater.FormatGui((float)Mathf.Max(1, Mathf.CeilToInt((propertyValue2 - num) / -propertyValue3)), false, true, false, 1); } else { this.GaugeProgress.Visible = false; this.NextPopulationTurns.Text = "-"; } }
public void DisplayCost(AgePrimitiveLabel costLabel) { string text = string.Empty; text = GuiFormater.FormatInstantCost(this.Term.EmpireWhichProposes, this.EmpirePointCost, DepartmentOfTheTreasury.Resources.EmpirePoint, false, 0); costLabel.Text = text; }
private void AnimateFIDSChange(AgePrimitiveLabel control, AgePrimitiveLabel modifier, float delta) { modifier.Text = GuiFormater.FormatGui(delta, false, true, true, 1); modifier.TintColor = ((delta < 0f) ? Color.red : Color.green); control.AgeTransform.StartAllModifiers(true, false); modifier.AgeTransform.StartAllModifiers(true, false); }
private void RefreshEmpirePoints() { float stockValue; if (!this.departmentOfTheTreasury.TryGetResourceStockValue(base.Empire.SimulationObject, DepartmentOfTheTreasury.Resources.EmpirePoint, out stockValue, false)) { Diagnostics.LogError("Can't get resource stock value {0} on simulation object {1}.", new object[] { DepartmentOfTheTreasury.Resources.EmpirePoint, base.Empire.SimulationObject }); } float netValue; this.departmentOfTheTreasury.TryGetNetResourceValue(base.Empire.SimulationObject, DepartmentOfTheTreasury.Resources.EmpirePoint, out netValue, false); this.EmpirePointsValue.Text = GuiFormater.FormatStockAndNet(stockValue, netValue, SimulationProperties.EmpirePoint, true); if (this.EmpirePointsValue.TextLines.Count > 1) { this.EmpirePointsValue.AgeTransform.Visible = false; this.EmpirePointsValueSmall.AgeTransform.Visible = true; this.EmpirePointsValueSmall.Text = GuiFormater.FormatStockAndNet(stockValue, netValue, SimulationProperties.EmpirePoint, true); } else { this.EmpirePointsValue.AgeTransform.Visible = true; this.EmpirePointsValueSmall.AgeTransform.Visible = false; } }
private string FormatEmpirePoints(global::Empire empire, bool withNet = false) { DepartmentOfTheTreasury agency = empire.GetAgency <DepartmentOfTheTreasury>(); float stockValue; if (!agency.TryGetResourceStockValue(empire.SimulationObject, DepartmentOfTheTreasury.Resources.EmpirePoint, out stockValue, false)) { Diagnostics.LogError("Can't get resource stock value {0} on simulation object {1}.", new object[] { DepartmentOfTheTreasury.Resources.EmpirePoint, empire.SimulationObject }); } if (!withNet) { return(GuiFormater.FormatStock(stockValue, SimulationProperties.EmpirePoint, 1, false)); } float netValue; if (!agency.TryGetNetResourceValue(empire.SimulationObject, DepartmentOfTheTreasury.Resources.EmpirePoint, out netValue, false)) { Diagnostics.LogError("Can't get resource net value {0} on simulation object {1}.", new object[] { DepartmentOfTheTreasury.Resources.EmpirePoint, empire.SimulationObject }); } return(GuiFormater.FormatStockAndNet(stockValue, netValue, SimulationProperties.EmpirePoint, false)); }
public static string FormatInstantCost(Empire empire, float cost, StaticString resourceName, bool monochromatic = false, int decimals = 1) { DepartmentOfTheTreasury agency = empire.GetAgency <DepartmentOfTheTreasury>(); float num; if (!agency.TryGetResourceStockValue(empire.SimulationObject, resourceName, out num, false)) { Diagnostics.Log("Can't get resource stock value {0} on simulation object {1}.", new object[] { resourceName, empire.SimulationObject.Name }); } StringBuilder stringBuilder = new StringBuilder(); bool flag = false; if (!monochromatic && num < cost) { AgeUtils.ColorToHexaKey(Color.red, ref stringBuilder, false); flag = true; } stringBuilder.Append(GuiFormater.FormatGui(cost, false, decimals == 0, false, decimals)); if (!monochromatic && flag) { stringBuilder.Append("#REVERT#"); } stringBuilder.Append(" "); stringBuilder.Append(Services.GetService <IGuiService>().FormatSymbol(resourceName)); return(stringBuilder.ToString()); }
private void RefreshParticipantScoreLine(AgeTransform tableitem, EmpireInfo empireInfo, int index) { tableitem.SetupCustomELCPScaling(this.ParticipantsScoreTableScale); if (this.visibleEmpires.Contains(empireInfo.EmpireIndex)) { tableitem.Visible = true; ParticipantScoreLine component = tableitem.GetComponent <ParticipantScoreLine>(); component.ParticipantName.AgeTransform.SetupCustomELCPScaling(this.ParticipantsScoreTableScale); component.ParticipantScore.AgeTransform.SetupCustomELCPScaling(this.ParticipantsScoreTableScale); component.ParticipantLogoBackground.TintColor = empireInfo.FactionColor; component.ParticipantName.Text = empireInfo.LocalizedName; GuiFaction guiFaction = new GuiFaction(empireInfo.Faction); component.ParticipantLogo.Image = guiFaction.GetImageTexture(GuiPanel.IconSize.LogoLarge, true); Snapshot[] snapshots = this.Snapshot.Snapshots; string name = string.Format("Turn #{0}", snapshots.Length - 1); Snapshot snapshot; Snapshot snapshot2; if (this.Snapshot.TryGetSnapshot(name, out snapshot) && snapshot.TryGetSnapshot(empireInfo.EmpireName, out snapshot2)) { float num; snapshot2.TryRead(this.CurrentScoreDefinition.Name, out num); string str = ""; int decimals = 0; component.ParticipantScore.WordWrap = false; if (num >= 1000f) { str = "k"; if (num <= 10000f) { num = Mathf.Round(num / 100f); num /= 10f; decimals = 1; } else if (num <= 999999f) { num = Mathf.Round(num / 1000f); } else if (num <= 9999999f) { num = Mathf.Round(num / 100000f); num /= 10f; str = "M"; decimals = 1; } else if (num > 9999999f) { num = Mathf.Round(num / 1000000f); str = "M"; } } component.ParticipantScore.Text = GuiFormater.FormatGui(num, false, false, false, decimals) + str; return; } } else { tableitem.Visible = false; } }
public static string FormatStock(float stockValue, StaticString resourceName, int decimals = 1, bool useKilo = false) { if (useKilo) { return(string.Format("{0} {1}", (stockValue < 1000f) ? GuiFormater.FormatGui(Mathf.Floor(stockValue), false, false, false, 0) : ((stockValue < 10000f) ? (GuiFormater.FormatGui(Mathf.Floor(stockValue / 1000f), false, false, false, 0) + "." + GuiFormater.FormatGui(Mathf.Floor(stockValue % 1000f / 100f), false, false, false, 0) + "k") : (GuiFormater.FormatGui(Mathf.Floor(stockValue / 1000f), false, false, false, 0) + "k")), Services.GetService <IGuiService>().FormatSymbol(resourceName))); } return(string.Format("{0} {1}", GuiFormater.FormatGui(Mathf.Floor(stockValue), false, false, true, 0), Services.GetService <IGuiService>().FormatSymbol(resourceName))); }
private string GetFormattedPrice(Tradable tradable, int quantity) { float priceWithSalesTaxes = tradable.GetPriceWithSalesTaxes(TradableTransactionType.Buyout, base.Empire, (float)quantity); ConstructionCost[] costs = new ConstructionCost[] { new ConstructionCost(DepartmentOfTheTreasury.Resources.EmpireMoney, priceWithSalesTaxes, true, false) }; return(GuiFormater.FormatCost(base.Empire, costs, false, 1, null)); }
public static void ComputeCostAndTurn(Amplitude.Unity.Gui.IGuiService guiService, ReadOnlyCollection <Construction> constructibles, DepartmentOfTheTreasury departmentOfTheTreasury, SimulationObjectWrapper context, out string costString, out int turn) { PanelFeatureCost.costByResource.Clear(); for (int i = 0; i < constructibles.Count; i++) { ConstructibleElement constructibleElement = constructibles[i].ConstructibleElement; if (constructibleElement.Costs != null) { if (constructibleElement is TechnologyDefinition && context.SimulationObject.Tags.Contains(FactionTrait.FactionTraitReplicants1) && (constructibleElement as TechnologyDefinition).TechnologyFlags != DepartmentOfScience.ConstructibleElement.TechnologyFlag.OrbUnlock && (constructibleElement as TechnologyDefinition).TechnologyFlags != DepartmentOfScience.ConstructibleElement.TechnologyFlag.KaijuUnlock) { costString = string.Empty; turn = -1; global::Empire empire = context as global::Empire; if (empire == null) { Diagnostics.LogError("Empire is null."); return; } DepartmentOfScience agency = empire.GetAgency <DepartmentOfScience>(); if (agency == null) { Diagnostics.LogError("Department of science is null"); return; } float buyOutTechnologyCost = agency.GetBuyOutTechnologyCost(constructibleElement); if (buyOutTechnologyCost != 3.40282347E+38f) { costString = GuiFormater.FormatInstantCost(empire, buyOutTechnologyCost, DepartmentOfTheTreasury.Resources.EmpireMoney, true, 0); return; } costString = "-"; return; } else { for (int j = 0; j < constructibleElement.Costs.Length; j++) { if (constructibleElement.Costs[j] is PopulationConstructionCost) { PopulationConstructionCost populationConstructionCost = constructibleElement.Costs[j] as PopulationConstructionCost; PanelFeatureCost.AppendCost(SimulationProperties.Population, populationConstructionCost.PopulationValue, true); } else { float productionCostWithBonus = DepartmentOfTheTreasury.GetProductionCostWithBonus(context, constructibleElement, constructibleElement.Costs[j], true); PanelFeatureCost.AppendCost(constructibleElement.Costs[j].ResourceName, productionCostWithBonus, constructibleElement.Costs[j].Instant || constructibleElement.Costs[j].InstantOnCompletion); } } } } } PanelFeatureCost.GetCostAndTurn(guiService, departmentOfTheTreasury, context, out costString, out turn); }
private void ChangeQuantityIfValid() { this.ClampEnteredQuantity(); if (this.CheckQuantityValidity()) { float f; float.TryParse(this.QuantityTextField.AgePrimitiveLabel.Text, out f); this.CurrentQuantity = Mathf.FloorToInt(f); } else { this.QuantityTextField.ReplaceInputText(GuiFormater.FormatGui(this.CurrentQuantity)); } }
public void RefreshContent() { if (this.empire == null) { Diagnostics.LogWarning("Trying to refresh a BoosterStock while the current empire is null"); return; } this.IconImage.Image = this.guiStackedBooster.IconTexture; this.IconImage.TintColor = this.guiStackedBooster.IconColor; this.QuantityLabel.Text = GuiFormater.FormatGui(Mathf.Floor((float)this.guiStackedBooster.Quantity), false, false, false, 1); this.AgeTransform.AgeTooltip.Class = this.guiStackedBooster.BoosterDefinition.TooltipClass; this.AgeTransform.AgeTooltip.Content = this.guiStackedBooster.BoosterDefinition.Name; this.AgeTransform.AgeTooltip.ClientData = this.guiStackedBooster; this.RefreshBoosterAvailability(); }
private void RefreshForceShiftingButton() { if (this.ForceShiftButton == null || this.Garrison == null || this.Garrison.Empire == null) { return; } this.ForceShiftButton.Visible = false; this.ForceShiftButton.Enable = false; if (this.IsOtherEmpire || !this.interactionsAllowed) { return; } DepartmentOfScience agency = this.Garrison.Empire.GetAgency <DepartmentOfScience>(); if (agency == null || agency.GetTechnologyState("TechnologyDefinitionOrbUnlock17WinterShifters") != DepartmentOfScience.ConstructibleElement.State.Researched) { return; } if (this.selectedUnits.Count > 0) { List <Unit> list = new List <Unit>(this.selectedUnits); list.RemoveAll((Unit match) => !match.IsShifter() || !match.IsInCurrentSeasonForm()); if (list.Count > 0) { ConstructionCost[] unitForceShiftingCost = this.DepartmentOfTheTreasury.GetUnitForceShiftingCost(list); AgeUtils.CleanLine(GuiFormater.FormatCost(this.garrison.Empire, unitForceShiftingCost, false, 1, null), ref this.monochromaticFormat); this.ForceShiftButtonPriceLabel.Text = GuiFormater.FormatCost(this.garrison.Empire, unitForceShiftingCost, false, 0, null); this.ForceShiftButton.Visible = true; if (this.DepartmentOfTheTreasury.CanAfford(unitForceShiftingCost)) { if (!this.garrison.IsInEncounter) { this.ForceShiftButton.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%ForceShiftTabOKFormat").Replace("$Value", this.monochromaticFormat.ToString()); this.ForceShiftButton.Enable = true; } else { this.ForceShiftButton.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%ArmyLockedInBattleDescription"); } } else { this.ForceShiftButton.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%ForceShiftTabCannotAffordDescription") + " : " + this.monochromaticFormat; } } } }
protected virtual void DisplayPriceLevel() { this.PriceLevelLabel.Text = GuiFormater.FormatGui(this.PriceLevel, false, false, true, 1); string priceLevelName = this.GetPriceLevelName(); GuiElement guiElement; if (!this.guiPanelHelper.TryGetGuiElement(priceLevelName, out guiElement)) { Diagnostics.LogError("Cannot find a GuiElement for the price level {0}", new object[] { priceLevelName }); return; } Texture2D image; if (!this.guiPanelHelper.TryGetTextureFromIcon(guiElement, global::GuiPanel.IconSize.Large, out image)) { Diagnostics.LogError("Cannot find a texture for the large icon of GuiElement {0}", new object[] { guiElement.Name }); return; } this.PriceLevelImage.Image = image; AgeTooltip ageTooltip = this.PriceLevelGroup.GetComponent <AgeTransform>().AgeTooltip; if (ageTooltip != null) { float referencePriceWithSalesTaxes = this.Tradable.GetReferencePriceWithSalesTaxes(TradableTransactionType.Buyout, this.empire); ageTooltip.Content = string.Concat(new string[] { AgeLocalizer.Instance.LocalizeString("%MarketplaceTradableMaximumPrice"), ": ", GuiFormater.FormatGui(referencePriceWithSalesTaxes * Tradable.MaximumPriceMultiplier, false, false, false, 1), "\n", AgeLocalizer.Instance.LocalizeString("%MarketplaceTradableStandardPrice"), ": ", GuiFormater.FormatGui(referencePriceWithSalesTaxes, false, false, false, 1), "\n", AgeLocalizer.Instance.LocalizeString("%MarketplaceTradableMinimumPrice"), ": ", GuiFormater.FormatGui(referencePriceWithSalesTaxes * Tradable.MinimumPriceMultiplier, false, false, false, 1) }); } }
public static string FormatCost(Empire empire, IConstructionCost[] costs, bool monochromatic = false, int decimals = 1, SimulationObject context = null) { DepartmentOfTheTreasury agency = empire.GetAgency <DepartmentOfTheTreasury>(); if (context == null) { context = empire.SimulationObject; } StringBuilder stringBuilder = new StringBuilder(); if (costs != null) { bool flag = false; for (int i = 0; i < costs.Length; i++) { float value = costs[i].GetValue(empire); if (stringBuilder.Length > 0) { stringBuilder.Append(" "); } float num; if (!agency.TryGetResourceStockValue(context, costs[i].ResourceName, out num, false)) { Diagnostics.Log("Can't get resource stock value {0} on simulation object {1}.", new object[] { costs[i].ResourceName, empire.SimulationObject.Name }); } if (!monochromatic && (costs[i].Instant || costs[i].InstantOnCompletion) && num < value) { AgeUtils.ColorToHexaKey(Color.red, ref stringBuilder, false); flag = true; } stringBuilder.Append(GuiFormater.FormatGui(value, false, decimals == 0, false, decimals)); if (!monochromatic && flag) { stringBuilder.Append("#REVERT#"); flag = false; } stringBuilder.Append(" "); stringBuilder.Append(Services.GetService <IGuiService>().FormatSymbol(costs[i].ResourceName)); } } return(stringBuilder.ToString()); }
public override void RefreshContent() { base.RefreshContent(); if (this.City == null) { Diagnostics.LogError("Trying to refresh CityManagementPanel while not bound to a city"); return; } this.IsOtherEmpire = (this.playerControllerRepository.ActivePlayerController.Empire != this.City.Empire); int count = this.City.CityImprovements.Count; int num = Mathf.CeilToInt(this.City.GetPropertyValue(SimulationProperties.CityMoneyUpkeep)); this.NumberValue.Text = count.ToString(); this.UpkeepValue.Text = GuiFormater.FormatQuantity((float)num, SimulationProperties.CityMoneyUpkeep, 1); ReadOnlyCollection <CityImprovement> cityImprovements = this.City.CityImprovements; this.CityImprovementsTable.Height = 0f; this.CityImprovementsTable.ReserveChildren(count, this.BuildingPrefab, "Item"); this.CityImprovementsTable.RefreshChildrenIList <CityImprovement>(cityImprovements, this.refreshCityImprovementDelegate, true, true); this.CityImprovementsTable.ArrangeChildren(); this.CityImprovementsScrollView.OnPositionRecomputed(); PointOfInterest[] pointOfInterests = this.City.Region.PointOfInterests; this.regionBuildings.Clear(); for (int i = 0; i < pointOfInterests.Length; i++) { if (pointOfInterests[i].PointOfInterestImprovement != null) { string a; if (pointOfInterests[i].PointOfInterestDefinition.TryGetValue("Type", out a) && a == "Village") { if (!pointOfInterests[i].SimulationObject.Tags.Contains("PacifiedVillage")) { goto IL_18D; } } this.regionBuildings.Add(pointOfInterests[i]); } IL_18D :; } this.RegionBuildingsTable.Height = 0f; this.RegionBuildingsTable.ReserveChildren(this.regionBuildings.Count, this.BuildingPrefab, "Item"); this.RegionBuildingsTable.RefreshChildrenIList <PointOfInterest>(this.regionBuildings, this.refreshRegionBuildingDelegate, true, true); this.RegionBuildingsTable.ArrangeChildren(); this.RegionBuildingsScrollView.OnPositionRecomputed(); }
public static void RefreshPopulationBuyoutButton(Amplitude.Unity.Game.Empire observer, City city, AgeControlButton populationBuyoutButton) { if (observer != city.Empire) { populationBuyoutButton.AgeTransform.Enable = false; return; } float propertyValue = city.GetPropertyValue(SimulationProperties.CityGrowthStock); float propertyValue2 = city.GetPropertyValue(SimulationProperties.NetCityGrowth); float propertyValue3 = city.GetPropertyValue(SimulationProperties.Population); DepartmentOfTheInterior agency = city.Empire.GetAgency <DepartmentOfTheInterior>(); float num; float num2; agency.GetGrowthLimits(propertyValue3, out num, out num2); if (propertyValue + propertyValue2 >= num2) { populationBuyoutButton.AgeTransform.Enable = false; populationBuyoutButton.AgeTransform.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%CityBuyoutPopulationNotNeededDescription"); return; } float propertyValue4 = city.Empire.GetPropertyValue(SimulationProperties.PopulationBuyoutCooldown); if (propertyValue4 > 0f) { populationBuyoutButton.AgeTransform.Enable = false; populationBuyoutButton.AgeTransform.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%CityBuyoutPopulationCooldownDescription").Replace("$Cooldown", propertyValue4.ToString()); return; } float num3 = -DepartmentOfTheTreasury.GetPopulationBuyOutCost(city); ResourceDefinition resourceDefinition = ResourceDefinition.GetResourceDefinition(DepartmentOfTheTreasury.Resources.PopulationBuyout); string newValue = GuiFormater.FormatInstantCost(city.Empire, -num3, resourceDefinition.GetName(city.Empire), true, 0); DepartmentOfTheTreasury agency2 = city.Empire.GetAgency <DepartmentOfTheTreasury>(); if (agency2.IsTransferOfResourcePossible(city.Empire, DepartmentOfTheTreasury.Resources.PopulationBuyout, ref num3)) { populationBuyoutButton.AgeTransform.Enable = CityInfoPanel.interactionsAllowed; populationBuyoutButton.AgeTransform.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%CityBuyoutPopulationDescription").Replace("$Cost", newValue); } else { populationBuyoutButton.AgeTransform.Enable = false; populationBuyoutButton.AgeTransform.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%CityCannotBuyoutPopulationDescription").Replace("$Cost", newValue); } }
private bool CanSellUnitsAndExplain() { this.SellButtonPriceLabel.AgeTransform.Visible = false; if (this.IsOtherEmpire || !this.DepartmentOfScience.CanTradeUnits(false)) { return(false); } if (this.selectedUnits.Count == 0) { this.SellButton.AgeTooltip.Content = "%ArmyEmptySelectionDescription"; return(false); } this.SellComputeCandidates(); if (this.salableUnits.Count == 0) { this.SellButton.AgeTooltip.Content = "%SellTabNoCandidateDescription"; return(false); } if (ELCPUtilities.UseELCPUnitSelling && this.Garrison is Army) { IWorldPositionningService service = base.GameService.Game.Services.GetService <IWorldPositionningService>(); Army army = this.Garrison as Army; Region region = service.GetRegion(army.WorldPosition); if (region == null || region.Owner != army.Empire) { this.SellButton.AgeTooltip.Content = "%SellTabNotInOwnRegionDescription"; return(false); } } float num = this.TotalSellPriceOfSalableUnits(); string text = GuiFormater.FormatStock(num, DepartmentOfTheTreasury.Resources.EmpireMoney, 0, true); string formattedLine = GuiFormater.FormatInstantCost(this.Garrison.Empire, num, DepartmentOfTheTreasury.Resources.EmpireMoney, true, 1); this.SellButtonPriceLabel.Text = text; this.SellButtonPriceLabel.AgeTransform.Visible = true; AgeUtils.CleanLine(formattedLine, ref this.monochromaticFormat); if (!this.Garrison.IsInEncounter) { this.SellButton.AgeTooltip.Content = string.Format(AgeLocalizer.Instance.LocalizeString("%SellTabOKDescription"), this.monochromaticFormat); return(true); } this.SellButton.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%ArmyLockedInBattleDescription"); return(false); }
protected void DisplayPrice() { ConstructionCost[] costs = new ConstructionCost[] { new ConstructionCost(DepartmentOfTheTreasury.Resources.EmpireMoney, this.Price, true, false) }; string text = GuiFormater.FormatCost(this.empire, costs, false, 1, null); this.PriceLabel.Text = text; AgeTooltip ageTooltip = this.PriceLabel.AgeTransform.AgeTooltip; if (ageTooltip != null) { string formattedLine = AgeLocalizer.Instance.LocalizeString("%MarketplaceTradablePriceDescription").Replace("$TradableName", this.LocalizedName).Replace("$Price", text); StringBuilder stringBuilder = new StringBuilder(); AgeUtils.CleanLine(formattedLine, ref stringBuilder); ageTooltip.Content = stringBuilder.ToString(); } }
private void ClampEnteredQuantity() { float num; if (!float.TryParse(this.QuantityTextField.AgePrimitiveLabel.Text, out num)) { this.QuantityTextField.ReplaceInputText(GuiFormater.FormatGui(this.CurrentQuantity)); return; } if (num <= 1f) { Diagnostics.Assert(this.SelectedTradableLine.Tradable.Quantity >= 1f); this.QuantityTextField.ReplaceInputText("1"); } else if (num > this.SelectedTradableLine.Tradable.Quantity) { this.QuantityTextField.ReplaceInputText(Mathf.FloorToInt(this.SelectedTradableLine.Tradable.Quantity).ToString()); } }
public void RefreshBuyout(AgeControlButton buyoutButton) { DepartmentOfTheTreasury agency = base.Empire.GetAgency <DepartmentOfTheTreasury>(); ConstructibleElement technology = null; if (this.departmentOfScience.ResearchQueue.Peek() != null) { technology = this.departmentOfScience.ResearchQueue.Peek().ConstructibleElement; } float buyOutTechnologyCost = this.departmentOfScience.GetBuyOutTechnologyCost(technology); float num = -buyOutTechnologyCost; string text = GuiFormater.FormatInstantCost(base.Empire, buyOutTechnologyCost, DepartmentOfTheTreasury.Resources.EmpireMoney, true, 0); string content; if (buyOutTechnologyCost != 3.40282347E+38f) { if (agency.IsTransferOfResourcePossible(base.Empire, DepartmentOfTheTreasury.Resources.TechnologiesBuyOut, ref num) && this.interactionsAllowed) { buyoutButton.AgeTransform.Enable = true; buyoutButton.AgeTransform.Alpha = 1f; this.ResearchBuyoutCostLabel.Text = text; content = AgeLocalizer.Instance.LocalizeString("%ResearchBuyoutAvailableFormat").Replace("$Cost", text); } else { buyoutButton.AgeTransform.Enable = false; buyoutButton.AgeTransform.Alpha = 0.5f; this.ResearchBuyoutCostLabel.Text = text; content = AgeLocalizer.Instance.LocalizeString("%ResearchBuyoutUnavailableFormat").Replace("$Cost", text); } } else { buyoutButton.AgeTransform.Enable = false; buyoutButton.AgeTransform.Alpha = 0.5f; this.ResearchBuyoutCostLabel.Text = "%ResearchVoidSymbol"; content = AgeLocalizer.Instance.LocalizeString("%ResearchBuyoutNoSelection"); } if (buyoutButton.AgeTransform.AgeTooltip != null) { buyoutButton.AgeTransform.AgeTooltip.Content = content; } }
protected override IEnumerator OnShow(params object[] parameters) { this.Value.Text = string.Empty; bool isVisible = false; WorldPosition worldPosition = WorldPosition.Invalid; if (this.context is WorldPosition) { worldPosition = (WorldPosition)this.context; } else if (this.context is IWorldPositionable) { worldPosition = (this.context as IWorldPositionable).WorldPosition; } global::Empire empire = this.playerControllerRepository.ActivePlayerController.Empire as global::Empire; bool flag; if (empire.GetAgency <DepartmentOfForeignAffairs>().CanSeeOrbWithOrbHunterTrait) { flag = this.visibilityService.IsWorldPositionExploredFor(worldPosition, empire); } else { flag = this.visibilityService.IsWorldPositionVisibleFor(worldPosition, empire); } int orbValueAtPosition = this.orbService.GetOrbValueAtPosition(worldPosition); if (worldPosition.IsValid && orbValueAtPosition > 0 && flag) { isVisible = true; this.Value.AgeTransform.PixelMarginLeft = this.Title.Font.ComputeTextWidth(AgeLocalizer.Instance.LocalizeString(this.Title.Text), false, false) + 3f * this.Title.AgeTransform.PixelMarginLeft; this.Value.Text = GuiFormater.FormatStock((float)orbValueAtPosition, DepartmentOfTheTreasury.Resources.Orb, 0, true); if (this.Value.AgeTransform.PixelMarginTop == this.Title.AgeTransform.PixelMarginTop) { this.Value.AgeTransform.PixelMarginLeft = 2f * this.Title.AgeTransform.PixelMarginLeft + this.Title.Font.ComputeTextWidth(AgeLocalizer.Instance.LocalizeString(this.Title.Text), this.Title.ForceCaps, false); } } yield return(base.OnShow(parameters)); base.AgeTransform.Visible = isVisible; yield break; }
private void RefreshButtons() { this.TheirEmpireNameDropList.AgeTransform.Enable = this.interactionsAllowed; if (this.SelectedEmpire == null || this.DepartmentOfForeignAffairs == null || this.PlayerDiplomaticRelationWithOther == null || this.PlayerDiplomaticRelationWithOther.State.Name == DiplomaticRelationState.Names.Dead) { this.OfferButton.AgeTransform.Visible = false; this.OfferCostLabel.Text = string.Empty; this.CounterOfferButton.AgeTransform.Visible = false; this.CounterOfferMyCostLabel.Text = string.Empty; this.ResetButton.AgeTransform.Visible = false; return; } float cost = this.ComputeContractCost(this.DiplomaticContract.EmpireWhichProposes); string text = GuiFormater.FormatInstantCost(this.DiplomaticContract.EmpireWhichProposes, cost, SimulationProperties.EmpirePoint, false, 0); float cost2 = this.ComputeContractCost(this.DiplomaticContract.EmpireWhichReceives); string text2 = GuiFormater.FormatInstantCost(this.DiplomaticContract.EmpireWhichReceives, cost2, SimulationProperties.EmpirePoint, true, 0); bool flag = base.Empire != this.DiplomaticContract.EmpireWhichInitiated; if (flag) { this.OfferButton.AgeTransform.Visible = false; this.OfferCostLabel.Text = string.Empty; this.CounterOfferButton.AgeTransform.Visible = true; this.CounterOfferMyCostLabel.Text = text; this.CounterOfferTheirCostLabel.Text = text2; this.ResetButton.AgeTransform.Visible = true; this.ResetButton.AgeTransform.Enable = false; this.ResetButton.AgeTransform.AgeTooltip.Content = "%NegotiationCannotResetCounterOfferDescription"; this.CounterOfferButton.AgeTransform.Enable = (this.CanContractBeValidated() && this.interactionsAllowed); } else { this.OfferButton.AgeTransform.Visible = true; this.OfferCostLabel.Text = text; this.CounterOfferButton.AgeTransform.Visible = false; this.CounterOfferMyCostLabel.Text = string.Empty; this.ResetButton.AgeTransform.Visible = true; this.ResetButton.AgeTransform.Enable = this.interactionsAllowed; this.ResetButton.AgeTransform.AgeTooltip.Content = "%NegotiationResetDescription"; this.OfferButton.AgeTransform.Enable = (this.CanContractBeValidated() && this.interactionsAllowed); } }
public static string FormatStockCost(Empire empire, ConstructionResourceStock[] stockCosts, bool monochromatic = false, int decimals = 1) { DepartmentOfTheTreasury agency = empire.GetAgency <DepartmentOfTheTreasury>(); StringBuilder stringBuilder = new StringBuilder(); if (stockCosts != null) { bool flag = false; for (int i = 0; i < stockCosts.Length; i++) { float stock = stockCosts[i].Stock; if (stringBuilder.Length > 0) { stringBuilder.Append(" "); } float num; if (!agency.TryGetResourceStockValue(empire.SimulationObject, stockCosts[i].PropertyName, out num, false)) { Diagnostics.Log("Can't get resource stock value {0} on simulation object {1}.", new object[] { stockCosts[i].PropertyName, empire.SimulationObject.Name }); } if (!monochromatic) { AgeUtils.ColorToHexaKey(Color.red, ref stringBuilder, false); flag = true; } stringBuilder.Append(GuiFormater.FormatGui(stock, false, decimals == 0, false, decimals)); if (!monochromatic && flag) { stringBuilder.Append("#REVERT#"); flag = false; } stringBuilder.Append(" "); stringBuilder.Append(Services.GetService <IGuiService>().FormatSymbol(stockCosts[i].PropertyName)); } } return(stringBuilder.ToString()); }
public override void RefreshContent() { base.RefreshContent(); this.AffinityDropList.SelectedItem = this.affinityGuiTraits.IndexOf(this.SelectedAffinity); this.OverrideSelectedAffinityTooltip(); this.SelectedAffinityMapping = this.SelectedAffinity.DefaultGuiAffinityMapping; Diagnostics.Assert(this.SelectedAffinityMapping != null); this.PortraitImage.Image = this.SelectedAffinityMapping.GetImageTexture(GuiPanel.IconSize.Leader); this.BuildListOfAvailableTraits(); this.AvailableTraitsTable.Height = 0f; this.AvailableTraitsTable.ReserveChildren(this.availableGuiTraits.Count, this.CustomTraitPrefab, "AvailableTrait"); this.AvailableTraitsTable.RefreshChildrenIList <GuiFactionTrait>(this.availableGuiTraits, this.setupAvailableGuiTraitDelegate, true, false); this.AvailableTraitsTable.ArrangeChildren(); this.AvailableTraitsScrollView.OnPositionRecomputed(); this.PreselectedTraitsTable.Height = 0f; this.PreselectedTraitsTable.ReserveChildren(this.preselectedGuiTraits.Count, this.CustomTraitPrefab, "PreselectedTrait"); this.PreselectedTraitsTable.RefreshChildrenIList <GuiFactionTrait>(this.preselectedGuiTraits, this.setupSelectedGuiTraitDelegate, true, false); this.PreselectedTraitsTable.ArrangeChildren(); this.SelectedTraitsTable.Height = 0f; this.SelectedTraitsTable.ReserveChildren(this.selectedGuiTraits.Count, this.CustomTraitPrefab, "SelectedTrait"); this.SelectedTraitsTable.RefreshChildrenIList <GuiFactionTrait>(this.selectedGuiTraits, this.setupSelectedGuiTraitDelegate, true, false); this.SelectedTraitsTable.ArrangeChildren(); this.SelectedTraitsTable.Y = this.PreselectedTraitsTable.Y + this.PreselectedTraitsTable.Height + this.SelectedTraitsScrollView.VirtualArea.VerticalSpacing; this.SelectedTraitsScrollView.VirtualArea.Height = this.SelectedTraitsTable.Y + this.SelectedTraitsTable.Height; this.SelectedTraitsScrollView.OnPositionRecomputed(); this.totalPoints = this.ComputePointsSpent(); this.PointsCounterLabel.Text = GuiFormater.FormatGui(this.totalPoints) + "/" + GuiFormater.FormatGui(this.SelectedAffinity.MaxPoints); if (this.totalPoints <= this.SelectedAffinity.MaxPoints) { this.PointsCounterBackground.TintColor = this.PointsCounterBackgroundColors[0]; } else { this.PointsCounterBackground.TintColor = this.PointsCounterBackgroundColors[1]; } this.RefreshButtons(); this.AvailableTraitsSortsContainer.RefreshSortContent(); this.SelectedTraitsSortsContainer.RefreshSortContent(); }
private bool CanHealUnitsAndExplain() { this.HealButton.Visible = false; if (this.IsOtherEmpire) { return(false); } if (this.selectedUnits.Count > 0) { List <Unit> list = new List <Unit>(this.selectedUnits); list.RemoveAll((Unit match) => !match.CheckUnitAbility(UnitAbility.UnitAbilityInstantHeal, -1)); list.RemoveAll((Unit match) => !match.IsWounded()); if (list.Count > 0) { ConstructionCost[] unitHealCost = this.DepartmentOfTheTreasury.GetUnitHealCost(list); AgeUtils.CleanLine(GuiFormater.FormatCost(this.garrison.Empire, unitHealCost, false, 1, null), ref this.monochromaticFormat); this.HealButtonPriceLabel.Text = GuiFormater.FormatCost(this.garrison.Empire, unitHealCost, false, 0, null); this.HealButton.Visible = true; if (list.Exists((Unit unit) => !unit.HasEnoughActionPointLeft(1))) { this.HealButton.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%HealTabNoActionPointDescription"); } else if (this.DepartmentOfTheTreasury.CanAfford(unitHealCost)) { if (!this.garrison.IsInEncounter) { this.HealButton.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%HealTabOKFormat").Replace("$Value", this.monochromaticFormat.ToString()); return(true); } this.HealButton.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%ArmyLockedInBattleDescription"); } else { this.HealButton.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%HealTabCannotAffordDescription") + " : " + this.monochromaticFormat; } } } return(false); }
private bool CanConvertVillage(Army army, Village village, DepartmentOfTheTreasury departmentOfTheTreasury, List <StaticString> failureFlags) { if (village == null) { failureFlags.Add(ArmyAction.NoCanDoWhileSystemError); return(false); } if (village.HasBeenConverted) { failureFlags.Add(ArmyAction_Convert.NoCanDoWhileVillageIsAlreadyConverted); return(false); } if (!village.HasBeenPacified) { failureFlags.Add(ArmyAction_BaseVillage.NoCanDoWhileVillageIsNotPacified); return(false); } if (village.PointOfInterest.SimulationObject.Tags.Contains(DepartmentOfDefense.PillageStatusDescriptor)) { failureFlags.Add(ArmyAction_Convert.NoCanDoWhileVillageIsPillaged); return(false); } if (village.PointOfInterest.SimulationObject.Tags.Contains(DepartmentOfCreepingNodes.InfectedPointOfInterest)) { failureFlags.Add(ArmyAction_Convert.NoCanDoWhileVillageIsInfected); return(false); } ConstructionCost[] convertionCost = this.GetConvertionCost(army, village); if (!departmentOfTheTreasury.CanAfford(convertionCost)) { failureFlags.Add(ArmyAction_Convert.NoCanDoWhileCannotAfford); this.lastConvertCostDescription = GuiFormater.FormatCost(army.Empire, convertionCost, false, 1, null); return(false); } return(true); }
public override void RefreshContent() { if (this.City == null) { return; } base.RefreshContent(); float num = 0f; WorkersDragPanel guiPanel = base.GuiService.GetGuiPanel <WorkersDragPanel>(); for (int i = 0; i < this.workerTypes.Count; i++) { int num2 = Mathf.FloorToInt(this.City.GetPropertyValue(this.workerTypes[i])); if (guiPanel.DragInProgress && guiPanel.DragMoved && this.workerTypes[i] == guiPanel.StartingWorkerType) { num2 -= guiPanel.NumberOfWorkers; } if (i < this.WorkersGroups.Length) { this.WorkersGroups[i].RefreshContent(this.City, num2, this.workerTypes[i], guiPanel); this.WorkersGroups[i].GetComponent <AgeTransform>().Enable = (this.interactionsAllowed && !this.IsOtherEmpire); } int num3 = num2 / this.workersPerLine; if (num3 * this.workersPerLine != num2) { num3++; } if (num3 < 1) { num3 = 1; } if (i < this.WorkersGroups.Length && this.WorkersGroups[i] != null) { AgeTransform workersTable = this.WorkersGroups[i].WorkersTable; float num4 = workersTable.VerticalMargin + (float)num3 * (this.childHeight + workersTable.VerticalSpacing); if (num4 > num) { num = num4; } } } for (int j = 0; j < this.prodPerPopFIDSTypes.Count; j++) { float num5 = 0f; if (j < this.ProdPerPopFIDSValues.Length) { float propertyValue = this.City.GetPropertyValue(this.prodPerPopFIDSTypes[j]); this.ProdPerPopFIDSValues[j].Text = GuiFormater.FormatGui(propertyValue, false, false, false, 0); } float propertyValue2 = this.City.GetPropertyValue(this.workedFIDSTypes[j]); if (j < this.CityTileFIDSValues.Length) { float propertyValue3 = this.City.GetPropertyValue(this.cityTileFIDSTypes[j]); this.CityTileFIDSValues[j].Text = GuiFormater.FormatGui(propertyValue3, false, false, false, 0); } if (j < this.TotalFIDSValues.Length) { num5 = this.City.GetPropertyValue(this.totalFIDSTypes[j]); if (this.City.SimulationObject.Tags.Contains(City.MimicsCity) && this.TotalFIDSValues[j].AgeTransform.AgeTooltip.ClientData != null && this.TotalFIDSValues[j].AgeTransform.AgeTooltip.ClientData is SimulationPropertyTooltipData) { SimulationPropertyTooltipData simulationPropertyTooltipData = this.TotalFIDSValues[j].AgeTransform.AgeTooltip.ClientData as SimulationPropertyTooltipData; if (simulationPropertyTooltipData.Title == SimulationProperties.NetCityProduction) { num5 = 0f; } else if (simulationPropertyTooltipData.Title == SimulationProperties.NetCityGrowth) { num5 = this.City.GetPropertyValue("AlmostNetCityGrowth"); } } this.TotalFIDSValues[j].Text = GuiFormater.FormatGui(num5, false, false, false, 0); } if (j < this.ModifierFIDSValues.Length) { float num6 = num5 - propertyValue2; if (Mathf.RoundToInt(num6) != 0) { this.ModifierFIDSValues[j].Text = GuiFormater.FormatGui(num6, false, false, true, 0); } else { this.ModifierFIDSValues[j].Text = string.Empty; } } } this.WorkerGroupsTable.Height = num; this.WorkersTitle.Height = num; for (int k = 0; k < this.WorkersGroups.Length; k++) { this.WorkersGroups[k].WorkersTable.Height = num; this.WorkersGroups[k].ActiveHighlight.Height = num; this.WorkersGroups[k].GetComponent <AgeTransform>().Height = num; } base.AgeTransform.Height = this.TopMargin * AgeUtils.CurrentUpscaleFactor() + num + this.WorkerGroupsTable.PixelMarginBottom; bool flag = DepartmentOfTheInterior.CanBuyoutPopulation(this.City); bool flag2 = this.City.Empire.SimulationObject.Tags.Contains(FactionTrait.FactionTraitReplicants1); bool flag3 = this.City.Empire.SimulationObject.Tags.Contains(FactionTrait.FactionTraitMimics2); int rowIndex; Func <WorkersGroup, bool> < > 9__0; int rowIndex2; for (rowIndex = 0; rowIndex < this.FoodColumnCells.Length; rowIndex = rowIndex2 + 1) { bool flag4 = false; if (this.IsOtherEmpire) { IEnumerable <WorkersGroup> workersGroups = this.WorkersGroups; Func <WorkersGroup, bool> predicate; if ((predicate = < > 9__0) == null) { predicate = (< > 9__0 = ((WorkersGroup cell) => cell.GetComponent <AgeTransform>() == this.FoodColumnCells[rowIndex])); } flag4 = workersGroups.Any(predicate); } this.FoodColumnCells[rowIndex].Enable = (!flag && this.interactionsAllowed && !flag4); this.ScienceColumnCells[rowIndex].Enable = (!flag2 && this.interactionsAllowed && !flag4); this.IndustryColumnCells[rowIndex].Enable = (!flag3 && this.interactionsAllowed && !flag4); rowIndex2 = rowIndex; } if (this.BoostersTable == null) { bool highDefinition = AgeUtils.HighDefinition; AgeUtils.HighDefinition = false; this.BoostersTable = base.AgeTransform.InstanciateChild(this.BoostersEnumerator.BoostersTable.transform, "WorkerPanelBoostersTable1"); this.BoostersTable.TableArrangement = false; this.BoostersTable2 = base.AgeTransform.InstanciateChild(this.BoostersEnumerator.BoostersTable.transform, "WorkerPanelBoostersTable2"); this.BoostersTable2.TableArrangement = false; AgeUtils.HighDefinition = highDefinition; } this.stackedBoosters.Clear(); this.stackedBoosters2.Clear(); float num7 = 0f; bool flag5 = false; bool flag6 = false; bool flag7 = false; bool flag8 = false; float num8 = AgeUtils.HighDefinition ? 3f : 2f; if (!this.IsOtherEmpire) { foreach (string text in new List <string> { "BoosterFood", "BoosterCadavers", "BoosterIndustry", "FlamesIndustryBooster", "BoosterScience" }) { BoosterDefinition boosterDefinition2; if (this.database.TryGetValue(text, out boosterDefinition2)) { GuiStackedBooster item = new GuiStackedBooster(boosterDefinition2); this.stackedBoosters.Add(item); if (!this.ParentIsCityListScreen && (text == "BoosterCadavers" || text == "FlamesIndustryBooster")) { this.stackedBoosters2.Add(item); } } } bool flag9 = false; this.vaultBoosters = this.departmentOfEducation.GetVaultItems <BoosterDefinition>(); for (int l = 0; l < this.vaultBoosters.Count; l++) { BoosterDefinition boosterDefinition = this.vaultBoosters[l].Constructible as BoosterDefinition; if (boosterDefinition != null) { flag9 = true; if (boosterDefinition.Name == "BoosterFood") { flag5 = true; } else if (boosterDefinition.Name == "BoosterIndustry") { flag6 = true; } else if (boosterDefinition.Name == "BoosterCadavers") { flag7 = true; } else if (boosterDefinition.Name == "FlamesIndustryBooster") { flag8 = true; } this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.RewardType == boosterDefinition.RewardType).AddVaultBooster(this.vaultBoosters[l]); } } if (!flag9) { this.stackedBoosters.Clear(); this.stackedBoosters2.Clear(); } else { num7 = this.FidsGroups[0].Height; if (!this.ParentIsCityListScreen) { if (!flag6) { GuiStackedBooster item2 = this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.Name == "BoosterIndustry"); this.stackedBoosters.Remove(item2); } else { GuiStackedBooster item3 = this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.Name == "FlamesIndustryBooster"); this.stackedBoosters.Remove(item3); } if (!flag5) { GuiStackedBooster item4 = this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.Name == "BoosterFood"); this.stackedBoosters.Remove(item4); } else { GuiStackedBooster item5 = this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.Name == "BoosterCadavers"); this.stackedBoosters.Remove(item5); } if (!flag6 && !flag5) { this.stackedBoosters2.Clear(); } } else { if (flag8 && !flag6) { GuiStackedBooster item6 = this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.Name == "BoosterIndustry"); this.stackedBoosters.Remove(item6); } else if (!flag8) { GuiStackedBooster item7 = this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.Name == "FlamesIndustryBooster"); this.stackedBoosters.Remove(item7); } if (!flag5 && flag7) { GuiStackedBooster item8 = this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.Name == "BoosterFood"); this.stackedBoosters.Remove(item8); } else if (!flag7) { GuiStackedBooster item9 = this.stackedBoosters.Find((GuiStackedBooster booster) => booster.BoosterDefinition.Name == "BoosterCadavers"); this.stackedBoosters.Remove(item9); } } } } this.BoostersTable2.ReserveChildren(this.stackedBoosters2.Count, this.BoostersEnumerator.BoosterStockPrefab, "Item2"); this.BoostersTable2.RefreshChildrenIList <GuiStackedBooster>(this.stackedBoosters2, this.refreshDelegate, true, true); this.BoostersTable.ReserveChildren(this.stackedBoosters.Count, this.BoostersEnumerator.BoosterStockPrefab, "Item"); this.BoostersTable.RefreshChildrenIList <GuiStackedBooster>(this.stackedBoosters, this.refreshDelegate, true, true); this.BoostersTable.PixelMarginTop = base.AgeTransform.Height; this.BoostersTable2.PixelMarginTop = base.AgeTransform.Height + this.FidsGroups[0].Height + num8; float num9 = 0f; foreach (BoosterStock boosterStock in this.BoostersTable.GetChildren <BoosterStock>(true)) { float num10 = num8; if (this.ParentIsCityListScreen && ((flag5 && flag7 && (boosterStock.GuiStackedBooster.BoosterDefinition.Name == "BoosterFood" || boosterStock.GuiStackedBooster.BoosterDefinition.Name == "BoosterCadavers")) || (flag6 && flag8 && (boosterStock.GuiStackedBooster.BoosterDefinition.Name == "BoosterIndustry" || boosterStock.GuiStackedBooster.BoosterDefinition.Name == "FlamesIndustryBooster")))) { boosterStock.AgeTransform.Width = this.FidsGroups[0].Width / 2f - 1f; if (boosterStock.GuiStackedBooster.BoosterDefinition.Name == "BoosterFood" || boosterStock.GuiStackedBooster.BoosterDefinition.Name == "BoosterIndustry") { num10 = 2f; } } else { boosterStock.AgeTransform.Width = this.FidsGroups[0].Width; } if (boosterStock.GuiStackedBooster.Quantity == 0 || (flag && (num9 == 0f || boosterStock.GuiStackedBooster.BoosterDefinition.Name == "BoosterCadavers")) || (flag2 && boosterStock.GuiStackedBooster.BoosterDefinition.Name == "BoosterScience")) { boosterStock.AgeTransform.Enable = false; boosterStock.AgeTransform.Visible = false; } else { num7 = boosterStock.AgeTransform.Height; boosterStock.AgeTransform.Enable = this.interactionsAllowed; boosterStock.AgeTransform.Visible = true; boosterStock.QuickActivation = true; boosterStock.Guid = this.City.GUID; boosterStock.QuantityLabel.AgeTransform.AttachTop = true; boosterStock.QuantityLabel.AgeTransform.AttachRight = true; boosterStock.QuantityLabel.AgeTransform.PixelMarginLeft = 0f; boosterStock.QuantityLabel.Alignement = AgeTextAnchor.AscendMiddleRight; if (!this.ParentIsCityListScreen) { boosterStock.IconImage.AgeTransform.PixelMarginLeft = num8 * 2.5f; boosterStock.QuantityLabel.AgeTransform.PixelMarginRight = num8 * 2f; } else { boosterStock.IconImage.AgeTransform.PixelMarginLeft = ((boosterStock.AgeTransform.Width == this.FidsGroups[0].Width) ? (boosterStock.AgeTransform.Width / 3f) : (boosterStock.AgeTransform.Width / 5f)); boosterStock.QuantityLabel.AgeTransform.PixelMarginRight = ((boosterStock.AgeTransform.Width == this.FidsGroups[0].Width) ? (boosterStock.AgeTransform.Width / 3f) : (boosterStock.AgeTransform.Width / 5f)); } } boosterStock.AgeTransform.X = num9; boosterStock.AgeTransform.AttachRight = false; boosterStock.AgeTransform.AttachLeft = true; num9 += boosterStock.AgeTransform.Width + num10; } if (this.BoostersTable2.GetChildren <BoosterStock>(true).Count > 0) { bool flag10 = false; num9 = 0f; foreach (BoosterStock boosterStock2 in this.BoostersTable2.GetChildren <BoosterStock>(true)) { boosterStock2.AgeTransform.Width = this.FidsGroups[0].Width; if (boosterStock2.GuiStackedBooster.Quantity == 0 || (num9 == 0f && !flag5) || (num9 > 0f && !flag6) || (flag && num9 == 0f)) { boosterStock2.AgeTransform.Enable = false; boosterStock2.AgeTransform.Visible = false; } else { flag10 = true; boosterStock2.AgeTransform.Enable = this.interactionsAllowed; boosterStock2.AgeTransform.Visible = true; boosterStock2.QuickActivation = true; boosterStock2.Guid = this.City.GUID; boosterStock2.IconImage.AgeTransform.PixelMarginLeft = num8 * 2.5f; boosterStock2.QuantityLabel.AgeTransform.AttachTop = true; boosterStock2.QuantityLabel.AgeTransform.AttachRight = true; boosterStock2.QuantityLabel.AgeTransform.PixelMarginLeft = 0f; boosterStock2.QuantityLabel.AgeTransform.PixelMarginRight = num8 * 2f; boosterStock2.QuantityLabel.Alignement = AgeTextAnchor.AscendMiddleRight; } boosterStock2.AgeTransform.X = num9; boosterStock2.AgeTransform.AttachRight = false; boosterStock2.AgeTransform.AttachLeft = true; num9 += this.FidsGroups[0].Width + this.BoostersTable2.HorizontalSpacing; } num7 += (flag10 ? (this.FidsGroups[0].Height + num8) : 0f); } base.AgeTransform.Height += num7; this.AgeModifierPosition.EndHeight = base.AgeTransform.Height; foreach (AgeTransform ageTransform in base.AgeTransform.GetChildren()) { if (ageTransform.name.Contains("CityTile") || ageTransform.name.Contains("Total") || ageTransform.name.Contains("Modifiers")) { ageTransform.PixelMarginBottom = this.OriginalMargins[ageTransform.name] * (AgeUtils.HighDefinition ? 1.5f : 1f) + num7; } } }