public override void Draw(GameTime gameTime, SpriteBatch spriteBatch) { Texture2D grass = _content.Load <Texture2D>("Grass"); spriteBatch.Begin(); spriteBatch.Draw(grass, new Rectangle(0, 0, 800, 500), Color.White); DateTime dateTime = DateTime.Now; string time = dateTime.ToString("h:mm tt"); if (dayAndNight() == true) { //nightTime spriteBatch.Draw(grass, new Rectangle(0, 0, 800, 500), new Color(50, 50, 125)); spriteBatch.DrawString(font, "Time: " + time, new Vector2(640, 15), Color.White); } if (this.selectedSeed != null) { spriteBatch.Draw(selectedSeed.GetTexture(), new Vector2(200, 20), null, Color.White, 0f, Vector2.Zero, .5f, SpriteEffects.None, 0f); } if (currRain == true) { spriteBatch.Draw(rainTexture, new Rectangle(0, 0, 800, 500), Color.White * 0.7f); } foreach (var component in components) { component.Draw(gameTime, spriteBatch); } spriteBatch.DrawString(font, "Time: " + time, new Vector2(640, 15), Color.White); spriteBatch.DrawString(font, "Temperature:" + currTemp.ToString(), new Vector2(640, 35), Color.White); spriteBatch.DrawString(font, "Humidity:" + currHum.ToString(), new Vector2(640, 55), Color.White); spriteBatch.DrawString(font, "Sunshine:" + currSun.ToString(), new Vector2(640, 75), Color.White); spriteBatch.Draw(littleChicken, new Vector2(280, 5), null, Color.White, 0f, Vector2.Zero, .5f, SpriteEffects.None, 0f); spriteBatch.Draw(littleCow, new Vector2(280, 30), null, Color.White, 0f, Vector2.Zero, .5f, SpriteEffects.None, 0f); spriteBatch.Draw(slotTexture, new Vector2(195, 15), null, Color.White, 0f, Vector2.Zero, .5f, SpriteEffects.None, 0f); spriteBatch.DrawString(font, "X " + chickenCount, new Vector2(320, 15), Color.White); spriteBatch.DrawString(font, "X " + cowCount, new Vector2(320, 40), Color.White); if (this.selectedSeed != null) { spriteBatch.Draw(selectedSeed.GetTexture(), new Vector2(Mouse.GetState().X, Mouse.GetState().Y), null, Color.White, 0f, Vector2.Zero, 0.5f, SpriteEffects.None, 0f); } spriteBatch.End(); }
public InventorySlot(ContentManager content, Vector2 position, SeedItem seeditem, float scale) : base(seeditem.GetTexture(), position, 1) { this.Position = position; this.seeditem = seeditem; this.scale = scale; this.isSeed = true; Texture2D buttonTexture = content.Load <Texture2D>("Button"); slotTexture = content.Load <Texture2D>("ItemSlot"); font = content.Load <SpriteFont>("defaultFont"); itemCount = content.Load <Texture2D>("itemCount"); this.buttonSfx = content.Load <SoundEffect>("Sound/selectionClick"); var buttonFont = content.Load <SpriteFont>("defaultFont"); selectButton = new Button(buttonTexture, buttonFont, this.Position + new Vector2(-30, 120), 1) { Text = "select", }; selectButton.Click += SelectButton_Click; }