BlueMagic.cs 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. using Microsoft.Xna.Framework;
  2. using System.Collections.Generic;
  3. namespace OpenVIII.IGMData.Pool
  4. {
  5. /// <summary>
  6. /// </summary>
  7. /// <see cref="https://www.youtube.com/watch?v=BhgixAEvuu0"/>
  8. public class BlueMagic : IGMData.Pool.Base<Saves.Data, Kernel_bin.Blue_magic_Quistis_limit_break>
  9. {
  10. #region Fields
  11. private List<Kernel_bin.Blue_Magic> unlocked = new List<Kernel_bin.Blue_Magic>();
  12. #endregion Fields
  13. #region Properties
  14. public IGMData.Target.Group Target_Group => (IGMData.Target.Group)(((IGMData.Base)ITEM[Rows, 0]));
  15. #endregion Properties
  16. #region Methods
  17. public static BlueMagic Create(Rectangle pos, Damageable damageable, bool battle = false) =>
  18. Create<BlueMagic>(5, 1, new IGMDataItem.Box { Pos = pos, Title = Icons.ID.SPECIAL }, 4, 4, damageable);
  19. public override bool Inputs()
  20. {
  21. if (Target_Group.Enabled)
  22. {
  23. Cursor_Status |= Cursor_Status.Enabled | Cursor_Status.Blinking;
  24. return Target_Group.Inputs();
  25. }
  26. else
  27. {
  28. Cursor_Status |= Cursor_Status.Enabled;
  29. Cursor_Status &= ~Cursor_Status.Blinking;
  30. return base.Inputs();
  31. }
  32. }
  33. public override bool Inputs_CANCEL()
  34. {
  35. Hide();
  36. base.Inputs_CANCEL();
  37. return true;
  38. }
  39. public override bool Inputs_OKAY()
  40. {
  41. Kernel_bin.Blue_magic_Quistis_limit_break c = Contents[CURSOR_SELECT];
  42. //c.Target;
  43. Target_Group.SelectTargetWindows(c);
  44. Target_Group.ShowTargetWindows();
  45. return base.Inputs_OKAY();
  46. }
  47. public override void Refresh()
  48. {
  49. if (Memory.State == null || Memory.State.LimitBreakQuistis_Unlocked_BlueMagic == null) return;
  50. Kernel_bin.Blue_Magic bm = 0;
  51. unlocked = new List<Kernel_bin.Blue_Magic>();
  52. foreach (bool b in Memory.State.LimitBreakQuistis_Unlocked_BlueMagic)
  53. {
  54. if (b)
  55. unlocked.Add(bm);
  56. bm++;
  57. }
  58. int skip = Rows * Page;
  59. int i;
  60. for (i = skip; i < unlocked.Count && i < Rows + skip; i++)
  61. {
  62. int j = i % Rows;
  63. ITEM[j, 0].Show();
  64. BLANKS[j] = false;
  65. Contents[j] = Kernel_bin.BluemagicQuistislimitbreak[unlocked[i]];
  66. ((IGMDataItem.Text)ITEM[j, 0]).Data = Contents[j].Name;
  67. }
  68. for (; i < Rows + skip; i++)
  69. {
  70. int j = i % Rows;
  71. ITEM[j, 0].Hide();
  72. BLANKS[j] = true;
  73. }
  74. if (unlocked.Count / Rows <= 1)
  75. ((IGMDataItem.Box)CONTAINER).Title = Icons.ID.SPECIAL;
  76. else
  77. ((IGMDataItem.Box)CONTAINER).Title = (Icons.ID)((int)(Icons.ID.SPECIAL_PG1) + Page);
  78. base.Refresh();
  79. }
  80. public override void Reset()
  81. {
  82. Hide();
  83. base.Reset();
  84. }
  85. protected override void DrawITEM(int i, int d)
  86. {
  87. if (Rows >= i || !Target_Group.Enabled)
  88. base.DrawITEM(i, d);
  89. }
  90. protected override void Init()
  91. {
  92. base.Init();
  93. for (int i = 0; i < Rows; i++)
  94. {
  95. ITEM[i, 0] = new IGMDataItem.Text { Pos = SIZE[i] };
  96. }
  97. ITEM[Rows, 0] = IGMData.Target.Group.Create(Damageable, false);
  98. PointerZIndex = 0;
  99. }
  100. protected override void InitShift(int i, int col, int row)
  101. {
  102. base.InitShift(i, col, row);
  103. SIZE[i].Inflate(-22, -8);
  104. SIZE[i].Offset(0, 12 + (-8 * row));
  105. SIZE[i].Height = (int)(12 * TextScale.Y);
  106. }
  107. protected override void PAGE_NEXT()
  108. {
  109. base.PAGE_NEXT();
  110. while (BLANKS[0] && Page > 0)
  111. {
  112. skipsnd = true;
  113. base.PAGE_NEXT();
  114. }
  115. Refresh();
  116. }
  117. protected override void PAGE_PREV()
  118. {
  119. base.PAGE_PREV();
  120. while (BLANKS[0] && Page > 0)
  121. {
  122. skipsnd = true;
  123. base.PAGE_PREV();
  124. }
  125. Refresh();
  126. }
  127. #endregion Methods
  128. }
  129. }