示例#1
0
        public override void Draw(SpriteBatchRelative spriteBatch, bool isRelative)
        {
            double environmentScore = 10; //Hello magic number. How are you today.
            int educatedCount = 0;

            foreach (Person person in World.PersonSet) {
                if (person.IsEducated) {
                    educatedCount++;
                }
            }

            foreach (Building b in World.BuildingSet) {
                if (b is Factory){
                    environmentScore -= ((Factory) b).PollutionFactor;
                }
            }

            educationBar.Fraction = educatedCount / (double)World.PersonSet.Count;

            environmentBar.Fraction = environmentScore / (double)10;

            overallBar.Fraction = (educationBar.Fraction + healthBar.Fraction + environmentBar.Fraction) / 3;

            base.Draw(spriteBatch, isRelative);
        }
示例#2
0
        public override void Draw(SpriteBatchRelative spriteBatch)
        {
            spriteBatch.DrawRelative(Texture, BoundingBox, Color.Red, Layer.GetWorldDepth(GridLocation));

            effectDisplay.Sequence = effects[ActivatedEffect].sequence;
            effectDisplay.Draw(spriteBatch, true);
        }
示例#3
0
        public override void Draw(SpriteBatchRelative spriteBatch, bool isRelative)
        {
            dayNightButton.Text = World.IsNight ? "Begin Day" : "Begin Night";
            timeBar.Fraction = World.TimeLeft / World.DAY_TIME_LIMIT;
            dayBox.Text = "Day " + World.DayCount.ToString();
            moneyNumBox.Text = "$" + World.Money.ToString();

            base.Draw(spriteBatch, isRelative);
        }
示例#4
0
 public override void Draw(SpriteBatchRelative spriteBatch, bool isRelative)
 {
     if (IsActive) {
         foreach (Button button in buttons) {
             spriteBatch.DrawAbsolute(MediaRepository.Textures["BlankTile"], button.BoundingBox, new Color(0, 0, 0, 50));
         }
         base.Draw(spriteBatch, isRelative);
     }
 }
示例#5
0
 public override void Draw(SpriteBatchRelative spriteBatch, bool isRelative)
 {
     if (IsActive) {
         title.Text = professionToString[person.Profession];
         educationBar.Fraction = person.Education / (double)Person.EDUCATION_MAX;
         movementBar.Fraction = person.RemainingMovement / (double) person.MovementRange;
         healthBar.Fraction = person.Health / (double)Person.HEALTH_MAX;
         professionIcon.Color = professionToColor[person.Profession];
         base.Draw(spriteBatch, isRelative);
     }
 }
示例#6
0
        public override void Draw(SpriteBatchRelative spriteBatch, bool isRelative)
        {
            base.Draw(spriteBatch, isRelative);

            Rectangle frontBarBoundingBox = BoundingBox;
            frontBarBoundingBox.Width = (int)(frontBarBoundingBox.Width * fraction);

            if (isRelative) {
                spriteBatch.DrawRelative(MediaRepository.Textures["Blank"], frontBarBoundingBox, frontColor, layerDepth);
            } else {
                spriteBatch.DrawAbsolute(MediaRepository.Textures["Blank"], frontBarBoundingBox, frontColor);
            }
        }
示例#7
0
        public override void Draw(SpriteBatchRelative spriteBatch, bool isRelative)
        {
            if (IsActive) {
                spriteBatch.DrawAbsolute(base.background, base.boundingBox, base.color);

                Rectangle tileRect = new Rectangle(boundingBox.X, boundingBox.Y + TilePosY, ButtonWidth, ButtonWidth / 2);
                for (int n = 0; n < professionButtons.Count(); n++) {
                    spriteBatch.DrawAbsolute(MediaRepository.Textures["BlankTile"],
                        tileRect, new Color(255, 255, 255, 100));
                    tileRect = Geometry.Translate(tileRect, ButtonWidth, 0);
                }

                foreach (Button button in professionButtons) {
                    button.Draw(spriteBatch, false);
                }
            }
        }
示例#8
0
        public override void Draw(SpriteBatchRelative spriteBatch)
        {
            Rectangle arrowBox = Display.GridLocationToViewport(GridLocation);
            Color arrowColor = new Color(255, 255, 255, 200);
            switch (direction)
            {
                case DirectionType.North:
                    spriteBatch.DrawRelative(MediaRepository.Textures["Arrow_N"], arrowBox, arrowColor, Layer.Depth["Arrow"]);
                    break;
                case DirectionType.East:
                    spriteBatch.DrawRelative(MediaRepository.Textures["Arrow_E"], arrowBox, arrowColor, Layer.Depth["Arrow"]);
                    break;
                case DirectionType.South:
                    spriteBatch.DrawRelative(MediaRepository.Textures["Arrow_S"], arrowBox, arrowColor, Layer.Depth["Arrow"]);
                    break;
                case DirectionType.West:
                    spriteBatch.DrawRelative(MediaRepository.Textures["Arrow_W"], arrowBox, arrowColor, Layer.Depth["Arrow"]);
                    break;
            }

            spriteBatch.DrawRelative(Texture, BoundingBox, Color.White, Layer.GetWorldDepth(GridLocation));
        }
示例#9
0
        public override void Draw(SpriteBatchRelative spriteBatch, bool isRelative)
        {
            if (IsActive) {
                base.Draw(spriteBatch, isRelative);

                Point curPivot = new Point(BoundingBox.X, BoundingBox.Y);
                Point increment = new Point(tileSize.Width + indent, 0);

                for (Light.LightType type = 0; type < Light.LightType.SIZE; type++) {
                    for (int count = 0; count < sequence.Frequencies[type]; count++) {
                        if (isRelative) {
                            spriteBatch.DrawRelative(MediaRepository.Textures["Blank"], Geometry.ConstructRectangle(curPivot, tileSize),
                                Light.GetLightColor(type), layerDepth);
                        }
                        else {
                            spriteBatch.DrawAbsolute(MediaRepository.Textures["Blank"], Geometry.ConstructRectangle(curPivot, tileSize),
                                Light.GetLightColor(type));
                        }

                        curPivot = Geometry.Sum(curPivot, increment);
                    }
                }
            }
        }
示例#10
0
 public abstract void Draw(SpriteBatchRelative spriteBatch);
示例#11
0
 public override void Draw(SpriteBatchRelative spriteBatch)
 {
     //    spriteBatch.Draw(Texture, BoundingBox, colorTable[type]);
 }
示例#12
0
        public override void Draw(SpriteBatchRelative spriteBatch, bool isRelative)
        {
            if (IsActive) {
                Building thisBuilding = (Building)World.SelectedEntities.First();
                for (int index = 0; index < 4; index++) {
                    if (thisBuilding.GetEffects()[index].isKnown) {
                        descriptions[index].Activate();
                        effectButtons[index].Activate();
                        sequenceBars[index].Activate();
                        unknownTexts[index].Deactivate();
                    }
                    else {
                        descriptions[index].Deactivate();
                        effectButtons[index].Deactivate();
                        sequenceBars[index].Deactivate();
                        unknownTexts[index].Activate();
                    }

                    if (World.IsNight) {
                        effectButtons[index].Deactivate();
                    }
                }

                base.Draw(spriteBatch, isRelative);

                spriteBatch.DrawAbsolute(MediaRepository.Textures["Border"], effectButtons[thisBuilding.ActivatedEffect].BoundingBox, World.IsNight ? Color.Black : Color.White);
            }
        }
示例#13
0
        public override void Draw(SpriteBatchRelative spriteBatch)
        {
            switch (type) {
                case TileType.Grass:
                    spriteBatch.DrawRelative(MediaRepository.Textures["GrassTile"], BoundingBox, new Color(255, 255, 255, 100), Layer.Depth["Tile"]);
                    break;
                case TileType.Water:
                    spriteBatch.DrawRelative(MediaRepository.Textures["WaterTile"], BoundingBox, new Color(255, 255, 255, 100), Layer.Depth["Tile"]);
                    break;
            }
            if (highlightColor != TileHighlightColor.None) {
                spriteBatch.DrawRelative(MediaRepository.Textures["BlankTile"], BoundingBox, tileHighlightColors[highlightColor], Layer.Depth["Highlight"]);
            }

            foreach (Entity entity in entities) {
                if (!entity.DeferDraw && !entity.Hidden) {
                    entity.Draw(spriteBatch);
                }
            }
        }
示例#14
0
        public override void Draw(SpriteBatchRelative spriteBatch)
        {
            Rectangle arrowBox = Display.GridLocationToViewport(GridLocation);
            Color arrowColor = new Color(255, 255, 255, 200);
            switch (direction)
            {
                case DirectionType.North:
                    spriteBatch.DrawRelative(MediaRepository.Textures["Arrow_N"], arrowBox, arrowColor, Layer.Depth["Arrow"]);
                    break;
                case DirectionType.East:
                    spriteBatch.DrawRelative(MediaRepository.Textures["Arrow_E"], arrowBox, arrowColor, Layer.Depth["Arrow"]);
                    break;
                case DirectionType.South:
                    spriteBatch.DrawRelative(MediaRepository.Textures["Arrow_S"], arrowBox, arrowColor, Layer.Depth["Arrow"]);
                    break;
                case DirectionType.West:
                    spriteBatch.DrawRelative(MediaRepository.Textures["Arrow_W"], arrowBox, arrowColor, Layer.Depth["Arrow"]);
                    break;
            }

            spriteBatch.DrawRelative(Texture, BoundingBox, Color.White, Layer.GetWorldDepth(GridLocation));

            if (IsEducated && (profession == ProfessionType.Worker))
            {
                Rectangle noticeBox = new Rectangle(BoundingBox.X, BoundingBox.Y, BoundingBox.Width / 2, BoundingBox.Height / 2);
                spriteBatch.DrawRelative(MediaRepository.Textures["Notice"], noticeBox, Color.Yellow, Layer.Depth["Notice"]);
            }
        }
示例#15
0
        public override void Draw(SpriteBatchRelative spriteBatch, bool isRelative)
        {
            if (!IsActive) {
                return;
            }

            base.Draw(spriteBatch, isRelative);

            foreach (Component c in components) {
                c.Draw(spriteBatch, isRelative);
            }
        }
示例#16
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatchRelative(GraphicsDevice);

            MediaRepository.LoadAll(this);
        }
示例#17
0
        public override void Draw(SpriteBatchRelative spriteBatch, bool isRelative)
        {
            if (IsActive) {
                activateButton.Deactivate();
                abortButton.Deactivate();

                if (thisCenter.IsActive) {
                    abortButton.Activate();
                }

                if (thisResearch != null) {

                    descriptionText.Text = thisResearch.Description;
                    if (thisResearch.IsCompleted) {
                        statusText.Text = "Completed";
                    }
                    else if (thisResearch.IsInProgress) {
                        statusText.Text = "In Progress";
                    }
                    else {
                        statusText.Text = "Not Started";
                        activateButton.Activate();
                    }

                    for (int index = 0; index < MaxTasksPerResearch; index++) {
                        if (index < thisResearch.TaskCount) {
                            tasksDisplay[index].Sequence = thisResearch.GetTask(index);
                        }
                        else {
                            tasksDisplay[index].Sequence = new LightSequence();
                        }
                    }
                }
                base.Draw(spriteBatch, isRelative);
            }
        }
示例#18
0
 public override void Draw(SpriteBatchRelative spriteBatch)
 {
     spriteBatch.DrawRelative(GetTexture(), BoundingBox, Color.White, Layer.GetWorldDepth(GridLocation));
 }
示例#19
0
        public override void Draw(SpriteBatchRelative spriteBatch, bool isRelative)
        {
            if (World.CurrentMission.GetMissionStatus() == Objective.StatusType.Failure)
            {
                missionResultBox.Color = new Color(255, 0, 0, 100);
                missionResultBox.Text = "Mission Fail!";
            }
            else if (World.CurrentMission.GetMissionStatus() == Objective.StatusType.Success)
            {
                missionResultBox.Color = new Color(0, 0, 255, 100);
                missionResultBox.Text = "Mission Complete!";
            }

            base.Draw(spriteBatch, isRelative);
        }