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.

39 lines
1.1KB

  1. using System;
  2. namespace TechbloxModdingAPI.Interface.IMGUI
  3. {
  4. /// <summary>
  5. /// GUI Element like a text field, button or picture.
  6. /// This interface is used to wrap many elements from Unity's IMGUI system.
  7. /// </summary>
  8. public abstract class UIElement
  9. {
  10. protected UIElement(string text, string name)
  11. {
  12. Name = name ?? GetType().FullName + "::" + text;
  13. IMGUIManager.AddElement(this);
  14. }
  15. ~UIElement()
  16. {
  17. IMGUIManager.RemoveElement(this);
  18. }
  19. /// <summary>
  20. /// GUI operations to perform in the OnGUI scope.
  21. /// This is basically equivalent to a MonoBehaviour's OnGUI method.
  22. /// </summary>
  23. public abstract void OnGUI();
  24. /// <summary>
  25. /// The element's name.
  26. /// This should be unique for every instance of the class.
  27. /// </summary>
  28. public string Name { get; }
  29. /// <summary>
  30. /// Whether to display the UI element or not.
  31. /// </summary>
  32. public bool Enabled { get; set; } = true;
  33. }
  34. }