Some UI adjustments and layout fixes

This commit is contained in:
Sinai
2021-05-17 18:47:37 +10:00
parent fb6e413153
commit 2fc9657560
7 changed files with 108 additions and 63 deletions

View File

@ -18,6 +18,8 @@ namespace UnityExplorer.UI.Inspectors
{
public GameObject GOTarget => Target as GameObject;
public GameObject Content;
public GameObjectControls GOControls;
public TransformTree TransformTree;
@ -217,11 +219,17 @@ namespace UnityExplorer.UI.Inspectors
public override GameObject CreateContent(GameObject parent)
{
UIRoot = UIFactory.CreateVerticalGroup(Pool<GameObjectInspector>.Instance.InactiveHolder,
"GameObjectInspector", true, true, true, true, 5, new Vector4(4, 4, 4, 4), new Color(0.065f, 0.065f, 0.065f));
"GameObjectInspector", true, false, true, true, 5, new Vector4(4, 4, 4, 4), new Color(0.065f, 0.065f, 0.065f));
var scrollObj = UIFactory.CreateScrollView(UIRoot, "GameObjectInspector", out Content, out var scrollbar,
new Color(0.065f, 0.065f, 0.065f));
UIFactory.SetLayoutElement(scrollObj, minHeight: 300, flexibleWidth: 9999, flexibleHeight: 1);
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(Content, spacing: 3, padTop: 2, padBottom: 2, padLeft: 2, padRight: 2);
// Construct GO Controls
GOControls = new GameObjectControls(this);
ConstructLists();
return UIRoot;
@ -231,9 +239,12 @@ namespace UnityExplorer.UI.Inspectors
private void ConstructLists()
{
var listHolder = UIFactory.CreateUIObject("ListTitles", UIRoot);
var listHolder = UIFactory.CreateUIObject("ListHolders", UIRoot);
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(listHolder, false, true, true, true, 8, 2, 2, 2, 2);
UIFactory.SetLayoutElement(listHolder, flexibleWidth: 9999, flexibleHeight: 9999);
UIFactory.SetLayoutElement(listHolder, minHeight: 350, flexibleWidth: 9999, flexibleHeight: 9999);
//var listRect = listHolder.GetComponent<RectTransform>();
//listRect.anchorMin = new Vector2(0, 1);
//listRect.anchorMax = new Vector2(1, 1);
// Left group (Children)
@ -268,7 +279,7 @@ namespace UnityExplorer.UI.Inspectors
// Right group (Components)
var rightGroup = UIFactory.CreateUIObject("ChildrenGroup", listHolder);
var rightGroup = UIFactory.CreateUIObject("ComponentGroup", listHolder);
UIFactory.SetLayoutElement(rightGroup, flexibleWidth: 9999, flexibleHeight: 9999);
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(rightGroup, false, false, true, true, 2);