private int ComputeRemainingTurn(City city, Construction construction, List <ConstructionResourceStock> previousConstructionSurplus, ref int alreadyPassedTurns, out int worstNumberOfTurn, out bool checkPrerequisites) { worstNumberOfTurn = -1; checkPrerequisites = false; float num = -1f; float num2 = -1f; QueueGuiItem.GetConstructionTurnInfos(city, construction, previousConstructionSurplus, out worstNumberOfTurn, out num, out num2, out checkPrerequisites); if (worstNumberOfTurn >= 0 && worstNumberOfTurn != 2147483647) { alreadyPassedTurns += worstNumberOfTurn; } string s; if (worstNumberOfTurn == 2147483647) { s = QueueGuiItem.FormatNumberOfTurns(worstNumberOfTurn); } else if (worstNumberOfTurn == 0) { int numberOfTurn = Mathf.Max(1, alreadyPassedTurns); s = QueueGuiItem.FormatNumberOfTurns(numberOfTurn); } else { int numberOfTurn2 = Mathf.Max(1, alreadyPassedTurns); s = QueueGuiItem.FormatNumberOfTurns(numberOfTurn2); } base.AgeTransform.Alpha = ((!checkPrerequisites) ? 0.666f : 1f); if (num2 == 0f) { Diagnostics.LogWarning("The worst cost is 0. Construction = {0}.", new object[] { construction.ConstructibleElement.Name }); num2 = 1f; } int result = 0; int.TryParse(s, out result); return(result); }
private void RefreshCurrentResearch() { DepartmentOfScience agency = base.Empire.GetAgency <DepartmentOfScience>(); DepartmentOfTheTreasury agency2 = base.Empire.GetAgency <DepartmentOfTheTreasury>(); Construction construction = agency.ResearchQueue.Peek(); IDownloadableContentService service = Services.GetService <IDownloadableContentService>(); if (service != null && service.IsShared(DownloadableContent11.ReadOnlyName) && base.Empire.SimulationObject.Tags.Contains(FactionTrait.FactionTraitReplicants1)) { this.ResearchBuyoutButton.AgeTransform.Visible = true; this.ResearchBuyoutLabel.AgeTransform.Visible = true; this.CurrentResearchTitle.AgeTransform.Visible = false; this.EmpireResearchPanel.Enable = true; this.EmpireResearchPanel.AgeTooltip.Class = string.Empty; this.EmpireResearchPanel.AgeTooltip.Content = string.Empty; this.EmpireResearchPanel.AgeTooltip.ClientData = null; 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 newValue = GuiFormater.FormatInstantCost(base.Empire, buyOutTechnologyCost, DepartmentOfTheTreasury.Resources.EmpireMoney, true, 0); string content; if (construction != null) { this.ResearchBuyoutLabel.AgeTransform.Alpha = 1f; TechnologyDefinition technologyDefinition = construction.ConstructibleElement as TechnologyDefinition; if (technologyDefinition != null) { AgeUtils.TruncateString(AgeLocalizer.Instance.LocalizeString(DepartmentOfScience.GetTechnologyTitle(technologyDefinition)), this.ResearchBuyoutLabel, out this.format, '.'); DepartmentOfScience.BuildTechnologyTooltip(technologyDefinition, base.Empire, this.ResearchBuyoutLabel.AgeTransform.AgeTooltip, MultipleConstructibleTooltipData.TechnologyState.Normal); } if (agency2.IsTransferOfResourcePossible(base.Empire, DepartmentOfTheTreasury.Resources.TechnologiesBuyOut, ref num) && this.interactionsAllowed) { this.ResearchBuyoutButton.AgeTransform.Enable = true; this.ResearchBuyoutButton.AgeTransform.Alpha = 1f; this.ResearchBuyoutLabel.Text = this.format; content = AgeLocalizer.Instance.LocalizeString("%ResearchBuyoutAvailableFormat").Replace("$Cost", newValue); } else { this.ResearchBuyoutButton.AgeTransform.Enable = false; this.ResearchBuyoutButton.AgeTransform.Alpha = 0.5f; this.ResearchBuyoutLabel.Text = this.format; content = AgeLocalizer.Instance.LocalizeString("%ResearchBuyoutUnavailableFormat").Replace("$Cost", newValue); } } else { this.ResearchBuyoutButton.AgeTransform.Enable = false; this.ResearchBuyoutButton.AgeTransform.Alpha = 0.5f; this.ResearchBuyoutLabel.Text = "%ResearchNoneTitle"; this.ResearchBuyoutLabel.AgeTransform.Alpha = 0.5f; content = AgeLocalizer.Instance.LocalizeString("%ResearchBuyoutNoSelection"); this.ResearchBuyoutLabel.AgeTransform.AgeTooltip.Class = string.Empty; this.ResearchBuyoutLabel.AgeTransform.AgeTooltip.Content = "%ResearchNoneDescription"; this.ResearchBuyoutLabel.AgeTransform.AgeTooltip.ClientData = null; } if (this.ResearchBuyoutButton.AgeTransform.AgeTooltip != null) { this.ResearchBuyoutButton.AgeTransform.AgeTooltip.Content = content; return; } } else { this.ResearchBuyoutButton.AgeTransform.Visible = false; this.ResearchBuyoutLabel.AgeTransform.Visible = false; this.CurrentResearchTitle.AgeTransform.Visible = true; if (construction != null) { this.EmpireResearchPanel.Enable = true; int num2 = agency2.ComputeConstructionRemainingTurn(base.Empire, construction); if (num2 == 2147483647) { this.format = string.Format("$Tech ({0})", GuiFormater.Infinite.ToString()); } else { this.format = string.Format("$Tech ({0})", QueueGuiItem.FormatNumberOfTurns(num2)); } TechnologyDefinition technologyDefinition2 = construction.ConstructibleElement as TechnologyDefinition; if (technologyDefinition2 != null) { AgeUtils.TruncateStringWithSubst(this.format, "$Tech", AgeLocalizer.Instance.LocalizeString(DepartmentOfScience.GetTechnologyTitle(technologyDefinition2)), this.CurrentResearchTitle, out this.format, '.'); this.CurrentResearchTitle.Text = this.format; DepartmentOfScience.BuildTechnologyTooltip(technologyDefinition2, base.Empire, this.EmpireResearchPanel.AgeTooltip, MultipleConstructibleTooltipData.TechnologyState.Normal); } } else { this.EmpireResearchPanel.Enable = false; AgeUtils.TruncateString(AgeLocalizer.Instance.LocalizeString("%ResearchNoneTitle"), this.CurrentResearchTitle, out this.format, '.'); this.CurrentResearchTitle.Text = this.format; this.EmpireResearchPanel.AgeTooltip.Class = string.Empty; this.EmpireResearchPanel.AgeTooltip.Content = "%ResearchNoneDescription"; this.EmpireResearchPanel.AgeTooltip.ClientData = null; } this.CurrentResearchTitle.Text = this.format; } }
public void RefreshContent() { if (this.City == null) { return; } if (this.City.Empire == null) { return; } if (this.GuiEmpire.Index != this.City.Empire.Index) { if (this.guiEmpire == null) { this.Unbind(); return; } this.GuiEmpire = new GuiEmpire(this.City.Empire); DepartmentOfIndustry agency = this.City.Empire.GetAgency <DepartmentOfIndustry>(); this.ConstructionQueue = agency.GetConstructionQueue(this.City); } if (this.GuiEmpire != null) { this.FactionBackground.TintColor = this.GuiEmpire.Color; this.PopulationSymbol.TintColor = this.GuiEmpire.Color; this.FactionSymbol.TintColor = this.GuiEmpire.Color; this.PinLine.TintColor = this.GuiEmpire.Color; this.PopulationNumber.Text = GuiFormater.FormatGui(this.City.GetPropertyValue(SimulationProperties.Population), false, false, false, 1); this.FactionSymbol.Image = this.GuiEmpire.GuiFaction.GetImageTexture(global::GuiPanel.IconSize.LogoSmall, true); } string content = "%CityCurrentConstructionDescription"; if (this.City.IsInfected) { this.PanelSpying.Visible = false; this.PanelOvergrownCity.Visible = true; this.AgeTransform.Height = this.ModifierPosition.EndHeight; if (this.GuiPreviousEmpire == null) { this.GuiPreviousEmpire = new GuiEmpire(this.City.LastNonInfectedOwner); } if (this.GuiPreviousEmpire != null) { this.PreviousEmpireFactionIcon.TintColor = this.GuiPreviousEmpire.Color; this.PreviousEmpireFactionIcon.Image = this.GuiPreviousEmpire.GuiFaction.GetImageTexture(global::GuiPanel.IconSize.LogoSmall, true); this.PreviousEmpireFactionTooltip.Class = "Descriptor"; this.PreviousEmpireFactionTooltip.ClientData = this.GuiEmpire.Empire; Faction faction = this.GuiPreviousEmpire.Empire.Faction; if (faction != null) { new List <string>(); foreach (SimulationDescriptor simulationDescriptor in faction.GetIntegrationDescriptors()) { this.PreviousEmpireFactionTooltip.Content = simulationDescriptor.Name; } } } if (this.ConstructionQueue.PendingConstructions.Count > 0) { Construction construction = this.ConstructionQueue.Peek(); if (construction.ConstructibleElement.SubCategory == "SubCategoryAssimilation" && construction.ConstructibleElement.Name != "CityConstructibleActionInfectedRaze") { content = "%IntegratingFactionUnderConstructionDescription"; } } } this.ConstructionGroup.AgeTooltip.Content = content; this.RefreshCityName(); DepartmentOfIntelligence agency2 = this.playerControllerRepository.ActivePlayerController.Empire.GetAgency <DepartmentOfIntelligence>(); bool flag = this.playerControllerRepository.ActivePlayerController.Empire.SimulationObject.Tags.Contains(global::Empire.TagEmpireEliminated); if (flag && ELCPUtilities.SpectatorSpyFocus >= 0) { agency2 = this.game.Empires[ELCPUtilities.SpectatorSpyFocus].GetAgency <DepartmentOfIntelligence>(); } Unit hero = null; InfiltrationProcessus.InfiltrationState infiltrationState = InfiltrationProcessus.InfiltrationState.None; bool flag2 = false; if (this.playerControllerRepository != null) { if (this.City.Empire == this.playerControllerRepository.ActivePlayerController.Empire) { flag2 = true; } else if (this.PanelSpying.Visible && agency2 != null && agency2.TryGetSpyOnGarrison(this.City, out hero, out infiltrationState) && infiltrationState == InfiltrationProcessus.InfiltrationState.Infiltrated) { flag2 = true; } else if (flag) { flag2 = true; } } if (!flag2) { if (this.City.Empire == null) { this.CompetitorTitle.Text = string.Empty; } else { DiplomaticRelation diplomaticRelation = this.playerControllerRepository.ActivePlayerController.Empire.GetAgency <DepartmentOfForeignAffairs>().GetDiplomaticRelation(this.City.Empire); Diagnostics.Assert(diplomaticRelation != null); if (diplomaticRelation.State != null && diplomaticRelation.State.Name == DiplomaticRelationState.Names.Alliance) { AgeUtils.TruncateString(AgeLocalizer.Instance.LocalizeString("%CityLabelAlliedTitle"), this.CompetitorTitle, out this.temp, '.'); this.CompetitorTitle.Text = this.temp; } else if (diplomaticRelation.State != null && diplomaticRelation.State.Name == DiplomaticRelationState.Names.Peace) { AgeUtils.TruncateString(AgeLocalizer.Instance.LocalizeString("%CityLabelFriendlyTitle"), this.CompetitorTitle, out this.temp, '.'); this.CompetitorTitle.Text = this.temp; } else { AgeUtils.TruncateString(AgeLocalizer.Instance.LocalizeString("%CityLabelEnemyTitle"), this.CompetitorTitle, out this.temp, '.'); this.CompetitorTitle.Text = this.temp; } } } this.SelectionButton.AgeTransform.Enable = flag2; this.PlayerSpecificGroup.Visible = flag2; this.CompetitorSpecificGroup.Visible = !flag2; float propertyValue = this.City.GetPropertyValue(SimulationProperties.CityDefensePoint); float propertyValue2 = this.City.GetPropertyValue(SimulationProperties.MaximumCityDefensePoint); float propertyValue3 = this.City.GetPropertyValue(SimulationProperties.CityDefensePointRecoveryPerTurn); float propertyValue4 = this.City.GetPropertyValue(SimulationProperties.Ownership); Diagnostics.Assert(this.UnitNumber != null); Diagnostics.Assert(this.City.StandardUnits != null); int num = (this.City.Militia == null) ? 0 : this.City.Militia.StandardUnits.Count; this.UnitNumber.Text = GuiFormater.FormatGui(this.City.StandardUnits.Count + num); this.DefenseNumber.Text = GuiFormater.FormatStock(propertyValue, SimulationProperties.CityDefensePoint, 0, true); float propertyValue5 = this.City.GetPropertyValue(SimulationProperties.DefensivePower); this.DefenseGroup.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%CityDefenseDescription"); this.DefenseIcon.Image = AgeManager.Instance.FindDynamicTexture("fortificationCityLabel", false); if (propertyValue5 > 0f) { this.DefenseGroup.AgeTooltip.Content = AgeLocalizer.Instance.LocalizeString("%CityDefenseWithDefensivePowerDescription").Replace("$DefensivePowerValue", GuiFormater.FormatGui(propertyValue5, false, true, false, 1)); this.DefenseIcon.Image = AgeManager.Instance.FindDynamicTexture("retaliationCityLabel", false); } this.DefenseGroup.AgeTooltip.Content = this.DefenseGroup.AgeTooltip.Content.Replace("$CityDefenseValue", GuiFormater.FormatGui(propertyValue, false, true, false, 1)); if (propertyValue4 < 1f && !this.City.IsInfected) { this.OwnershipPercentage.AgeTransform.Visible = true; this.OwnershipPercentage.Text = GuiFormater.FormatGui(propertyValue4, true, false, false, 1); } else { this.OwnershipPercentage.AgeTransform.Visible = false; } if (this.City.BesiegingEmpire != null || this.City.BesiegingSeafaringArmies.Count != 0 || this.City.IsUnderEarthquake) { float num2 = DepartmentOfTheInterior.GetBesiegingPower(this.City, true); num2 += DepartmentOfTheInterior.GetCityPointEarthquakeDamage(this.City); this.DefenseTendency.Text = "(" + GuiFormater.FormatGui(-num2, false, true, true, 1) + ")"; } else if (propertyValue < propertyValue2) { this.DefenseTendency.Text = "(" + GuiFormater.FormatGui(propertyValue3, false, true, true, 1) + ")"; } else { this.DefenseTendency.Text = string.Empty; } if (flag2) { Construction construction2 = null; if (this.ConstructionQueue != null) { construction2 = this.ConstructionQueue.Peek(); } if (this.City.IsInfected && construction2 == null) { this.PlayerSpecificGroup.Visible = false; } if (construction2 != null) { IImageFeatureProvider imageFeatureProvider = construction2.ConstructibleElement as IImageFeatureProvider; GuiElement guiElement; if (imageFeatureProvider != null) { Texture2D image; if (imageFeatureProvider.TryGetTextureFromIcon(global::GuiPanel.IconSize.Small, out image)) { this.ConstructionImage.Image = image; } } else if (this.guiPanelHelper.TryGetGuiElement(construction2.ConstructibleElement.Name, out guiElement)) { Texture2D image2; if (this.guiPanelHelper.TryGetTextureFromIcon(guiElement, global::GuiPanel.IconSize.Small, out image2)) { this.ConstructionImage.Image = image2; } } else { this.ConstructionImage.Image = null; } CityLabel.emptyList.Clear(); int b; float num3; float num4; bool flag3; QueueGuiItem.GetConstructionTurnInfos(this.City, construction2, CityLabel.emptyList, out b, out num3, out num4, out flag3); int numberOfTurn = Mathf.Max(1, b); this.ConstructionTurns.Text = QueueGuiItem.FormatNumberOfTurns(numberOfTurn); } else { this.ConstructionImage.Image = this.NoConstructionTexture; this.ConstructionTurns.Text = "%EmptyConstructionTitle"; } } if (this.PanelSpying.Visible && this.playerControllerRepository != null && agency2 != null) { float value = this.City.GetPropertyValue(SimulationProperties.CityAntiSpy) * 0.01f; this.AntiSpyValue.Text = GuiFormater.FormatGui(value, true, true, false, 0); this.HeroGroup.Visible = false; this.SpyingEffectsGroup.Visible = false; this.AssignSpyButton.AgeTransform.Visible = false; if (this.City.Empire != this.playerControllerRepository.ActivePlayerController.Empire) { if (infiltrationState != InfiltrationProcessus.InfiltrationState.None) { this.HeroGroup.Visible = true; this.HeroCard.Bind(hero, this.playerControllerRepository.ActivePlayerController.Empire as global::Empire, null); this.HeroCard.RefreshContent(false, false); if (this.HeroCard.GuiHero != null) { AgeTooltip ageTooltip = this.HeroCard.HeroPortrait.AgeTransform.AgeTooltip; if (ageTooltip != null) { ageTooltip.Class = "Unit"; ageTooltip.ClientData = this.HeroCard.GuiHero; ageTooltip.Content = this.HeroCard.GuiHero.Title; } } if (infiltrationState == InfiltrationProcessus.InfiltrationState.Infiltrated) { this.InfiltrationTurnSymbol.AgeTransform.Visible = false; this.InfiltrationTurnValue.AgeTransform.Visible = false; this.HeroCard.AgeTransform.Alpha = 1f; this.SpyingEffectsGroup.Visible = true; } else { this.HeroCard.AgeTransform.Alpha = 0.75f; this.InfiltrationTurnSymbol.AgeTransform.Visible = true; this.InfiltrationTurnValue.AgeTransform.Visible = true; int value2 = DepartmentOfIntelligence.InfiltrationRemainingTurns(hero); this.InfiltrationTurnValue.Text = GuiFormater.FormatGui(value2); } } else if (!flag) { this.AssignSpyButton.AgeTransform.Visible = true; float value3 = 0f; this.failures.Clear(); bool flag4 = agency2.CanBeInfiltrate(this.City, out value3, this.failures); bool flag5 = agency2.Empire.GetAgency <DepartmentOfEducation>().Heroes.Count < 1; if (flag5) { flag4 = false; } this.AssignSpyButton.AgeTransform.Enable = flag4; global::IGuiService service = Services.GetService <global::IGuiService>(); string str = string.Empty; if (this.failures.Contains(DepartmentOfIntelligence.InfiltrationTargetFailureNotAffordable)) { str = "#c52222#"; } string arg = str + GuiFormater.FormatGui(value3, false, true, false, 0) + service.FormatSymbol(this.infiltrationCostResourceName); string format = AgeLocalizer.Instance.LocalizeString("%EspionageLabelAssignSpyTitle"); this.AssignTitle.Text = string.Format(format, arg); AgeTooltip ageTooltip2 = this.AssignSpyButton.AgeTransform.AgeTooltip; if (ageTooltip2) { if (flag4) { ageTooltip2.Content = "%EspionageLabelAssignSpyDescription"; } else if (flag5) { ageTooltip2.Content = "%EspionageLabelAssignSpyNoHeroesDescription"; } else if (this.failures.Contains(DepartmentOfIntelligence.InfiltrationTargetFailureNotVisible)) { ageTooltip2.Content = "%EspionageLabelAssignSpyNoVisibilityDescription"; } else if (this.failures.Contains(DepartmentOfIntelligence.InfiltrationTargetFailureSiege)) { ageTooltip2.Content = "%EspionageLabelAssignSpyUnderSiegeDescription"; } else if (this.failures.Contains(DepartmentOfIntelligence.InfiltrationTargetFailureNotAffordable)) { ageTooltip2.Content = "%EspionageLabelAssignSpyNotAffordableDescription"; } else if (this.failures.Contains(DepartmentOfIntelligence.InfiltrationTargetFailureAlreadyInfiltrated)) { ageTooltip2.Content = "%EspionageLabelAssignSpyAlreadyInfiltratedDescription"; } else if (this.failures.Contains(DepartmentOfIntelligence.InfiltrationTargetFailureCityInfected)) { ageTooltip2.Content = "%EspionageLabelAssignSpyCityInfectedDescription"; } } } } } bool flag6 = false; List <Kaiju> list = new List <Kaiju>(); foreach (RegionalEffect regionalEffect in this.city.GetRegionalEffects()) { IRegionalEffectsProviderGameEntity regionalEffectsProviderGameEntity = null; if (this.regionalEffectsService.TryGetEffectOwner(regionalEffect.GUID, out regionalEffectsProviderGameEntity) && regionalEffectsProviderGameEntity.GetRegionalEffectsProviderContext().SimulationObject.Tags.Contains("ClassKaiju")) { flag6 = true; if (regionalEffectsProviderGameEntity is Kaiju) { Kaiju item = regionalEffectsProviderGameEntity as Kaiju; if (!list.Contains(item)) { list.Add(item); } } } } if (flag6) { AgeTransform ageTransform = this.KaijuIcon.AgeTransform; ageTransform.Visible = true; ageTransform.Enable = true; this.PopulationGroup.PercentBottom = 100f - (ageTransform.Height + ageTransform.PixelMarginBottom) / ageTransform.GetParent().Height * 100f; KaijuInfluenceInCityTooltipData clientData = new KaijuInfluenceInCityTooltipData(this.City, list); this.KaijuIcon.AgeTransform.AgeTooltip.Content = "%CityKaijuAffectedDescription"; this.KaijuIcon.AgeTransform.AgeTooltip.Class = "Kaijus"; this.KaijuIcon.AgeTransform.AgeTooltip.ClientData = clientData; return; } this.KaijuIcon.AgeTransform.Visible = false; this.KaijuIcon.AgeTransform.Enable = false; this.PopulationGroup.PercentBottom = 100f; }
protected override IEnumerator OnShow(params object[] parameters) { Quest quest = this.context as Quest; if (quest == null) { Diagnostics.LogError("Context must be a quest"); yield break; } int num = 0; GuiElement guiElement; if (base.GuiService.GuiPanelHelper.TryGetGuiElement(quest.Name, out guiElement)) { QuestGuiElement questGuiElement = guiElement as QuestGuiElement; this.ObjectiveLabel.AgeTransform.Height = 0f; this.ObjectiveLabel.Text = string.Empty; if (!this.progressionOnly) { this.ObjectiveBackground.TintColor = this.DescriptionColor; AgePrimitiveLabel objectiveLabel = this.ObjectiveLabel; objectiveLabel.Text += AgeLocalizer.Instance.LocalizeString(questGuiElement.Steps[num].Text); } if (!this.descriptionOnly) { this.ObjectiveBackground.TintColor = this.ProgressionColor; AgePrimitiveLabel objectiveLabel2 = this.ObjectiveLabel; objectiveLabel2.Text += quest.GetProgressionString(quest.QuestDefinition.Steps[num].Name); if (this.constructibleProgression && quest.QuestState != QuestState.Failed && quest.QuestState != QuestState.Completed) { if (this.departmentOfIndustries == null) { IGameService service = Services.GetService <IGameService>(); Diagnostics.Assert(service != null && service.Game != null); global::Game game = service.Game as global::Game; this.departmentOfIndustries = new List <DepartmentOfIndustry>(); for (int i = 0; i < game.Empires.Length; i++) { global::Empire empire = game.Empires[i]; if (empire is MajorEmpire) { DepartmentOfIndustry agency = empire.GetAgency <DepartmentOfIndustry>(); if (agency != null) { this.departmentOfIndustries.Add(agency); } } } } DepartmentOfIndustry.ConstructibleElement constructibleElement = null; if (!this.departmentOfIndustries[0].ConstructibleElementDatabase.TryGetValue(quest.Name.ToString().Replace("Quest", string.Empty), out constructibleElement)) { Diagnostics.LogError("Cannot find ConstructibleElement {0}", new object[] { quest.Name.ToString().Replace("Quest", string.Empty) }); } else { List <KeyValuePair <float, City> > list = new List <KeyValuePair <float, City> >(); KeyValuePair <float, City> item = default(KeyValuePair <float, City>); for (int j = 0; j < this.departmentOfIndustries.Count; j++) { City city; Construction construction = this.departmentOfIndustries[j].GetConstruction(constructibleElement, out city); if (construction != null && city != null) { int num2; float key; float num3; bool flag; QueueGuiItem.GetConstructionTurnInfos(city, construction, QueueGuiItem.EmptyList, out num2, out key, out num3, out flag); KeyValuePair <float, City> keyValuePair = new KeyValuePair <float, City>(key, city); list.Add(keyValuePair); if (city.Empire.Bits == quest.EmpireBits) { item = keyValuePair; } } } list.Sort(new Comparison <KeyValuePair <float, City> >(PanelFeatureQuest.ConstructionInProgressInverseSorter)); int num4; if (item.Value != null) { num4 = list.IndexOf(item); } else { num4 = list.Count; } if (this.ObjectiveLabel.Text != string.Empty) { AgePrimitiveLabel objectiveLabel3 = this.ObjectiveLabel; objectiveLabel3.Text += "\n"; } this.ObjectiveLabel.Text = string.Concat(new object[] { this.ObjectiveLabel.Text, AgeLocalizer.Instance.LocalizeString("%QuestRank"), num4 + 1, "/", this.departmentOfIndustries.Count }); } } } if (!string.IsNullOrEmpty(this.ObjectiveLabel.Text)) { this.ObjectiveLabel.AgeTransform.Width = this.DefaultWidth - this.ObjectiveLabel.AgeTransform.PixelMarginLeft - this.ObjectiveLabel.AgeTransform.PixelMarginRight; this.ObjectiveLabel.ComputeText(); this.ObjectiveGroup.Height = this.ObjectiveLabel.Font.LineHeight * (float)this.ObjectiveLabel.TextLines.Count + this.ObjectiveLabel.AgeTransform.PixelMarginTop + this.ObjectiveLabel.AgeTransform.PixelMarginBottom; this.ObjectiveBox.Height = this.ObjectiveGroup.Height + this.ObjectiveGroup.PixelMarginTop + this.ObjectiveGroup.PixelMarginBottom; } base.AgeTransform.Height = this.ObjectiveBox.Height; } yield return(base.OnShow(parameters)); yield break; }