mirror of
https://github.com/originalnicodr/CinematicUnityExplorer.git
synced 2026-10-11 09:58:02 +08:00
Lots of fixes, everything basically done except Reflection Inspector
This commit is contained in:
1 parent
70a1570441
commit
e4d38af4f5
27 files changed
+569
-428
No files matched your search
@@ -6,6 +6,7 @@ using UnityEngine;
|
||||
using UnityExplorer.UI;
|
||||
using UnityExplorer.UI.Shared;
|
||||
using UnityExplorer.Helpers;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace UnityExplorer.Inspectors.Reflection
|
||||
{
|
||||
@@ -16,9 +17,7 @@ namespace UnityExplorer.Inspectors.Reflection
|
||||
public virtual bool CanWrite => false;
|
||||
public virtual bool HasParameters => false;
|
||||
public virtual bool IsMember => false;
|
||||
|
||||
//public bool IsStaticClassSearchResult { get; set; }
|
||||
|
||||
public virtual bool HasEvaluated => true;
|
||||
|
||||
// TODO
|
||||
public virtual void InitValue(object value, Type valueType)
|
||||
@@ -28,85 +27,30 @@ namespace UnityExplorer.Inspectors.Reflection
|
||||
return;
|
||||
}
|
||||
|
||||
//ExplorerCore.Log("Initializing InteractiveValue of type " + valueType.FullName);
|
||||
|
||||
// InteractiveValue interactive;
|
||||
|
||||
//if (valueType == typeof(GameObject) || valueType == typeof(Transform))
|
||||
//{
|
||||
// interactive = new InteractiveGameObject();
|
||||
//}
|
||||
//else if (valueType == typeof(Texture2D))
|
||||
//{
|
||||
// interactive = new InteractiveTexture2D();
|
||||
//}
|
||||
//else if (valueType == typeof(Texture))
|
||||
//{
|
||||
// interactive = new InteractiveTexture();
|
||||
//}
|
||||
//else if (valueType == typeof(Sprite))
|
||||
//{
|
||||
// interactive = new InteractiveSprite();
|
||||
//}
|
||||
//else if (valueType.IsPrimitive || valueType == typeof(string))
|
||||
//{
|
||||
// interactive = new InteractivePrimitive();
|
||||
//}
|
||||
//else if (valueType.IsEnum)
|
||||
//{
|
||||
// if (valueType.GetCustomAttributes(typeof(FlagsAttribute), true) is object[] attributes && attributes.Length > 0)
|
||||
// {
|
||||
// interactive = new InteractiveFlags();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// interactive = new InteractiveEnum();
|
||||
// }
|
||||
//}
|
||||
//else if (valueType == typeof(Vector2) || valueType == typeof(Vector3) || valueType == typeof(Vector4))
|
||||
//{
|
||||
// interactive = new InteractiveVector();
|
||||
//}
|
||||
//else if (valueType == typeof(Quaternion))
|
||||
//{
|
||||
// interactive = new InteractiveQuaternion();
|
||||
//}
|
||||
//else if (valueType == typeof(Color))
|
||||
//{
|
||||
// interactive = new InteractiveColor();
|
||||
//}
|
||||
//else if (valueType == typeof(Rect))
|
||||
//{
|
||||
// interactive = new InteractiveRect();
|
||||
//}
|
||||
//// must check this before IsEnumerable
|
||||
//else if (ReflectionHelpers.IsDictionary(valueType))
|
||||
//{
|
||||
// interactive = new InteractiveDictionary();
|
||||
//}
|
||||
//else if (ReflectionHelpers.IsEnumerable(valueType))
|
||||
//{
|
||||
// interactive = new InteractiveEnumerable();
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// interactive = new InteractiveValue();
|
||||
//}
|
||||
|
||||
//interactive.Value = obj;
|
||||
//interactive.ValueType = valueType;
|
||||
|
||||
//this.IValue = interactive;
|
||||
//this.IValue.OwnerCacheObject = this;
|
||||
|
||||
//UpdateValue();
|
||||
|
||||
//this.IValue.Init();
|
||||
// TEMP
|
||||
IValue = new InteractiveValue
|
||||
{
|
||||
OwnerCacheObject = this,
|
||||
ValueType = ReflectionHelpers.GetActualType(value) ?? valueType,
|
||||
};
|
||||
UpdateValue();
|
||||
}
|
||||
|
||||
public virtual void Draw(Rect window, float width)
|
||||
public virtual void Enable()
|
||||
{
|
||||
// IValue.Draw(window, width);
|
||||
if (!m_constructedUI)
|
||||
{
|
||||
ConstructUI();
|
||||
IValue.ConstructUI(m_topContent);
|
||||
UpdateValue();
|
||||
}
|
||||
|
||||
m_mainContent.SetActive(true);
|
||||
}
|
||||
|
||||
public virtual void Disable()
|
||||
{
|
||||
m_mainContent.SetActive(false);
|
||||
}
|
||||
|
||||
public virtual void UpdateValue()
|
||||
@@ -115,5 +59,57 @@ namespace UnityExplorer.Inspectors.Reflection
|
||||
}
|
||||
|
||||
public virtual void SetValue() => throw new NotImplementedException();
|
||||
|
||||
#region UI CONSTRUCTION
|
||||
|
||||
internal bool m_constructedUI;
|
||||
internal GameObject m_parentContent;
|
||||
internal GameObject m_mainContent;
|
||||
internal GameObject m_topContent;
|
||||
//internal GameObject m_subContent;
|
||||
|
||||
// Make base UI holder for CacheObject, this doesnt actually display anything.
|
||||
internal virtual void ConstructUI()
|
||||
{
|
||||
m_constructedUI = true;
|
||||
|
||||
m_mainContent = UIFactory.CreateVerticalGroup(m_parentContent, new Color(0.1f, 0.1f, 0.1f));
|
||||
var rowGroup = m_mainContent.GetComponent<VerticalLayoutGroup>();
|
||||
rowGroup.childForceExpandWidth = true;
|
||||
rowGroup.childControlWidth = true;
|
||||
rowGroup.childForceExpandHeight = false;
|
||||
rowGroup.childControlHeight = true;
|
||||
var rowLayout = m_mainContent.AddComponent<LayoutElement>();
|
||||
rowLayout.minHeight = 25;
|
||||
rowLayout.flexibleHeight = 0;
|
||||
rowLayout.minWidth = 200;
|
||||
rowLayout.flexibleWidth = 5000;
|
||||
|
||||
m_topContent = UIFactory.CreateHorizontalGroup(m_mainContent, new Color(1, 1, 1, 0));
|
||||
var topLayout = m_topContent.AddComponent<LayoutElement>();
|
||||
topLayout.minHeight = 25;
|
||||
topLayout.flexibleHeight = 0;
|
||||
var topGroup = m_topContent.GetComponent<HorizontalLayoutGroup>();
|
||||
topGroup.childForceExpandHeight = false;
|
||||
topGroup.childForceExpandWidth = true;
|
||||
topGroup.childControlHeight = true;
|
||||
topGroup.childControlWidth = true;
|
||||
topGroup.spacing = 4;
|
||||
|
||||
//m_subContent = UIFactory.CreateHorizontalGroup(m_parentContent, new Color(1, 1, 1, 0));
|
||||
//var subGroup = m_subContent.GetComponent<HorizontalLayoutGroup>();
|
||||
//subGroup.childForceExpandWidth = true;
|
||||
//subGroup.childControlWidth = true;
|
||||
//var subLayout = m_subContent.AddComponent<LayoutElement>();
|
||||
//subLayout.minHeight = 25;
|
||||
//subLayout.flexibleHeight = 500;
|
||||
//subLayout.minWidth = 125;
|
||||
//subLayout.flexibleWidth = 9000;
|
||||
|
||||
//m_subContent.SetActive(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user