Пример #1
0
    public void AddConvertVillageOnLoad(Village village, MajorEmpire converter)
    {
        if (converter == null)
        {
            throw new ArgumentNullException("converter");
        }
        SimulationDescriptor value = this.SimulationDescriptorDatabase.GetValue(BarbarianCouncil.VillageStatusConverted);

        village.SwapDescriptor(value);
        if (!village.HasBeenConverted)
        {
            if (village.HasBeenPacified)
            {
                village.HasBeenPacified = false;
            }
            SimulationDescriptor value2 = this.SimulationDescriptorDatabase.GetValue(Village.ConvertedVillage);
            if (value2 != null)
            {
                Diagnostics.Assert(village.PointOfInterest != null);
                village.PointOfInterest.SwapDescriptor(value2);
                village.SwapDescriptor(value2);
            }
            village.Converter = converter;
            if (village.Converter.ConvertedVillages != null && village.Converter.ConvertedVillages.Contains(village))
            {
                village.Converter.AddChild(village);
            }
            DepartmentOfTheInterior.GenerateFIMSEForConvertedVillage(village.Converter, village.PointOfInterest);
        }
    }
Пример #2
0
    public void ConvertVillage(Village village, MajorEmpire converter)
    {
        if (converter == null)
        {
            throw new ArgumentNullException("converter");
        }
        SimulationDescriptor value = this.SimulationDescriptorDatabase.GetValue(BarbarianCouncil.VillageStatusConverted);

        village.SwapDescriptor(value);
        if (!village.HasBeenConverted)
        {
            if (village.HasBeenPacified)
            {
                village.HasBeenPacified = false;
            }
            SimulationDescriptor value2 = this.SimulationDescriptorDatabase.GetValue(Village.ConvertedVillage);
            if (value2 != null)
            {
                Diagnostics.Assert(village.PointOfInterest != null);
                village.PointOfInterest.SwapDescriptor(value2);
                village.SwapDescriptor(value2);
            }
            for (int i = village.StandardUnits.Count - 1; i >= 0; i--)
            {
                Unit unit = village.StandardUnits[i];
                this.GameEntityRepositoryService.Unregister(unit);
                village.RemoveUnit(unit);
                unit.Dispose();
            }
            village.Converter = converter;
            village.ConvertedUnitSpawnTurn = (this.GameService.Game as global::Game).Turn + village.GetConvertedUnitProductionTimer();
            EventVillageConverted eventToNotify = new EventVillageConverted(converter, village);
            this.EventService.Notify(eventToNotify);
            if (village.Converter.ConvertedVillages != null)
            {
                Diagnostics.Assert(!village.Converter.ConvertedVillages.Contains(village));
                village.Converter.AddConvertedVillage(village);
            }
            DepartmentOfTheInterior.GenerateFIMSEForConvertedVillage(village.Converter, village.PointOfInterest);
        }
    }
Пример #3
0
	protected override IEnumerator OnLoad()
	{
		if (this.convertedVillages != null)
		{
			for (int index = 0; index < this.convertedVillages.Count; index++)
			{
				Village village = this.convertedVillages[index];
				village.Empire = null;
				Diagnostics.Assert(village.PointOfInterest != null);
				Diagnostics.Assert(village.PointOfInterest.Region != null);
				MinorEmpire minorEmpire = village.PointOfInterest.Region.MinorEmpire;
				Diagnostics.Assert(minorEmpire != null);
				BarbarianCouncil barbarianCouncil = minorEmpire.GetAgency<BarbarianCouncil>();
				Diagnostics.Assert(barbarianCouncil != null);
				barbarianCouncil.AddVillage(village);
				barbarianCouncil.AddConvertVillageOnLoad(village, this);
				DepartmentOfTheInterior.GenerateFIMSEForConvertedVillage(this, village.PointOfInterest);
			}
		}
		if (this.InfectedVillages != null)
		{
			for (int index2 = 0; index2 < this.InfectedVillages.Count; index2++)
			{
				Village village2 = this.InfectedVillages[index2];
				village2.Empire = null;
				Diagnostics.Assert(village2.PointOfInterest != null);
				Diagnostics.Assert(village2.PointOfInterest.Region != null);
				MinorEmpire minorEmpire2 = village2.PointOfInterest.Region.MinorEmpire;
				Diagnostics.Assert(minorEmpire2 != null);
				BarbarianCouncil barbarianCouncil2 = minorEmpire2.GetAgency<BarbarianCouncil>();
				Diagnostics.Assert(barbarianCouncil2 != null);
				barbarianCouncil2.AddVillage(village2);
			}
		}
		yield return base.OnLoad();
		yield break;
	}