Exemple #1
0
    private void ComputeVillageScoring()
    {
        this.villagePOI.Clear();
        DepartmentOfTheInterior agency = this.OtherEmpire.GetAgency <DepartmentOfTheInterior>();

        for (int i = 0; i < agency.Cities.Count; i++)
        {
            MinorEmpire minorEmpire = agency.Cities[i].Region.MinorEmpire;
            if (minorEmpire != null)
            {
                BarbarianCouncil council = minorEmpire.GetAgency <BarbarianCouncil>();
                if (council != null)
                {
                    bool flag = agency.IsAssimilated(minorEmpire.MinorFaction);
                    int  villageIndex2;
                    int  villageIndex;
                    Predicate <DissentTask_Empire.VillageScoring> < > 9__1;
                    for (villageIndex = 0; villageIndex < council.Villages.Count; villageIndex = villageIndex2 + 1)
                    {
                        if (council.Villages[villageIndex].HasBeenPacified && !council.Villages[villageIndex].HasBeenConverted && !council.Villages[villageIndex].HasBeenInfected)
                        {
                            List <DissentTask_Empire.VillageScoring>      list = this.villagePOI;
                            Predicate <DissentTask_Empire.VillageScoring> match2;
                            if ((match2 = < > 9__1) == null)
                            {
                                match2 = (< > 9__1 = ((DissentTask_Empire.VillageScoring match) => match.Village.GUID == council.Villages[villageIndex].GUID));
                            }
                            DissentTask_Empire.VillageScoring villageScoring = list.Find(match2);
                            if (villageScoring == null)
                            {
                                villageScoring = new DissentTask_Empire.VillageScoring(council.Villages[villageIndex]);
                                this.villagePOI.Add(villageScoring);
                            }
                            villageScoring.Reset();
                            if (flag)
                            {
                                villageScoring.Score.Boost(0.2f, "Assimilated", new object[0]);
                            }
                            if (this.visibilityService.IsWorldPositionVisibleFor(villageScoring.Village.WorldPosition, base.Owner))
                            {
                                villageScoring.Score.Boost(0.2f, "Visible", new object[0]);
                            }
                        }
                        villageIndex2 = villageIndex;
                    }
                }
            }
        }
        this.villagePOI.Sort((DissentTask_Empire.VillageScoring left, DissentTask_Empire.VillageScoring right) => - 1 * left.Score.CompareTo(right.Score));
    }