Skip to content
This repository was archived by the owner on May 9, 2023. It is now read-only.

Commit 2fc9657

Browse files
committed
Some UI adjustments and layout fixes
1 parent fb6e413 commit 2fc9657

File tree

7 files changed

+108
-63
lines changed

7 files changed

+108
-63
lines changed

src/UI/Inspectors/GameObjectInspector.cs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ public class GameObjectInspector : InspectorBase
1818
{
1919
public GameObject GOTarget => Target as GameObject;
2020

21+
public GameObject Content;
22+
2123
public GameObjectControls GOControls;
2224

2325
public TransformTree TransformTree;
@@ -217,11 +219,17 @@ private void OnAddComponentClicked(string input)
217219
public override GameObject CreateContent(GameObject parent)
218220
{
219221
UIRoot = UIFactory.CreateVerticalGroup(Pool<GameObjectInspector>.Instance.InactiveHolder,
220-
"GameObjectInspector", true, true, true, true, 5, new Vector4(4, 4, 4, 4), new Color(0.065f, 0.065f, 0.065f));
222+
"GameObjectInspector", true, false, true, true, 5, new Vector4(4, 4, 4, 4), new Color(0.065f, 0.065f, 0.065f));
223+
224+
var scrollObj = UIFactory.CreateScrollView(UIRoot, "GameObjectInspector", out Content, out var scrollbar,
225+
new Color(0.065f, 0.065f, 0.065f));
226+
UIFactory.SetLayoutElement(scrollObj, minHeight: 300, flexibleWidth: 9999, flexibleHeight: 1);
227+
228+
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(Content, spacing: 3, padTop: 2, padBottom: 2, padLeft: 2, padRight: 2);
221229

222230
// Construct GO Controls
223231
GOControls = new GameObjectControls(this);
224-
232+
225233
ConstructLists();
226234

227235
return UIRoot;
@@ -231,9 +239,12 @@ public override GameObject CreateContent(GameObject parent)
231239

232240
private void ConstructLists()
233241
{
234-
var listHolder = UIFactory.CreateUIObject("ListTitles", UIRoot);
242+
var listHolder = UIFactory.CreateUIObject("ListHolders", UIRoot);
235243
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(listHolder, false, true, true, true, 8, 2, 2, 2, 2);
236-
UIFactory.SetLayoutElement(listHolder, flexibleWidth: 9999, flexibleHeight: 9999);
244+
UIFactory.SetLayoutElement(listHolder, minHeight: 350, flexibleWidth: 9999, flexibleHeight: 9999);
245+
//var listRect = listHolder.GetComponent<RectTransform>();
246+
//listRect.anchorMin = new Vector2(0, 1);
247+
//listRect.anchorMax = new Vector2(1, 1);
237248

238249
// Left group (Children)
239250

@@ -268,7 +279,7 @@ private void ConstructLists()
268279

269280
// Right group (Components)
270281

271-
var rightGroup = UIFactory.CreateUIObject("ChildrenGroup", listHolder);
282+
var rightGroup = UIFactory.CreateUIObject("ComponentGroup", listHolder);
272283
UIFactory.SetLayoutElement(rightGroup, flexibleWidth: 9999, flexibleHeight: 9999);
273284
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(rightGroup, false, false, true, true, 2);
274285

src/UI/Inspectors/GameObjectWidgets/ComponentList.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,14 @@ private void SetComponentCell(ComponentCell cell, int index)
9999
{
100100
cell.BehaviourToggle.interactable = true;
101101
cell.BehaviourToggle.Set(comp.TryCast<Behaviour>().enabled, false);
102+
cell.BehaviourToggle.graphic.color = new Color(0.8f, 1, 0.8f, 0.3f);
102103
}
103104
else
104105
{
105106
cell.BehaviourToggle.interactable = false;
106-
cell.BehaviourToggle.Set(false, false);
107+
cell.BehaviourToggle.Set(true, false);
108+
//RuntimeProvider.Instance.SetColorBlock(cell.BehaviourToggle,)
109+
cell.BehaviourToggle.graphic.color = new Color(0.2f, 0.2f, 0.2f);
107110
}
108111

109112
// if component is the first index it must be the transform, dont show Destroy button for it.

src/UI/Inspectors/GameObjectWidgets/GameObjectControls.cs

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ private void OnPathEndEdit(string input)
196196

197197
private void DoSetParent(Transform transform)
198198
{
199+
ExplorerCore.Log($"Setting target's transform parent to: {(transform == null ? "null" : $"'{transform.name}'")}");
200+
199201
if (GOTarget.GetComponent<RectTransform>())
200202
GOTarget.transform.SetParent(transform, false);
201203
else
@@ -434,9 +436,10 @@ public void UpdateVectorSlider()
434436

435437
private void ConstructTopInfo()
436438
{
437-
var topInfoHolder = UIFactory.CreateVerticalGroup(Parent.UIRoot, "TopInfoHolder", false, false, true, true, 3,
439+
var topInfoHolder = UIFactory.CreateVerticalGroup(Parent.Content, "TopInfoHolder", false, false, true, true, 3,
438440
new Vector4(3, 3, 3, 3), new Color(0.1f, 0.1f, 0.1f), TextAnchor.MiddleLeft);
439-
UIFactory.SetLayoutElement(topInfoHolder, minHeight: 25, flexibleWidth: 9999);
441+
UIFactory.SetLayoutElement(topInfoHolder, minHeight: 100, flexibleWidth: 9999);
442+
topInfoHolder.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;
440443

441444
// first row (parent, path)
442445

@@ -449,11 +452,16 @@ private void ConstructTopInfo()
449452
UIFactory.SetLayoutElement(ViewParentButton.Component.gameObject, minHeight: 25, minWidth: 100);
450453
ViewParentButton.OnClick += OnViewParentClicked;
451454

452-
this.PathInput = UIFactory.CreateInputField(firstRow, "PathInput", "Enter a GameObject name or path...");
455+
this.PathInput = UIFactory.CreateInputField(firstRow, "PathInput", "...");
453456
PathInput.Component.textComponent.color = Color.grey;
457+
PathInput.Component.textComponent.fontSize = 14;
454458
UIFactory.SetLayoutElement(PathInput.UIRoot, minHeight: 25, minWidth: 100, flexibleWidth: 9999);
455459
PathInput.Component.lineType = InputField.LineType.MultiLineSubmit;
456460

461+
//var pathApplyBtn = UIFactory.CreateButton(firstRow, "PathButton", "Set Parent Path", new Color(0.2f, 0.2f, 0.2f));
462+
//UIFactory.SetLayoutElement(pathApplyBtn.Component.gameObject, minHeight: 25, minWidth: 120);
463+
//pathApplyBtn.OnClick += () => { OnPathEndEdit(PathInput.Text); };
464+
457465
PathInput.Component.onEndEdit.AddListener((string val) => { OnPathEndEdit(val); });
458466

459467
// Title and update row
@@ -597,11 +605,14 @@ private static void GetHideFlagNames()
597605

598606
private void ConstructTransformControls()
599607
{
600-
//var transformGroup = UIFactory.CreateUIObject("TransformGroup", UIRoot);
601-
//UIFactory.SetLayoutGroup<VerticalLayoutGroup>(transformGroup, false, false, true, true, 2, 2, 2);
602-
var transformGroup = UIFactory.CreateVerticalGroup(Parent.UIRoot, "TransformControls", false, false, true, true, 2,
608+
var transformGroup = UIFactory.CreateVerticalGroup(Parent.Content, "TransformControls", false, false, true, true, 2,
603609
new Vector4(2, 2, 0, 0), new Color(0.1f, 0.1f, 0.1f));
604-
UIFactory.SetLayoutElement(transformGroup, minHeight: 25, flexibleWidth: 9999);
610+
UIFactory.SetLayoutElement(transformGroup, minHeight: 100, flexibleWidth: 9999);
611+
//transformGroup.SetActive(false);
612+
//var groupRect = transformGroup.GetComponent<RectTransform>();
613+
//groupRect.anchorMin = new Vector2(0, 1);
614+
//groupRect.anchorMax = new Vector2(1, 1);
615+
//groupRect.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 0, 100);
605616

606617
PositionControl = AddTransformRow(transformGroup, "Position:", TransformType.Position);
607618
LocalPositionControl = AddTransformRow(transformGroup, "Local Position:", TransformType.LocalPosition);

src/UI/Panels/CSConsolePanel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public override void ConstructPanelContent()
124124

125125
int fontSize = 16;
126126

127-
var inputObj = UIFactory.CreateSrollInputField(this.content, "ConsoleInput", ConsoleController.STARTUP_TEXT, out var inputScroller, fontSize);
127+
var inputObj = UIFactory.CreateScrollInputField(this.content, "ConsoleInput", ConsoleController.STARTUP_TEXT, out var inputScroller, fontSize);
128128
InputScroll = inputScroller;
129129
ConsoleController.defaultInputFieldAlpha = Input.Component.selectionColor.a;
130130
Input.OnValueChanged += InvokeOnValueChanged;

src/UI/Panels/InspectorPanel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class InspectorPanel : UIPanel
1919
public override string Name => "Inspector";
2020
public override UIManager.Panels PanelType => UIManager.Panels.Inspector;
2121
public override bool ShouldSaveActiveState => false;
22-
public override int MinWidth => 800;
22+
public override int MinWidth => 810;
2323
public override int MinHeight => 350;
2424

2525
public GameObject NavbarHolder;

0 commit comments

Comments
 (0)