using UnityEngine; namespace GamecraftModdingAPI.Interface.IMGUI { public class Image : UIElement { private bool automaticLayout = false; public Texture Texture { get; set; } public Rect Box { get; set; } = Rect.zero; public void OnGUI() { //if (Texture == null) return; if (automaticLayout) { GUILayout.Label(Texture, Constants.Default.label); } else { GUI.Label(Box, Texture, Constants.Default.label); } } public string Name { get; } public bool Enabled { set; get; } = true; public Image(Texture texture = null, string name = null) { automaticLayout = true; Texture = texture; if (name == null) { if (texture == null) { this.Name = typeof(Image).FullName + "::" + texture; } else { this.Name = typeof(Image).FullName + "::" + texture.name + "(" + texture.width + "x" + texture.height + ")"; } } else { this.Name = name; } IMGUIManager.AddElement(this); } public Image(Rect box, Texture texture = null, string name = null) : this(texture, name) { this.Box = box; automaticLayout = false; } } }