public override void Draw(SpriteBatch spriteBatch) { spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(bg, new Vector2(0, 0), new Color(255, 255, 255, 255));//background if (isRank) { if (GameScene.isMode) { TimeAtackRank(); for (int i = 0; i < 5; i++) { spriteBatch.DrawString(rankingfont, list[i], new Vector2(450, 50 + (i + 1) * 120), Color.Black); } } else { if (!isFIrst) { String order = "select point, id from bread order by point DESC;"; MySqlCommand cm = new MySqlCommand(order, Game1.conn); cm.ExecuteNonQuery(); MySqlDataReader rd = cm.ExecuteReader(); String sentence; int vk = 0; bg = new Texture2D(graphics.GraphicsDevice, 100, 100); bg = game.Content.Load <Texture2D>("ranking"); while (vk != 5) { vk++; rd.Read(); sentence = rd["id"].ToString() + " : " + rd["point"].ToString(); list.Add(sentence); } rd.Close(); } for (int i = 0; i < 5; i++) { spriteBatch.DrawString(rankingfont, list[i], new Vector2(450, 50 + (i + 1) * 120), Color.Black); } isFIrst = true; } } if (!isRank) { textboxHandler.Draw(spriteBatch); } spriteBatch.End(); }
public override void Draw(SpriteBatch spriteBatch) { spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); spriteBatch.Draw(backgroundTexture, viewportRect, Color.White); spriteBatch.Draw(button1, new Vector2(400, 670), Color.White); spriteBatch.Draw(button2, new Vector2(640, 670), Color.White); textboxHandler.Draw(spriteBatch); if (isHelp) { spriteBatch.Draw(howtoplay, viewportRect, Color.White); } if (counter > 0 && counter <= 1) { spriteBatch.Draw(count3, viewportRect, Color.White); } if (counter > 1 && counter <= 2) { spriteBatch.Draw(count2, viewportRect, Color.White); } if (counter > 2 && counter <= 3) { spriteBatch.Draw(count1, viewportRect, Color.White); } spriteBatch.Draw(exit, new Vector2(1120, 30), Color.White); spriteBatch.End(); base.Draw(spriteBatch); }