コード例 #1
0
 public override void RefreshContent()
 {
     base.RefreshContent();
     this.validPointsOfInterest.Clear();
     this.validImprovements.Clear();
     if (this.City != null && this.City.BesiegingEmpire == null && base.Empire == this.City.Empire && !this.City.IsInfected)
     {
         DepartmentOfIndustry    agency  = this.City.Empire.GetAgency <DepartmentOfIndustry>();
         DepartmentOfTheInterior agency2 = this.City.Empire.GetAgency <DepartmentOfTheInterior>();
         DepartmentOfTheTreasury agency3 = this.City.Empire.GetAgency <DepartmentOfTheTreasury>();
         ConstructibleElement[]  availableConstructibleElements = agency.ConstructibleElementDatabase.GetAvailableConstructibleElements(new StaticString[0]);
         ConstructibleElement[]  array = availableConstructibleElements;
         List <StaticString>     list  = new List <StaticString>();
         for (int i = 0; i < this.City.Region.PointOfInterests.Length; i++)
         {
             PointOfInterest pointOfInterest = this.City.Region.PointOfInterests[i];
             if (pointOfInterest.PointOfInterestImprovement == null && pointOfInterest.CreepingNodeImprovement == null && (base.WorldPositionningService.GetExplorationBits(pointOfInterest.WorldPosition) & this.City.Empire.Bits) > 0)
             {
                 List <PointOfInterestImprovementDefinition> list2 = new List <PointOfInterestImprovementDefinition>();
                 List <ConstructibleDistrictDefinition>      list3 = new List <ConstructibleDistrictDefinition>();
                 for (int j = 0; j < array.Length; j++)
                 {
                     if (array[j] is PointOfInterestImprovementDefinition)
                     {
                         PointOfInterestImprovementDefinition pointOfInterestImprovementDefinition = array[j] as PointOfInterestImprovementDefinition;
                         if (pointOfInterestImprovementDefinition.PointOfInterestTemplateName == pointOfInterest.PointOfInterestDefinition.PointOfInterestTemplateName)
                         {
                             list.Clear();
                             DepartmentOfTheTreasury.CheckConstructiblePrerequisites(this.City, pointOfInterestImprovementDefinition, ref list, new string[]
                             {
                                 ConstructionFlags.Prerequisite
                             });
                             if (!list.Contains(ConstructionFlags.Discard) && agency3.CheckConstructibleInstantCosts(this.City, pointOfInterestImprovementDefinition))
                             {
                                 list2.Add(agency2.GetBestImprovementDefinition(this.City, pointOfInterest, pointOfInterestImprovementDefinition, list));
                             }
                         }
                     }
                     else if (array[j] is ConstructibleDistrictDefinition)
                     {
                         ConstructibleDistrictDefinition constructibleDistrictDefinition = array[j] as ConstructibleDistrictDefinition;
                         if (constructibleDistrictDefinition != null)
                         {
                             list3.Add(constructibleDistrictDefinition);
                         }
                     }
                 }
                 if (list2.Count > 0)
                 {
                     ConstructionQueue constructionQueue = agency.GetConstructionQueue(this.City);
                     bool flag = false;
                     for (int k = 0; k < list2.Count; k++)
                     {
                         for (int l = 0; l < constructionQueue.Length; l++)
                         {
                             Construction construction = constructionQueue.PeekAt(l);
                             if (construction.ConstructibleElement == list2[k] && construction.WorldPosition == pointOfInterest.WorldPosition)
                             {
                                 flag = true;
                                 break;
                             }
                         }
                     }
                     if (!flag)
                     {
                         for (int m = 0; m < list3.Count; m++)
                         {
                             for (int n = 0; n < constructionQueue.Length; n++)
                             {
                                 Construction construction2 = constructionQueue.PeekAt(n);
                                 if (construction2.ConstructibleElement == list3[m] && construction2.WorldPosition == pointOfInterest.WorldPosition)
                                 {
                                     flag = true;
                                     break;
                                 }
                             }
                         }
                     }
                     if (!flag)
                     {
                         for (int num = 0; num < list2.Count; num++)
                         {
                             this.validPointsOfInterest.Add(pointOfInterest);
                             this.validImprovements.Add(list2[num]);
                         }
                     }
                 }
             }
         }
     }
     this.LabelsTable.ReserveChildren(this.validPointsOfInterest.Count, this.LabelPrefab, "ConstructibleLabel");
     this.LabelsTable.RefreshChildrenIList <PointOfInterest>(this.validPointsOfInterest, new AgeTransform.RefreshTableItem <PointOfInterest>(this.RefreshPointOfInterest), true, false);
     this.LabelsTable.Enable = this.interactionsAllowed;
     this.UnbindAndHideLabels(this.validPointsOfInterest.Count);
 }