Module_main_menu_LGSG.cs 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. using Microsoft.Xna.Framework;
  2. using System;
  3. using System.Collections.Generic;
  4. namespace OpenVIII
  5. {
  6. public static partial class Module_main_menu_debug
  7. {
  8. #region Fields
  9. private static Vector2 CurrentLastPageLoc;
  10. private static Vector2 CurrentPageLoc;
  11. private static Matrix IGM_focus;
  12. private static Vector2 IGM_Size;
  13. private static Vector2 lastscale;
  14. private static Tuple<FF8String, FF8String, FF8String> LGSGHEADER;
  15. private static Point ml;
  16. private static Vector2 PageSize;
  17. private static Vector2 scale;
  18. #endregion Fields
  19. #region Enums
  20. private enum Litems
  21. {
  22. GameFolder,
  23. Load,
  24. LoadFF8,
  25. Loading,
  26. Slot1,
  27. Slot2,
  28. FF8,
  29. Save,
  30. SaveFF8,
  31. GameFolderSlot1,
  32. GameFolderSlot2,
  33. CheckGameFolder,
  34. BlockToLoad,
  35. BlockToSave,
  36. Saving
  37. }
  38. #endregion Enums
  39. #region Properties
  40. public static float Blink_Amount => Menu.Blink_Amount;
  41. public static Vector2 TextScale { get; } = new Vector2(2.545455f, 3.0375f);
  42. private static double PercentLoaded { get; set; } = 0f;
  43. #endregion Properties
  44. #region Methods
  45. private static void DrawLGSG()
  46. {
  47. if (State == MainMenuStates.SaveGameChooseGame || State == MainMenuStates.LoadGameChooseGame)
  48. DrawLGSGChooseBlocks();
  49. Memory.SpriteBatchStartAlpha(tm: IGM_focus);
  50. switch (State)
  51. {
  52. case MainMenuStates.LoadGameChooseSlot:
  53. DrawLGChooseSlot();
  54. break;
  55. case MainMenuStates.LoadGameCheckingSlot:
  56. DrawLGCheckSlot();
  57. break;
  58. case MainMenuStates.LoadGameChooseGame:
  59. DrawLGChooseGame();
  60. break;
  61. case MainMenuStates.LoadGameLoading:
  62. DrawLG_Loading();
  63. break;
  64. case MainMenuStates.SaveGameChooseSlot:
  65. DrawSGChooseSlot();
  66. break;
  67. case MainMenuStates.SaveGameCheckingSlot:
  68. DrawSGCheckSlot();
  69. break;
  70. case MainMenuStates.SaveGameChooseGame:
  71. DrawSGChooseGame();
  72. break;
  73. case MainMenuStates.SaveGameSaving:
  74. DrawSG_Saving();
  75. break;
  76. }
  77. Memory.SpriteBatchEnd();
  78. Memory.SpriteBatchStartAlpha();
  79. DrawLGSGHeader();
  80. Memory.SpriteBatchEnd();
  81. }
  82. private static void DrawLGSGHeader(FF8String info, FF8String name, FF8String help) => LGSGHEADER = new Tuple<FF8String, FF8String, FF8String>(info, name, help);
  83. private static Rectangle DrawLGSGHeader() => LGSGHEADER != null ? DrawLGSGHeader(LGSGHEADER) : Rectangle.Empty;
  84. private static Rectangle DrawLGSGHeader(Tuple<FF8String, FF8String, FF8String> tuple)
  85. {
  86. FF8String info = tuple.Item1;
  87. FF8String name = tuple.Item2;
  88. FF8String help = tuple.Item3;
  89. Vector2 TextZoom = Memory.Scale(Width: 960, scaleMode: Memory.ScaleMode.FitBoth);
  90. Vector2 BoxZoom = new Vector2(1, TextZoom.Y);
  91. Rectangle dst = new Rectangle((int)(vp.X * 0.82421875f), 0, (int)(vp.X * 0.17578125f), (int)(vp_per.Y * 0.0916666666666667f));
  92. Menu.DrawBox(dst, name, boxScale: BoxZoom, textScale: TextZoom);
  93. dst = new Rectangle(0, dst.Y, (int)(vp.X * 0.8203125f), dst.Height);
  94. Menu.DrawBox(dst, info, Icons.ID.INFO, boxScale: BoxZoom, textScale: TextZoom, options: Box_Options.Indent);
  95. dst = new Rectangle((int)(vp.X * 0.0282101167315175f), (int)(dst.Height + dst.Y + vp_per.Y * 0.0041666666666667f), (int)(vp.X * 0.943579766536965f), dst.Height);
  96. Menu.DrawBox(dst, help, Icons.ID.HELP, boxScale: BoxZoom, textScale: TextZoom);
  97. return dst;
  98. }
  99. private static void DrawLGSGLoadBar()
  100. {
  101. Rectangle dst = new Rectangle
  102. {
  103. X = (int)(vp_per.X * 0.328125f),
  104. Y = (int)(vp_per.Y * 0.45f),
  105. Width = (int)(vp_per.X * 0.34375f),
  106. Height = (int)(vp_per.Y * 0.1f),
  107. };
  108. dst = Menu.DrawBox(dst, null, Icons.ID.INFO).HotSpot;
  109. dst.Offset(new Vector2
  110. {
  111. X = (vp_per.X * 0.01328125f),
  112. Y = (vp_per.Y * 0.0333333333333333f),
  113. });
  114. dst.Size = (new Point
  115. {
  116. X = (int)(vp_per.X * 0.3171875f),
  117. Y = (int)(vp_per.Y * 0.0333333333333333f),
  118. }.ToVector2()).ToPoint();
  119. Memory.Icons.Draw(Icons.ID.Bar_BG, -1, dst, Vector2.UnitY, Fade);
  120. dst.Width = (int)(dst.Width * PercentLoaded);
  121. Memory.Icons.Draw(Icons.ID.Bar_Fill, -1, dst, Vector2.UnitY, Fade);
  122. }
  123. private static Menu.BoxReturn DrawLGSGSlot(Vector2 offset, FF8String title, FF8String main)
  124. {
  125. Rectangle dst = new Rectangle((int)(vp_per.X * 0.3703125f), (int)(vp_per.Y * 0.386111111f), (int)(vp_per.X * 0.259375f), (int)(vp_per.Y * 0.141666667f));
  126. Rectangle slot = new Rectangle(dst.Location, new Point((int)(vp_per.X * 0.1f), (int)(vp_per.Y * 0.0875f)));
  127. slot.Offset(vp_per.X * -0.00859375f, vp_per.Y * -0.033333333f);
  128. slot.Offset(offset);
  129. dst.Offset(offset);
  130. Menu.BoxReturn location = Menu.DrawBox(dst, main, options: Box_Options.Buttom);
  131. Menu.DrawBox(slot, title);
  132. return location;
  133. }
  134. private static void InitLoad()
  135. {
  136. strLoadScreen = new Dictionary<Enum, Item>()
  137. {
  138. { Litems.GameFolder, new Item{Text=Memory.Strings.Read(Strings.FileID.MNGRP, 1 ,86) } },
  139. { Litems.Load, new Item{Text=Memory.Strings.Read(Strings.FileID.MNGRP, 0 ,54) } },
  140. { Litems.LoadFF8, new Item{Text=Memory.Strings.Read(Strings.FileID.MNGRP, 1 ,128) } },
  141. { Litems.Save, new Item{Text=Memory.Strings.Read(Strings.FileID.MNGRP, 0 ,14) } },
  142. { Litems.SaveFF8, new Item{Text=Memory.Strings.Read(Strings.FileID.MNGRP, 1 ,117) } },
  143. { Litems.FF8, new Item{Text=Memory.Strings.Read(Strings.FileID.MNGRP, 1 ,127) } },
  144. { Litems.Loading, new Item{Text=Memory.Strings.Read(Strings.FileID.MNGRP, 1 ,93) } },
  145. { Litems.Saving, new Item{Text=Memory.Strings.Read(Strings.FileID.MNGRP, 1 ,94) } },
  146. { Litems.Slot1, new Item{Text=Memory.Strings.Read(Strings.FileID.MNGRP, 1 ,87) } },
  147. { Litems.Slot2, new Item{Text=Memory.Strings.Read(Strings.FileID.MNGRP, 1 ,88) } },
  148. { Litems.GameFolderSlot1, new Item{Text=Memory.Strings.Read(Strings.FileID.MNGRP, 1 ,121) } },
  149. { Litems.GameFolderSlot2, new Item{Text=Memory.Strings.Read(Strings.FileID.MNGRP, 1 ,122) } },
  150. { Litems.CheckGameFolder, new Item{Text=Memory.Strings.Read(Strings.FileID.MNGRP, 1 ,110) } },
  151. { Litems.BlockToLoad, new Item{Text=Memory.Strings.Read(Strings.FileID.MNGRP, 1 ,114) } },
  152. { Litems.BlockToSave, new Item{Text=Memory.Strings.Read(Strings.FileID.MNGRP, 1 ,89) } },
  153. };
  154. SlotLoc = 0;
  155. BlockLoc = 0;
  156. SlotLocs = new Menu.BoxReturn[2];
  157. BlockLocs = new Menu.BoxReturn[3];
  158. }
  159. private static void UpdateLGSG()
  160. {
  161. Rectangle dst = new Rectangle
  162. {
  163. X = 220,
  164. Y = 42,
  165. Width = 840,
  166. Height = 477,
  167. };
  168. IGM_Size = new Vector2 { X = 843, Y = 630 };
  169. Vector2 Zoom = Memory.Scale(IGM_Size.X, IGM_Size.Y, Memory.ScaleMode.FitBoth);
  170. IGM_focus = Matrix.CreateTranslation(-dst.X + (IGM_Size.X / -2), -dst.Y + (IGM_Size.Y / -2), 0) *
  171. Matrix.CreateScale(new Vector3(Zoom.X, Zoom.Y, 1)) *
  172. Matrix.CreateTranslation(vp.X / 2, vp.Y / 2, 0);
  173. Memory.IsMouseVisible = true;
  174. ml = InputMouse.Location.Transform(IGM_focus);
  175. switch (State)
  176. {
  177. case MainMenuStates.LoadGameChooseSlot:
  178. UpdateLGChooseSlot();
  179. break;
  180. case MainMenuStates.LoadGameCheckingSlot:
  181. UpdateLGCheckSlot();
  182. Memory.IsMouseVisible = false;
  183. break;
  184. case MainMenuStates.LoadGameChooseGame:
  185. UpdateLGChooseGame();
  186. break;
  187. case MainMenuStates.LoadGameLoading:
  188. UpdateLG_Loading();
  189. Memory.IsMouseVisible = false;
  190. break;
  191. case MainMenuStates.SaveGameChooseSlot:
  192. UpdateSGChooseSlot();
  193. break;
  194. case MainMenuStates.SaveGameCheckingSlot:
  195. UpdateSGCheckSlot();
  196. Memory.IsMouseVisible = false;
  197. break;
  198. case MainMenuStates.SaveGameChooseGame:
  199. UpdateSGChooseGame();
  200. break;
  201. case MainMenuStates.SaveGameSaving:
  202. UpdateSG_Saving();
  203. Memory.IsMouseVisible = false;
  204. break;
  205. }
  206. }
  207. #endregion Methods
  208. }
  209. }