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.

30 lines
1.1KB

  1. using System;
  2. using GamecraftModdingAPI.Blocks;
  3. namespace GamecraftModdingAPI.Utility
  4. {
  5. public static class GameClient
  6. {
  7. private static DebugInterfaceEngine _engine = new DebugInterfaceEngine();
  8. /// <summary>
  9. /// Saves the extra information to be displayed on the debug view.
  10. /// The provided getter function is called each time the view updates so make sure it returns quickly.
  11. /// </summary>
  12. /// <param name="id">A global ID for the custom information</param>
  13. /// <param name="contentGetter">A function that returns the current information</param>
  14. public static void SetDebugInfo(string id, Func<string> contentGetter) => _engine.SetInfo(id, contentGetter);
  15. /// <summary>
  16. /// Removes an information provided by a plugin.
  17. /// </summary>
  18. /// <param name="id">The ID of the custom information</param>
  19. /// <returns></returns>
  20. public static bool RemoveDebugInfo(string id) => _engine.RemoveInfo(id);
  21. public static void Init()
  22. {
  23. GameEngineManager.AddGameEngine(_engine);
  24. }
  25. }
  26. }