From 8e2e2abef4905bd635949cf06bb3f7f364c71b65 Mon Sep 17 00:00:00 2001 From: sinaioutlander <49360850+sinaioutlander@users.noreply.github.com> Date: Tue, 17 Nov 2020 02:05:45 +1100 Subject: [PATCH] finishing off interactive values --- .../Reflection/InstanceInspector.cs | 105 ++++++++++++++++-- .../InteractiveValue/InteractiveEnum.cs | 21 ++++ .../InteractiveValue/InteractiveFlags.cs | 2 - .../InteractiveUnityStruct.cs | 13 ++- .../InteractiveValue/InteractiveValue.cs | 24 +--- src/Tests/Tests.cs | 2 +- 6 files changed, 128 insertions(+), 39 deletions(-) diff --git a/src/Inspectors/Reflection/InstanceInspector.cs b/src/Inspectors/Reflection/InstanceInspector.cs index 73a61af..f129dee 100644 --- a/src/Inspectors/Reflection/InstanceInspector.cs +++ b/src/Inspectors/Reflection/InstanceInspector.cs @@ -45,25 +45,110 @@ namespace UnityExplorer.Inspectors.Reflection public void ConstructInstanceHelpers() { - // On second thought, I'm not sure about this, seems unnecessary (and bloaty) - // I might do the Texture2D helper (view/save image) but idk about anything else. + // WIP + + //if (m_targetType == typeof(Texture2D)) + // ConstructTextureHelper(); + + // todo other helpers //if (typeof(Component).IsAssignableFrom(m_targetType)) //{ - // // component helpers (ref GO) - // var tempObj = UIFactory.CreateLabel(Content, TextAnchor.MiddleLeft); - // var text = tempObj.GetComponent(); - // text.text = "TODO comp helpers"; //} //else if (typeof(UnityEngine.Object).IsAssignableFrom(m_targetType)) //{ - // // unityengine.object helpers (name, instantiate, destroy?) - // var tempObj = UIFactory.CreateLabel(Content, TextAnchor.MiddleLeft); - // var text = tempObj.GetComponent(); - // text.text = "TODO unity object helpers"; //} } + //internal bool showingTextureHelper; + //internal bool constructedTextureViewer; + + //internal void ConstructTextureHelper() + //{ + // var rowObj = UIFactory.CreateHorizontalGroup(Content, new Color(0.1f, 0.1f, 0.1f)); + // var rowLayout = rowObj.AddComponent(); + // rowLayout.minHeight = 25; + // rowLayout.flexibleHeight = 0; + // var rowGroup = rowObj.GetComponent(); + // rowGroup.childForceExpandHeight = true; + // rowGroup.childForceExpandWidth = false; + // rowGroup.padding.top = 3; + // rowGroup.padding.left = 3; + // rowGroup.padding.bottom = 3; + // rowGroup.padding.right = 3; + // rowGroup.spacing = 5; + + // var showBtnObj = UIFactory.CreateButton(rowObj, new Color(0.2f, 0.2f, 0.2f)); + // var showBtnLayout = showBtnObj.AddComponent(); + // showBtnLayout.minWidth = 50; + // showBtnLayout.flexibleWidth = 0; + // var showText = showBtnObj.GetComponentInChildren(); + // showText.text = "Show"; + // var showBtn = showBtnObj.GetComponent