Draw.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. using Microsoft.Xna.Framework;
  2. using System.Linq;
  3. namespace OpenVIII.IGMData.Pool
  4. {
  5. public partial class Draw : IGMData.Pool.Base<Saves.Data, Debug_battleDat.Magic>
  6. {
  7. #region Fields
  8. #endregion Fields
  9. #region Methods
  10. public static Draw Create(Rectangle pos, Damageable damageable, bool battle = false)
  11. {
  12. return Create<Draw>(5, 3, new IGMDataItem.Box { Pos = pos, Title = Icons.ID.CHOICE }, 4, 1, damageable, battle: battle);
  13. }
  14. public override bool Inputs()
  15. {
  16. if (ITEM[CURSOR_SELECT, 2].Enabled)
  17. {
  18. Cursor_Status |= Cursor_Status.Blinking;
  19. return ITEM[CURSOR_SELECT, 2].Inputs();
  20. }
  21. else
  22. Cursor_Status &= ~Cursor_Status.Blinking;
  23. return base.Inputs();
  24. }
  25. public override bool Inputs_CANCEL()
  26. {
  27. Hide();
  28. return true;
  29. }
  30. public override bool Inputs_OKAY()
  31. {
  32. ITEM[CURSOR_SELECT, 2]?.Show();
  33. return base.Inputs_OKAY();
  34. }
  35. public void Refresh(Debug_battleDat.Magic[] magics)
  36. {
  37. Contents = magics;
  38. Refresh();
  39. }
  40. public override void Refresh()
  41. {
  42. base.Refresh();
  43. Source = Memory.State;
  44. if (Source != null && Damageable != null)
  45. {
  46. byte pos = 0;
  47. int skip = Page * Rows;
  48. for (byte i = 0; pos < Rows && i < Contents.Length; i++)
  49. {
  50. bool unlocked = Source.UnlockedGFs.Contains(Contents[i].GF);
  51. bool junctioned = (Damageable.GetCharacterData(out Saves.CharacterData c) && c.Stat_J.ContainsValue(Contents[i].ID));
  52. ((IGMDataItem.Text)(ITEM[pos, 0])).Data = Contents[i].Name;
  53. ((IGMDataItem.Text)(ITEM[pos, 0])).Show();
  54. if (junctioned)
  55. ((IGMDataItem.Icon)(ITEM[pos, 1])).Show();
  56. else
  57. ((IGMDataItem.Icon)(ITEM[pos, 1])).Hide();
  58. ((Commands)ITEM[pos, 2]).Refresh(Contents[i]);
  59. BLANKS[pos] = false;
  60. pos++;
  61. }
  62. for (; pos < Rows; pos++)
  63. {
  64. ((IGMDataItem.Text)(ITEM[pos, 0])).Hide();
  65. ((IGMDataItem.Icon)(ITEM[pos, 1])).Hide();
  66. BLANKS[pos] = true;
  67. }
  68. }
  69. }
  70. protected override void Init()
  71. {
  72. base.Init();
  73. Rectangle r = CONTAINER.Pos;
  74. r.Inflate(-Width * .25f, -Height * .25f);
  75. for (byte pos = 0; pos < Rows; pos++)
  76. {
  77. ITEM[pos, 0] = new IGMDataItem.Text { Pos = SIZE[pos] };
  78. ITEM[pos, 1] = new IGMDataItem.Icon { Data = Icons.ID.JunctionSYM, Pos = new Rectangle(SIZE[pos].X + SIZE[pos].Width - 60, SIZE[pos].Y, 0, 0) };
  79. ITEM[pos, 2] = Commands.Create(r, Damageable, Battle);
  80. ITEM[pos, 2].Hide();
  81. }
  82. DepthFirst = true;
  83. PointerZIndex = 0;
  84. }
  85. protected override void InitShift(int i, int col, int row)
  86. {
  87. base.InitShift(i, col, row);
  88. //SIZE[i].Inflate(-18, -20);
  89. //SIZE[i].Y -= 5 * row;
  90. SIZE[i].Inflate(-22, -8);
  91. SIZE[i].Offset(0, 12 + (-8 * row));
  92. SIZE[i].Height = (int)(12 * TextScale.Y);
  93. }
  94. #endregion Methods
  95. }
  96. }