using System; using System.Collections.Generic; using System.Linq; using System.Text; using UnityEngine; using UnityEngine.UI; namespace UnityExplorer.UI.Main.Home.Inspectors { public class MouseInspectorUI { internal Text s_objNameLabel; internal Text s_objPathLabel; internal Text s_mousePosLabel; internal GameObject s_UIContent; public MouseInspectorUI() { ConstructUI(); } #region UI Construction internal void ConstructUI() { s_UIContent = UIFactory.CreatePanel(UIManager.CanvasRoot, "MouseInspect", out GameObject content); s_UIContent.AddComponent(); var baseRect = s_UIContent.GetComponent(); var half = new Vector2(0.5f, 0.5f); baseRect.anchorMin = half; baseRect.anchorMax = half; baseRect.pivot = half; baseRect.sizeDelta = new Vector2(700, 150); var group = content.GetComponent(); group.childForceExpandHeight = true; // Title text var titleObj = UIFactory.CreateLabel(content, TextAnchor.MiddleCenter); var titleText = titleObj.GetComponent(); titleText.text = "Mouse Inspector (press ESC to cancel)"; var mousePosObj = UIFactory.CreateLabel(content, TextAnchor.MiddleCenter); s_mousePosLabel = mousePosObj.GetComponent(); s_mousePosLabel.text = "Mouse Position:"; var hitLabelObj = UIFactory.CreateLabel(content, TextAnchor.MiddleLeft); s_objNameLabel = hitLabelObj.GetComponent(); s_objNameLabel.text = "No hits..."; s_objNameLabel.horizontalOverflow = HorizontalWrapMode.Overflow; var pathLabelObj = UIFactory.CreateLabel(content, TextAnchor.MiddleLeft); s_objPathLabel = pathLabelObj.GetComponent(); s_objPathLabel.fontStyle = FontStyle.Italic; s_objPathLabel.horizontalOverflow = HorizontalWrapMode.Wrap; var pathLayout = pathLabelObj.AddComponent(); pathLayout.minHeight = 75; pathLayout.flexibleHeight = 0; s_UIContent.SetActive(false); } #endregion } }