|
- using System;
-
- namespace TechbloxModdingAPI.Interface.IMGUI
- {
- /// <summary>
- /// GUI Element like a text field, button or picture.
- /// This interface is used to wrap many elements from Unity's IMGUI system.
- /// </summary>
- public abstract class UIElement
- {
- protected UIElement(string text, string name)
- {
- Name = name ?? GetType().FullName + "::" + text;
- IMGUIManager.AddElement(this);
- }
-
- ~UIElement()
- {
- IMGUIManager.RemoveElement(this);
- }
-
- /// <summary>
- /// GUI operations to perform in the OnGUI scope.
- /// This is basically equivalent to a MonoBehaviour's OnGUI method.
- /// </summary>
- public abstract void OnGUI();
-
- /// <summary>
- /// The element's name.
- /// This should be unique for every instance of the class.
- /// </summary>
- public string Name { get; }
-
- /// <summary>
- /// Whether to display the UI element or not.
- /// </summary>
- public bool Enabled { get; set; } = true;
- }
- }
|