Update to UniverseLib 1.2, cleanups

This commit is contained in:
Sinai 2022-01-31 21:24:01 +11:00
parent f35232bb64
commit 9985ed0fd8
69 changed files with 312 additions and 262 deletions

View File

@ -35,7 +35,7 @@
| ------- | ------ | ---- |
| ML 0.4+ | ✅ [link](https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.MelonLoader.Il2Cpp.zip) | ✅ [link](https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.MelonLoader.Mono.zip) |
1. Take the `UnityExplorer.ML.[version].dll` and the `UniverseLib.[version].dll` files and put them in the `Mods\` folder created by MelonLoader.
1. Take the `UnityExplorer.ML.[version].dll` file and put them in the `Mods\` folder created by MelonLoader, and then put the `UniverseLib.[version].dll` file in the `UserLibs\` folder.
## Standalone
@ -43,9 +43,10 @@
| ------ | ---- |
| ✅ [link](https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.Standalone.Il2Cpp.zip) | ✅ [link](https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.Standalone.Mono.zip) |
The standalone release can be used with any injector or loader of your choice, but it requires you to load the dependencies manually: HarmonyX, and the IL2CPP version also requires that you set up an [Il2CppAssemblyUnhollower runtime](https://github.com/knah/Il2CppAssemblyUnhollower#required-external-setup).
The standalone release can be used with any injector or loader of your choice, but it requires you to load the dependencies manually.
1. Load the required libs - UniverseLib, HarmonyX, and Il2CppAssemblyUnhollower if IL2CPP
1. Ensure the required libs are loaded - UniverseLib, HarmonyX and MonoMod
2. For IL2CPP, load Il2CppAssemblyUnhollower and start an [Il2CppAssemblyUnhollower runtime](https://github.com/knah/Il2CppAssemblyUnhollower#required-external-setup)
2. Load the UnityExplorer DLL
3. Create an instance of Unity Explorer with `UnityExplorer.ExplorerStandalone.CreateInstance();`
4. Optionally subscribe to the `ExplorerStandalone.OnLog` event to handle logging if you wish
@ -130,11 +131,9 @@ The inspector is used to see detailed information on objects of any type and man
# Building
For Visual Studio:
0. Clone the repository and run `git submodule update --init --recursive` to get the submodules.
1. Open the `src\UnityExplorer.sln` project.
2. Build `mcs` (Release/AnyCPU, you may need to run `nuget restore mcs.sln`), and if using IL2CPP then build `Il2CppAssemblyUnhollower` (Release/AnyCPU) as well.
2. Build `mcs` (Release/AnyCPU, you may need to run `nuget restore mcs.sln`)
3. Build the UnityExplorer release(s) you want to use, either by selecting the config as the Active Config, or batch-building.
If you fork the repository on GitHub you can build using the [dotnet workflow](https://github.com/sinai-dev/UnityExplorer/blob/master/.github/workflows/dotnet.yml):
@ -146,7 +145,7 @@ If you fork the repository on GitHub you can build using the [dotnet workflow](h
# Acknowledgments
* [ManlyMarco](https://github.com/ManlyMarco) for [Runtime Unity Editor](https://github.com/ManlyMarco/RuntimeUnityEditor) \[[license](THIRDPARTY_LICENSES.md#runtimeunityeditor-license)\], the ScriptEvaluator from RUE's REPL console was used as the base for UnityExplorer's C# console.
* [denikson](https://github.com/denikson) (aka Horse) for [mcs-unity](https://github.com/denikson/mcs-unity) \[no license\], used as the `Mono.CSharp` reference for the C# Console.
* [Geoffrey Horsington](https://github.com/ghorsington) for [mcs-unity](https://github.com/sinai-dev/mcs-unity) \[no license\], used as the `Mono.CSharp` reference for the C# Console.
### Disclaimer

View File

@ -8,6 +8,8 @@ using UnityExplorer.UI;
using UnityExplorer.UI.Widgets.AutoComplete;
using UniverseLib;
using UniverseLib.UI;
using UniverseLib.UI.Models;
using UniverseLib.Utility;
namespace UnityExplorer.CSConsole
{
@ -25,7 +27,7 @@ namespace UnityExplorer.CSConsole
AutoCompleteModal.Instance.ReleaseOwnership(this);
}
private readonly HashSet<char> delimiters = new HashSet<char>
private readonly HashSet<char> delimiters = new()
{
'{', '}', ',', ';', '<', '>', '(', ')', '[', ']', '=', '|', '&', '?'
};

View File

@ -16,6 +16,8 @@ using UnityExplorer.UI.Panels;
using UnityExplorer.UI.Widgets.AutoComplete;
using UniverseLib.UI;
using UniverseLib;
using UniverseLib.UI.Models;
using UniverseLib.Utility;
namespace UnityExplorer.CSConsole
{
@ -357,7 +359,7 @@ namespace UnityExplorer.CSConsole
var charTop = charInfo.cursorPos.y;
var charBot = charTop - CSCONSOLE_LINEHEIGHT;
var viewportMin = Input.Rect.rect.height - Input.Rect.anchoredPosition.y - (Input.Rect.rect.height * 0.5f);
var viewportMin = Input.Transform.rect.height - Input.Transform.anchoredPosition.y - (Input.Transform.rect.height * 0.5f);
var viewportMax = viewportMin - Panel.InputScroller.ViewportRect.rect.height;
float diff = 0f;
@ -368,7 +370,7 @@ namespace UnityExplorer.CSConsole
if (Math.Abs(diff) > 1)
{
var rect = Input.Rect;
var rect = Input.Transform;
rect.anchoredPosition = new Vector2(rect.anchoredPosition.x, rect.anchoredPosition.y - diff);
}
}
@ -378,7 +380,7 @@ namespace UnityExplorer.CSConsole
{
settingCaretCoroutine = true;
Input.Component.readOnly = true;
RuntimeProvider.Instance.StartCoroutine(SetCaretCoroutine(caretPosition));
RuntimeHelper.StartCoroutine(SetCaretCoroutine(caretPosition));
}
internal static PropertyInfo SelectionGuardProperty => selectionGuardPropInfo ?? GetSelectionGuardPropInfo();
@ -438,7 +440,7 @@ namespace UnityExplorer.CSConsole
// the top and bottom position of the viewport in relation to the text height
// they need the half-height adjustment to normalize against the 'line.topY' value.
var viewportMin = Input.Rect.rect.height - Input.Rect.anchoredPosition.y - (Input.Rect.rect.height * 0.5f);
var viewportMin = Input.Transform.rect.height - Input.Transform.anchoredPosition.y - (Input.Transform.rect.height * 0.5f);
var viewportMax = viewportMin - Panel.InputScroller.ViewportRect.rect.height;
for (int i = 0; i < Input.TextGenerator.lineCount; i++)

View File

@ -7,6 +7,7 @@ using UnityEngine;
using UnityEngine.UI;
using UnityExplorer.CSConsole.Lexers;
using UniverseLib;
using UniverseLib.Utility;
namespace UnityExplorer.CSConsole
{

View File

@ -2,6 +2,7 @@
using System.Linq;
using UnityEngine;
using UniverseLib;
using UniverseLib.Utility;
namespace UnityExplorer.CSConsole.Lexers
{

View File

@ -1,4 +1,5 @@
using Mono.CSharp;
using HarmonyLib;
using Mono.CSharp;
using System;
using System.Collections;
using System.Collections.Generic;
@ -29,7 +30,7 @@ namespace UnityExplorer.CSConsole
=> InspectorManager.Inspect(type);
public static void Start(IEnumerator ienumerator)
=> RuntimeProvider.Instance.StartCoroutine(ienumerator);
=> RuntimeHelper.StartCoroutine(ienumerator);
public static void Copy(object obj)
=> ClipboardPanel.Copy(obj);
@ -51,7 +52,7 @@ namespace UnityExplorer.CSConsole
public static void GetClasses()
{
if (ReflectionUtility.GetFieldInfo(typeof(Evaluator), "source_file")
if (AccessTools.Field(typeof(Evaluator), "source_file")
.GetValue(Evaluator) is CompilationSourceFile sourceFile
&& sourceFile.Containers.Any())
{

View File

@ -5,6 +5,7 @@ using System.Text;
using UnityExplorer.CacheObject.IValues;
using UnityExplorer.CacheObject.Views;
using UniverseLib;
using UniverseLib.Utility;
namespace UnityExplorer.CacheObject
{

View File

@ -12,6 +12,8 @@ using UnityExplorer.UI;
using UniverseLib;
using UniverseLib.UI;
using UnityExplorer.UI.Widgets;
using UniverseLib.Utility;
using UniverseLib.UI.ObjectPool;
namespace UnityExplorer.CacheObject
{
@ -111,14 +113,14 @@ namespace UnityExplorer.CacheObject
{
cell.EvaluateButton.ButtonText.text = "Hide";
Evaluator.UIRoot.transform.SetParent(cell.EvaluateHolder.transform, false);
RuntimeProvider.Instance.SetColorBlock(cell.EvaluateButton.Component, evalEnabledColor, evalEnabledColor * 1.3f);
RuntimeHelper.SetColorBlock(cell.EvaluateButton.Component, evalEnabledColor, evalEnabledColor * 1.3f);
}
}
else
cell.EvaluateButton.ButtonText.text = "Evaluate";
if (!Evaluating)
RuntimeProvider.Instance.SetColorBlock(cell.EvaluateButton.Component, evalDisabledColor, evalDisabledColor * 1.3f);
RuntimeHelper.SetColorBlock(cell.EvaluateButton.Component, evalDisabledColor, evalDisabledColor * 1.3f);
}
if (State == ValueState.NotEvaluated && !ShouldAutoEvaluate)
@ -235,7 +237,7 @@ namespace UnityExplorer.CacheObject
{
try
{
if (RuntimeHelper.IsBlacklisted(member))
if (UERuntimeHelper.IsBlacklisted(member))
return;
var sig = GetSig(member);

View File

@ -5,6 +5,7 @@ using System.Reflection;
using System.Text;
using UnityExplorer.Inspectors;
using UniverseLib;
using UniverseLib.Utility;
namespace UnityExplorer.CacheObject
{

View File

@ -13,6 +13,8 @@ using UniverseLib.UI.Models;
using UnityExplorer.UI;
using UniverseLib;
using UniverseLib.UI;
using UniverseLib.Utility;
using UniverseLib.UI.ObjectPool;
namespace UnityExplorer.CacheObject
{

View File

@ -7,6 +7,8 @@ using UnityEngine.UI;
using UnityExplorer.CacheObject;
using UnityExplorer.UI;
using UniverseLib.UI;
using UniverseLib.UI.Models;
using UniverseLib;
namespace UnityExplorer.CacheObject.IValues
{
@ -16,11 +18,11 @@ namespace UnityExplorer.CacheObject.IValues
public Color EditedColor;
private Image m_colorImage;
private readonly InputFieldRef[] m_inputs = new InputFieldRef[4];
private readonly Slider[] m_sliders = new Slider[4];
private Image colorImage;
private readonly InputFieldRef[] inputs = new InputFieldRef[4];
private readonly Slider[] sliders = new Slider[4];
private ButtonRef m_applyButton;
private ButtonRef applyButton;
private static readonly string[] fieldNames = new[] { "R", "G", "B", "A" };
@ -28,11 +30,11 @@ namespace UnityExplorer.CacheObject.IValues
{
base.OnBorrowed(owner);
m_applyButton.Component.gameObject.SetActive(owner.CanWrite);
applyButton.Component.gameObject.SetActive(owner.CanWrite);
foreach (var slider in m_sliders)
foreach (var slider in sliders)
slider.interactable = owner.CanWrite;
foreach (var input in m_inputs)
foreach (var input in inputs)
input.Component.readOnly = !owner.CanWrite;
}
@ -48,27 +50,27 @@ namespace UnityExplorer.CacheObject.IValues
{
IsValueColor32 = true;
EditedColor = c32;
m_inputs[0].Text = c32.r.ToString();
m_inputs[1].Text = c32.g.ToString();
m_inputs[2].Text = c32.b.ToString();
m_inputs[3].Text = c32.a.ToString();
foreach (var slider in m_sliders)
inputs[0].Text = c32.r.ToString();
inputs[1].Text = c32.g.ToString();
inputs[2].Text = c32.b.ToString();
inputs[3].Text = c32.a.ToString();
foreach (var slider in sliders)
slider.maxValue = 255;
}
else
{
IsValueColor32 = false;
EditedColor = (Color)value;
m_inputs[0].Text = EditedColor.r.ToString();
m_inputs[1].Text = EditedColor.g.ToString();
m_inputs[2].Text = EditedColor.b.ToString();
m_inputs[3].Text = EditedColor.a.ToString();
foreach (var slider in m_sliders)
inputs[0].Text = EditedColor.r.ToString();
inputs[1].Text = EditedColor.g.ToString();
inputs[2].Text = EditedColor.b.ToString();
inputs[3].Text = EditedColor.a.ToString();
foreach (var slider in sliders)
slider.maxValue = 1;
}
if (m_colorImage)
m_colorImage.color = EditedColor;
if (colorImage)
colorImage.color = EditedColor;
}
// setting value to owner
@ -91,8 +93,8 @@ namespace UnityExplorer.CacheObject.IValues
case 3: EditedColor.a = val; break;
}
if (m_colorImage)
m_colorImage.color = EditedColor;
if (colorImage)
colorImage.color = EditedColor;
}
private void OnInputChanged(string val, int fieldIndex)
@ -103,13 +105,13 @@ namespace UnityExplorer.CacheObject.IValues
if (IsValueColor32)
{
byte value = byte.Parse(val);
m_sliders[fieldIndex].value = value;
sliders[fieldIndex].value = value;
f = (float)((decimal)value / 255);
}
else
{
f = float.Parse(val);
m_sliders[fieldIndex].value = f;
sliders[fieldIndex].value = f;
}
SetColorField(f, fieldIndex);
@ -129,12 +131,12 @@ namespace UnityExplorer.CacheObject.IValues
{
if (IsValueColor32)
{
m_inputs[fieldIndex].Text = ((byte)val).ToString();
inputs[fieldIndex].Text = ((byte)val).ToString();
val /= 255f;
}
else
{
m_inputs[fieldIndex].Text = val.ToString();
inputs[fieldIndex].Text = val.ToString();
}
SetColorField(val, fieldIndex);
@ -167,15 +169,15 @@ namespace UnityExplorer.CacheObject.IValues
// apply button
m_applyButton = UIFactory.CreateButton(horiGroup, "ApplyButton", "Apply", new Color(0.2f, 0.26f, 0.2f));
UIFactory.SetLayoutElement(m_applyButton.Component.gameObject, minHeight: 25, minWidth: 90);
m_applyButton.OnClick += SetValueToOwner;
applyButton = UIFactory.CreateButton(horiGroup, "ApplyButton", "Apply", new Color(0.2f, 0.26f, 0.2f));
UIFactory.SetLayoutElement(applyButton.Component.gameObject, minHeight: 25, minWidth: 90);
applyButton.OnClick += SetValueToOwner;
// image of color
var imgObj = UIFactory.CreateUIObject("ColorImageHelper", horiGroup);
UIFactory.SetLayoutElement(imgObj, minHeight: 25, minWidth: 50, flexibleWidth: 50);
m_colorImage = imgObj.AddComponent<Image>();
colorImage = imgObj.AddComponent<Image>();
return UIRoot;
}
@ -190,11 +192,11 @@ namespace UnityExplorer.CacheObject.IValues
var input = UIFactory.CreateInputField(row, "Input", "...");
UIFactory.SetLayoutElement(input.UIRoot, minWidth: 40, minHeight: 25, flexibleHeight: 0);
m_inputs[index] = input;
inputs[index] = input;
input.OnValueChanged += (string val) => { OnInputChanged(val, index); };
var sliderObj = UIFactory.CreateSlider(row, "Slider", out Slider slider);
m_sliders[index] = slider;
sliders[index] = slider;
UIFactory.SetLayoutElement(sliderObj, minHeight: 25, minWidth: 70, flexibleWidth: 999, flexibleHeight: 0);
slider.minValue = 0;
slider.maxValue = 1;

View File

@ -14,6 +14,8 @@ using UnityExplorer.UI.Widgets;
using UniverseLib;
using UniverseLib.UI;
using UniverseLib.UI.Widgets;
using UniverseLib.UI.Widgets.ScrollView;
using UniverseLib.Utility;
namespace UnityExplorer.CacheObject.IValues
{

View File

@ -10,6 +10,8 @@ using UnityExplorer.UI;
using UnityExplorer.UI.Widgets.AutoComplete;
using UniverseLib;
using UniverseLib.UI;
using UniverseLib.UI.Models;
using UniverseLib.Utility;
namespace UnityExplorer.CacheObject.IValues
{

View File

@ -14,6 +14,8 @@ using UnityExplorer.UI.Widgets;
using UniverseLib;
using UniverseLib.UI;
using UniverseLib.UI.Widgets;
using UniverseLib.UI.Widgets.ScrollView;
using UniverseLib.Utility;
namespace UnityExplorer.CacheObject.IValues
{

View File

@ -11,6 +11,8 @@ using UnityExplorer.UI.Widgets;
using UnityExplorer.UI;
using UniverseLib.UI;
using UniverseLib;
using UniverseLib.UI.Models;
using UniverseLib.Utility;
namespace UnityExplorer.CacheObject.IValues
{

View File

@ -8,6 +8,7 @@ using UnityExplorer.CacheObject;
using UnityExplorer.UI;
using UniverseLib.UI;
using UniverseLib.UI.Models;
using UniverseLib.UI.ObjectPool;
namespace UnityExplorer.CacheObject.IValues
{

View File

@ -9,6 +9,8 @@ using UnityExplorer.CacheObject;
using UnityExplorer.UI;
using UniverseLib;
using UniverseLib.UI;
using UniverseLib.UI.Models;
using UniverseLib.Utility;
namespace UnityExplorer.CacheObject.IValues
{
@ -55,7 +57,7 @@ namespace UnityExplorer.CacheObject.IValues
}
}
private static readonly Dictionary<string, StructInfo> typeSupportCache = new Dictionary<string, StructInfo>();
private static readonly Dictionary<string, StructInfo> typeSupportCache = new();
private const BindingFlags INSTANCE_FLAGS = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public;
private const string SYSTEM_VOID = "System.Void";

View File

@ -7,6 +7,7 @@ using UnityEngine.UI;
using UnityExplorer.UI;
using UniverseLib;
using UniverseLib.UI;
using UniverseLib.Utility;
namespace UnityExplorer.CacheObject.Views
{

View File

@ -9,6 +9,7 @@ using UnityExplorer.Inspectors;
using UnityExplorer.UI;
using UnityExplorer.UI.Widgets;
using UniverseLib.UI;
using UniverseLib.UI.Models;
namespace UnityExplorer.CacheObject.Views
{

View File

@ -7,6 +7,7 @@ using UnityEngine.UI;
using UnityExplorer.UI;
using UnityExplorer.UI.Widgets;
using UniverseLib.UI;
using UniverseLib.UI.Models;
namespace UnityExplorer.CacheObject.Views
{

View File

@ -4,14 +4,12 @@ using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
using UnityExplorer.CacheObject.IValues;
using UnityExplorer.Inspectors;
using UnityExplorer.UI;
using UnityExplorer.UI.Panels;
using UnityExplorer.UI.Widgets;
using UniverseLib;
using UniverseLib.UI;
using UniverseLib.UI.Widgets;
using UniverseLib.UI.Models;
using UniverseLib.UI.Widgets.ScrollView;
using UniverseLib.Utility;
namespace UnityExplorer.CacheObject.Views
{
@ -103,7 +101,7 @@ namespace UnityExplorer.CacheObject.Views
{
this.SubContentButton.ButtonText.text = SubContentHolder.activeSelf ? "▼" : "▲";
Color color = SubContentHolder.activeSelf ? subActiveColor : subInactiveColor;
RuntimeProvider.Instance.SetColorBlock(SubContentButton.Component, color, color * 1.3f);
RuntimeHelper.SetColorBlock(SubContentButton.Component, color, color * 1.3f);
}
protected abstract void ConstructEvaluateHolder(GameObject parent);

View File

@ -43,7 +43,7 @@ namespace UnityExplorer
Directory.CreateDirectory(Loader.ExplorerFolder);
ConfigManager.Init(Loader.ConfigHandler);
RuntimeHelper.Init();
UERuntimeHelper.Init();
ExplorerBehaviour.Setup();
UniverseLib.Universe.Init(ConfigManager.Startup_Delay_Time.Value, LateInit, Log, new()

View File

@ -7,7 +7,9 @@ using UnityEngine.UI;
using UnityExplorer.UI;
using UnityExplorer.UI.Widgets;
using UniverseLib.UI;
using UniverseLib.UI.Models;
using UniverseLib.UI.Widgets;
using UniverseLib.UI.Widgets.ScrollView;
namespace UnityExplorer.Hooks
{

View File

@ -5,7 +5,9 @@ using System.Text;
using UnityEngine;
using UnityEngine.UI;
using UniverseLib.UI;
using UniverseLib.UI.Models;
using UniverseLib.UI.Widgets;
using UniverseLib.UI.Widgets.ScrollView;
namespace UnityExplorer.Hooks
{

View File

@ -52,9 +52,9 @@ namespace UnityExplorer.Hooks
}
// Evaluator.source_file
private static readonly FieldInfo fi_sourceFile = ReflectionUtility.GetFieldInfo(typeof(Evaluator), "source_file");
private static readonly FieldInfo fi_sourceFile = AccessTools.Field(typeof(Evaluator), "source_file");
// TypeDefinition.Definition
private static readonly PropertyInfo pi_Definition = ReflectionUtility.GetPropertyInfo(typeof(TypeDefinition), "Definition");
private static readonly PropertyInfo pi_Definition = AccessTools.Property(typeof(TypeDefinition), "Definition");
public bool CompileAndGenerateProcessor(string patchSource)
{

View File

@ -13,6 +13,8 @@ using UnityExplorer.UI.Panels;
using UnityExplorer.UI.Widgets;
using UniverseLib;
using UniverseLib.UI.Widgets;
using UniverseLib.UI.Widgets.ScrollView;
using UniverseLib.Utility;
namespace UnityExplorer.Hooks
{
@ -87,7 +89,7 @@ namespace UnityExplorer.Hooks
cell.MethodNameLabel.text = SignatureHighlighter.HighlightMethod(hook.TargetMethod);
cell.ToggleActiveButton.ButtonText.text = hook.Enabled ? "Enabled" : "Disabled";
RuntimeProvider.Instance.SetColorBlockAuto(cell.ToggleActiveButton.Component,
RuntimeHelper.SetColorBlockAuto(cell.ToggleActiveButton.Component,
hook.Enabled ? new Color(0.15f, 0.2f, 0.15f) : new Color(0.2f, 0.2f, 0.15f));
}
@ -109,7 +111,7 @@ namespace UnityExplorer.Hooks
currentAddEligableMethods.Clear();
foreach (var method in type.GetMethods(ReflectionUtility.FLAGS))
{
if (method.IsGenericMethod /* || method.IsAbstract */ || RuntimeHelper.IsBlacklisted(method))
if (method.IsGenericMethod || UERuntimeHelper.IsBlacklisted(method))
continue;
currentAddEligableMethods.Add(method);
filteredEligableMethods.Add(method);

View File

@ -14,6 +14,8 @@ using UnityExplorer.UI.Widgets.AutoComplete;
using UniverseLib.UI.Widgets;
using UniverseLib.UI;
using UniverseLib;
using UniverseLib.UI.Widgets.ScrollView;
using UniverseLib.Utility;
namespace UnityExplorer.Inspectors
{
@ -44,7 +46,7 @@ namespace UnityExplorer.Inspectors
GOControls.UpdateGameObjectInfo(true, true);
GOControls.UpdateTransformControlValues(true);
RuntimeProvider.Instance.StartCoroutine(InitCoroutine());
RuntimeHelper.StartCoroutine(InitCoroutine());
}
private IEnumerator InitCoroutine()
@ -227,7 +229,7 @@ namespace UnityExplorer.Inspectors
{
try
{
RuntimeProvider.Instance.AddComponent<Component>(GOTarget, type);
RuntimeHelper.AddComponent<Component>(GOTarget, type);
UpdateComponents();
}
catch (Exception ex)

View File

@ -4,10 +4,10 @@ using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
using UnityExplorer.UI;
using UnityExplorer.UI.Widgets;
using UniverseLib;
using UniverseLib.UI;
using UniverseLib.UI.Widgets;
using UniverseLib.UI.Models;
using UniverseLib.UI.Widgets.ButtonList;
namespace UnityExplorer.Inspectors
{

View File

@ -3,9 +3,10 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityExplorer.UI.Widgets;
using UniverseLib;
using UniverseLib.UI.Widgets;
using UniverseLib.UI.Widgets.ButtonList;
using UniverseLib.UI.Widgets.ScrollView;
using UniverseLib.Utility;
namespace UnityExplorer.Inspectors
{
@ -113,7 +114,7 @@ namespace UnityExplorer.Inspectors
{
cell.BehaviourToggle.interactable = false;
cell.BehaviourToggle.Set(true, false);
//RuntimeProvider.Instance.SetColorBlock(cell.BehaviourToggle,)
//RuntimeHelper.SetColorBlock(cell.BehaviourToggle,)
cell.BehaviourToggle.graphic.color = new Color(0.2f, 0.2f, 0.2f);
}

View File

@ -9,6 +9,8 @@ using UnityExplorer.UI;
using UniverseLib.UI;
using UniverseLib;
using UnityExplorer.UI.Panels;
using UniverseLib.UI.Models;
using UniverseLib.Utility;
namespace UnityExplorer.Inspectors
{
@ -175,7 +177,7 @@ namespace UnityExplorer.Inspectors
{
// look for inactive objects
var name = input.Split('/').Last();
var allObjects = RuntimeProvider.Instance.FindObjectsOfTypeAll(typeof(GameObject));
var allObjects = RuntimeHelper.FindObjectsOfTypeAll(typeof(GameObject));
var shortList = new List<GameObject>();
foreach (var obj in allObjects)
if (obj.name == name) shortList.Add(obj.TryCast<GameObject>());
@ -572,7 +574,7 @@ namespace UnityExplorer.Inspectors
var layerLabel = UIFactory.CreateLabel(thirdrow, "LayerLabel", "Layer:", TextAnchor.MiddleLeft, Color.grey);
UIFactory.SetLayoutElement(layerLabel.gameObject, minHeight: 25, minWidth: 50);
var layerDrop = UIFactory.CreateDropdown(thirdrow, out LayerDropdown, "0", 14, OnLayerDropdownChanged);
var layerDrop = UIFactory.CreateDropdown(thirdrow, "LayerDropdown", out LayerDropdown, "0", 14, OnLayerDropdownChanged);
UIFactory.SetLayoutElement(layerDrop, minHeight: 25, minWidth: 110, flexibleWidth: 999);
LayerDropdown.captionText.color = SignatureHighlighter.EnumGreen;
if (layerToNames == null)
@ -586,7 +588,7 @@ namespace UnityExplorer.Inspectors
var flagsLabel = UIFactory.CreateLabel(thirdrow, "FlagsLabel", "Flags:", TextAnchor.MiddleRight, Color.grey);
UIFactory.SetLayoutElement(flagsLabel.gameObject, minHeight: 25, minWidth: 50);
var flagsDrop = UIFactory.CreateDropdown(thirdrow, out FlagsDropdown, "None", 14, OnFlagsDropdownChanged);
var flagsDrop = UIFactory.CreateDropdown(thirdrow, "FlagsDropdown", out FlagsDropdown, "None", 14, OnFlagsDropdownChanged);
FlagsDropdown.captionText.color = SignatureHighlighter.EnumGreen;
UIFactory.SetLayoutElement(flagsDrop, minHeight: 25, minWidth: 135, flexibleWidth: 999);
if (hideFlagsValues == null)
@ -604,7 +606,7 @@ namespace UnityExplorer.Inspectors
layerToNames = new List<string>();
for (int i = 0; i < 32; i++)
{
var name = RuntimeProvider.Instance.LayerToName(i);
var name = RuntimeHelper.LayerToName(i);
if (string.IsNullOrEmpty(name))
name = i.ToString();
layerToNames.Add(name);

View File

@ -12,6 +12,7 @@ using UnityExplorer.UI;
using UnityExplorer.UI.Panels;
using UniverseLib;
using UniverseLib.UI;
using UniverseLib.Utility;
namespace UnityExplorer.Inspectors
{
@ -179,7 +180,7 @@ namespace UnityExplorer.Inspectors
this.titleBar.SetActive(false);
this.UIRoot.transform.SetParent(UIManager.UIRoot.transform, false);
var inspectContent = UIFactory.CreateVerticalGroup(this.content, "InspectContent", true, true, true, true, 3, new Vector4(2, 2, 2, 2));
var inspectContent = UIFactory.CreateVerticalGroup(this.uiRoot, "InspectContent", true, true, true, true, 3, new Vector4(2, 2, 2, 2));
UIFactory.SetLayoutElement(inspectContent, flexibleWidth: 9999, flexibleHeight: 9999);
// Title text

View File

@ -8,6 +8,7 @@ using UnityExplorer.UI;
using UniverseLib.UI.Models;
using UnityExplorer.UI.Panels;
using UniverseLib.UI;
using UniverseLib.UI.ObjectPool;
namespace UnityExplorer.Inspectors
{

View File

@ -11,6 +11,8 @@ using UniverseLib.UI.Models;
using UnityExplorer.UI.Panels;
using UniverseLib;
using UniverseLib.UI;
using UniverseLib.UI.ObjectPool;
using UniverseLib.Utility;
namespace UnityExplorer
{

View File

@ -10,6 +10,7 @@ using UnityExplorer.UI.Widgets;
using UniverseLib.UI;
using UniverseLib;
using UnityExplorer.UI.Panels;
using UniverseLib.UI.ObjectPool;
namespace UnityExplorer.Inspectors
{
@ -28,7 +29,7 @@ namespace UnityExplorer.Inspectors
public void SetTabColor(bool active)
{
Color color = active ? enabledTabColor : disabledTabColor;
RuntimeProvider.Instance.SetColorBlock(TabButton.Component, color, color * 1.2f);
RuntimeHelper.SetColorBlock(TabButton.Component, color, color * 1.2f);
}
public GameObject CreateContent(GameObject parent)

View File

@ -58,7 +58,7 @@ namespace UnityExplorer.Inspectors.MouseInspectors
continue;
var list = new List<RaycastResult>();
RuntimeProvider.Instance.GraphicRaycast(gr, ped, list);
RuntimeHelper.GraphicRaycast(gr, ped, list);
if (list.Count > 0)
{
foreach (var hit in list)
@ -77,7 +77,7 @@ namespace UnityExplorer.Inspectors.MouseInspectors
private static void SetupUIRaycast()
{
foreach (var obj in RuntimeProvider.Instance.FindObjectsOfTypeAll(typeof(Canvas)))
foreach (var obj in RuntimeHelper.FindObjectsOfTypeAll(typeof(Canvas)))
{
var canvas = obj.TryCast<Canvas>();
if (!canvas || !canvas.enabled || !canvas.gameObject.activeInHierarchy)
@ -91,7 +91,7 @@ namespace UnityExplorer.Inspectors.MouseInspectors
}
// recache Graphic Raycasters each time we start
var casters = RuntimeProvider.Instance.FindObjectsOfTypeAll(typeof(GraphicRaycaster));
var casters = RuntimeHelper.FindObjectsOfTypeAll(typeof(GraphicRaycaster));
graphicRaycasters = new GraphicRaycaster[casters.Length];
for (int i = 0; i < casters.Length; i++)
{
@ -99,7 +99,7 @@ namespace UnityExplorer.Inspectors.MouseInspectors
}
// enable raycastTarget on Graphics
foreach (var obj in RuntimeProvider.Instance.FindObjectsOfTypeAll(typeof(Graphic)))
foreach (var obj in RuntimeHelper.FindObjectsOfTypeAll(typeof(Graphic)))
{
var graphic = obj.TryCast<Graphic>();
if (!graphic || !graphic.enabled || graphic.raycastTarget || !graphic.gameObject.activeInHierarchy)
@ -110,7 +110,7 @@ namespace UnityExplorer.Inspectors.MouseInspectors
}
// enable blocksRaycasts on CanvasGroups
foreach (var obj in RuntimeProvider.Instance.FindObjectsOfTypeAll(typeof(CanvasGroup)))
foreach (var obj in RuntimeHelper.FindObjectsOfTypeAll(typeof(CanvasGroup)))
{
var canvas = obj.TryCast<CanvasGroup>();
if (!canvas || !canvas.gameObject.activeInHierarchy || canvas.blocksRaycasts)

View File

@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using UnityEngine;
using UniverseLib;
using UniverseLib.Utility;
namespace UnityExplorer.Inspectors.MouseInspectors
{

View File

@ -19,6 +19,9 @@ using UniverseLib.UI.Widgets;
using UniverseLib.UI;
using UniverseLib;
using UniverseLib.Runtime;
using UniverseLib.UI.Models;
using UniverseLib.UI.Widgets.ScrollView;
using UniverseLib.Utility;
namespace UnityExplorer.Inspectors
{
@ -29,8 +32,8 @@ namespace UnityExplorer.Inspectors
public bool StaticOnly { get; internal set; }
public bool CanWrite => true;
private List<CacheMember> members = new List<CacheMember>();
private readonly List<CacheMember> filteredMembers = new List<CacheMember>();
private List<CacheMember> members = new();
private readonly List<CacheMember> filteredMembers = new();
public bool AutoUpdateWanted => autoUpdateToggle.isOn;
@ -58,11 +61,11 @@ namespace UnityExplorer.Inspectors
private string currentBaseTabText;
private readonly Color disabledButtonColor = new Color(0.24f, 0.24f, 0.24f);
private readonly Color enabledButtonColor = new Color(0.2f, 0.27f, 0.2f);
private readonly Color disabledButtonColor = new(0.24f, 0.24f, 0.24f);
private readonly Color enabledButtonColor = new(0.2f, 0.27f, 0.2f);
private readonly Dictionary<BindingFlags, ButtonRef> scopeFilterButtons = new Dictionary<BindingFlags, ButtonRef>();
private readonly List<Toggle> memberTypeToggles = new List<Toggle>();
private readonly Dictionary<BindingFlags, ButtonRef> scopeFilterButtons = new();
private readonly List<Toggle> memberTypeToggles = new();
private InputFieldRef filterInputField;
// Setup / return
@ -74,7 +77,7 @@ namespace UnityExplorer.Inspectors
SetTarget(target);
RuntimeProvider.Instance.StartCoroutine(InitCoroutine());
RuntimeHelper.StartCoroutine(InitCoroutine());
}
private IEnumerator InitCoroutine()
@ -225,11 +228,11 @@ namespace UnityExplorer.Inspectors
if (flagsFilter != FlagsFilter)
{
var btn = scopeFilterButtons[FlagsFilter].Component;
RuntimeProvider.Instance.SetColorBlock(btn, disabledButtonColor, disabledButtonColor * 1.3f);
RuntimeHelper.SetColorBlock(btn, disabledButtonColor, disabledButtonColor * 1.3f);
this.FlagsFilter = flagsFilter;
btn = scopeFilterButtons[FlagsFilter].Component;
RuntimeProvider.Instance.SetColorBlock(btn, enabledButtonColor, enabledButtonColor * 1.3f);
RuntimeHelper.SetColorBlock(btn, enabledButtonColor, enabledButtonColor * 1.3f);
}
}
@ -477,7 +480,13 @@ namespace UnityExplorer.Inspectors
{
var toggleObj = UIFactory.CreateToggle(parent, "Toggle_" + type, out Toggle toggle, out Text toggleText);
UIFactory.SetLayoutElement(toggleObj, minHeight: 25, minWidth: width);
var color = SignatureHighlighter.GetMemberInfoColor(type);
var color = type switch
{
MemberTypes.Method => SignatureHighlighter.METHOD_INSTANCE,
MemberTypes.Field => SignatureHighlighter.FIELD_INSTANCE,
MemberTypes.Property => SignatureHighlighter.PROP_INSTANCE,
_ => throw new NotImplementedException()
};
toggleText.text = $"<color={color}>{type}</color>";
toggle.graphic.TryCast<Image>().color = color.ToColor() * 0.65f;
@ -677,7 +686,7 @@ namespace UnityExplorer.Inspectors
textureSavePathInput.Text = Path.Combine(ConfigManager.Default_Output_Path.Value, $"{name}.png");
var sprite = TextureUtilProvider.Instance.CreateSprite(TextureRef);
var sprite = TextureHelper.CreateSprite(TextureRef);
textureImage.sprite = sprite;
textureImageLayout.preferredHeight = sprite.rect.height;
@ -713,10 +722,10 @@ namespace UnityExplorer.Inspectors
var tex = TextureRef;
if (!TextureUtilProvider.IsReadable(tex))
tex = TextureUtilProvider.ForceReadTexture(tex);
if (!TextureHelper.IsReadable(tex))
tex = TextureHelper.ForceReadTexture(tex);
byte[] data = TextureUtilProvider.Instance.EncodeToPNG(tex);
byte[] data = TextureHelper.EncodeToPNG(tex);
File.WriteAllBytes(path, data);
if (tex != TextureRef)

View File

@ -4,14 +4,14 @@ using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
using UnityExplorer.UI;
using UniverseLib.UI.Models;
using UnityExplorer.UI.Panels;
using UnityExplorer.UI.Widgets;
using UnityExplorer.UI.Widgets.AutoComplete;
using UniverseLib.UI.Widgets;
using UniverseLib.UI;
using UniverseLib;
using UniverseLib.UI.Widgets.ButtonList;
using UniverseLib.UI.Widgets.ScrollView;
using UniverseLib.Utility;
namespace UnityExplorer.ObjectExplorer
{
@ -29,23 +29,20 @@ namespace UnityExplorer.ObjectExplorer
private ChildFilter childFilter = ChildFilter.Any;
private string desiredTypeInput;
private string lastCheckedTypeInput;
private bool lastTypeCanHaveGO;
private bool lastTypeCanHaveGameObject;
public ButtonListHandler<object, ButtonCell> dataHandler;
private ScrollPool<ButtonCell> resultsScrollPool;
private List<object> currentResults = new();
public TypeCompleter typeAutocompleter;
public override GameObject UIRoot => uiRoot;
private GameObject uiRoot;
private GameObject sceneFilterRow;
private GameObject childFilterRow;
private GameObject unityObjectClassRow;
private GameObject classInputRow;
public TypeCompleter typeAutocompleter;
private GameObject nameInputRow;
private InputFieldRef nameInputField;
private Text resultsLabel;
public List<object> GetEntries() => currentResults;
@ -55,9 +52,9 @@ namespace UnityExplorer.ObjectExplorer
cachedCellTexts.Clear();
if (context == SearchContext.Singleton)
currentResults = SearchProvider.SingletonSearch(nameInputField.Text);
currentResults = SearchProvider.InstanceSearch(desiredTypeInput).ToList();
else if (context == SearchContext.Class)
currentResults = SearchProvider.ClassSearch(nameInputField.Text);
currentResults = SearchProvider.ClassSearch(desiredTypeInput);
else
currentResults = SearchProvider.UnityObjectSearch(nameInputField.Text, desiredTypeInput, childFilter, sceneFilter);
@ -77,15 +74,15 @@ namespace UnityExplorer.ObjectExplorer
if (ReflectionUtility.GetTypeByName(desiredTypeInput) is Type cachedType)
{
var type = cachedType;
lastTypeCanHaveGO = typeof(Component).IsAssignableFrom(type) || type == typeof(GameObject);
sceneFilterRow.SetActive(lastTypeCanHaveGO);
childFilterRow.SetActive(lastTypeCanHaveGO);
lastTypeCanHaveGameObject = typeof(Component).IsAssignableFrom(type) || type == typeof(GameObject);
sceneFilterRow.SetActive(lastTypeCanHaveGameObject);
childFilterRow.SetActive(lastTypeCanHaveGameObject);
}
else
{
sceneFilterRow.SetActive(false);
childFilterRow.SetActive(false);
lastTypeCanHaveGO = false;
lastTypeCanHaveGameObject = false;
}
}
}
@ -100,7 +97,10 @@ namespace UnityExplorer.ObjectExplorer
sceneFilterRow.SetActive(false);
childFilterRow.SetActive(false);
unityObjectClassRow.SetActive(context == SearchContext.UnityObject);
nameInputRow.SetActive(context == SearchContext.UnityObject);
typeAutocompleter.BaseType = context == SearchContext.UnityObject ? typeof(UnityEngine.Object) : typeof(object);
typeAutocompleter.CacheTypes();
}
private void OnSceneFilterDropChanged(int value) => sceneFilter = (SceneFilter)value;
@ -120,7 +120,7 @@ namespace UnityExplorer.ObjectExplorer
}
// Cache the syntax-highlighted text for each search result to reduce allocs.
private static readonly Dictionary<int, string> cachedCellTexts = new Dictionary<int, string>();
private static readonly Dictionary<int, string> cachedCellTexts = new();
public void SetCell(ButtonCell cell, int index)
{
@ -164,20 +164,20 @@ namespace UnityExplorer.ObjectExplorer
var contextLbl = UIFactory.CreateLabel(contextGroup, "SearchContextLabel", "Searching for:", TextAnchor.MiddleLeft);
UIFactory.SetLayoutElement(contextLbl.gameObject, minWidth: 110, flexibleWidth: 0);
var contextDropObj = UIFactory.CreateDropdown(contextGroup, out Dropdown contextDrop, null, 14, OnContextDropdownChanged);
var contextDropObj = UIFactory.CreateDropdown(contextGroup, "ContextDropdown", out Dropdown contextDrop, null, 14, OnContextDropdownChanged);
foreach (var name in Enum.GetNames(typeof(SearchContext)))
contextDrop.options.Add(new Dropdown.OptionData(name));
UIFactory.SetLayoutElement(contextDropObj, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
// Unity class input
// Class input
unityObjectClassRow = UIFactory.CreateHorizontalGroup(uiRoot, "UnityClassRow", false, true, true, true, 2, new Vector4(2, 2, 2, 2));
UIFactory.SetLayoutElement(unityObjectClassRow, minHeight: 25, flexibleHeight: 0);
classInputRow = UIFactory.CreateHorizontalGroup(uiRoot, "ClassRow", false, true, true, true, 2, new Vector4(2, 2, 2, 2));
UIFactory.SetLayoutElement(classInputRow, minHeight: 25, flexibleHeight: 0);
var unityClassLbl = UIFactory.CreateLabel(unityObjectClassRow, "UnityClassLabel", "Class filter:", TextAnchor.MiddleLeft);
var unityClassLbl = UIFactory.CreateLabel(classInputRow, "ClassLabel", "Class filter:", TextAnchor.MiddleLeft);
UIFactory.SetLayoutElement(unityClassLbl.gameObject, minWidth: 110, flexibleWidth: 0);
var classInputField = UIFactory.CreateInputField(unityObjectClassRow, "ClassInput", "...");
var classInputField = UIFactory.CreateInputField(classInputRow, "ClassInput", "...");
UIFactory.SetLayoutElement(classInputField.UIRoot, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
typeAutocompleter = new TypeCompleter(typeof(UnityEngine.Object), classInputField);
@ -193,7 +193,7 @@ namespace UnityExplorer.ObjectExplorer
var childLbl = UIFactory.CreateLabel(childFilterRow, "ChildLabel", "Child filter:", TextAnchor.MiddleLeft);
UIFactory.SetLayoutElement(childLbl.gameObject, minWidth: 110, flexibleWidth: 0);
var childDropObj = UIFactory.CreateDropdown(childFilterRow, out Dropdown childDrop, null, 14, OnChildFilterDropChanged);
var childDropObj = UIFactory.CreateDropdown(childFilterRow, "ChildFilterDropdown", out Dropdown childDrop, null, 14, OnChildFilterDropChanged);
foreach (var name in Enum.GetNames(typeof(ChildFilter)))
childDrop.options.Add(new Dropdown.OptionData(name));
UIFactory.SetLayoutElement(childDropObj, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
@ -208,7 +208,7 @@ namespace UnityExplorer.ObjectExplorer
var sceneLbl = UIFactory.CreateLabel(sceneFilterRow, "SceneLabel", "Scene filter:", TextAnchor.MiddleLeft);
UIFactory.SetLayoutElement(sceneLbl.gameObject, minWidth: 110, flexibleWidth: 0);
var sceneDropObj = UIFactory.CreateDropdown(sceneFilterRow, out Dropdown sceneDrop, null, 14, OnSceneFilterDropChanged);
var sceneDropObj = UIFactory.CreateDropdown(sceneFilterRow, "SceneFilterDropdown", out Dropdown sceneDrop, null, 14, OnSceneFilterDropChanged);
foreach (var name in Enum.GetNames(typeof(SceneFilter)))
{
if (!SceneHandler.DontDestroyExists && name == "DontDestroyOnLoad")
@ -221,13 +221,13 @@ namespace UnityExplorer.ObjectExplorer
// Name filter input
var nameRow = UIFactory.CreateHorizontalGroup(uiRoot, "NameRow", true, true, true, true, 2, new Vector4(2, 2, 2, 2));
UIFactory.SetLayoutElement(nameRow, minHeight: 25, flexibleHeight: 0);
nameInputRow = UIFactory.CreateHorizontalGroup(uiRoot, "NameRow", true, true, true, true, 2, new Vector4(2, 2, 2, 2));
UIFactory.SetLayoutElement(nameInputRow, minHeight: 25, flexibleHeight: 0);
var nameLbl = UIFactory.CreateLabel(nameRow, "NameFilterLabel", "Name contains:", TextAnchor.MiddleLeft);
var nameLbl = UIFactory.CreateLabel(nameInputRow, "NameFilterLabel", "Name contains:", TextAnchor.MiddleLeft);
UIFactory.SetLayoutElement(nameLbl.gameObject, minWidth: 110, flexibleWidth: 0);
nameInputField = UIFactory.CreateInputField(nameRow, "NameFilterInput", "...");
nameInputField = UIFactory.CreateInputField(nameInputRow, "NameFilterInput", "...");
UIFactory.SetLayoutElement(nameInputField.UIRoot, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
// Search button

View File

@ -14,6 +14,7 @@ using UnityExplorer.UI.Widgets;
using UniverseLib.UI;
using UniverseLib;
using System.Collections;
using UniverseLib.Utility;
namespace UnityExplorer.ObjectExplorer
{
@ -42,7 +43,7 @@ namespace UnityExplorer.ObjectExplorer
private GameObject refreshRow;
private Dropdown sceneDropdown;
private readonly Dictionary<Scene, Dropdown.OptionData> sceneToDropdownOption = new Dictionary<Scene, Dropdown.OptionData>();
private readonly Dictionary<Scene, Dropdown.OptionData> sceneToDropdownOption = new();
// scene loader
private Dropdown allSceneDropdown;
@ -197,7 +198,7 @@ namespace UnityExplorer.ObjectExplorer
var dropLabel = UIFactory.CreateLabel(dropRow, "SelectorLabel", "Scene:", TextAnchor.MiddleLeft, Color.cyan, false, 15);
UIFactory.SetLayoutElement(dropLabel.gameObject, minHeight: 25, minWidth: 60, flexibleWidth: 0);
var dropdownObj = UIFactory.CreateDropdown(dropRow, out sceneDropdown, "<notset>", 13, OnDropdownChanged);
var dropdownObj = UIFactory.CreateDropdown(dropRow, "SceneDropdown", out sceneDropdown, "<notset>", 13, OnDropdownChanged);
UIFactory.SetLayoutElement(dropdownObj, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
SceneHandler.Update();
@ -212,7 +213,7 @@ namespace UnityExplorer.ObjectExplorer
//Filter input field
var inputField = UIFactory.CreateInputField(filterRow, "FilterInput", "Search and press enter...");
inputField.Component.targetGraphic.color = new Color(0.2f, 0.2f, 0.2f);
RuntimeProvider.Instance.SetColorBlock(inputField.Component, new Color(0.4f, 0.4f, 0.4f), new Color(0.2f, 0.2f, 0.2f),
RuntimeHelper.SetColorBlock(inputField.Component, new Color(0.4f, 0.4f, 0.4f), new Color(0.2f, 0.2f, 0.2f),
new Color(0.08f, 0.08f, 0.08f));
UIFactory.SetLayoutElement(inputField.UIRoot, minHeight: 25);
//inputField.OnValueChanged += OnFilterInput;
@ -255,7 +256,7 @@ namespace UnityExplorer.ObjectExplorer
ConstructSceneLoader();
RuntimeProvider.Instance.StartCoroutine(TempFixCoro());
RuntimeHelper.StartCoroutine(TempFixCoro());
}
// To "fix" a strange FPS drop issue with MelonLoader.
@ -328,7 +329,7 @@ namespace UnityExplorer.ObjectExplorer
// Dropdown
var allSceneDropObj = UIFactory.CreateDropdown(sceneLoaderObj, out allSceneDropdown, "", 14, null);
var allSceneDropObj = UIFactory.CreateDropdown(sceneLoaderObj, "SceneLoaderDropdown", out allSceneDropdown, "", 14, null);
UIFactory.SetLayoutElement(allSceneDropObj, minHeight: 25, minWidth: 150, flexibleWidth: 0, flexibleHeight: 0);
RefreshSceneLoaderOptions(string.Empty);
@ -352,8 +353,8 @@ namespace UnityExplorer.ObjectExplorer
};
var disabledColor = new Color(0.24f, 0.24f, 0.24f);
RuntimeProvider.Instance.SetColorBlock(loadButton.Component, disabled: disabledColor);
RuntimeProvider.Instance.SetColorBlock(loadAdditiveButton.Component, disabled: disabledColor);
RuntimeHelper.SetColorBlock(loadButton.Component, disabled: disabledColor);
RuntimeHelper.SetColorBlock(loadAdditiveButton.Component, disabled: disabledColor);
loadButton.Component.interactable = false;
loadAdditiveButton.Component.interactable = false;

View File

@ -126,10 +126,10 @@ namespace UnityExplorer.ObjectExplorer
// Finally, update the root objects list.
if (SelectedScene != null && ((Scene)SelectedScene).IsValid())
CurrentRootObjects = RuntimeProvider.Instance.GetRootGameObjects((Scene)SelectedScene);
CurrentRootObjects = RuntimeHelper.GetRootGameObjects((Scene)SelectedScene);
else
{
var allObjects = RuntimeProvider.Instance.FindObjectsOfTypeAll(typeof(GameObject));
var allObjects = RuntimeHelper.FindObjectsOfTypeAll(typeof(GameObject));
var objects = new List<GameObject>();
foreach (var obj in allObjects)
{

View File

@ -7,6 +7,8 @@ using UnityEngine;
using UnityEngine.SceneManagement;
using UnityExplorer.Runtime;
using UniverseLib;
using UniverseLib.Input;
using UniverseLib.Utility;
namespace UnityExplorer.ObjectExplorer
{
@ -34,22 +36,16 @@ namespace UnityExplorer.ObjectExplorer
public static class SearchProvider
{
private static bool Filter(Scene scene, SceneFilter filter)
{
switch (filter)
return filter switch
{
case SceneFilter.Any:
return true;
case SceneFilter.DontDestroyOnLoad:
return scene.handle == -12;
case SceneFilter.HideAndDontSave:
return scene == default;
case SceneFilter.ActivelyLoaded:
return scene.buildIndex != -1;
default:
return false;
}
SceneFilter.Any => true,
SceneFilter.DontDestroyOnLoad => scene.handle == -12,
SceneFilter.HideAndDontSave => scene == default,
SceneFilter.ActivelyLoaded => scene.buildIndex != -1,
_ => false,
};
}
internal static List<object> UnityObjectSearch(string input, string customTypeInput, ChildFilter childFilter, SceneFilter sceneFilter)
@ -73,7 +69,7 @@ namespace UnityExplorer.ObjectExplorer
if (searchType == null)
searchType = typeof(UnityEngine.Object);
var allObjects = RuntimeProvider.Instance.FindObjectsOfTypeAll(searchType);
var allObjects = RuntimeHelper.FindObjectsOfTypeAll(searchType);
// perform filter comparers
@ -167,7 +163,7 @@ namespace UnityExplorer.ObjectExplorer
"<instance>k__BackingField",
};
internal static List<object> SingletonSearch(string input)
internal static List<object> InstanceSearch(string input)
{
var instances = new List<object>();
@ -176,7 +172,7 @@ namespace UnityExplorer.ObjectExplorer
nameFilter = input;
var flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static;
foreach (var asm in AppDomain.CurrentDomain.GetAssemblies())
{
// Search all non-static, non-enum classes.
@ -186,13 +182,13 @@ namespace UnityExplorer.ObjectExplorer
{
if (!string.IsNullOrEmpty(nameFilter) && !type.FullName.ContainsIgnoreCase(nameFilter))
continue;
ReflectionUtility.FindSingleton(instanceNames, type, flags, instances);
}
catch { }
}
}
return instances;
}

View File

@ -2,21 +2,11 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using BF = System.Reflection.BindingFlags;
using System.Text;
using UnhollowerBaseLib;
using UnhollowerRuntimeLib;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.EventSystems;
namespace UnityExplorer.Runtime
{
public class Il2CppProvider : RuntimeHelper
public class Il2CppHelper : UERuntimeHelper
{
public override void SetupEvents()
{
@ -41,7 +31,7 @@ namespace UnityExplorer.Runtime
// These methods currently cause a crash in most il2cpp games,
// even from doing "GetParameters()" on the MemberInfo.
// Blacklisting until the issue is fixed in Unhollower.
public static HashSet<string> defaultIl2CppBlacklist = new HashSet<string>
public static HashSet<string> defaultIl2CppBlacklist = new()
{
// These were deprecated a long time ago, still show up in some IL2CPP games for some reason
"UnityEngine.MonoBehaviour.allowPrefabModeInPlayMode",

View File

@ -1,20 +1,10 @@
#if MONO
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using UnityExplorer;
namespace UnityExplorer.Runtime
{
public class MonoProvider : RuntimeHelper
public class MonoHelper : UERuntimeHelper
{
public override void SetupEvents()
{

View File

@ -13,16 +13,18 @@ using UniverseLib;
namespace UnityExplorer.Runtime
{
public abstract class RuntimeHelper
// Not really that necessary anymore, can eventually just be refactored away into the few classes that use this class.
public abstract class UERuntimeHelper
{
public static RuntimeHelper Instance;
public static UERuntimeHelper Instance;
public static void Init()
{
#if CPP
Instance = new Il2CppProvider();
Instance = new Il2CppHelper();
#else
Instance = new MonoProvider();
Instance = new MonoHelper();
#endif
Instance.SetupEvents();
@ -35,9 +37,7 @@ namespace UnityExplorer.Runtime
public abstract void SetupEvents();
#region Reflection Blacklist
private static readonly HashSet<string> currentBlacklist = new HashSet<string>();
private static readonly HashSet<string> currentBlacklist = new();
public virtual string[] DefaultReflectionBlacklist => new string[0];
@ -88,7 +88,5 @@ namespace UnityExplorer.Runtime
return currentBlacklist.Contains(sig);
}
#endregion
}
}

View File

@ -61,7 +61,7 @@ namespace UnityExplorer.UI
canvasCamera.targetDisplay = display;
}
RuntimeProvider.Instance.StartCoroutine(FixPanels());
RuntimeHelper.StartCoroutine(FixPanels());
}
private static IEnumerator FixPanels()

View File

@ -11,6 +11,7 @@ using UnityExplorer.CSConsole;
using UnityExplorer.UI.Widgets;
using UniverseLib;
using UniverseLib.UI;
using UniverseLib.UI.Models;
using UniverseLib.UI.Widgets;
namespace UnityExplorer.UI.Panels
@ -74,7 +75,7 @@ namespace UnityExplorer.UI.Panels
{
// Tools Row
var toolsRow = UIFactory.CreateHorizontalGroup(this.content, "ToggleRow", false, false, true, true, 5, new Vector4(8, 8, 10, 5),
var toolsRow = UIFactory.CreateHorizontalGroup(this.uiRoot, "ToggleRow", false, false, true, true, 5, new Vector4(8, 8, 10, 5),
default, TextAnchor.MiddleLeft);
UIFactory.SetLayoutElement(toolsRow, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
@ -92,7 +93,7 @@ namespace UnityExplorer.UI.Panels
// Help dropdown
var helpDrop = UIFactory.CreateDropdown(toolsRow, out var dropdown, "Help", 14, null);
var helpDrop = UIFactory.CreateDropdown(toolsRow, "HelpDropdown", out var dropdown, "Help", 14, null);
UIFactory.SetLayoutElement(helpDrop, minHeight: 25, minWidth: 100);
HelpDropdown = dropdown;
HelpDropdown.onValueChanged.AddListener((int val) => { this.OnHelpDropdownChanged?.Invoke(val); });
@ -123,7 +124,7 @@ namespace UnityExplorer.UI.Panels
// Console Input
var inputArea = UIFactory.CreateUIObject("InputGroup", content);
var inputArea = UIFactory.CreateUIObject("InputGroup", uiRoot);
UIFactory.SetLayoutElement(inputArea, flexibleWidth: 9999, flexibleHeight: 9999);
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(inputArea, false, true, true, true);
inputArea.AddComponent<Image>().color = Color.white;
@ -190,7 +191,7 @@ namespace UnityExplorer.UI.Panels
Input.PlaceholderText.font = UniversalUI.ConsoleFont;
HighlightText.font = UniversalUI.ConsoleFont;
RuntimeProvider.Instance.StartCoroutine(DelayedLayoutSetup());
RuntimeHelper.StartCoroutine(DelayedLayoutSetup());
}
private IEnumerator DelayedLayoutSetup()
@ -201,8 +202,8 @@ namespace UnityExplorer.UI.Panels
public void SetInputLayout()
{
Input.Rect.offsetMin = new Vector2(52, Input.Rect.offsetMin.y);
Input.Rect.offsetMax = new Vector2(2, Input.Rect.offsetMax.y);
Input.Transform.offsetMin = new Vector2(52, Input.Transform.offsetMin.y);
Input.Transform.offsetMax = new Vector2(2, Input.Transform.offsetMax.y);
}
}
}

View File

@ -12,6 +12,7 @@ using UniverseLib;
using UniverseLib.Input;
using UniverseLib.UI;
using UniverseLib.UI.Widgets;
using UniverseLib.Utility;
namespace UnityExplorer.UI.Panels
{

View File

@ -9,7 +9,9 @@ using UnityExplorer.Hooks;
using UnityExplorer.UI.Widgets;
using UnityExplorer.UI.Widgets.AutoComplete;
using UniverseLib.UI;
using UniverseLib.UI.Models;
using UniverseLib.UI.Widgets;
using UniverseLib.UI.Widgets.ScrollView;
namespace UnityExplorer.UI.Panels
{
@ -81,7 +83,7 @@ namespace UnityExplorer.UI.Panels
{
// ~~~~~~~~~ Active hooks scroll pool
currentHooksPanel = UIFactory.CreateUIObject("CurrentHooksPanel", this.content);
currentHooksPanel = UIFactory.CreateUIObject("CurrentHooksPanel", this.uiRoot);
UIFactory.SetLayoutElement(currentHooksPanel, flexibleHeight: 9999, flexibleWidth: 9999);
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(currentHooksPanel, true, true, true, true);
@ -107,7 +109,7 @@ namespace UnityExplorer.UI.Panels
// ~~~~~~~~~ Add hooks panel
addHooksPanel = UIFactory.CreateUIObject("AddHooksPanel", this.content);
addHooksPanel = UIFactory.CreateUIObject("AddHooksPanel", this.uiRoot);
UIFactory.SetLayoutElement(addHooksPanel, flexibleHeight: 9999, flexibleWidth: 9999);
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(addHooksPanel, true, true, true, true);
@ -134,7 +136,7 @@ namespace UnityExplorer.UI.Panels
// ~~~~~~~~~ Hook source editor panel
editorPanel = UIFactory.CreateUIObject("HookSourceEditor", this.content);
editorPanel = UIFactory.CreateUIObject("HookSourceEditor", this.uiRoot);
UIFactory.SetLayoutElement(editorPanel, flexibleHeight: 9999, flexibleWidth: 9999);
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(editorPanel, true, true, true, true);

View File

@ -58,7 +58,7 @@ namespace UnityExplorer.UI.Panels
// Inspect under mouse dropdown on title bar
var mouseDropdown = UIFactory.CreateDropdown(closeHolder, out MouseInspectDropdown, "Mouse Inspect", 14,
var mouseDropdown = UIFactory.CreateDropdown(closeHolder, "MouseInspectDropdown", out MouseInspectDropdown, "Mouse Inspect", 14,
InspectUnderMouse.OnDropdownSelect);
UIFactory.SetLayoutElement(mouseDropdown, minHeight: 25, minWidth: 140);
MouseInspectDropdown.options.Add(new Dropdown.OptionData("Mouse Inspect"));
@ -76,14 +76,14 @@ namespace UnityExplorer.UI.Panels
// this.UIRoot.GetComponent<Mask>().enabled = false;
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(this.content, true, true, true, true, 4, padLeft: 5, padRight: 5);
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(this.uiRoot, true, true, true, true, 4, padLeft: 5, padRight: 5);
this.NavbarHolder = UIFactory.CreateGridGroup(this.content, "Navbar", new Vector2(200, 22), new Vector2(4, 4),
this.NavbarHolder = UIFactory.CreateGridGroup(this.uiRoot, "Navbar", new Vector2(200, 22), new Vector2(4, 4),
new Color(0.05f, 0.05f, 0.05f));
//UIFactory.SetLayoutElement(NavbarHolder, flexibleWidth: 9999, minHeight: 0, preferredHeight: 0, flexibleHeight: 9999);
NavbarHolder.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;
this.ContentHolder = UIFactory.CreateVerticalGroup(this.content, "ContentHolder", true, true, true, true, 0, default,
this.ContentHolder = UIFactory.CreateVerticalGroup(this.uiRoot, "ContentHolder", true, true, true, true, 0, default,
new Color(0.1f, 0.1f, 0.1f));
UIFactory.SetLayoutElement(ContentHolder, flexibleHeight: 9999);
ContentRect = ContentHolder.GetComponent<RectTransform>();

View File

@ -10,7 +10,10 @@ using UnityExplorer.Config;
using UnityExplorer.UI.Widgets;
using UniverseLib;
using UniverseLib.UI;
using UniverseLib.UI.Models;
using UniverseLib.UI.Widgets;
using UniverseLib.UI.Widgets.ScrollView;
using UniverseLib.Utility;
namespace UnityExplorer.UI.Panels
{
@ -141,7 +144,7 @@ namespace UnityExplorer.UI.Panels
cell.Input.Component.textComponent.color = logColors[log.type];
var color = index % 2 == 0 ? logEvenColor : logOddColor;
RuntimeProvider.Instance.SetColorBlock(cell.Input.Component, color);
RuntimeHelper.SetColorBlock(cell.Input.Component, color);
}
protected internal override void DoSetDefaultPosAndAnchors()
@ -158,13 +161,13 @@ namespace UnityExplorer.UI.Panels
{
// Log scroll pool
logScrollPool = UIFactory.CreateScrollPool<ConsoleLogCell>(this.content, "Logs", out GameObject scrollObj,
logScrollPool = UIFactory.CreateScrollPool<ConsoleLogCell>(this.uiRoot, "Logs", out GameObject scrollObj,
out GameObject scrollContent, new Color(0.03f, 0.03f, 0.03f));
UIFactory.SetLayoutElement(scrollObj, flexibleWidth: 9999, flexibleHeight: 9999);
// Buttons and toggles
var optionsRow = UIFactory.CreateUIObject("OptionsRow", this.content);
var optionsRow = UIFactory.CreateUIObject("OptionsRow", this.uiRoot);
UIFactory.SetLayoutElement(optionsRow, minHeight: 25, flexibleWidth: 9999);
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(optionsRow, false, false, true, true, 5, 2, 2, 2, 2);
@ -217,7 +220,7 @@ namespace UnityExplorer.UI.Panels
Input = UIFactory.CreateInputField(UIRoot, "Input", "");
//Input.Component.gameObject.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;
UIFactory.SetLayoutElement(Input.UIRoot, minHeight: 25, flexibleWidth: 9999);
RuntimeProvider.Instance.SetColorBlock(Input.Component, new Color(0.1f, 0.1f, 0.1f), new Color(0.13f, 0.13f, 0.13f),
RuntimeHelper.SetColorBlock(Input.Component, new Color(0.1f, 0.1f, 0.1f), new Color(0.13f, 0.13f, 0.13f),
new Color(0.07f, 0.07f, 0.07f));
Input.Component.GetComponent<Image>().color = new Color(0.2f, 0.2f, 0.2f);

View File

@ -43,7 +43,7 @@ namespace UnityExplorer.UI.Panels
content.SetActive(true);
var button = tabButtons[tabIndex];
RuntimeProvider.Instance.SetColorBlock(button.Component, UniversalUI.enabledButtonColor, UniversalUI.enabledButtonColor * 1.2f);
RuntimeHelper.SetColorBlock(button.Component, UniversalUI.EnabledButtonColor, UniversalUI.EnabledButtonColor * 1.2f);
SelectedTab = tabIndex;
SaveInternalData();
@ -52,7 +52,7 @@ namespace UnityExplorer.UI.Panels
private void DisableTab(int tabIndex)
{
tabPages[tabIndex].SetActive(false);
RuntimeProvider.Instance.SetColorBlock(tabButtons[tabIndex].Component, UniversalUI.disabledButtonColor, UniversalUI.disabledButtonColor * 1.2f);
RuntimeHelper.SetColorBlock(tabButtons[tabIndex].Component, UniversalUI.DisabledButtonColor, UniversalUI.DisabledButtonColor * 1.2f);
}
public override void Update()
@ -99,17 +99,17 @@ namespace UnityExplorer.UI.Panels
public override void ConstructPanelContent()
{
// Tab bar
var tabGroup = UIFactory.CreateHorizontalGroup(content, "TabBar", true, true, true, true, 2, new Vector4(2, 2, 2, 2));
var tabGroup = UIFactory.CreateHorizontalGroup(uiRoot, "TabBar", true, true, true, true, 2, new Vector4(2, 2, 2, 2));
UIFactory.SetLayoutElement(tabGroup, minHeight: 25, flexibleHeight: 0);
// Scene Explorer
SceneExplorer = new SceneExplorer(this);
SceneExplorer.ConstructUI(content);
SceneExplorer.ConstructUI(uiRoot);
tabPages.Add(SceneExplorer);
// Object search
ObjectSearch = new ObjectSearch(this);
ObjectSearch.ConstructUI(content);
ObjectSearch.ConstructUI(uiRoot);
tabPages.Add(ObjectSearch);
// set up tabs

View File

@ -10,6 +10,7 @@ using UnityExplorer.CacheObject.Views;
using UnityExplorer.UI.Widgets;
using UniverseLib.UI.Widgets;
using UniverseLib.UI;
using UniverseLib.UI.Widgets.ScrollView;
namespace UnityExplorer.UI.Panels
{
@ -70,13 +71,13 @@ namespace UnityExplorer.UI.Panels
{
// Save button
var saveBtn = UIFactory.CreateButton(this.content, "Save", "Save Options", new Color(0.2f, 0.3f, 0.2f));
var saveBtn = UIFactory.CreateButton(this.uiRoot, "Save", "Save Options", new Color(0.2f, 0.3f, 0.2f));
UIFactory.SetLayoutElement(saveBtn.Component.gameObject, flexibleWidth: 9999, minHeight: 30, flexibleHeight: 0);
saveBtn.OnClick += ConfigManager.Handler.SaveConfig;
// Config entries
var scrollPool = UIFactory.CreateScrollPool<ConfigEntryCell>(this.content, "ConfigEntries", out GameObject scrollObj,
var scrollPool = UIFactory.CreateScrollPool<ConfigEntryCell>(this.uiRoot, "ConfigEntries", out GameObject scrollObj,
out GameObject scrollContent);
scrollPool.Initialize(this);

View File

@ -10,6 +10,7 @@ using UniverseLib.UI.Models;
using UnityExplorer.UI.Widgets.AutoComplete;
using UniverseLib.UI;
using UniverseLib;
using UniverseLib.Utility;
namespace UnityExplorer.UI.Panels
{

View File

@ -93,7 +93,6 @@ namespace UnityExplorer.UI.Panels
public override GameObject UIRoot => uiRoot;
protected GameObject uiRoot;
public RectTransform Rect;
public GameObject content;
public GameObject titleBar;
public virtual void OnFinishResize(RectTransform panel)
@ -118,8 +117,8 @@ namespace UnityExplorer.UI.Panels
if (NavButtonWanted)
{
var color = active ? UniversalUI.enabledButtonColor : UniversalUI.disabledButtonColor;
RuntimeProvider.Instance.SetColorBlock(NavButton.Component, color, color * 1.2f);
var color = active ? UniversalUI.EnabledButtonColor : UniversalUI.DisabledButtonColor;
RuntimeHelper.SetColorBlock(NavButton.Component, color, color * 1.2f);
}
if (!active)
@ -240,7 +239,7 @@ namespace UnityExplorer.UI.Panels
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(navBtn, false, true, true, true, 0, 0, 0, 5, 5, TextAnchor.MiddleCenter);
UIFactory.SetLayoutElement(navBtn, minWidth: 80);
RuntimeProvider.Instance.SetColorBlock(NavButton.Component, UniversalUI.disabledButtonColor, UniversalUI.disabledButtonColor * 1.2f);
RuntimeHelper.SetColorBlock(NavButton.Component, UniversalUI.DisabledButtonColor, UniversalUI.DisabledButtonColor * 1.2f);
NavButton.OnClick += () => { UIManager.TogglePanel(PanelType); };
var txtObj = navBtn.transform.Find("Text").gameObject;
@ -248,18 +247,18 @@ namespace UnityExplorer.UI.Panels
}
// create core canvas
uiRoot = UIFactory.CreatePanel(Name, UIManager.PanelHolder, out GameObject panelContent);
uiRoot = UIFactory.CreatePanel(Name, UIManager.PanelHolder);
Rect = this.uiRoot.GetComponent<RectTransform>();
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(this.uiRoot, false, false, true, true, 0, 2, 2, 2, 2, TextAnchor.UpperLeft);
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(this.uiRoot, false, false, true, true, 2, 2, 2, 2, 2, TextAnchor.UpperLeft);
int id = this.uiRoot.transform.GetInstanceID();
transformToPanelDict.Add(id, this);
content = panelContent;
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(this.content, false, false, true, true, 2, 2, 2, 2, 2, TextAnchor.UpperLeft);
//content = panelContent;
//UIFactory.SetLayoutGroup<VerticalLayoutGroup>(this.content, false, false, true, true, 2, 2, 2, 2, 2, TextAnchor.UpperLeft);
// Title bar
titleBar = UIFactory.CreateHorizontalGroup(content, "TitleBar", false, true, true, true, 2,
titleBar = UIFactory.CreateHorizontalGroup(uiRoot, "TitleBar", false, true, true, true, 2,
new Vector4(2, 2, 2, 2), new Color(0.06f, 0.06f, 0.06f));
UIFactory.SetLayoutElement(titleBar, minHeight: 25, flexibleHeight: 0);
@ -275,7 +274,7 @@ namespace UnityExplorer.UI.Panels
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(closeHolder, false, false, true, true, 3, childAlignment: TextAnchor.MiddleRight);
var closeBtn = UIFactory.CreateButton(closeHolder, "CloseButton", "—");
UIFactory.SetLayoutElement(closeBtn.Component.gameObject, minHeight: 25, minWidth: 25, flexibleWidth: 0);
RuntimeProvider.Instance.SetColorBlock(closeBtn.Component, new Color(0.33f, 0.32f, 0.31f));
RuntimeHelper.SetColorBlock(closeBtn.Component, new Color(0.33f, 0.32f, 0.31f));
closeBtn.OnClick += () =>
{
@ -313,7 +312,7 @@ namespace UnityExplorer.UI.Panels
SetTransformDefaults();
}
RuntimeProvider.Instance.StartCoroutine(LateSetupCoroutine());
RuntimeHelper.StartCoroutine(LateSetupCoroutine());
// simple listener for saving enabled state
this.OnToggleEnabled += (bool val) =>

View File

@ -8,6 +8,9 @@ using UnityExplorer.UI.Widgets;
using UniverseLib;
using UniverseLib.UI;
using UniverseLib.UI.Widgets;
using UniverseLib.UI.Widgets.ButtonList;
using UniverseLib.UI.Widgets.ScrollView;
using UniverseLib.Utility;
namespace UnityExplorer.UI.Panels
{
@ -58,7 +61,7 @@ namespace UnityExplorer.UI.Panels
{
dataHandler = new ButtonListHandler<GameObject, ButtonCell>(buttonScrollPool, GetEntries, SetCell, ShouldDisplayCell, OnCellClicked);
buttonScrollPool = UIFactory.CreateScrollPool<ButtonCell>(this.content, "ResultsList", out GameObject scrollObj,
buttonScrollPool = UIFactory.CreateScrollPool<ButtonCell>(this.uiRoot, "ResultsList", out GameObject scrollObj,
out GameObject scrollContent);
buttonScrollPool.Initialize(dataHandler);

View File

@ -9,7 +9,11 @@ using UnityExplorer.UI.Widgets.AutoComplete;
using UniverseLib;
using UniverseLib.Input;
using UniverseLib.UI;
using UniverseLib.UI.Models;
using UniverseLib.UI.ObjectPool;
using UniverseLib.UI.Widgets;
using UniverseLib.UI.Widgets.ScrollView;
using UniverseLib.Utility;
namespace UnityExplorer.UI
{
@ -285,7 +289,7 @@ namespace UnityExplorer.UI
timeInput.Component.textComponent.color = pauseButtonPausing ? Color.grey : Color.white;
Color color = pauseButtonPausing ? new Color(0.3f, 0.3f, 0.2f) : new Color(0.2f, 0.2f, 0.2f);
RuntimeProvider.Instance.SetColorBlock(pauseBtn.Component, color, color * 1.2f, color * 0.7f);
RuntimeHelper.SetColorBlock(pauseBtn.Component, color, color * 1.2f, color * 0.7f);
pauseBtn.ButtonText.text = pauseButtonPausing ? "►" : "||";
}
@ -353,7 +357,7 @@ namespace UnityExplorer.UI
closeBtn = UIFactory.CreateButton(navbarPanel, "CloseButton", ConfigManager.Master_Toggle.Value.ToString());
UIFactory.SetLayoutElement(closeBtn.Component.gameObject, minHeight: 25, minWidth: 80, flexibleWidth: 0);
RuntimeProvider.Instance.SetColorBlock(closeBtn.Component, new Color(0.63f, 0.32f, 0.31f),
RuntimeHelper.SetColorBlock(closeBtn.Component, new Color(0.63f, 0.32f, 0.31f),
new Color(0.81f, 0.25f, 0.2f), new Color(0.6f, 0.18f, 0.16f));
ConfigManager.Master_Toggle.OnValueChanged += Master_Toggle_OnValueChanged;

View File

@ -11,6 +11,9 @@ using UnityExplorer.UI.Panels;
using UniverseLib.UI.Widgets;
using UniverseLib;
using UniverseLib.UI;
using UniverseLib.UI.Widgets.ButtonList;
using UniverseLib.UI.Widgets.ScrollView;
using UniverseLib.Utility;
namespace UnityExplorer.UI.Widgets.AutoComplete
{
@ -37,7 +40,7 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
public static ScrollPool<ButtonCell> scrollPool;
private static GameObject navigationTipRow;
private static List<Suggestion> Suggestions = new List<Suggestion>();
private static List<Suggestion> Suggestions = new();
private static int SelectedIndex = 0;
public static Suggestion SelectedSuggestion => Suggestions[SelectedIndex];
@ -213,10 +216,10 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
scrollPool.Content.anchoredPosition = pos;
}
RuntimeProvider.Instance.SetColorBlock(cell.Button.Component, selectedSuggestionColor);
RuntimeHelper.SetColorBlock(cell.Button.Component, selectedSuggestionColor);
}
else
RuntimeProvider.Instance.SetColorBlock(cell.Button.Component, inactiveSuggestionColor);
RuntimeHelper.SetColorBlock(cell.Button.Component, inactiveSuggestionColor);
setFirstCell = true;
}
@ -247,13 +250,13 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
Vector3 caretPos = textGen.characters[caretIdx].cursorPos;
// transform to world point
caretPos = input.UIRoot.transform.TransformPoint(caretPos);
caretPos += new Vector3(input.Rect.rect.width * 0.5f, -(input.Rect.rect.height * 0.5f), 0);
caretPos += new Vector3(input.Transform.rect.width * 0.5f, -(input.Transform.rect.height * 0.5f), 0);
uiRoot.transform.position = new Vector3(caretPos.x + 10, caretPos.y - 30, 0);
}
else
{
uiRoot.transform.position = input.Rect.position + new Vector3(-(input.Rect.rect.width / 2) + 10, -20, 0);
uiRoot.transform.position = input.Transform.position + new Vector3(-(input.Transform.rect.width / 2) + 10, -20, 0);
//var textGen = input.Component.textComponent.cachedTextGenerator;
//var pos = input.UIRoot.transform.TransformPoint(textGen.characters[0].cursorPos);
//uiRoot.transform.position = new Vector3(pos.x + 10, pos.y - 20, 0);
@ -302,13 +305,13 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
{
dataHandler = new ButtonListHandler<Suggestion, ButtonCell>(scrollPool, GetEntries, SetCell, ShouldDisplay, OnCellClicked);
scrollPool = UIFactory.CreateScrollPool<ButtonCell>(this.content, "AutoCompleter", out GameObject scrollObj,
scrollPool = UIFactory.CreateScrollPool<ButtonCell>(this.uiRoot, "AutoCompleter", out GameObject scrollObj,
out GameObject scrollContent);
scrollPool.Initialize(dataHandler);
UIFactory.SetLayoutElement(scrollObj, flexibleHeight: 9999);
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(scrollContent, true, false, true, false);
navigationTipRow = UIFactory.CreateHorizontalGroup(this.content, "BottomRow", true, true, true, true, 0, new Vector4(2, 2, 2, 2));
navigationTipRow = UIFactory.CreateHorizontalGroup(this.uiRoot, "BottomRow", true, true, true, true, 0, new Vector4(2, 2, 2, 2));
UIFactory.SetLayoutElement(navigationTipRow, minHeight: 20, flexibleWidth: 9999);
UIFactory.CreateLabel(navigationTipRow, "HelpText", "Up/Down to select, Enter to use, Esc to close",
TextAnchor.MiddleLeft, Color.grey, false, 13);

View File

@ -4,6 +4,8 @@ using System.Collections.Specialized;
using UnityExplorer.CacheObject.IValues;
using UniverseLib;
using UniverseLib.UI;
using UniverseLib.UI.Models;
using UniverseLib.Utility;
namespace UnityExplorer.UI.Widgets.AutoComplete
{

View File

@ -5,6 +5,7 @@ using System.Text;
using UnityEngine;
using UnityEngine.UI;
using UniverseLib.UI;
using UniverseLib.UI.Models;
namespace UnityExplorer.UI.Widgets.AutoComplete
{

View File

@ -2,13 +2,13 @@
using System.Collections.Generic;
using UniverseLib;
using UniverseLib.UI;
using UniverseLib.UI.Models;
using UniverseLib.Utility;
namespace UnityExplorer.UI.Widgets.AutoComplete
{
public class TypeCompleter : ISuggestionProvider
{
internal static readonly Dictionary<string, string> sharedTypeToLabel = new Dictionary<string, string>(4096);
public bool Enabled
{
get => _enabled;
@ -31,8 +31,8 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
public InputFieldRef InputField { get; }
public bool AnchorToCaretPosition => false;
private readonly List<Suggestion> suggestions = new List<Suggestion>();
private readonly HashSet<string> suggestedNames = new HashSet<string>();
private readonly List<Suggestion> suggestions = new();
private readonly HashSet<string> suggestedNames = new();
private HashSet<Type> allowedTypes;
@ -112,6 +112,8 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
}
}
internal static readonly Dictionary<string, string> sharedTypeToLabel = new();
void AddSuggestion(Type type)
{
if (suggestedNames.Contains(type.FullName))

View File

@ -7,6 +7,7 @@ using UnityEngine.UI;
using UnityExplorer.UI.Widgets.AutoComplete;
using UniverseLib.UI;
using UniverseLib.UI.Models;
using UniverseLib.UI.ObjectPool;
namespace UnityExplorer.UI.Widgets
{

View File

@ -11,6 +11,7 @@ using UnityExplorer.UI.Widgets.AutoComplete;
using UniverseLib.UI;
using UniverseLib;
using UnityExplorer.CacheObject;
using UniverseLib.UI.ObjectPool;
namespace UnityExplorer.UI.Widgets
{

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using UniverseLib;
using UniverseLib.Utility;
namespace UnityExplorer.UI.Widgets
{

View File

@ -10,6 +10,8 @@ using UnityExplorer.UI.Panels;
using UnityExplorer.UI.Widgets.AutoComplete;
using UniverseLib;
using UniverseLib.UI;
using UniverseLib.UI.Models;
using UniverseLib.Utility;
namespace UnityExplorer.UI.Widgets
{

View File

@ -1,6 +1,8 @@
using System;
using HarmonyLib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
@ -8,7 +10,9 @@ using UnityExplorer.Inspectors;
using UnityExplorer.UI.Widgets;
using UniverseLib;
using UniverseLib.UI;
using UniverseLib.UI.Models;
using UniverseLib.UI.Widgets;
using UniverseLib.UI.Widgets.ScrollView;
namespace UnityExplorer.UI.Widgets
{
@ -152,8 +156,8 @@ namespace UnityExplorer.UI.Widgets
Color highlight = new Color(0.25f, 0.25f, 0.25f);
Color pressed = new Color(0.05f, 0.05f, 0.05f);
Color disabled = new Color(1, 1, 1, 0);
RuntimeProvider.Instance.SetColorBlock(ExpandButton.Component, normal, highlight, pressed, disabled);
RuntimeProvider.Instance.SetColorBlock(NameButton.Component, normal, highlight, pressed, disabled);
RuntimeHelper.SetColorBlock(ExpandButton.Component, normal, highlight, pressed, disabled);
RuntimeHelper.SetColorBlock(NameButton.Component, normal, highlight, pressed, disabled);
NameButton.OnClick += OnMainButtonClicked;
ExpandButton.OnClick += OnExpandClicked;

View File

@ -8,6 +8,8 @@ using UnityEngine;
using UnityEngine.UI;
using UniverseLib;
using UniverseLib.UI.Widgets;
using UniverseLib.UI.Widgets.ScrollView;
using UniverseLib.Utility;
namespace UnityExplorer.UI.Widgets
{
@ -145,7 +147,7 @@ namespace UnityExplorer.UI.Widgets
private void OnCellJumpedTo(TransformCell cell)
{
RuntimeProvider.Instance.StartCoroutine(HighlightCellCoroutine(cell));
RuntimeHelper.StartCoroutine(HighlightCellCoroutine(cell));
}
private IEnumerator HighlightCellCoroutine(TransformCell cell)

View File

@ -175,16 +175,16 @@
<Private>False</Private>
</Reference>
<Reference Include="UniverseLib.Mono">
<HintPath>packages\UniverseLib.1.1.2\lib\net35\UniverseLib.Mono.dll</HintPath>
<HintPath>packages\UniverseLib.1.2.1\lib\net35\UniverseLib.Mono.dll</HintPath>
</Reference>
</ItemGroup>
<!-- Il2Cpp refs -->
<ItemGroup Condition="'$(IsCpp)'=='true'">
<Reference Include="UniverseLib.IL2CPP">
<HintPath>packages\UniverseLib.1.1.2\lib\net472\UniverseLib.IL2CPP.dll</HintPath>
<HintPath>packages\UniverseLib.1.2.1\lib\net472\UniverseLib.IL2CPP.dll</HintPath>
</Reference>
<Reference Include="UnhollowerBaseLib">
<HintPath>..\lib\Il2CppAssemblyUnhollower\UnhollowerBaseLib\bin\Release\net4.7.2\UnhollowerBaseLib.dll</HintPath>
<Reference Include="UnhollowerBaseLib, Version=0.4.22.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>packages\Il2CppAssemblyUnhollower.BaseLib.0.4.22\lib\net472\UnhollowerBaseLib.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Il2Cppmscorlib">
@ -291,9 +291,9 @@
<Compile Include="Config\ConfigHandler.cs" />
<Compile Include="Config\ConfigManager.cs" />
<Compile Include="Config\IConfigElement.cs" />
<Compile Include="Runtime\Il2CppProvider.cs" />
<Compile Include="Runtime\MonoProvider.cs" />
<Compile Include="Runtime\RuntimeHelper.cs" />
<Compile Include="Runtime\Il2CppHelper.cs" />
<Compile Include="Runtime\MonoHelper.cs" />
<Compile Include="Runtime\UERuntimeHelper.cs" />
<Compile Include="ObjectExplorer\SceneHandler.cs" />
<Compile Include="ObjectExplorer\SearchProvider.cs" />
<Compile Include="Tests\TestClass.cs" />
@ -326,7 +326,9 @@
<None Include="ILRepack.targets" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
<ItemGroup>
<Analyzer Include="packages\UniverseLib.Analyzers.1.0.3\analyzers\dotnet\cs\UniverseLib.Analyzers.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="packages\ILRepack.Lib.MSBuild.Task.2.0.18.2\build\ILRepack.Lib.MSBuild.Task.targets" Condition="Exists('packages\ILRepack.Lib.MSBuild.Task.2.0.18.2\build\ILRepack.Lib.MSBuild.Task.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

View File

@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30128.74
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnhollowerBaseLib", "..\lib\Il2CppAssemblyUnhollower\UnhollowerBaseLib\UnhollowerBaseLib.csproj", "{7B7E5024-385D-4A46-9196-A6AF8F7FBDD5}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mcs", "..\lib\mcs-unity\mcs\mcs.csproj", "{E4989E4C-0875-4528-9031-08E2C0E70103}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UnityExplorer", "UnityExplorer.csproj", "{B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}"
@ -20,20 +18,6 @@ Global
Release_STANDALONE_Mono|Any CPU = Release_STANDALONE_Mono|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7B7E5024-385D-4A46-9196-A6AF8F7FBDD5}.Release_BIE_Cpp|Any CPU.ActiveCfg = Release|Any CPU
{7B7E5024-385D-4A46-9196-A6AF8F7FBDD5}.Release_BIE_Cpp|Any CPU.Build.0 = Release|Any CPU
{7B7E5024-385D-4A46-9196-A6AF8F7FBDD5}.Release_BIE5_Mono|Any CPU.ActiveCfg = Release|Any CPU
{7B7E5024-385D-4A46-9196-A6AF8F7FBDD5}.Release_BIE5_Mono|Any CPU.Build.0 = Release|Any CPU
{7B7E5024-385D-4A46-9196-A6AF8F7FBDD5}.Release_BIE6_Mono|Any CPU.ActiveCfg = Release|Any CPU
{7B7E5024-385D-4A46-9196-A6AF8F7FBDD5}.Release_BIE6_Mono|Any CPU.Build.0 = Release|Any CPU
{7B7E5024-385D-4A46-9196-A6AF8F7FBDD5}.Release_ML_Cpp|Any CPU.ActiveCfg = Release|Any CPU
{7B7E5024-385D-4A46-9196-A6AF8F7FBDD5}.Release_ML_Cpp|Any CPU.Build.0 = Release|Any CPU
{7B7E5024-385D-4A46-9196-A6AF8F7FBDD5}.Release_ML_Mono|Any CPU.ActiveCfg = Release|Any CPU
{7B7E5024-385D-4A46-9196-A6AF8F7FBDD5}.Release_ML_Mono|Any CPU.Build.0 = Release|Any CPU
{7B7E5024-385D-4A46-9196-A6AF8F7FBDD5}.Release_STANDALONE_Cpp|Any CPU.ActiveCfg = Release|Any CPU
{7B7E5024-385D-4A46-9196-A6AF8F7FBDD5}.Release_STANDALONE_Cpp|Any CPU.Build.0 = Release|Any CPU
{7B7E5024-385D-4A46-9196-A6AF8F7FBDD5}.Release_STANDALONE_Mono|Any CPU.ActiveCfg = Release|Any CPU
{7B7E5024-385D-4A46-9196-A6AF8F7FBDD5}.Release_STANDALONE_Mono|Any CPU.Build.0 = Release|Any CPU
{E4989E4C-0875-4528-9031-08E2C0E70103}.Release_BIE_Cpp|Any CPU.ActiveCfg = Release|Any CPU
{E4989E4C-0875-4528-9031-08E2C0E70103}.Release_BIE_Cpp|Any CPU.Build.0 = Release|Any CPU
{E4989E4C-0875-4528-9031-08E2C0E70103}.Release_BIE5_Mono|Any CPU.ActiveCfg = Release|Any CPU

View File

@ -1,8 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="HarmonyX" version="2.5.2" targetFramework="net35" />
<package id="Iced" version="1.15.0" targetFramework="net472" />
<package id="Il2CppAssemblyUnhollower.BaseLib" version="0.4.22" targetFramework="net472" />
<package id="ILRepack.Lib.MSBuild.Task" version="2.0.18.2" targetFramework="net35" />
<package id="Mono.Cecil" version="0.10.4" targetFramework="net35" />
<package id="Samboy063.Tomlet" version="3.1.3" targetFramework="net472" />
<package id="UniverseLib" version="1.1.2" targetFramework="net35" />
<package id="UniverseLib" version="1.2.1" targetFramework="net35" />
<package id="UniverseLib.Analyzers" version="1.0.3" targetFramework="net35" developmentDependency="true" />
</packages>