A stable modding interface between Techblox and mods https://mod.exmods.org/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.0KB

  1. using System;
  2. using UnityEngine;
  3. using GamecraftModdingAPI.Utility;
  4. namespace GamecraftModdingAPI.App
  5. {
  6. /// <summary>
  7. /// The Gamecraft application that is running this code right now.
  8. /// </summary>
  9. public class Client
  10. {
  11. // extensible engine
  12. protected static AppEngine appEngine = new AppEngine();
  13. /// <summary>
  14. /// An event that fires whenever the main menu is loaded.
  15. /// </summary>
  16. public static event EventHandler<MenuEventArgs> EnterMenu
  17. {
  18. add => appEngine.EnterMenu += value;
  19. remove => appEngine.EnterMenu -= value;
  20. }
  21. /// <summary>
  22. /// An event that fire whenever the main menu is exited.
  23. /// </summary>
  24. public static event EventHandler<MenuEventArgs> ExitMenu
  25. {
  26. add => appEngine.ExitMenu += value;
  27. remove => appEngine.ExitMenu -= value;
  28. }
  29. /// <summary>
  30. /// Gamecraft build version string.
  31. /// Usually this is in the form YYYY.mm.DD.HH.MM.SS
  32. /// </summary>
  33. /// <value>The version.</value>
  34. public string Version
  35. {
  36. get => Application.version;
  37. }
  38. /// <summary>
  39. /// Unity version string.
  40. /// </summary>
  41. /// <value>The unity version.</value>
  42. public string UnityVersion
  43. {
  44. get => Application.unityVersion;
  45. }
  46. /// <summary>
  47. /// Game saves currently visible in the menu.
  48. /// These take a second to completely populate after the EnterMenu event fires.
  49. /// </summary>
  50. /// <value>My games.</value>
  51. public Game[] MyGames
  52. {
  53. get
  54. {
  55. if (!appEngine.IsInMenu) return new Game[0];
  56. return appEngine.GetMyGames();
  57. }
  58. }
  59. /// <summary>
  60. /// Whether Gamecraft is in the Main Menu
  61. /// </summary>
  62. /// <value><c>true</c> if in menu; <c>false</c> when loading or in a game.</value>
  63. public bool InMenu
  64. {
  65. get => appEngine.IsInMenu;
  66. }
  67. internal static void Init()
  68. {
  69. MenuEngineManager.AddMenuEngine(appEngine);
  70. }
  71. }
  72. }