2020-08-07 22:19:03 +10:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using UnityEngine;
|
2020-10-08 06:15:42 +11:00
|
|
|
|
using Explorer.UI;
|
|
|
|
|
using Explorer.UI.Shared;
|
|
|
|
|
using Explorer.CacheObject;
|
|
|
|
|
using Explorer.UI.Inspectors;
|
2020-09-27 22:04:23 +10:00
|
|
|
|
#if CPP
|
|
|
|
|
using UnhollowerBaseLib;
|
|
|
|
|
#endif
|
2020-08-07 22:19:03 +10:00
|
|
|
|
|
2020-10-08 06:15:42 +11:00
|
|
|
|
namespace Explorer.UI.Inspectors
|
2020-08-07 22:19:03 +10:00
|
|
|
|
{
|
2020-10-08 06:15:42 +11:00
|
|
|
|
public abstract class ReflectionInspector : WindowBase
|
2020-08-07 22:19:03 +10:00
|
|
|
|
{
|
2020-08-30 01:08:48 +10:00
|
|
|
|
public override string Title => WindowManager.TabView
|
2020-10-08 06:15:42 +11:00
|
|
|
|
? $"<color=cyan>[R]</color> {TargetType.Name}"
|
2020-09-01 18:03:44 +10:00
|
|
|
|
: $"Reflection Inspector ({TargetType.Name})";
|
2020-08-07 22:19:03 +10:00
|
|
|
|
|
2020-10-08 06:15:42 +11:00
|
|
|
|
public virtual bool IsStaticInspector { get; }
|
|
|
|
|
|
2020-09-01 18:03:44 +10:00
|
|
|
|
public Type TargetType;
|
2020-08-07 22:19:03 +10:00
|
|
|
|
|
2020-10-08 06:15:42 +11:00
|
|
|
|
private CacheMember[] m_allCachedMembers;
|
|
|
|
|
private CacheMember[] m_cachedMembersFiltered;
|
2020-09-03 19:48:50 +10:00
|
|
|
|
|
|
|
|
|
public PageHelper Pages = new PageHelper();
|
2020-08-07 22:19:03 +10:00
|
|
|
|
|
|
|
|
|
private bool m_autoUpdate = false;
|
|
|
|
|
private string m_search = "";
|
2020-10-08 06:15:42 +11:00
|
|
|
|
public MemberTypes m_typeFilter = MemberTypes.Property;
|
2020-08-24 01:42:19 +10:00
|
|
|
|
private bool m_hideFailedReflection = false;
|
2020-08-07 22:19:03 +10:00
|
|
|
|
|
2020-10-08 06:15:42 +11:00
|
|
|
|
private MemberScopes m_scopeFilter;
|
|
|
|
|
private enum MemberScopes
|
|
|
|
|
{
|
|
|
|
|
Both,
|
|
|
|
|
Instance,
|
|
|
|
|
Static
|
|
|
|
|
}
|
2020-08-07 22:19:03 +10:00
|
|
|
|
|
2020-09-11 00:17:13 +10:00
|
|
|
|
private static readonly HashSet<string> _typeAndMemberBlacklist = new HashSet<string>
|
2020-08-07 22:19:03 +10:00
|
|
|
|
{
|
2020-09-10 18:02:41 +10:00
|
|
|
|
// Causes a crash
|
|
|
|
|
"Type.DeclaringMethod",
|
2020-09-13 17:39:15 +10:00
|
|
|
|
// Causes a crash
|
|
|
|
|
"Rigidbody2D.Cast",
|
2020-09-11 00:17:13 +10:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
private static readonly HashSet<string> _methodStartsWithBlacklist = new HashSet<string>
|
|
|
|
|
{
|
2020-09-10 18:02:41 +10:00
|
|
|
|
// Pointless (handled by Properties)
|
|
|
|
|
"get_",
|
2020-09-13 17:39:15 +10:00
|
|
|
|
"set_",
|
2020-09-10 18:02:41 +10:00
|
|
|
|
};
|
2020-08-18 17:11:58 +10:00
|
|
|
|
|
2020-09-10 18:02:41 +10:00
|
|
|
|
public override void Init()
|
|
|
|
|
{
|
2020-10-08 06:15:42 +11:00
|
|
|
|
if (!IsStaticInspector)
|
2020-08-29 21:15:54 +10:00
|
|
|
|
{
|
2020-10-08 06:15:42 +11:00
|
|
|
|
TargetType = ReflectionHelpers.GetActualType(Target);
|
|
|
|
|
CacheMembers(ReflectionHelpers.GetAllBaseTypes(Target));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
CacheMembers(new Type[] { TargetType });
|
2020-08-29 21:15:54 +10:00
|
|
|
|
}
|
2020-08-07 22:19:03 +10:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void Update()
|
|
|
|
|
{
|
2020-10-08 06:15:42 +11:00
|
|
|
|
if (m_allCachedMembers == null)
|
2020-09-07 17:05:37 +10:00
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-30 07:01:13 +10:00
|
|
|
|
m_cachedMembersFiltered = m_allCachedMembers.Where(x => ShouldProcessMember(x)).ToArray();
|
2020-08-22 00:16:05 +10:00
|
|
|
|
|
2020-08-07 22:19:03 +10:00
|
|
|
|
if (m_autoUpdate)
|
|
|
|
|
{
|
|
|
|
|
UpdateValues();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-22 00:16:05 +10:00
|
|
|
|
private void UpdateValues()
|
2020-08-18 17:11:58 +10:00
|
|
|
|
{
|
2020-08-30 07:01:13 +10:00
|
|
|
|
foreach (var member in m_cachedMembersFiltered)
|
2020-08-07 22:19:03 +10:00
|
|
|
|
{
|
2020-08-22 17:17:11 +10:00
|
|
|
|
member.UpdateValue();
|
2020-08-07 22:19:03 +10:00
|
|
|
|
}
|
2020-08-18 17:11:58 +10:00
|
|
|
|
}
|
|
|
|
|
|
2020-10-08 06:15:42 +11:00
|
|
|
|
public virtual bool ShouldProcessMember(CacheMember holder)
|
2020-08-18 17:11:58 +10:00
|
|
|
|
{
|
2020-09-10 18:02:41 +10:00
|
|
|
|
// check MemberTypes filter
|
2020-10-08 06:15:42 +11:00
|
|
|
|
if (m_typeFilter != MemberTypes.All && m_typeFilter != holder.MemInfo?.MemberType)
|
2020-09-10 18:02:41 +10:00
|
|
|
|
return false;
|
|
|
|
|
|
2020-10-08 06:15:42 +11:00
|
|
|
|
// check scope filter
|
|
|
|
|
if (m_scopeFilter == MemberScopes.Instance)
|
|
|
|
|
{
|
|
|
|
|
return !holder.IsStatic;
|
|
|
|
|
}
|
|
|
|
|
else if (m_scopeFilter == MemberScopes.Static)
|
|
|
|
|
{
|
|
|
|
|
return holder.IsStatic;
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-10 18:02:41 +10:00
|
|
|
|
// hide failed reflection
|
2020-10-08 06:15:42 +11:00
|
|
|
|
if (!string.IsNullOrEmpty(holder.ReflectionException) && m_hideFailedReflection)
|
2020-09-10 18:02:41 +10:00
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
// see if we should do name search
|
2020-10-08 06:15:42 +11:00
|
|
|
|
if (m_search == "" || holder.MemInfo == null)
|
2020-09-10 18:02:41 +10:00
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
// ok do name search
|
|
|
|
|
return (holder.MemInfo.DeclaringType.Name + "." + holder.MemInfo.Name)
|
|
|
|
|
.ToLower()
|
|
|
|
|
.Contains(m_search.ToLower());
|
2020-08-18 17:11:58 +10:00
|
|
|
|
}
|
|
|
|
|
|
2020-08-22 17:17:11 +10:00
|
|
|
|
private void CacheMembers(Type[] types)
|
2020-08-18 17:11:58 +10:00
|
|
|
|
{
|
2020-10-08 06:15:42 +11:00
|
|
|
|
var list = new List<CacheMember>();
|
2020-09-10 18:02:41 +10:00
|
|
|
|
var cachedSigs = new List<string>();
|
2020-08-22 17:17:11 +10:00
|
|
|
|
|
|
|
|
|
foreach (var declaringType in types)
|
2020-08-07 22:19:03 +10:00
|
|
|
|
{
|
2020-08-22 00:16:05 +10:00
|
|
|
|
MemberInfo[] infos;
|
2020-08-18 17:11:58 +10:00
|
|
|
|
try
|
|
|
|
|
{
|
2020-08-22 17:17:11 +10:00
|
|
|
|
infos = declaringType.GetMembers(ReflectionHelpers.CommonFlags);
|
2020-08-18 17:11:58 +10:00
|
|
|
|
}
|
2020-10-08 06:15:42 +11:00
|
|
|
|
catch
|
2020-08-18 17:11:58 +10:00
|
|
|
|
{
|
2020-09-27 22:04:23 +10:00
|
|
|
|
ExplorerCore.Log($"Exception getting members for type: {declaringType.FullName}");
|
2020-08-22 00:16:05 +10:00
|
|
|
|
continue;
|
2020-08-18 17:11:58 +10:00
|
|
|
|
}
|
|
|
|
|
|
2020-08-22 17:17:11 +10:00
|
|
|
|
object target = Target;
|
2020-09-10 18:02:41 +10:00
|
|
|
|
string exception = null;
|
2020-08-29 21:15:54 +10:00
|
|
|
|
|
2020-09-27 22:04:23 +10:00
|
|
|
|
#if CPP
|
2020-10-08 06:15:42 +11:00
|
|
|
|
if (!IsStaticInspector && target is Il2CppSystem.Object ilObject)
|
2020-08-07 22:19:03 +10:00
|
|
|
|
{
|
2020-08-22 00:16:05 +10:00
|
|
|
|
try
|
2020-08-07 22:19:03 +10:00
|
|
|
|
{
|
2020-08-22 17:17:11 +10:00
|
|
|
|
target = ilObject.Il2CppCast(declaringType);
|
2020-08-22 00:16:05 +10:00
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
2020-08-18 17:11:58 +10:00
|
|
|
|
{
|
2020-08-22 17:17:11 +10:00
|
|
|
|
exception = ReflectionHelpers.ExceptionToString(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-09-27 22:04:23 +10:00
|
|
|
|
#endif
|
2020-08-22 17:17:11 +10:00
|
|
|
|
foreach (var member in infos)
|
|
|
|
|
{
|
2020-10-08 06:15:42 +11:00
|
|
|
|
try
|
|
|
|
|
{
|
2020-10-10 20:19:56 +11:00
|
|
|
|
// make sure member type is Field, Method or Property (4 / 8 / 16)
|
2020-10-08 06:15:42 +11:00
|
|
|
|
int m = (int)member.MemberType;
|
|
|
|
|
if (m < 4 || m > 16)
|
|
|
|
|
continue;
|
2020-09-10 18:02:41 +10:00
|
|
|
|
|
2020-10-08 06:15:42 +11:00
|
|
|
|
var fi = member as FieldInfo;
|
|
|
|
|
var pi = member as PropertyInfo;
|
|
|
|
|
var mi = member as MethodInfo;
|
2020-09-11 00:17:13 +10:00
|
|
|
|
|
2020-10-08 06:15:42 +11:00
|
|
|
|
if (IsStaticInspector)
|
|
|
|
|
{
|
|
|
|
|
if (fi != null && !fi.IsStatic) continue;
|
|
|
|
|
else if (pi != null && !pi.GetAccessors()[0].IsStatic) continue;
|
|
|
|
|
else if (mi != null && !mi.IsStatic) continue;
|
|
|
|
|
}
|
2020-09-10 18:02:41 +10:00
|
|
|
|
|
2020-10-08 06:15:42 +11:00
|
|
|
|
// check blacklisted members
|
|
|
|
|
var sig = $"{member.DeclaringType.Name}.{member.Name}";
|
|
|
|
|
if (_typeAndMemberBlacklist.Any(it => it == sig))
|
|
|
|
|
continue;
|
2020-08-22 17:17:11 +10:00
|
|
|
|
|
2020-10-08 06:15:42 +11:00
|
|
|
|
if (_methodStartsWithBlacklist.Any(it => member.Name.StartsWith(it)))
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
if (mi != null)
|
2020-09-09 19:15:47 +10:00
|
|
|
|
{
|
2020-10-08 06:15:42 +11:00
|
|
|
|
AppendParams(mi.GetParameters());
|
|
|
|
|
}
|
|
|
|
|
else if (pi != null)
|
|
|
|
|
{
|
|
|
|
|
AppendParams(pi.GetIndexParameters());
|
2020-09-09 19:15:47 +10:00
|
|
|
|
}
|
|
|
|
|
|
2020-10-08 06:15:42 +11:00
|
|
|
|
void AppendParams(ParameterInfo[] _args)
|
|
|
|
|
{
|
|
|
|
|
sig += " (";
|
|
|
|
|
foreach (var param in _args)
|
|
|
|
|
{
|
|
|
|
|
sig += $"{param.ParameterType.Name} {param.Name}, ";
|
|
|
|
|
}
|
|
|
|
|
sig += ")";
|
|
|
|
|
}
|
2020-08-24 01:42:19 +10:00
|
|
|
|
|
2020-10-08 06:15:42 +11:00
|
|
|
|
if (cachedSigs.Contains(sig))
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2020-09-13 17:39:15 +10:00
|
|
|
|
|
2020-10-08 06:15:42 +11:00
|
|
|
|
try
|
2020-08-24 01:42:19 +10:00
|
|
|
|
{
|
2020-10-08 06:15:42 +11:00
|
|
|
|
var cached = CacheFactory.GetCacheObject(member, target);
|
2020-10-11 20:07:23 +11:00
|
|
|
|
|
2020-10-08 06:15:42 +11:00
|
|
|
|
if (cached != null)
|
|
|
|
|
{
|
|
|
|
|
cachedSigs.Add(sig);
|
|
|
|
|
list.Add(cached);
|
2020-10-12 20:15:41 +11:00
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(cached.ReflectionException))
|
|
|
|
|
{
|
|
|
|
|
cached.ReflectionException = exception;
|
|
|
|
|
}
|
2020-10-08 06:15:42 +11:00
|
|
|
|
}
|
2020-08-24 01:42:19 +10:00
|
|
|
|
}
|
2020-10-08 06:15:42 +11:00
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
ExplorerCore.LogWarning($"Exception caching member {sig}!");
|
|
|
|
|
ExplorerCore.Log(e.ToString());
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-09-10 18:02:41 +10:00
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
2020-10-08 06:15:42 +11:00
|
|
|
|
ExplorerCore.LogWarning($"Exception caching member {member.DeclaringType.FullName}.{member.Name}!");
|
2020-09-27 22:04:23 +10:00
|
|
|
|
ExplorerCore.Log(e.ToString());
|
2020-09-10 18:02:41 +10:00
|
|
|
|
}
|
2020-08-18 17:11:58 +10:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-08-30 07:01:13 +10:00
|
|
|
|
m_allCachedMembers = list.ToArray();
|
2020-08-07 22:19:03 +10:00
|
|
|
|
}
|
|
|
|
|
|
2020-08-18 17:11:58 +10:00
|
|
|
|
// =========== GUI DRAW =========== //
|
|
|
|
|
|
2020-08-07 22:19:03 +10:00
|
|
|
|
public override void WindowFunction(int windowID)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
2020-08-30 07:01:13 +10:00
|
|
|
|
// ====== HEADER ======
|
|
|
|
|
|
2020-08-30 01:08:48 +10:00
|
|
|
|
var rect = WindowManager.TabView ? TabViewWindow.Instance.m_rect : this.m_rect;
|
2020-08-07 22:19:03 +10:00
|
|
|
|
|
2020-08-30 01:08:48 +10:00
|
|
|
|
if (!WindowManager.TabView)
|
|
|
|
|
{
|
|
|
|
|
Header();
|
2020-09-13 17:11:15 +10:00
|
|
|
|
GUIUnstrip.BeginArea(new Rect(5, 25, rect.width - 10, rect.height - 35), GUI.skin.box);
|
2020-08-30 01:08:48 +10:00
|
|
|
|
}
|
2020-08-07 22:19:03 +10:00
|
|
|
|
|
2020-10-08 06:15:42 +11:00
|
|
|
|
var asInstance = this as InstanceInspector;
|
|
|
|
|
|
|
|
|
|
GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]);
|
|
|
|
|
var labelWidth = (asInstance != null && asInstance.m_uObj)
|
|
|
|
|
? new GUILayoutOption[] { GUILayout.Width(245f) }
|
|
|
|
|
: new GUILayoutOption[0];
|
|
|
|
|
GUILayout.Label("<b>Type:</b> <color=cyan>" + TargetType.FullName + "</color>", labelWidth);
|
2020-10-14 20:47:19 +11:00
|
|
|
|
GUILayout.EndHorizontal();
|
2020-10-08 06:15:42 +11:00
|
|
|
|
|
|
|
|
|
if (asInstance != null)
|
2020-08-07 22:19:03 +10:00
|
|
|
|
{
|
2020-10-08 06:15:42 +11:00
|
|
|
|
asInstance.DrawInstanceControls(rect);
|
2020-08-07 22:19:03 +10:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UIStyles.HorizontalLine(Color.grey);
|
|
|
|
|
|
2020-10-08 06:15:42 +11:00
|
|
|
|
GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]);
|
2020-09-14 20:25:38 +10:00
|
|
|
|
GUILayout.Label("<b>Search:</b>", new GUILayoutOption[] { GUILayout.Width(75) });
|
2020-10-08 06:15:42 +11:00
|
|
|
|
m_search = GUIUnstrip.TextField(m_search, new GUILayoutOption[0]);
|
2020-09-14 20:25:38 +10:00
|
|
|
|
GUILayout.EndHorizontal();
|
2020-08-07 22:19:03 +10:00
|
|
|
|
|
2020-10-08 06:15:42 +11:00
|
|
|
|
GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]);
|
2020-09-14 20:25:38 +10:00
|
|
|
|
GUILayout.Label("<b>Filter:</b>", new GUILayoutOption[] { GUILayout.Width(75) });
|
2020-10-08 06:15:42 +11:00
|
|
|
|
FilterTypeToggle(MemberTypes.All, "All");
|
|
|
|
|
FilterTypeToggle(MemberTypes.Property, "Properties");
|
|
|
|
|
FilterTypeToggle(MemberTypes.Field, "Fields");
|
|
|
|
|
FilterTypeToggle(MemberTypes.Method, "Methods");
|
2020-09-14 20:25:38 +10:00
|
|
|
|
GUILayout.EndHorizontal();
|
2020-08-07 22:19:03 +10:00
|
|
|
|
|
2020-10-08 06:15:42 +11:00
|
|
|
|
if (this is InstanceInspector)
|
|
|
|
|
{
|
|
|
|
|
GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]);
|
|
|
|
|
GUILayout.Label("<b>Scope:</b>", new GUILayoutOption[] { GUILayout.Width(75) });
|
|
|
|
|
FilterScopeToggle(MemberScopes.Both, "Both");
|
|
|
|
|
FilterScopeToggle(MemberScopes.Instance, "Instance");
|
|
|
|
|
FilterScopeToggle(MemberScopes.Static, "Static");
|
|
|
|
|
GUILayout.EndHorizontal();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]);
|
2020-09-14 20:25:38 +10:00
|
|
|
|
GUILayout.Label("<b>Values:</b>", new GUILayoutOption[] { GUILayout.Width(75) });
|
|
|
|
|
if (GUILayout.Button("Update", new GUILayoutOption[] { GUILayout.Width(100) }))
|
2020-08-07 22:19:03 +10:00
|
|
|
|
{
|
|
|
|
|
UpdateValues();
|
|
|
|
|
}
|
|
|
|
|
GUI.color = m_autoUpdate ? Color.green : Color.red;
|
2020-09-14 20:25:38 +10:00
|
|
|
|
m_autoUpdate = GUILayout.Toggle(m_autoUpdate, "Auto-update?", new GUILayoutOption[] { GUILayout.Width(100) });
|
2020-08-22 17:17:11 +10:00
|
|
|
|
GUI.color = m_hideFailedReflection ? Color.green : Color.red;
|
2020-09-14 20:25:38 +10:00
|
|
|
|
m_hideFailedReflection = GUILayout.Toggle(m_hideFailedReflection, "Hide failed Reflection?", new GUILayoutOption[] { GUILayout.Width(150) });
|
2020-08-07 22:19:03 +10:00
|
|
|
|
GUI.color = Color.white;
|
2020-09-14 20:25:38 +10:00
|
|
|
|
GUILayout.EndHorizontal();
|
2020-08-07 22:19:03 +10:00
|
|
|
|
|
2020-09-12 00:59:59 +10:00
|
|
|
|
GUIUnstrip.Space(10);
|
2020-08-07 22:19:03 +10:00
|
|
|
|
|
2020-09-04 21:36:40 +10:00
|
|
|
|
Pages.ItemCount = m_cachedMembersFiltered.Length;
|
2020-09-03 19:48:50 +10:00
|
|
|
|
|
2020-08-30 01:08:48 +10:00
|
|
|
|
// prev/next page buttons
|
2020-10-08 06:15:42 +11:00
|
|
|
|
GUIUnstrip.BeginHorizontal(new GUILayoutOption[0]);
|
2020-08-30 01:08:48 +10:00
|
|
|
|
|
2020-09-03 19:48:50 +10:00
|
|
|
|
Pages.DrawLimitInputArea();
|
|
|
|
|
|
2020-09-04 21:36:40 +10:00
|
|
|
|
if (Pages.ItemCount > Pages.ItemsPerPage)
|
2020-08-07 22:19:03 +10:00
|
|
|
|
{
|
2020-09-14 20:25:38 +10:00
|
|
|
|
if (GUILayout.Button("< Prev", new GUILayoutOption[] { GUILayout.Width(80) }))
|
2020-08-22 00:16:05 +10:00
|
|
|
|
{
|
2020-09-03 19:48:50 +10:00
|
|
|
|
Pages.TurnPage(Turn.Left, ref this.scroll);
|
2020-08-22 00:16:05 +10:00
|
|
|
|
}
|
2020-08-07 22:19:03 +10:00
|
|
|
|
|
2020-09-03 19:48:50 +10:00
|
|
|
|
Pages.CurrentPageLabel();
|
2020-08-22 00:16:05 +10:00
|
|
|
|
|
2020-09-14 20:25:38 +10:00
|
|
|
|
if (GUILayout.Button("Next >", new GUILayoutOption[] { GUILayout.Width(80) }))
|
2020-08-22 00:16:05 +10:00
|
|
|
|
{
|
2020-09-03 19:48:50 +10:00
|
|
|
|
Pages.TurnPage(Turn.Right, ref this.scroll);
|
2020-08-22 00:16:05 +10:00
|
|
|
|
}
|
2020-08-07 22:19:03 +10:00
|
|
|
|
}
|
2020-09-14 20:25:38 +10:00
|
|
|
|
GUILayout.EndHorizontal();
|
2020-08-07 22:19:03 +10:00
|
|
|
|
|
2020-08-30 07:01:13 +10:00
|
|
|
|
// ====== BODY ======
|
|
|
|
|
|
2020-09-04 21:36:40 +10:00
|
|
|
|
scroll = GUIUnstrip.BeginScrollView(scroll);
|
2020-08-22 00:16:05 +10:00
|
|
|
|
|
2020-09-12 00:59:59 +10:00
|
|
|
|
GUIUnstrip.Space(10);
|
2020-08-22 00:16:05 +10:00
|
|
|
|
|
2020-08-30 07:01:13 +10:00
|
|
|
|
UIStyles.HorizontalLine(Color.grey);
|
2020-08-22 00:16:05 +10:00
|
|
|
|
|
2020-10-08 06:15:42 +11:00
|
|
|
|
GUIUnstrip.BeginVertical(GUIContent.none, GUI.skin.box, null);
|
2020-08-07 22:19:03 +10:00
|
|
|
|
|
2020-08-30 07:01:13 +10:00
|
|
|
|
var members = this.m_cachedMembersFiltered;
|
2020-09-03 19:48:50 +10:00
|
|
|
|
int start = Pages.CalculateOffsetIndex();
|
2020-08-07 22:19:03 +10:00
|
|
|
|
|
2020-09-04 21:36:40 +10:00
|
|
|
|
for (int j = start; (j < start + Pages.ItemsPerPage && j < members.Length); j++)
|
2020-08-30 07:01:13 +10:00
|
|
|
|
{
|
|
|
|
|
var holder = members[j];
|
2020-08-22 00:16:05 +10:00
|
|
|
|
|
2020-10-08 06:15:42 +11:00
|
|
|
|
GUIUnstrip.BeginHorizontal(new GUILayoutOption[] { GUILayout.Height(25) });
|
|
|
|
|
try
|
|
|
|
|
{
|
2020-08-30 07:01:13 +10:00
|
|
|
|
holder.Draw(rect, 180f);
|
2020-10-08 06:15:42 +11:00
|
|
|
|
}
|
|
|
|
|
catch
|
2020-09-01 18:03:44 +10:00
|
|
|
|
{
|
2020-09-14 20:25:38 +10:00
|
|
|
|
GUILayout.EndHorizontal();
|
2020-09-01 18:03:44 +10:00
|
|
|
|
continue;
|
2020-08-30 07:01:13 +10:00
|
|
|
|
}
|
2020-09-14 20:25:38 +10:00
|
|
|
|
GUILayout.EndHorizontal();
|
2020-08-30 01:08:48 +10:00
|
|
|
|
|
2020-09-01 18:03:44 +10:00
|
|
|
|
// if not last element
|
2020-09-04 21:36:40 +10:00
|
|
|
|
if (!(j == (start + Pages.ItemsPerPage - 1) || j == (members.Length - 1)))
|
2020-09-01 18:03:44 +10:00
|
|
|
|
UIStyles.HorizontalLine(new Color(0.07f, 0.07f, 0.07f), true);
|
2020-08-30 07:01:13 +10:00
|
|
|
|
}
|
2020-08-13 18:43:34 +10:00
|
|
|
|
|
2020-09-14 20:25:38 +10:00
|
|
|
|
GUILayout.EndVertical();
|
2020-09-04 21:36:40 +10:00
|
|
|
|
GUIUnstrip.EndScrollView();
|
2020-08-13 18:43:34 +10:00
|
|
|
|
|
2020-08-30 07:01:13 +10:00
|
|
|
|
if (!WindowManager.TabView)
|
|
|
|
|
{
|
|
|
|
|
m_rect = ResizeDrag.ResizeWindow(rect, windowID);
|
2020-08-22 00:16:05 +10:00
|
|
|
|
|
2020-09-13 17:11:15 +10:00
|
|
|
|
GUIUnstrip.EndArea();
|
2020-08-30 07:01:13 +10:00
|
|
|
|
}
|
2020-08-22 00:16:05 +10:00
|
|
|
|
}
|
2020-09-27 22:04:23 +10:00
|
|
|
|
catch (Exception e) when (e.Message.Contains("in a group with only"))
|
2020-08-22 00:16:05 +10:00
|
|
|
|
{
|
2020-09-27 22:04:23 +10:00
|
|
|
|
// suppress
|
2020-08-30 07:01:13 +10:00
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
2020-09-27 22:04:23 +10:00
|
|
|
|
ExplorerCore.LogWarning("Exception drawing ReflectionWindow: " + e.GetType() + ", " + e.Message);
|
2020-08-30 07:01:13 +10:00
|
|
|
|
DestroyWindow();
|
|
|
|
|
return;
|
2020-08-18 17:11:58 +10:00
|
|
|
|
}
|
2020-08-07 22:19:03 +10:00
|
|
|
|
}
|
|
|
|
|
|
2020-10-08 06:15:42 +11:00
|
|
|
|
private void FilterTypeToggle(MemberTypes mode, string label)
|
|
|
|
|
{
|
|
|
|
|
if (m_typeFilter == mode)
|
|
|
|
|
{
|
|
|
|
|
GUI.color = Color.green;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
GUI.color = Color.white;
|
|
|
|
|
}
|
|
|
|
|
if (GUILayout.Button(label, new GUILayoutOption[] { GUILayout.Width(100) }))
|
|
|
|
|
{
|
|
|
|
|
m_typeFilter = mode;
|
|
|
|
|
Pages.PageOffset = 0;
|
|
|
|
|
scroll = Vector2.zero;
|
|
|
|
|
}
|
|
|
|
|
GUI.color = Color.white;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void FilterScopeToggle(MemberScopes mode, string label)
|
2020-08-07 22:19:03 +10:00
|
|
|
|
{
|
2020-10-08 06:15:42 +11:00
|
|
|
|
if (m_scopeFilter == mode)
|
2020-08-07 22:19:03 +10:00
|
|
|
|
{
|
2020-08-18 17:11:58 +10:00
|
|
|
|
GUI.color = Color.green;
|
2020-08-07 22:19:03 +10:00
|
|
|
|
}
|
2020-08-18 17:11:58 +10:00
|
|
|
|
else
|
2020-08-07 22:19:03 +10:00
|
|
|
|
{
|
2020-08-18 17:11:58 +10:00
|
|
|
|
GUI.color = Color.white;
|
2020-08-07 22:19:03 +10:00
|
|
|
|
}
|
2020-09-14 20:25:38 +10:00
|
|
|
|
if (GUILayout.Button(label, new GUILayoutOption[] { GUILayout.Width(100) }))
|
2020-08-07 22:19:03 +10:00
|
|
|
|
{
|
2020-10-08 06:15:42 +11:00
|
|
|
|
m_scopeFilter = mode;
|
2020-09-03 19:48:50 +10:00
|
|
|
|
Pages.PageOffset = 0;
|
|
|
|
|
scroll = Vector2.zero;
|
2020-08-07 22:19:03 +10:00
|
|
|
|
}
|
2020-08-18 17:11:58 +10:00
|
|
|
|
GUI.color = Color.white;
|
2020-08-07 22:19:03 +10:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|