mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-16 00:07:52 +08:00
Finished argument inputs for Method/Props, some UI cleanups and fixes
This commit is contained in:
@ -21,12 +21,15 @@ namespace UnityExplorer.Inspectors.GameObjects
|
||||
}
|
||||
|
||||
public static PageHandler s_childListPageHandler;
|
||||
private static GameObject s_childListContent;
|
||||
|
||||
private static GameObject[] s_allChildren = new GameObject[0];
|
||||
private static readonly List<GameObject> s_childrenShortlist = new List<GameObject>();
|
||||
private static GameObject s_childListContent;
|
||||
private static readonly List<Text> s_childListTexts = new List<Text>();
|
||||
private static int s_lastChildCount;
|
||||
|
||||
private static readonly List<Text> s_childListTexts = new List<Text>();
|
||||
private static readonly List<Toggle> s_childListToggles = new List<Toggle>();
|
||||
|
||||
internal void RefreshChildObjectList()
|
||||
{
|
||||
var go = GameObjectInspector.ActiveInstance.TargetGO;
|
||||
@ -86,6 +89,9 @@ namespace UnityExplorer.Inspectors.GameObjects
|
||||
text.text = name;
|
||||
text.color = obj.activeSelf ? Color.green : Color.red;
|
||||
|
||||
var tog = s_childListToggles[i];
|
||||
tog.isOn = obj.activeSelf;
|
||||
|
||||
var label = text.transform.parent.parent.gameObject;
|
||||
if (!label.activeSelf)
|
||||
{
|
||||
@ -117,6 +123,18 @@ namespace UnityExplorer.Inspectors.GameObjects
|
||||
Instance.RefreshChildObjectList();
|
||||
}
|
||||
|
||||
internal static void OnToggleClicked(int index, bool newVal)
|
||||
{
|
||||
if (GameObjectInspector.ActiveInstance == null)
|
||||
return;
|
||||
|
||||
if (index >= s_childrenShortlist.Count || !s_childrenShortlist[index])
|
||||
return;
|
||||
|
||||
var obj = s_childrenShortlist[index];
|
||||
obj.SetActive(newVal);
|
||||
}
|
||||
|
||||
#region UI CONSTRUCTION
|
||||
|
||||
internal void ConstructChildList(GameObject parent)
|
||||
@ -166,6 +184,15 @@ namespace UnityExplorer.Inspectors.GameObjects
|
||||
btnLayout.flexibleHeight = 0;
|
||||
btnGroupObj.AddComponent<Mask>();
|
||||
|
||||
var toggleObj = UIFactory.CreateToggle(btnGroupObj, out Toggle toggle, out Text toggleText, new Color(0.3f, 0.3f, 0.3f));
|
||||
var toggleLayout = toggleObj.AddComponent<LayoutElement>();
|
||||
toggleLayout.minHeight = 25;
|
||||
toggleLayout.minWidth = 25;
|
||||
toggleText.text = "";
|
||||
toggle.isOn = false;
|
||||
s_childListToggles.Add(toggle);
|
||||
toggle.onValueChanged.AddListener((bool val) => { OnToggleClicked(thisIndex, val); });
|
||||
|
||||
GameObject mainButtonObj = UIFactory.CreateButton(btnGroupObj);
|
||||
LayoutElement mainBtnLayout = mainButtonObj.AddComponent<LayoutElement>();
|
||||
mainBtnLayout.minHeight = 25;
|
||||
|
@ -183,20 +183,14 @@ namespace UnityExplorer.Inspectors.GameObjects
|
||||
|
||||
// Behaviour enabled toggle
|
||||
|
||||
var toggleObj = UIFactory.CreateToggle(btnGroupObj, out Toggle toggle, out Text toggleText);
|
||||
var togBg = toggleObj.transform.Find("Background").GetComponent<Image>();
|
||||
togBg.color = new Color(0.1f, 0.1f, 0.1f, 1);
|
||||
var toggleObj = UIFactory.CreateToggle(btnGroupObj, out Toggle toggle, out Text toggleText, new Color(0.3f, 0.3f, 0.3f));
|
||||
var toggleLayout = toggleObj.AddComponent<LayoutElement>();
|
||||
toggleLayout.minWidth = 25;
|
||||
toggleLayout.flexibleWidth = 0;
|
||||
toggleLayout.minHeight = 25;
|
||||
toggleLayout.flexibleHeight = 0;
|
||||
var checkImg = toggleObj.transform.Find("Background/Checkmark").GetComponent<Image>();
|
||||
checkImg.color = UISyntaxHighlight.Class_Instance.ToColor();
|
||||
checkImg.color *= 0.66f;
|
||||
toggle.onValueChanged.AddListener((bool val) => { OnCompToggleClicked(thisIndex, val); });
|
||||
toggleLayout.minWidth = 25;
|
||||
toggleText.text = "";
|
||||
toggle.isOn = false;
|
||||
s_compToggles.Add(toggle);
|
||||
toggle.onValueChanged.AddListener((bool val) => { OnCompToggleClicked(thisIndex, val); });
|
||||
|
||||
// Main component button
|
||||
|
||||
|
@ -314,15 +314,15 @@ namespace UnityExplorer.Inspectors.GameObjects
|
||||
}
|
||||
}
|
||||
|
||||
// set parent
|
||||
ConstructSetParent(contentObj);
|
||||
|
||||
// transform controls
|
||||
ConstructVector3Editor(contentObj, "Position", ControlType.position, out s_positionControl);
|
||||
ConstructVector3Editor(contentObj, "Local Position", ControlType.localPosition, out s_localPosControl);
|
||||
ConstructVector3Editor(contentObj, "Rotation", ControlType.eulerAngles, out s_rotationControl);
|
||||
ConstructVector3Editor(contentObj, "Scale", ControlType.localScale, out s_scaleControl);
|
||||
|
||||
// set parent
|
||||
ConstructSetParent(contentObj);
|
||||
|
||||
// bottom row buttons
|
||||
ConstructBottomButtons(contentObj);
|
||||
|
||||
|
Reference in New Issue
Block a user