public void Draw(SpriteBatch spriteBatch) { // Draw cases for (int i = 0; i < NbrCases; i++) { if (SelectedBlock == i) { spriteBatch.Draw(TextureSelectedCase, new Rectangle((int)Math.Round(i * WidthCases + Position.X), (int)Position.Y, WidthCases, HeightCases), Color.White); } else { spriteBatch.Draw(TextureCases, new Rectangle((int)Math.Round(i * WidthCases + Position.X), (int)Position.Y, WidthCases, HeightCases), Color.White); } } // Draw items foreach (KeyValuePair <CEAInventoryItem, int> item in Items) { if (item.Key != null) { item.Key.Image.Draw(spriteBatch); CETextElement amountText = new CETextElement(item.Value + "", Assets.MainFont, Color.White, new Rectangle(item.Key.Image.Rect.X + item.Key.Image.Rect.Width / 2, item.Key.Image.Rect.Y + item.Key.Image.Rect.Height / 2, (int)Math.Round(item.Key.Image.Rect.Width / 2.5), (int)Math.Round(item.Key.Image.Rect.Height / 2.3))); amountText.Draw(spriteBatch); } } }
public CEATravelZone(Rectangle rect, string idToGo, string text, SpriteFont font, Color color, string cursorPath, Main baseGame) { Rect = rect; IdToGo = idToGo; Text = new CETextElement(text, font, color, new Rectangle(0, 0, 0, 0)); CursorPath = cursorPath; BaseGame = baseGame; cursorStep = BaseGame.Content.Load <Texture2D>(CursorPath); }