public float GetValue(ConstructionType ct)
        {
            float value = 0;

            switch (ct)
            {
            case ConstructionType.Economy:
                value = Economy;
                break;

            case ConstructionType.Education:
                value = Education;
                break;

            case ConstructionType.Environment:
                value = Environment;
                break;

            case ConstructionType.Food:
                value = Food;
                break;

            case ConstructionType.Health:
                value = Health;
                break;

            case ConstructionType.Energy:
                value = Energy;
                break;
            }
            return(value);
        }
Пример #2
0
    private void OnUpdateCoreBlock()
    {
        if (Input.GetButtonDown("BuildKey1"))
        {
            _constructionType = ConstructionType.Wall;
        }
        if (Input.GetButtonDown("BuildKey2"))
        {
            _constructionType = ConstructionType.Stairs;
        }
        if (Input.GetButtonDown("BuildKey3"))
        {
            _constructionType = ConstructionType.Floor;
        }

        if (_previousConstructionType != _constructionType)
        {
            Destroy(_toBeBuildConstruction);
            _toBeBuildConstruction = null;
            _toBeBuildConstruction = Instantiate(ConstructionManager.instance.GetConstructionGameobject(_constructionType));
            _toBeBuildConstruction.GetComponent <Renderer>().material = _toBeBuildMaterial;
            Destroy(_toBeBuildConstruction.GetComponent <Collider>());
            _toBeBuildConstruction.transform.SetParent(_modeManager.environment);
        }

        UpdateToBeBuildConstructionPosition();

        _previousConstructionType = _constructionType;
    }
        public IHttpActionResult PostConstructionType(ConstructionType constructionType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.ConstructionTypes.Add(constructionType);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (ConstructionTypeExists(constructionType.ConstructionType1))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = constructionType.ConstructionType1 }, constructionType));
        }
Пример #4
0
        public static IEnumerable <string> ToShipTypes(this ConstructionType c, bool usePrefix = false)
        {
            IEnumerable <string> types;

            switch (c)
            {
            case ConstructionType.Light:
                types = new[] { "Light Cruiser", "Light Aircraft Carrier", "Destroyer", "Repair Ship" };
                break;

            case ConstructionType.Heavy:
                types = new[] { "Light Cruiser", "Heavy Cruiser", "Monitor", "Battle Cruiser", "Battleship" };
                break;

            case ConstructionType.Special:
                types = new[] { "Aircraft Carrier", "Light Aircraft Carrier", "Light Cruiser", "Heavy Cruiser", "Repair Ship", "Submarine" };
                break;

            default:
                types = new List <string>();
                break;
            }
            return(usePrefix
                ? types.Select(s => s.ToPrefix())
                : types);
        }
        public IHttpActionResult PutConstructionType(string id, ConstructionType constructionType)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != constructionType.ConstructionType1)
            {
                return(BadRequest());
            }

            db.Entry(constructionType).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ConstructionTypeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
 public virtual void DoJob(ConstructionJobInstance job, ref NPCBase.NPCState state)
 {
     if (ConstructionType != null)
     {
         ConstructionType.DoJob(IterationType, this, job, ref state);
     }
 }
        public BuildingTypeButton(Game game, ConstructionType categ)
            : base(game) {

            #region Decode
            category = categ;
            switch (categ) {
                case ConstructionType.Economy:
                    background = new Sprite(game, GraphicsCollection.GetPack("minimap-dollar"));
                    break;
                case ConstructionType.Education:
                    background = new Sprite(game, GraphicsCollection.GetPack("minimap-book"));
                    break;
                case ConstructionType.Environment:
                    background = new Sprite(game, GraphicsCollection.GetPack("minimap-tree"));
                    break;
                case ConstructionType.Food:
                    background = new Sprite(game, GraphicsCollection.GetPack("minimap-food"));
                    break;
                case ConstructionType.Health:
                    background = new Sprite(game, GraphicsCollection.GetPack("minimap-cross"));
                    break;
                case ConstructionType.Energy:
                    background = new Sprite(game, GraphicsCollection.GetPack("minimap-lightning"));
                    break;
                case ConstructionType.Population:
                    background = new Sprite(game, GraphicsCollection.GetPack("minimap-house"));
                    break;
            }
            #endregion

            AddChild(background);

            selected = false;
        }
        public void Refresh(ConstructionType mg)
        {
            startYear.Text = GameManager.StartingTravelYear.ToString();
            endYear.Text   = GameManager.EndTravelYear.ToString();
            for (int year = GameManager.StartingTravelYear; year < GameManager.EndTravelYear; year++)
            {
                MilleniumGoalsSet production = GameManager.GetConsumptionCoverage(year);
                bars[year - GameManager.StartingTravelYear].Percent = (int)(production.GetValue(mg) * 100);
            }
            Clear();
            int prod = (int)(GameManager.GetConsumptionCoverage(GameManager.CurrentYear).GetValue(mg) * 100);

            if (prod > 100)
            {
                prod = 100;
            }
            if (prod < 0)
            {
                prod = 0;
            }
            bars[GameManager.CurrentYear - GameManager.StartingTravelYear].Tint    = Color.Red;
            bars[GameManager.CurrentYear - GameManager.StartingTravelYear].Percent = 100;
            selectedYear.Text = mg + " Coverage in "
                                + GameManager.CurrentYear + ": " +
                                +prod +
                                " %";
        }
Пример #9
0
 public Slot(Game game, ConstructionType category) : base(game)
 {
     type            = category;
     visual          = new Sprite(game, GraphicsCollection.GetPack("flag"));
     reservationList = new List <Reservation>();
     AddChild(visual);
 }
Пример #10
0
 public Research(MilleniumGoalsSet bonus, int price, ConstructionType type)
 {
     done = false;
     this.bonus = bonus;
     cost = price;
     researchType = type;
 }
Пример #11
0
 public Research(MilleniumGoalsSet bonus, int price, ConstructionType type)
 {
     done         = false;
     this.bonus   = bonus;
     cost         = price;
     researchType = type;
 }
Пример #12
0
        public ActionResult DeleteConfirmed(int id)
        {
            ConstructionType constructiontype = db.ConstructionTypes.Find(id);

            db.ConstructionTypes.Remove(constructiontype);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #13
0
 public Construction(int id)
 {
     _gameObjectID = id;
     _gameObject   = null;
     _startPoint   = Vector3.zero;
     _endPoint     = Vector3.zero;
     _type         = ConstructionType.None;
 }
Пример #14
0
 public Body(string name, string header, ConstructionType constructionType, int howManySpaces, int additionalSpaces = 0)
 {
     this.name             = name;
     this.header           = header;
     this.howManySpaces    = howManySpaces;
     this.constructionType = constructionType;
     this.additionalSpaces = additionalSpaces;
 }
Пример #15
0
    public static void CreateConstruction(ConstructionType type, Vector2Int position)
    {
        DestroyConstruction(position);
        var newConstruction = Instantiate(type.construction, CoordinatesToWorldPoint(position), Quaternion.identity, instance._constructionsContainer);

        newConstruction.Init(type);
        instance.constructions.Set(position, newConstruction);
    }
Пример #16
0
 public void Set(ConstructionType constructionType)
 {
     _constructionType         = constructionType;
     _constructionImage.sprite = constructionType.sprite;
     _constructionName.text    = constructionType.displayName;
     _costText.text            = $"{constructionType.cost}";
     Refresh();
 }
Пример #17
0
 public Body(string name, string header,
             ConstructionType constructionType,
             int howManySpaces, List <string> variables,
             int additionalSpaces) : this(name, header, constructionType, howManySpaces, additionalSpaces)
 {
     this.variables  = variables;
     hasOwnVariables = false;
 }
Пример #18
0
        public ConstructionOrder(ConstructionType constructionType, Dictionary <Guid, int> minRequired, Dictionary <Guid, int> matRequired, Dictionary <Guid, int> compRequired) : this()
        {
            ConstructionType = constructionType;

            MineralsRequired   = new Dictionary <Guid, int>(minRequired);
            MaterialsRequired  = new Dictionary <Guid, int>(matRequired);
            ComponentsRequired = new Dictionary <Guid, int>(compRequired);
        }
        public void Refresh(ConstructionType mg)
        {
            Clear();
            selectedMG = mg;
            List <Research> list = GameManager.GetResearchList(mg);

            while (icons.Count > 0)
            {
                RemoveChild(icons[0]);
                icons.RemoveAt(0);
            }

            foreach (Research r in list)
            {
                //int range = ResearchPanel.RightPositioningLimit - ResearchPanel.LeftPositioningLimit;

                ////int travelRange = GameManager.EndTravelYear - GameManager.StartingTravelYear;
                ////float yearRatio = (float)(r.YearAvailable - GameManager.StartingTravelYear) / travelRange;

                //int travelRange = GameManager.EndTravelYear - 1800;
                //float yearRatio = (float)(r.YearAvailable - 1800) / travelRange;

                //float pos = yearRatio * range + LeftPositioningLimit;
                int pos = list.IndexOf(r) * (300 / (list.Count - 1)) + ResearchPanel.LeftPositioningLimit;
                if (r.YearAvailable <= GameManager.CurrentYear)
                {
                    ControlPanelButton icon;
                    if (!r.Completed || (r.Completed && r.YearCompleted > GameManager.CurrentYear))
                    {
                        icon = new ControlPanelButton(this.Game, ControlPanelButtonType.ResearchIcon);
                    }
                    else
                    {
                        icon = new ControlPanelButton(this.Game, ControlPanelButtonType.ResearchOK);
                    }
                    icon.StackOrder    = 3;
                    icon.XRelative     = (int)pos;
                    icon.YRelative     = 206;
                    icon.Data          = r;
                    icon.IsVisible     = this.IsVisible;
                    icon.OnMousePress += new EventHandler <Operation_Cronos.Input.MouseEventArgs>(icon_OnMousePress);
                    AddChild(icon);
                    icons.Add(icon);
                }
                ok.IsVisible = this.IsVisible;
            }
            if (selectedResearch != null && selectedResearch.ResearchType == selectedMG)
            {
                Refresh(selectedResearch);
            }
            else
            {
                if (icons.Count > 0)
                {
                    Refresh((Research)icons[0].Data);
                }
            }
        }
Пример #20
0
 public ConstructionJob(Guid designGuid, ConstructionType constructionType, ushort numberOrderd, int jobPoints, bool auto,
                        Dictionary <Guid, int> mineralCost, Dictionary <Guid, int> matCost, Dictionary <Guid, int> componentCost) :
     base(designGuid, numberOrderd, jobPoints, auto)
 {
     ConstructionType   = constructionType;
     MineralsRequired   = new Dictionary <Guid, int>(mineralCost);
     MaterialsRequired  = new Dictionary <Guid, int>(matCost);
     ComponentsRequired = new Dictionary <Guid, int>(componentCost);
 }
Пример #21
0
        public async Task <IEnumerable <Ship> > GetShipsForBuildPool([FromRoute] ConstructionType type)
        {
            var shipDetails = await _provider.GetShipDetails();

            var classesForPool = type.ToShipTypes();
            var ships          = shipDetails.Where(sd => sd.BuildTime.HasValue).Where(s => classesForPool.Any(t => t.Is(s.Type)));

            return(ships);
        }
Пример #22
0
 public ActionResult Edit(ConstructionType constructiontype)
 {
     if (ModelState.IsValid)
     {
         db.Entry(constructiontype).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(constructiontype));
 }
Пример #23
0
        //
        // GET: /ConstructionType/Delete/5

        public ActionResult Delete(int id = 0)
        {
            ConstructionType constructiontype = db.ConstructionTypes.Find(id);

            if (constructiontype == null)
            {
                return(HttpNotFound());
            }
            return(View(constructiontype));
        }
Пример #24
0
    public Construction(GameObject gameObject, ConstructionType type)
    {
        _gameObjectID = gameObject.GetInstanceID();
        _gameObject   = gameObject;
        _startPoint   = Vector3.zero;
        _endPoint     = Vector3.zero;
        _type         = type;

        CalculateStartEndPoint(gameObject.transform.position, gameObject.transform.rotation);
    }
        public IHttpActionResult GetConstructionType(string id)
        {
            ConstructionType constructionType = db.ConstructionTypes.Find(id);

            if (constructionType == null)
            {
                return(NotFound());
            }

            return(Ok(constructionType));
        }
Пример #26
0
        internal static void ConstructStuff(Entity colony)
        {
            CargoStorageDB stockpile = colony.GetDataBlob <CargoStorageDB>();
            Entity         faction;

            colony.Manager.FindEntityByGuid(colony.FactionOwner, out faction);
            var factionInfo        = faction.GetDataBlob <FactionInfoDB>();
            var colonyConstruction = colony.GetDataBlob <ConstructionDB>();

            var pointRates = new Dictionary <ConstructionType, int>(colonyConstruction.ConstructionRates);
            int maxPoints  = colonyConstruction.PointsPerTick;

            List <ConstructionJob> constructionJobs = colonyConstruction.JobBatchList;

            foreach (ConstructionJob batchJob in constructionJobs.ToArray())
            {
                var designInfo           = factionInfo.ComponentDesigns[batchJob.ItemGuid];
                ConstructionType conType = batchJob.ConstructionType;
                //total number of resources requred for a single job in this batch
                int resourcePoints = designInfo.MineralCosts.Sum(item => item.Value);
                resourcePoints += designInfo.MaterialCosts.Sum(item => item.Value);
                resourcePoints += designInfo.ComponentCosts.Sum(item => item.Value);

                while ((pointRates[conType] > 0) && (maxPoints > 0) && (batchJob.NumberCompleted < batchJob.NumberOrdered))
                {
                    //gather availible resorces for this job.

                    ConsumeResources(stockpile, batchJob.MineralsRequired);
                    ConsumeResources(stockpile, batchJob.MaterialsRequired);
                    ConsumeResources(stockpile, batchJob.ComponentsRequired);

                    int useableResourcePoints = designInfo.MineralCosts.Sum(item => item.Value) - batchJob.MineralsRequired.Sum(item => item.Value);
                    useableResourcePoints += designInfo.MaterialCosts.Sum(item => item.Value) - batchJob.MaterialsRequired.Sum(item => item.Value);
                    useableResourcePoints += designInfo.ComponentCosts.Sum(item => item.Value) - batchJob.ComponentsRequired.Sum(item => item.Value);
                    //how many construction points each resourcepoint is worth.
                    int pointPerResource = designInfo.BuildPointCost / resourcePoints;

                    //calculate how many construction points each resource we've got stored for this job is worth
                    int pointsToUse = Math.Min(pointRates[conType], maxPoints);
                    pointsToUse = Math.Min(pointsToUse, batchJob.ProductionPointsLeft);
                    pointsToUse = Math.Min(pointsToUse, useableResourcePoints * pointPerResource);

                    //construct only enough for the amount of resources we have.
                    batchJob.ProductionPointsLeft -= pointsToUse;
                    pointRates[conType]           -= pointsToUse;
                    maxPoints -= pointsToUse;

                    if (batchJob.ProductionPointsLeft == 0)
                    {
                        BatchJobItemComplete(colony, stockpile, batchJob, designInfo);
                    }
                }
            }
        }
Пример #27
0
        public ActionResult Create(ConstructionType constructiontype)
        {
            if (ModelState.IsValid)
            {
                db.ConstructionTypes.Add(constructiontype);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(constructiontype));
        }
Пример #28
0
        public ActionResult PostEditConstructionType(ConstructionType constructionType)
        {
            if (!User.IsInRole("admin"))
            {
                return(View("Error"));
            }

            _adminRepository.PostDataForConstructionTypeEdit(constructionType, User.Identity.Name);

            return(RedirectToAction("ConstructionType"));
        }
Пример #29
0
        public ActionResult GetEditConstructionType(int id)
        {
            if (!User.IsInRole("admin"))
            {
                return(View("Error"));
            }

            ConstructionType constructionType = _adminRepository.GetDataForConstructionTypeEdit(id);

            return(View("ConstructionTypeEdit", constructionType));
        }
Пример #30
0
        /// <summary>
        /// Delete construction type from database by id.
        /// </summary>
        /// <param name="constructionTypeId">Construction type id value.</param>
        public void DeleteConstructionType(int constructionTypeId)
        {
            ConstructionType deletingConstructionType = new ConstructionType
            {
                Id = constructionTypeId
            };

            _db.ConstructionTypes.Attach(deletingConstructionType);
            _db.ConstructionTypes.Remove(deletingConstructionType);

            _db.SaveChanges();
        }
Пример #31
0
    private static LXFMLConstruction GetConstructionByType(ConstructionType pType)
    {
        switch (pType)
        {
        case ConstructionType.Building:
            return(new LXFMLBuildingConstruction(BuildingTypes.AbstractType1));

        default:
        case ConstructionType.Vehicle:
            return(new LXFMLVehicleConstruction());
        }
    }
Пример #32
0
        /// <summary>
        /// Inserts a review type
        /// </summary>
        /// <param name="item">Review type</param>
        public virtual void InsertConstructionType(ConstructionType item)
        {
            if (item == null)
            {
                throw new ArgumentNullException(nameof(item));
            }

            _itemRepository.Insert(item);
            _cacheManager.RemoveByPattern(GSCatalogDefaults.ConstructionTypeByPatternKey);

            //event notification
            _eventPublisher.EntityInserted(item);
        }
Пример #33
0
        public ResearchPanel(Game game)
            : base(game)
        {
            selectedResearch = null;
            selectedMG = ConstructionType.None;

            timeline = new Sprite(game, GraphicsCollection.GetPack("control-research-timeline"));
            timeline.XRelative = 91;
            timeline.YRelative = 197;
            AddChild(timeline);

            ok = new ControlPanelButton(game, ControlPanelButtonType.ResearchOK);
            ok.XRelative = 413;
            ok.YRelative = 64;
            ok.IsVisible = false;
            ok.Enabled = false;
            ok.OnPress += new EventHandler<ButtonEventArgs>(ok_OnPress);
            AddChild(ok);

            name = new SpriteText(game, FontsCollection.GetPack("Calibri 11").Font);
            name.Tint = Color.White;
            name.XRelative = 101;
            name.YRelative = 64;
            AddChild(name);

            description = new SpriteText(game, FontsCollection.GetPack("Calibri 10").Font);
            description.Tint = Color.White;
            description.XRelative = 101;
            description.YRelative = 82;
            AddChild(description);

            price = new SpriteText(game, FontsCollection.GetPack("Calibri 10").Font);
            price.Tint = Color.Lime;
            price.XRelative = 101;
            price.YRelative = 178;
            AddChild(price);

            year = new SpriteText(game, FontsCollection.GetPack("Calibri 10").Font);
            year.Tint = Color.Lime;
            year.XRelative = 347;
            year.YRelative = 178;
            AddChild(year);

            icons = new List<ControlPanelButton>();
        }
Пример #34
0
 public void Refresh(ConstructionType mg)
 {
     startYear.Text = GameManager.StartingTravelYear.ToString();
     endYear.Text = GameManager.EndTravelYear.ToString();
     for (int year = GameManager.StartingTravelYear; year < GameManager.EndTravelYear; year++)
     {
         MilleniumGoalsSet production = GameManager.GetConsumptionCoverage(year);
         bars[year - GameManager.StartingTravelYear].Percent = (int)(production.GetValue(mg) * 100);
     }
     Clear();
     int prod = (int)(GameManager.GetConsumptionCoverage(GameManager.CurrentYear).GetValue(mg) * 100);
     if (prod > 100) prod = 100;
     if (prod < 0) prod = 0;
     bars[GameManager.CurrentYear - GameManager.StartingTravelYear].Tint = Color.Red;
     bars[GameManager.CurrentYear - GameManager.StartingTravelYear].Percent = 100;
     selectedYear.Text = mg + " Coverage in "
         + GameManager.CurrentYear + ": " +
          +prod +
         " %";
 }
Пример #35
0
 public void SelectBuildingCategory(ConstructionType category) {
     foreach (BuildingTypeButton b in buttons) {
         b.Unselect();
     }
     foreach (BuildingTypeButton  b in buttons) {
         if (b.Category == category) {
             b.Select();
             selectedCategory = category;
             OnCategorySelected(this, new BuildingTypeEventArgs(category));
             break;
         }
     }
 }
Пример #36
0
 public List<Research> GetResearchList(ConstructionType type)
 {
     return researchHistory.GetResearchList(type);
 }
Пример #37
0
        void InitialState()
        {
            constructionYear = 0;
            constructionLifetime = 0;
            if (isPopulationConstruction)
            {
                degradationPeriod = 0; //population constructions do not degradate
                upgraded = true;//set to upgrade automatically to historical period 2, when entering it

                if (isPopulationConstruction_UpgradedLevel)
                    constructingPeriod = 1;//takes 1 year to complete the construction stage
                //(because the constructing starts directly from stage 2)
                else
                    constructingPeriod = 2;//takes two years to complete the construction stage
                upgradeYear = (int)HistoricalPeriod.HP2_FirstYear; //initially

            }
            else
            {
                degradationPeriod = 1;//(initially) takes one year for the construction to disappear
                upgradeYear = 0;
                upgraded = false;
                constructingPeriod = 2;//takes two years to complete the construction stage
            }
            repairCost = 0;
            upgradeCost = 0;

            isSelected = false;

            constructionType = ConstructionType.None;
            constructionStatus = ConstructionStatus.None;

            historicalPeriod_1_Availability = 0;
            historicalPeriod_2_Availability = 0;

            HP1_Aspect_AnimationSpeed = 0;
            HP1_Aspect_ExtraAnimationSpeed = 0;
            HP2_Aspect_AnimationSpeed = 0;
            HP2_Aspect_ExtraAnimationSpeed = 0;

            HP1_AspectExtraAnimationSprite = null;
            HP2_AspectExtraAnimationSprite = null;
        }
Пример #38
0
 /// <summary>
 /// Called to display all the building slots of a certain category
 /// </summary>
 /// <param name="category"></param>
 public void DisplaySlots(ConstructionType category)
 {
     HideSlots();
     List<Point> positions = new List<Point>();
     foreach (Slot slot in slotList)
     {
         if (slot.ConstructionType == category)
             if (slot.IsFree(GameManager.GetCurrentYear()))
             {
                 slot.IsVisible = true;
                 slot.Enabled = true;
                 positions.Add(new Point(slot.XRelative, slot.YRelative));
             }
     }
     GUI.DisplaySlots(positions);
 }
Пример #39
0
 public BuildingTypeEventArgs(ConstructionType categ) {
     type = categ;
 }
Пример #40
0
        public void RefreshBuildings(ConstructionType category)
        {
            buildingCategory = category;
            HideIcons();
            if (Map != null)
            {
                Map.DisplaySlots(ConstructionType.None);
            }

            switch (category)
            {
                case ConstructionType.Economy:
                    selectedIcons = economyIcons;
                    break;
                case ConstructionType.Education:
                    selectedIcons = educationIcons;
                    break;
                case ConstructionType.Environment:
                    selectedIcons = environmentIcons;
                    break;
                case ConstructionType.Food:
                    selectedIcons = foodIcons;
                    break;
                case ConstructionType.Health:
                    selectedIcons = healthIcons;
                    break;
                case ConstructionType.Energy:
                    selectedIcons = energyIcons;
                    break;
                case ConstructionType.Population:
                    selectedIcons = populationIcons;
                    break;
            }

            if (selectedIcons != null)
                DisplayIcons();
        }
Пример #41
0
        public void Refresh(ConstructionType mg)
        {
            Clear();
            selectedMG = mg;
            List<Research> list = GameManager.GetResearchList(mg);
            while (icons.Count > 0)
            {
                RemoveChild(icons[0]);
                icons.RemoveAt(0);
            }

            foreach (Research r in list)
            {
                //int range = ResearchPanel.RightPositioningLimit - ResearchPanel.LeftPositioningLimit;

                ////int travelRange = GameManager.EndTravelYear - GameManager.StartingTravelYear;
                ////float yearRatio = (float)(r.YearAvailable - GameManager.StartingTravelYear) / travelRange;

                //int travelRange = GameManager.EndTravelYear - 1800;
                //float yearRatio = (float)(r.YearAvailable - 1800) / travelRange;

                //float pos = yearRatio * range + LeftPositioningLimit;
                int pos = list.IndexOf(r) * (300 / (list.Count - 1)) + ResearchPanel.LeftPositioningLimit;
                if (r.YearAvailable <= GameManager.CurrentYear)
                {
                    ControlPanelButton icon;
                    if (!r.Completed || (r.Completed && r.YearCompleted > GameManager.CurrentYear))
                        icon = new ControlPanelButton(this.Game, ControlPanelButtonType.ResearchIcon);
                    else
                        icon = new ControlPanelButton(this.Game, ControlPanelButtonType.ResearchOK);
                    icon.StackOrder = 3;
                    icon.XRelative = (int)pos;
                    icon.YRelative = 206;
                    icon.Data = r;
                    icon.IsVisible = this.IsVisible;
                    icon.OnMousePress += new EventHandler<Operation_Cronos.Input.MouseEventArgs>(icon_OnMousePress);
                    AddChild(icon);
                    icons.Add(icon);
                }
                ok.IsVisible = this.IsVisible;
            }
            if (selectedResearch != null && selectedResearch.ResearchType == selectedMG)
            {
                Refresh(selectedResearch);
            }
            else
            {
                if (icons.Count > 0)
                {
                    Refresh((Research)icons[0].Data);
                }
            }
        }
Пример #42
0
 public Slot(Game game, ConstructionType category):base(game) {
     type = category;
     visual = new Sprite(game, GraphicsCollection.GetPack("flag"));
     reservationList = new List<Reservation>();
     AddChild(visual);
 }
Пример #43
0
        public BuildingIcon(Game game, ConstructionType category, Construction building)
            : base(game)
        {
            this.building = building;
            this.category = category;

            #region Choose Graphics
            switch (building)
            {
                case Construction.EnergySolar:
                    visual = new Sprite(game, GraphicsCollection.GetPack("icon-energy-solar"));
                    AddChild(visual);
                    break;
                case Construction.EnergySolid:
                    visual = new Sprite(game, GraphicsCollection.GetPack("icon-energy-oil"));
                    AddChild(visual);
                    break;
                case Construction.EnergyWind:
                    visual = new Sprite(game, GraphicsCollection.GetPack("icon-energy-wind"));
                    AddChild(visual);
                    break;
                case Construction.EnergyGeo:
                    visual = new Sprite(game, GraphicsCollection.GetPack("icon-energy-geo"));
                    AddChild(visual);
                    break;
                case Construction.EnergyNuclear:
                    visual = new Sprite(game, GraphicsCollection.GetPack("icon-energy-nuclear"));
                    AddChild(visual);
                    break;
                case Construction.EducationSchool:
                    visual = new Sprite(game, GraphicsCollection.GetPack("icon-education-school"));
                    AddChild(visual);
                    break;
                case Construction.EducationHighSchool:
                    visual = new Sprite(game, GraphicsCollection.GetPack("icon-education-highschool"));
                    AddChild(visual);
                    break;
                case Construction.EducationUniversity:
                    visual = new Sprite(game, GraphicsCollection.GetPack("icon-education-university"));
                    AddChild(visual);
                    break;
                case Construction.FoodAnimalFarm:
                    visual = new Sprite(game, GraphicsCollection.GetPack("icon-food-animalFarm"));
                    AddChild(visual);
                    break;
                case Construction.FoodCropFarm:
                    visual = new Sprite(game, GraphicsCollection.GetPack("icon-food-cropFarm"));
                    AddChild(visual);
                    break;
                case Construction.FoodOrchard:
                    visual = new Sprite(game, GraphicsCollection.GetPack("icon-food-orchard"));
                    AddChild(visual);
                    break;
                case Construction.FoodFarmedFisherie:
                    visual = new Sprite(game, GraphicsCollection.GetPack("icon-food-farmedFisherie"));
                    AddChild(visual);
                    break;
                case Construction.PopulationVillage:
                    visual = new Sprite(game, GraphicsCollection.GetPack("icon-population-village"));
                    AddChild(visual);
                    break;
                case Construction.PopulationTown:
                    visual = new Sprite(game, GraphicsCollection.GetPack("icon-population-town"));
                    AddChild(visual);
                    break;
                case Construction.PopulationCity:
                    visual = new Sprite(game, GraphicsCollection.GetPack("icon-population-city"));
                    AddChild(visual);
                    break;
                case Construction.PopulationMetropolis:
                    visual = new Sprite(game, GraphicsCollection.GetPack("icon-population-metropolis"));
                    AddChild(visual);
                    break;
                case Construction.HealthHospital:
                    visual = new Sprite(game, GraphicsCollection.GetPack("icon-health-hospital"));
                    AddChild(visual);
                    break;
                case Construction.HealthClinic:
                    visual = new Sprite(game, GraphicsCollection.GetPack("icon-health-clinic"));
                    AddChild(visual);
                    break;
                case Construction.EconomyFactory:
                    visual = new Sprite(game, GraphicsCollection.GetPack("icon-economy-factory"));
                    AddChild(visual);
                    break;
                case Construction.EconomyOilWell:
                    visual = new Sprite(game, GraphicsCollection.GetPack("icon-economy-oilWell"));
                    AddChild(visual);
                    break;
                case Construction.EconomyMine:
                    visual = new Sprite(game, GraphicsCollection.GetPack("icon-economy-mine"));
                    AddChild(visual);
                    break;
                case Construction.EconomySawMill:
                    visual = new Sprite(game, GraphicsCollection.GetPack("icon-economy-sawMill"));
                    AddChild(visual);
                    break;
                case Construction.EnvironmentNursery:
                    visual = new Sprite(game, GraphicsCollection.GetPack("icon-environment-nursery"));
                    AddChild(visual);
                    break;
                case Construction.EnvironmentRecycling:
                    visual = new Sprite(game, GraphicsCollection.GetPack("icon-environment-recycling"));
                    AddChild(visual);
                    break;
                case Construction.EnvironmentWaterPurification:
                    visual = new Sprite(game, GraphicsCollection.GetPack("icon-environment-waterPurification"));
                    AddChild(visual);
                    break;
                default:
                    break;
            }
            #endregion
            
            RefreshTooltip();
        }
Пример #44
0
 void button_OnRelease(object sender, ButtonEventArgs e) {
     BuildingTypeButton button = (BuildingTypeButton)sender;
     if (button.IsSelected) {
         button.Unselect();
         selectedCategory = ConstructionType.None;
         OnCategoryUnselected(this, new BuildingTypeEventArgs(button.Category));
     } else {
         foreach (BuildingTypeButton  b in buttons) {
             b.Unselect();
         }
         button.Select();
         selectedCategory = button.Category;
         OnCategorySelected(this, new BuildingTypeEventArgs(button.Category));
     }
 }