Cards.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using Microsoft.Xna.Framework;
  2. using System;
  3. using System.Collections.Generic;
  4. namespace OpenVIII
  5. {
  6. public sealed partial class Cards : SP2
  7. {
  8. #region Constructors
  9. /// <summary>
  10. /// Card images used in menus. The images used in the triple triad game are in the ff8.exe in
  11. /// tim files.
  12. /// </summary>
  13. /// <seealso cref="http://forums.qhimm.com/index.php?topic=11084.0"/>
  14. public Cards()
  15. {
  16. }
  17. #endregion Constructors
  18. #region Methods
  19. public static Cards Load() => Load<Cards>();
  20. protected override void DefaultValues()
  21. {
  22. base.DefaultValues();
  23. Props = new List<TexProps>()
  24. {
  25. new TexProps{Filename="mc{0:00}.tex",Count =10 },
  26. };
  27. TextureStartOffset = 0;
  28. EntriesPerTexture = 11;
  29. IndexFilename = "cardanm.sp2";
  30. }
  31. public const float AspectRatio = 62f / 88f; //B6 paper
  32. protected override void Init() => base.Init();
  33. public override void Draw(Enum id, Rectangle dst, float fade = 1)
  34. {
  35. var v = Convert.ToInt32(id);
  36. //int t = (v / EntriesPerTexture);
  37. //int pos = v % EntriesPerTexture;
  38. // pos = (int) Memory.Cards.Count - 1;
  39. //base.Draw((Cards.ID)(pos+(EntriesPerTexture *t)), dst, fade);
  40. if (v >= (uint)Cards.ID.Card_Back)
  41. {
  42. var ept = EntriesPerTexture;
  43. EntriesPerTexture = -1;
  44. id = (Cards.ID)(ept);
  45. //Rectangle src = GetEntry(ID).GetRectangle;
  46. //TextureHandler tex = GetTexture(ID,v/ept);
  47. //tex.Draw(dst, src, Color.White * fade);
  48. base.Draw(id, dst, fade);
  49. EntriesPerTexture = ept;
  50. }
  51. else
  52. base.Draw(id, dst, fade);
  53. }
  54. #endregion Methods
  55. }
  56. }