IGMData_Selections.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. using Microsoft.Xna.Framework;
  2. using System;
  3. using System.Collections.Generic;
  4. namespace OpenVIII
  5. {
  6. public partial class IGM_Lobby
  7. {
  8. #region Classes
  9. private class IGMData_Selections : IGMData.Base
  10. {
  11. #region Fields
  12. private bool eventset = false;
  13. private Dictionary<int, Action> FadeOutActions;
  14. private Dictionary<int, Action> OkayActions;
  15. #endregion Fields
  16. #region Methods
  17. public static IGMData_Selections Create() =>
  18. Create<IGMData_Selections>(count: 3, depth: 1, container: new IGMDataItem.Empty { Pos = new Rectangle(320, 445, 250, 170) }, cols: 1, rows: 3);
  19. public override void Draw() => base.Draw();
  20. public override bool Inputs()
  21. {
  22. if (!FadingOut)
  23. return base.Inputs();
  24. return false;
  25. }
  26. public override bool Inputs_CANCEL() => false;
  27. public override void Inputs_Cards()
  28. {
  29. }
  30. public override void Inputs_Menu()
  31. {
  32. }
  33. public override bool Inputs_OKAY()
  34. {
  35. if (OkayActions.TryGetValue(CURSOR_SELECT, out var a))
  36. {
  37. a();
  38. return true;
  39. }
  40. return false;
  41. }
  42. public void NewGameFadeOutAction()
  43. {
  44. /*reverse engineering notes:
  45. *
  46. * we should happen to reset wm2field values
  47. * also the basic party of Squall is now set: SG_PARTY_FIELD1 = 0, and other members are 0xFF
  48. */
  49. Memory.FieldHolder.FieldID = 74; //RE: startup stage ID is hardcoded. Probably we would want to change it for modding
  50. //the module changes to 1 now
  51. Fields.Module.ResetField();
  52. ModuleMovieTest.Index = 30;
  53. ModuleMovieTest.ReturnState = OpenVIII.Module.FieldDebug;
  54. Memory.Module = OpenVIII.Module.MovieTest;
  55. Menu.Module.State = MenuModule.Mode.MainLobby;
  56. Memory.IsMouseVisible = false;
  57. //wait till next update to start drawing.
  58. Memory.SuppressDraw = true;
  59. }
  60. public override void Refresh()
  61. {
  62. if (!eventset)
  63. {
  64. Menu.FadedOutHandler += FadedOutEvent;
  65. eventset = true;
  66. }
  67. base.Refresh();
  68. }
  69. protected override void Init()
  70. {
  71. base.Init();
  72. ITEM[0, 0] = new IGMDataItem.Text() { Data = Strings.Name.New_Game, Pos = SIZE[0] };
  73. ITEM[1, 0] = new IGMDataItem.Text() { Data = Strings.Name.Load_Game, Pos = SIZE[1] };
  74. ITEM[2, 0] = new IGMDataItem.Text() { Data = "OpenVIII debug tools", Pos = SIZE[2] };
  75. Cursor_Status = Cursor_Status.Enabled | Cursor_Status.Vertical | Cursor_Status.Horizontal;
  76. OkayActions = new Dictionary<int, Action>()
  77. {
  78. {0, NewGameOkayAction },
  79. {1, LoadGameOkayAction },
  80. {2, DebugModeOkayAction },
  81. };
  82. FadeOutActions = new Dictionary<int, Action>()
  83. {
  84. {0, NewGameFadeOutAction },
  85. //{1, LoadGameOkayAction },
  86. //{2, DebugModeOkayAction },
  87. };
  88. }
  89. private void DebugModeOkayAction()
  90. {
  91. base.Inputs_OKAY();
  92. FadeIn();
  93. Menu.Module.State = MenuModule.Mode.DebugScreen;
  94. }
  95. private void FadedOutEvent(object sender, EventArgs e)
  96. {
  97. if (Menu.Module.State == MenuModule.Mode.MainLobby &&
  98. FadeOutActions.ContainsKey(CURSOR_SELECT))
  99. FadeOutActions[CURSOR_SELECT]();
  100. }
  101. private void LoadGameOkayAction()
  102. {
  103. base.Inputs_OKAY();
  104. FadeIn();
  105. Menu.Module.State = MenuModule.Mode.LoadGameChooseSlot;
  106. }
  107. private void NewGameOkayAction()
  108. {
  109. AV.Sound.Play(28);
  110. skipsnd = true;
  111. base.Inputs_OKAY();
  112. FadeOut();
  113. }
  114. #endregion Methods
  115. }
  116. #endregion Classes
  117. }
  118. }