* Fixed not being able to set values on Enums
* [MONO] Fixed an issue where GameObjects in no scene (a Resource/Asset) would display nothing for their scene name, instead of "None (Resource/Asset)".
* Some UI layout cleanups and fixes, the Child/Component lists on the GameObject inspector should now expand to fill available height.
This commit is contained in:
sinaioutlander 2020-11-22 18:22:57 +11:00
parent c38155ab04
commit bb46d77a02
8 changed files with 36 additions and 104 deletions

View File

@ -140,7 +140,7 @@ namespace UnityExplorer.Inspectors.GameObjects
{
var vertGroupObj = UIFactory.CreateVerticalGroup(parent, new Color(1, 1, 1, 0));
var vertGroup = vertGroupObj.GetComponent<VerticalLayoutGroup>();
vertGroup.childForceExpandHeight = false;
vertGroup.childForceExpandHeight = true;
vertGroup.childForceExpandWidth = false;
vertGroup.childControlWidth = true;
vertGroup.spacing = 5;

View File

@ -136,7 +136,7 @@ namespace UnityExplorer.Inspectors.GameObjects
{
var vertGroupObj = UIFactory.CreateVerticalGroup(parent, new Color(1, 1, 1, 0));
var vertGroup = vertGroupObj.GetComponent<VerticalLayoutGroup>();
vertGroup.childForceExpandHeight = false;
vertGroup.childForceExpandHeight = true;
vertGroup.childForceExpandWidth = false;
vertGroup.childControlWidth = true;
vertGroup.spacing = 5;
@ -157,6 +157,7 @@ namespace UnityExplorer.Inspectors.GameObjects
var compScrollObj = UIFactory.CreateScrollView(vertGroupObj, out s_compListContent, out SliderScrollbar scroller, new Color(0.07f, 0.07f, 0.07f));
var contentLayout = compScrollObj.AddComponent<LayoutElement>();
contentLayout.minHeight = 50;
contentLayout.flexibleHeight = 5000;
s_compListPageHandler = new PageHandler(scroller);
s_compListPageHandler.ConstructUI(vertGroupObj);

View File

@ -164,7 +164,7 @@ namespace UnityExplorer.Inspectors
m_layerDropdown.value = TargetGO.layer;
}
if (m_lastScene != TargetGO.scene.name)
if (string.IsNullOrEmpty(m_lastScene) || m_lastScene != TargetGO.scene.name)
{
m_lastScene = TargetGO.scene.name;
@ -217,10 +217,20 @@ namespace UnityExplorer.Inspectors
s_content = UIFactory.CreateScrollView(parent, out GameObject scrollContent, out _, new Color(0.1f, 0.1f, 0.1f));
var parentLayout = scrollContent.transform.parent.gameObject.AddComponent<VerticalLayoutGroup>();
parentLayout.childForceExpandWidth = true;
parentLayout.childControlWidth = true;
parentLayout.childForceExpandHeight = true;
parentLayout.childControlHeight = true;
var scrollGroup = scrollContent.GetComponent<VerticalLayoutGroup>();
scrollGroup.childForceExpandHeight = true;
scrollGroup.childControlHeight = true;
scrollGroup.childForceExpandWidth = true;
scrollGroup.childControlWidth = true;
scrollGroup.spacing = 5;
var contentFitter = scrollContent.GetComponent<ContentSizeFitter>();
contentFitter.verticalFit = ContentSizeFitter.FitMode.Unconstrained;
ConstructTopArea(scrollContent);
@ -230,6 +240,9 @@ namespace UnityExplorer.Inspectors
s_childList.ConstructChildList(midGroupObj);
s_compList.ConstructCompList(midGroupObj);
LayoutRebuilder.ForceRebuildLayoutImmediate(s_content.GetComponent<RectTransform>());
Canvas.ForceUpdateCanvases();
}
private void ConstructTopArea(GameObject scrollContent)
@ -431,11 +444,10 @@ namespace UnityExplorer.Inspectors
midGroup.childControlWidth = true;
midGroup.childForceExpandHeight = true;
midGroup.childControlHeight = true;
var midlayout = midGroupObj.AddComponent<LayoutElement>();
midlayout.minHeight = 350;
midlayout.flexibleHeight = 10000;
midlayout.minWidth = 200;
midlayout.flexibleWidth = 25000;
var midLayout = midGroupObj.AddComponent<LayoutElement>();
midLayout.minHeight = 300;
midLayout.flexibleHeight = 5000;
return midGroupObj;
}

View File

@ -230,84 +230,6 @@ namespace UnityExplorer.Inspectors
invisGroup.padding.right = 2;
invisGroup.spacing = 10;
// // time scale group
// var timeGroupObj = UIFactory.CreateHorizontalGroup(invisObj, new Color(1, 1, 1, 0));
// var timeGroup = timeGroupObj.GetComponent<HorizontalLayoutGroup>();
// timeGroup.childForceExpandWidth = false;
// timeGroup.childControlWidth = true;
// timeGroup.childForceExpandHeight = false;
// timeGroup.childControlHeight = true;
// timeGroup.padding.top = 2;
// timeGroup.padding.left = 5;
// timeGroup.padding.right = 2;
// timeGroup.padding.bottom = 2;
// timeGroup.spacing = 5;
// timeGroup.childAlignment = TextAnchor.MiddleCenter;
// var timeGroupLayout = timeGroupObj.AddComponent<LayoutElement>();
// timeGroupLayout.minWidth = 100;
// timeGroupLayout.flexibleWidth = 300;
// timeGroupLayout.minHeight = 25;
// timeGroupLayout.flexibleHeight = 0;
// // time scale title
// var timeTitleObj = UIFactory.CreateLabel(timeGroupObj, TextAnchor.MiddleLeft);
// var timeTitle = timeTitleObj.GetComponent<Text>();
// timeTitle.text = "Time Scale:";
// timeTitle.color = new Color(21f / 255f, 192f / 255f, 235f / 255f);
// var titleLayout = timeTitleObj.AddComponent<LayoutElement>();
// titleLayout.minHeight = 25;
// titleLayout.minWidth = 80;
// titleLayout.flexibleHeight = 0;
// timeTitle.horizontalOverflow = HorizontalWrapMode.Overflow;
// // actual active time label
// var timeLabelObj = UIFactory.CreateLabel(timeGroupObj, TextAnchor.MiddleLeft);
// var timeLabelLayout = timeLabelObj.AddComponent<LayoutElement>();
// timeLabelLayout.minWidth = 40;
// timeLabelLayout.minHeight = 25;
// timeLabelLayout.flexibleHeight = 0;
// // todo make static and update
// var s_timeText = timeLabelObj.GetComponent<Text>();
// s_timeText.text = Time.timeScale.ToString("F1");
// // time scale input
// var timeInputObj = UIFactory.CreateInputField(timeGroupObj);
// var timeInput = timeInputObj.GetComponent<InputField>();
// timeInput.characterValidation = InputField.CharacterValidation.Decimal;
// var timeInputLayout = timeInputObj.AddComponent<LayoutElement>();
// timeInputLayout.minWidth = 90;
// timeInputLayout.flexibleWidth = 0;
// timeInputLayout.minHeight = 25;
// timeInputLayout.flexibleHeight = 0;
// // time scale apply button
// var applyBtnObj = UIFactory.CreateButton(timeGroupObj);
// var applyBtn = applyBtnObj.GetComponent<Button>();
// applyBtn.onClick.AddListener(SetTimeScale);
// var applyText = applyBtnObj.GetComponentInChildren<Text>();
// applyText.text = "Apply";
// applyText.fontSize = 14;
// var applyLayout = applyBtnObj.AddComponent<LayoutElement>();
// applyLayout.minWidth = 50;
// applyLayout.minHeight = 25;
// applyLayout.flexibleHeight = 0;
// void SetTimeScale()
// {
// var scale = float.Parse(timeInput.text);
// Time.timeScale = scale;
// s_timeText.text = Time.timeScale.ToString("F1");
// }
// inspect under mouse button
var inspectObj = UIFactory.CreateButton(topRowObj);

View File

@ -96,7 +96,10 @@ namespace UnityExplorer.Inspectors.Reflection
private void SetValueFromDropdown()
{
var type = Value?.GetType() ?? FallbackType;
var value = Enum.Parse(type, m_dropdownText.text);
var index = m_dropdown.value;
var value = Enum.Parse(type, s_enumNamesCache[type][index].Value);
if (value != null)
{
Value = value;

View File

@ -63,8 +63,6 @@ namespace UnityExplorer.UI
throw new Exception("Could not find Type 'UnityEngine.Cursor'!");
}
ExplorerCore.Log("setting up forceunlockcursor patches...");
// Get current cursor state and enable cursor
try
{

View File

@ -178,13 +178,9 @@ namespace UnityExplorer.UI
Image image = groupObj.AddComponent<Image>();
if (color != default)
{
image.color = color;
}
else
{
image.color = new Color(44f / 255f, 44f / 255f, 44f / 255f);
}
return groupObj;
}
@ -657,16 +653,16 @@ namespace UnityExplorer.UI
contentFitter.horizontalFit = ContentSizeFitter.FitMode.Unconstrained;
contentFitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
var contentLayout = content.AddComponent<VerticalLayoutGroup>();
contentLayout.childForceExpandHeight = true;
contentLayout.childControlHeight = true;
contentLayout.childForceExpandWidth = true;
contentLayout.childControlWidth = true;
contentLayout.padding.left = 5;
contentLayout.padding.right = 5;
contentLayout.padding.top = 5;
contentLayout.padding.bottom = 5;
contentLayout.spacing = 5;
var contentGroup = content.AddComponent<VerticalLayoutGroup>();
contentGroup.childForceExpandHeight = true;
contentGroup.childControlHeight = true;
contentGroup.childForceExpandWidth = true;
contentGroup.childControlWidth = true;
contentGroup.padding.left = 5;
contentGroup.padding.right = 5;
contentGroup.padding.top = 5;
contentGroup.padding.bottom = 5;
contentGroup.spacing = 5;
GameObject scrollBarObj = CreateUIObject("DynamicScrollbar", mainObj);

View File

@ -25,7 +25,7 @@
<Prefer32Bit>false</Prefer32Bit>
<RootNamespace>UnityExplorer</RootNamespace>
<!-- Set this to the BepInEx Il2Cpp Game folder, without the ending '\' character. -->
<BIECppGameFolder>D:\Steam\steamapps\common\Outward_IL2CPP</BIECppGameFolder>
<BIECppGameFolder>D:\Steam\steamapps\common\Outward</BIECppGameFolder>
<!-- Set this to the BepInEx Mono Game folder, without the ending '\' character. -->
<BIEMonoGameFolder>D:\source\Unity Projects\Test\_BUILD_MONO</BIEMonoGameFolder>
<!-- Set this to the BepInEx Mono Managed folder, without the ending '\' character. -->