diff --git a/GamecraftModdingAPI/Interface/IMGUI/IMGUIManager.cs b/GamecraftModdingAPI/Interface/IMGUI/IMGUIManager.cs
index f6048e7..e75f8f2 100644
--- a/GamecraftModdingAPI/Interface/IMGUI/IMGUIManager.cs
+++ b/GamecraftModdingAPI/Interface/IMGUI/IMGUIManager.cs
@@ -12,12 +12,22 @@ using UnityEngine;
namespace GamecraftModdingAPI.Interface.IMGUI
{
+ ///
+ /// Keeps track of UIElement instances.
+ /// This also handles displaying and processing them during the MonoBehaviour.OnGUI phase of screen updates.
+ /// Most of this functionality is handled implicitly by the included UIElement implementations,
+ /// but this is left as a public API so it can be expanded.
+ ///
public static class IMGUIManager
{
internal static OnGuiRunner ImguiScheduler = new OnGuiRunner("GamecraftModdingAPI_IMGUIScheduler");
private static FasterDictionary _activeElements = new FasterDictionary();
+ ///
+ /// Add an UIElement instance to be managed by IMGUIManager.
+ ///
+ /// The UIElement instance.
public static void AddElement(UIElement e)
{
if (!ExistsElement(e))
@@ -26,16 +36,32 @@ namespace GamecraftModdingAPI.Interface.IMGUI
}
}
+ ///
+ /// Determine whether the UIElement instance is already tracked by IMGUIManager.
+ ///
+ /// The UIElement's unique name.
+ /// Whether the UIElement instance is already tracked by IMGUIManager (true) or not (false).
public static bool ExistsElement(string name)
{
return _activeElements.ContainsKey(name);
}
+ ///
+ /// Determine whether the UIElement instance is already tracked by IMGUIManager.
+ ///
+ /// The UIElement instance.
+ /// Whether the UIElement instance is already tracked by IMGUIManager (true) or not (false).
public static bool ExistsElement(UIElement element)
{
return ExistsElement(element.Name);
}
+ ///
+ /// Remove an UIElement instance from IMGUIManager.
+ /// The UIElement will become invisible and stop generating events.
+ ///
+ /// The UIElement's unique name.
+ /// Whether the UIElement instance existed in IMGUIManager (true) or not (false).
public static bool RemoveElement(string name)
{
if (ExistsElement(name))
@@ -46,6 +72,12 @@ namespace GamecraftModdingAPI.Interface.IMGUI
return false;
}
+ ///
+ /// Remove an UIElement instance from IMGUIManager.
+ /// The UIElement will become invisible and stop generating events.
+ ///
+ /// The UIElement instance.
+ /// Whether the UIElement instance existed in IMGUIManager (true) or not (false).
public static bool RemoveElement(UIElement element)
{
return RemoveElement(element.Name);
diff --git a/GamecraftModdingAPI/Interface/IMGUI/Image.cs b/GamecraftModdingAPI/Interface/IMGUI/Image.cs
index 8c026ed..b4fac9f 100644
--- a/GamecraftModdingAPI/Interface/IMGUI/Image.cs
+++ b/GamecraftModdingAPI/Interface/IMGUI/Image.cs
@@ -2,12 +2,22 @@ using UnityEngine;
namespace GamecraftModdingAPI.Interface.IMGUI
{
+ ///
+ /// An image.
+ /// This wraps Unity's IMGUI Label.
+ ///
public class Image : UIElement
{
private bool automaticLayout = false;
+ ///
+ /// The image texture to display
+ ///
public Texture Texture { get; set; }
+ ///
+ /// The rectangular area in the window that the image can use
+ ///
public Rect Box { get; set; } = Rect.zero;
public void OnGUI()
@@ -23,9 +33,21 @@ namespace GamecraftModdingAPI.Interface.IMGUI
}
}
+ ///
+ /// The image element's unique name.
+ ///
public string Name { get; }
+
+ ///
+ /// Whether to display the image and everything in it.
+ ///
public bool Enabled { set; get; } = true;
+ ///
+ /// Initializes a new instance of the class with automatic layout.
+ ///
+ /// Image to display.
+ /// The element's name.
public Image(Texture texture = null, string name = null)
{
automaticLayout = true;
@@ -49,6 +71,12 @@ namespace GamecraftModdingAPI.Interface.IMGUI
IMGUIManager.AddElement(this);
}
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// Rectangular area for the image.
+ /// Image to display.
+ /// The element's name.
public Image(Rect box, Texture texture = null, string name = null) : this(texture, name)
{
this.Box = box;
diff --git a/GamecraftModdingAPI/Interface/IMGUI/Label.cs b/GamecraftModdingAPI/Interface/IMGUI/Label.cs
index 2fb54f7..2483e3d 100644
--- a/GamecraftModdingAPI/Interface/IMGUI/Label.cs
+++ b/GamecraftModdingAPI/Interface/IMGUI/Label.cs
@@ -32,9 +32,21 @@ namespace GamecraftModdingAPI.Interface.IMGUI
}
}
+ ///
+ /// The label's unique name.
+ ///
public string Name { get; }
+
+ ///
+ /// Whether to display the label.
+ ///
public bool Enabled { set; get; } = true;
+ ///
+ /// Initializes a new instance of the class with automatic layout.
+ ///
+ /// Initial string to display on the label.
+ /// The element's name.
public Label(string initialText = null, string name = null)
{
automaticLayout = true;
@@ -50,6 +62,12 @@ namespace GamecraftModdingAPI.Interface.IMGUI
IMGUIManager.AddElement(this);
}
+ ///
+ /// Initializes a new instance of the .
+ ///
+ /// Rectangular area for the label.
+ /// Initial string to display on the label.
+ /// The element's name.
public Label(Rect box, string initialText = null, string name = null) : this(initialText, name)
{
this.Box = box;