BlackJackTable.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #region File Description
  2. //-----------------------------------------------------------------------------
  3. // BlackJackTable.cs
  4. //
  5. // Microsoft XNA Community Game Platform
  6. // Copyright (C) Microsoft Corporation. All rights reserved.
  7. //-----------------------------------------------------------------------------
  8. #endregion
  9. #region Using Statements
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Text;
  13. using CardsFramework;
  14. using Microsoft.Xna.Framework;
  15. using Microsoft.Xna.Framework.Graphics;
  16. #endregion
  17. namespace Blackjack
  18. {
  19. class BlackJackTable : GameTable
  20. {
  21. public Texture2D RingTexture { get; private set; }
  22. public Vector2 RingOffset { get; private set; }
  23. public BlackJackTable(Vector2 ringOffset, Rectangle tableBounds, Vector2 dealerPosition, int places,
  24. Func<int, Vector2> placeOrder, string theme, Game game)
  25. : base(tableBounds, dealerPosition, places, placeOrder, theme, game)
  26. {
  27. RingOffset = ringOffset;
  28. }
  29. /// <summary>
  30. /// Load the component assets
  31. /// </summary>
  32. protected override void LoadContent()
  33. {
  34. string assetName = string.Format(@"Images\UI\ring");
  35. RingTexture = Game.Content.Load<Texture2D>(assetName);
  36. base.LoadContent();
  37. }
  38. /// <summary>
  39. /// Draw the rings of the chip on the table
  40. /// </summary>
  41. /// <param name="gameTime"></param>
  42. public override void Draw(GameTime gameTime)
  43. {
  44. base.Draw(gameTime);
  45. SpriteBatch.Begin();
  46. for (int placeIndex = 0; placeIndex < Places; placeIndex++)
  47. {
  48. SpriteBatch.Draw(RingTexture, PlaceOrder(placeIndex) + RingOffset, Color.White);
  49. }
  50. SpriteBatch.End();
  51. }
  52. }
  53. }