public void UpdateInfectionStatus() { bool flag = this.Empire.SimulationObject.Tags.Contains(FactionTrait.FactionTraitMimics3); bool flag2 = this.Empire.SimulationObject.Tags.Contains(FactionTrait.FactionTraitMimics1) || this.Empire.SimulationObject.Tags.Contains(FactionTrait.FactionTraitCultists7); IDatabase <SimulationDescriptor> database = Databases.GetDatabase <SimulationDescriptor>(false); SimulationDescriptor descriptor = null; if (!database.TryGetValue(City.TagCityStatusInfected, out descriptor)) { Diagnostics.LogError("Infection Status descriptor could not be retrieved."); return; } if (this.LastNonInfectedOwner == null) { DepartmentOfTheInterior agency = this.Empire.GetAgency <DepartmentOfTheInterior>(); if (!flag || !flag2 || agency.Cities.Count == 1) { this.LastNonInfectedOwner = this.Empire; return; } DepartmentOfPlanificationAndDevelopment agency2 = this.Empire.GetAgency <DepartmentOfPlanificationAndDevelopment>(); global::Game game = this.gameService.Game as global::Game; if (game != null) { List <int> list = new List <int>(); List <int> list2 = new List <int>(); foreach (global::Empire empire in game.Empires) { if (!(empire is MajorEmpire)) { break; } if (empire.Faction.Affinity.Name != this.Empire.Faction.Affinity.Name && !agency2.HasIntegratedFaction(empire.Faction)) { list.Add(empire.Index); } else if (empire.Index != this.Empire.Index) { list2.Add(empire.Index); } } if (list.Count == 0) { list = list2; } int index = UnityEngine.Random.Range(0, list.Count); this.LastNonInfectedOwner = game.Empires[list[index]]; } } if (this.Empire == this.LastNonInfectedOwner) { if (this.IsInfected) { base.RemoveDescriptor(descriptor); return; } } else if (flag) { if (!this.IsInfected) { base.AddDescriptor(descriptor, false); return; } } else { if (this.IsInfected) { base.RemoveDescriptor(descriptor); } this.LastNonInfectedOwner = this.Empire; } }
public override void RefreshContent() { base.RefreshContent(); this.previousConstructionSurplus.Clear(); this.alreadyPassedTurns = 0; bool isIntegrated = this.City.IsIntegrated; this.TotalValuesTable.Visible = isIntegrated; this.FIDSIBackground.Visible = isIntegrated; for (int i = 0; i < this.typesFIDS.Count; i++) { if (i < this.valuesFIDS.Count) { this.valuesFIDS[i].AgeTransform.Alpha = 1f; this.valuesFIDS[i].AgeTransform.ResetAllModifiers(true, false); float propertyValue = this.City.GetPropertyValue(this.typesFIDS[i]); this.valuesFIDS[i].Text = GuiFormater.FormatGui(propertyValue, false, false, false, 0); } } bool flag = this.GetCurrentConstructionRaze() != null; DepartmentOfPlanificationAndDevelopment agency = this.Empire.GetAgency <DepartmentOfPlanificationAndDevelopment>(); if (this.ConstructionQueue.PendingConstructions.Count > 0 && !flag && !agency.HasIntegratedFaction(this.City.LastNonInfectedOwner.Faction)) { int num2; bool flag2; int num = this.ComputeRemainingTurn(this.City, this.ConstructionQueue.Peek(), this.previousConstructionSurplus, ref this.alreadyPassedTurns, out num2, out flag2); this.IntegrateStatusTitle.Text = string.Format(AgeLocalizer.Instance.LocalizeString("%IntegratingCityRemainTurns"), num); this.IntegrateStatusTitle.TintColor = Color.white; } else { this.IntegrateStatusTitle.Text = AgeLocalizer.Instance.LocalizeString("%IntegratingCityComplete"); this.IntegrateStatusTitle.TintColor = Color.green; } Faction faction = this.City.LastNonInfectedOwner.Faction; if (faction.Affinity.Name == this.City.Empire.Faction.Affinity.Name) { this.IntegratedTraitTitle.Text = "%OCPanelIntegratedFactionSameAffinityTitle"; this.IntegratedTraitTitle.AgeTransform.AgeTooltip.Class = string.Empty; this.IntegratedTraitTitle.AgeTransform.AgeTooltip.ClientData = null; this.IntegratedTraitTitle.AgeTransform.AgeTooltip.Content = "%OCPanelIntegratedFactionSameAffinityTooltip"; this.IntegratedFactionIconTooltip.Class = string.Empty; this.IntegratedFactionIconTooltip.ClientData = null; this.IntegratedFactionIconTooltip.Content = "%OCPanelIntegratedFactionSameAffinityTooltip"; } bool flag3 = this.CanRazeCity(); bool flag4 = this.OvergrownCityRazeCooldownReached(); this.ActionToogle.AgeTransform.Enable = flag3; this.ActionToogle.AgeTransform.Alpha = ((!flag3) ? 0.5f : 1f); this.ConstructibleActionIcon.AgeTransform.Alpha = ((!flag3) ? 0.5f : 1f); this.ActionToogle.State = false; if (this.City.BesiegingEmpire != null) { this.ActionToogle.AgeTransform.AgeTooltip.Content = OvergrownCityPanel.RazeOvergrownCityNotAvailableCityUnderSiegeString; } else if (flag) { this.ActionToogle.AgeTransform.AgeTooltip.Content = OvergrownCityPanel.RazeOvergrownCityQueuedDescriptionString; this.ActionToogle.State = true; } else if (flag4) { this.ActionToogle.AgeTransform.AgeTooltip.Content = OvergrownCityPanel.RazeOvergrownCityDescriptionString; } else { int num3 = this.OvergrownCityRazeCooldownRemainTurns(); this.ActionToogle.AgeTransform.AgeTooltip.Content = string.Format(AgeLocalizer.Instance.LocalizeString(OvergrownCityPanel.RazeOvergrownCityOnCooldownDescriptionString), num3); } if (this.ActionToogle.State && !this.ModifierSector.IsStarted()) { this.ModifierSector.StartAnimation(); } else if (!this.ActionToogle.State && this.ModifierSector.IsStarted()) { this.ModifierSector.Reset(); } }