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

Commit 5af9d31

Browse files
committed
Start GO inspector
1 parent 6977f1a commit 5af9d31

File tree

1 file changed

+44
-5
lines changed

1 file changed

+44
-5
lines changed

src/UI/Inspectors/GameObjectInspector.cs

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,13 @@ public class GameObjectInspector : InspectorBase
1616
{
1717
public GameObject GOTarget => Target as GameObject;
1818

19-
private Text NameText;
19+
// Top info
20+
21+
private InputFieldRef NameInput;
22+
private GameObject PathRow;
23+
private InputFieldRef PathInput;
24+
25+
// Child and comp lists
2026

2127
public TransformTree TransformTree;
2228
private ScrollPool<TransformCell> transformScroll;
@@ -30,8 +36,6 @@ public override void OnBorrowedFromPool(object target)
3036
base.OnBorrowedFromPool(target);
3137

3238
Target = target as GameObject;
33-
34-
NameText.text = GOTarget.name;
3539
Tab.TabText.text = $"[G] {GOTarget.name}";
3640

3741
RuntimeProvider.Instance.StartCoroutine(InitCoroutine());
@@ -191,9 +195,44 @@ public override GameObject CreateContent(GameObject parent)
191195
UIRoot = UIFactory.CreateVerticalGroup(Pool<GameObjectInspector>.Instance.InactiveHolder,
192196
"GameObjectInspector", true, true, true, true, 5, new Vector4(4, 4, 4, 4), new Color(0.12f, 0.12f, 0.12f));
193197

194-
NameText = UIFactory.CreateLabel(UIRoot, "Title", "not set", TextAnchor.MiddleLeft, fontSize: 20);
195-
UIFactory.SetLayoutElement(NameText.gameObject, minHeight: 30, flexibleHeight: 0);
198+
// Title row
199+
200+
var titleRow = UIFactory.CreateUIObject("TitleRow", UIRoot);
201+
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(titleRow, false, false, true, true, 5);
202+
203+
var titleLabel = UIFactory.CreateLabel(titleRow, "Title", SignatureHighlighter.Parse(typeof(GameObject), true),
204+
TextAnchor.MiddleLeft, fontSize: 17);
205+
UIFactory.SetLayoutElement(titleLabel.gameObject, minHeight: 30, flexibleHeight: 0, flexibleWidth: 9999);
206+
207+
// Update button
208+
var updateBtn = UIFactory.CreateButton(titleRow, "UpdateButton", "Update Info", new Color(0.2f, 0.3f, 0.2f));
209+
UIFactory.SetLayoutElement(updateBtn.Component.gameObject, minHeight: 25, minWidth: 200);
210+
updateBtn.OnClick += () => { ExplorerCore.Log("TODO!"); };
211+
212+
// ~~~~~~ Top info ~~~~~~
213+
214+
// parent / path row
215+
216+
this.PathRow = UIFactory.CreateUIObject("ParentRow", UIRoot);
217+
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(this.PathRow, false, false, true, true, 5, 2, 2, 2, 2);
218+
UIFactory.SetLayoutElement(this.PathRow, minHeight: 25, flexibleHeight: 100, flexibleWidth: 9999);
219+
220+
var viewParentButton = UIFactory.CreateButton(PathRow, "ViewParentButton", "View Parent", new Color(0.3f, 0.3f, 0.3f));
221+
UIFactory.SetLayoutElement(viewParentButton.Component.gameObject, minHeight: 25, minWidth: 80);
222+
viewParentButton.OnClick += () => { ExplorerCore.LogWarning("TODO!"); };
223+
224+
this.PathInput = UIFactory.CreateInputField(PathRow, "PathInput", "No parent (root object)");
225+
UIFactory.SetLayoutElement(PathInput.UIRoot, minHeight: 25, minWidth: 100, flexibleWidth: 9999);
226+
227+
228+
// ~~~~~~ Child and comp lists ~~~~~~
196229

230+
var listTitles = UIFactory.CreateUIObject("ListTitles", UIRoot);
231+
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(listTitles, true, true, true, true, 5, 2, 2, 2, 2);
232+
UIFactory.SetLayoutElement(listTitles, flexibleWidth: 9999, flexibleHeight: 30);
233+
UIFactory.CreateLabel(listTitles, "ChildListTitle", "Children", TextAnchor.MiddleCenter, default, false, 15);
234+
UIFactory.CreateLabel(listTitles, "CompListTitle", "Components", TextAnchor.MiddleCenter, default, false, 15);
235+
197236
var listHolder = UIFactory.CreateHorizontalGroup(UIRoot, "ListHolder", true, true, true, true, 5, new Vector4(2, 2, 2, 2));
198237
UIFactory.SetLayoutElement(listHolder, flexibleWidth: 9999, flexibleHeight: 9999);
199238

0 commit comments

Comments
 (0)