Exemple #1
0
        public void UpgradePopulationConstruction(Slot slot, Construction populationConstruction)
        {
            Reservation reservation = new Reservation(GameManager.CurrentYear, 500, populationConstruction);

            reservation.IsPopulationUpgraded = true;
            slot.MakeReservation(reservation);
        }
Exemple #2
0
        public void CreateBuilding(Slot slot, Construction building, int year)
        {
            BuildingsBaseProperties properties = new BuildingsBaseProperties();

            BaseConstruction newBuilding;

            if (slot.ConstructionType != ConstructionType.Population)
            {
                newBuilding = new BaseConstruction(this.Game, slot.XSlotCenter, slot.YSlotCenter, false, false);
            }
            else
            {
                newBuilding = new BaseConstruction(this.Game, slot.XSlotCenter, slot.YSlotCenter, true, false);
            }

            newBuilding.ConstructionName     = building;
            newBuilding.ConstructionYear     = year;
            newBuilding.ConstructionType     = slot.ConstructionType;
            newBuilding.ConstructionLifetime = properties.BuildingBaseProperties(building, year, 0, year).Lifetime;
            newBuilding.ConstructingPeriod   = properties.BuildingBaseProperties(building, year, 0, year).ConstructingPeriod;
            newBuilding.DegradationPeriod    = properties.BuildingBaseProperties(building, year, 0, year).DestructionPeriod;
            newBuilding.StackOrder           = stackOrder_slots + 1;
            newBuilding.ChangeGraphics();
            newBuilding.Slot = slot;

            AddChild(newBuilding);

            slot.CurrentConstruction = newBuilding;
            slot.MakeReservation(year, newBuilding.ConstructionLifetime, building);

            changesMade = true;

            GUI.ClearSelectedBuildingIcon();

            newBuilding.OnSelected += new EventHandler(Building_OnSelected);
            RemoveConstructionPanel();
        }
Exemple #3
0
        public void CreateBuilding(Slot slot, Construction building, int year)
        {
            BuildingsBaseProperties properties = new BuildingsBaseProperties();

            BaseConstruction newBuilding;
            if (slot.ConstructionType != ConstructionType.Population)
                newBuilding = new BaseConstruction(this.Game, slot.XSlotCenter, slot.YSlotCenter, false, false);
            else
                newBuilding = new BaseConstruction(this.Game, slot.XSlotCenter, slot.YSlotCenter, true, false);

            newBuilding.ConstructionName = building;
            newBuilding.ConstructionYear = year;
            newBuilding.ConstructionType = slot.ConstructionType;
            newBuilding.ConstructionLifetime = properties.BuildingBaseProperties(building, year, 0, year).Lifetime;
            newBuilding.ConstructingPeriod = properties.BuildingBaseProperties(building, year, 0, year).ConstructingPeriod;
            newBuilding.DegradationPeriod = properties.BuildingBaseProperties(building, year, 0, year).DestructionPeriod;
            newBuilding.StackOrder = stackOrder_slots + 1;
            newBuilding.ChangeGraphics();
            newBuilding.Slot = slot;

            AddChild(newBuilding);

            slot.CurrentConstruction = newBuilding;
            slot.MakeReservation(year, newBuilding.ConstructionLifetime, building);

            changesMade = true;

            GUI.ClearSelectedBuildingIcon();

            newBuilding.OnSelected += new EventHandler(Building_OnSelected);
            RemoveConstructionPanel();
        }
Exemple #4
0
 public void UpgradePopulationConstruction(Slot slot, Construction populationConstruction)
 {
     Reservation reservation = new Reservation(GameManager.CurrentYear, 500, populationConstruction);
     reservation.IsPopulationUpgraded = true;
     slot.MakeReservation(reservation);
 }
Exemple #5
0
        public List<Slot> LoadZoneHistory(String profilePath)
        {
            List<Slot> slotList = new List<Slot>();

            xmlLoader = XElement.Load(profilePath + "\\" + ZonesHistoryFile);
            IEnumerable<XElement> slotListData = from element in xmlLoader.Elements() select element;

            int xSlotCenter = 0;
            int ySlotCenter = 0;
            string constructionType = "";
            Slot currentSlot = null;
            Reservation currentReservation = null;

            foreach (XElement slot in slotListData)
            {
                xSlotCenter = Convert.ToInt32(slot.Element("X").Value);
                ySlotCenter = Convert.ToInt32(slot.Element("Y").Value);
                constructionType = slot.Element("constructionType").Value.ToString();
                currentSlot = new Slot(this.Game, (ConstructionType)Enum.Parse(typeof(ConstructionType), constructionType));
                currentSlot.XSlotCenter = xSlotCenter;
                currentSlot.YSlotCenter = ySlotCenter;
                IEnumerable<XElement> slotReservations = from element in slot.Elements("reservation") select element;

                foreach (XElement reservation in slotReservations)
                {
                    string constructionName = reservation.Element("constructionName").Value.ToString();
                    Construction construction = (Construction)Enum.Parse(typeof(Construction), constructionName);
                    int startingYear = Convert.ToInt32(reservation.Element("startingYear").Value);
                    int duration = Convert.ToInt32(reservation.Element("duration").Value);
                    int upgradeYear = Convert.ToInt32(reservation.Element("upgradeYear").Value);
                    bool isUpgraded = Convert.ToBoolean(reservation.Element("isUpgraded").Value);
                    bool isPopulationUpgraded = Convert.ToBoolean(reservation.Element("isPopulationUpgraded").Value);
                    bool isDestroyed = Convert.ToBoolean(reservation.Element("isDestroyed").Value);

                    currentReservation = new Reservation(startingYear, duration, construction);
                    currentReservation.UpgradeYear = upgradeYear;
                    currentReservation.IsUpgraded = isUpgraded;
                    currentReservation.IsPopulationUpgraded = isPopulationUpgraded;
                    currentReservation.IsDestroyed = isDestroyed;

                    currentSlot.MakeReservation(currentReservation);
                    slotList.Add(currentSlot);
                }
            }
                
            return slotList;
        }