mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-18 17:17:52 +08:00
Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
c927ac54be | |||
9f1df11940 | |||
62354b6aa2 | |||
44e57c32c3 |
@ -27,6 +27,7 @@ namespace UnityExplorer.CSConsole
|
|||||||
|
|
||||||
private static HashSet<string> usingDirectives;
|
private static HashSet<string> usingDirectives;
|
||||||
private static StringBuilder evaluatorOutput;
|
private static StringBuilder evaluatorOutput;
|
||||||
|
private static StringWriter evaluatorStringWriter;
|
||||||
|
|
||||||
public static CSConsolePanel Panel => UIManager.GetPanel<CSConsolePanel>(UIManager.Panels.CSConsole);
|
public static CSConsolePanel Panel => UIManager.GetPanel<CSConsolePanel>(UIManager.Panels.CSConsole);
|
||||||
public static InputFieldRef Input => Panel.Input;
|
public static InputFieldRef Input => Panel.Input;
|
||||||
@ -46,6 +47,7 @@ namespace UnityExplorer.CSConsole
|
|||||||
"System",
|
"System",
|
||||||
"System.Linq",
|
"System.Linq",
|
||||||
"System.Text",
|
"System.Text",
|
||||||
|
"System.Collections",
|
||||||
"System.Collections.Generic",
|
"System.Collections.Generic",
|
||||||
"UnityEngine",
|
"UnityEngine",
|
||||||
#if CPP
|
#if CPP
|
||||||
@ -130,6 +132,12 @@ namespace UnityExplorer.CSConsole
|
|||||||
|
|
||||||
#region Evaluating
|
#region Evaluating
|
||||||
|
|
||||||
|
private static void GenerateTextWriter()
|
||||||
|
{
|
||||||
|
evaluatorOutput = new StringBuilder();
|
||||||
|
evaluatorStringWriter = new StringWriter(evaluatorOutput);
|
||||||
|
}
|
||||||
|
|
||||||
public static void ResetConsole() => ResetConsole(true);
|
public static void ResetConsole() => ResetConsole(true);
|
||||||
|
|
||||||
public static void ResetConsole(bool logSuccess = true)
|
public static void ResetConsole(bool logSuccess = true)
|
||||||
@ -140,8 +148,8 @@ namespace UnityExplorer.CSConsole
|
|||||||
if (Evaluator != null)
|
if (Evaluator != null)
|
||||||
Evaluator.Dispose();
|
Evaluator.Dispose();
|
||||||
|
|
||||||
evaluatorOutput = new StringBuilder();
|
GenerateTextWriter();
|
||||||
Evaluator = new ScriptEvaluator(new StringWriter(evaluatorOutput))
|
Evaluator = new ScriptEvaluator(evaluatorStringWriter)
|
||||||
{
|
{
|
||||||
InteractiveBaseClass = typeof(ScriptInteraction)
|
InteractiveBaseClass = typeof(ScriptInteraction)
|
||||||
};
|
};
|
||||||
@ -176,6 +184,12 @@ namespace UnityExplorer.CSConsole
|
|||||||
if (SRENotSupported)
|
if (SRENotSupported)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (evaluatorStringWriter == null || evaluatorOutput == null)
|
||||||
|
{
|
||||||
|
GenerateTextWriter();
|
||||||
|
Evaluator._textWriter = evaluatorStringWriter;
|
||||||
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// Compile the code. If it returned a CompiledMethod, it is REPL.
|
// Compile the code. If it returned a CompiledMethod, it is REPL.
|
||||||
|
@ -14,7 +14,7 @@ using UnhollowerBaseLib;
|
|||||||
|
|
||||||
namespace UnityExplorer.Tests
|
namespace UnityExplorer.Tests
|
||||||
{
|
{
|
||||||
public static class TestClass
|
public class TestClass
|
||||||
{
|
{
|
||||||
static TestClass()
|
static TestClass()
|
||||||
{
|
{
|
||||||
@ -54,6 +54,12 @@ namespace UnityExplorer.Tests
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int this[int index]
|
||||||
|
{
|
||||||
|
get => UnityEngine.Random.Range(0, int.MaxValue);
|
||||||
|
set => ExplorerCore.Log(index);
|
||||||
|
}
|
||||||
|
|
||||||
// Test methods
|
// Test methods
|
||||||
|
|
||||||
private static object GetRandomObject()
|
private static object GetRandomObject()
|
||||||
@ -87,11 +93,12 @@ namespace UnityExplorer.Tests
|
|||||||
Vector3 vector,
|
Vector3 vector,
|
||||||
Quaternion quaternion,
|
Quaternion quaternion,
|
||||||
object obj,
|
object obj,
|
||||||
Type type)
|
Type type,
|
||||||
|
GameObject go)
|
||||||
{
|
{
|
||||||
ExplorerCore.Log($"_string: {_string}, integer: {integer}, color: {color.ToString()}, flags: {flags}, " +
|
ExplorerCore.Log($"_string: {_string}, integer: {integer}, color: {color.ToString()}, flags: {flags}, " +
|
||||||
$"vector: {vector.ToString()}, quaternion: {quaternion.ToString()}, obj: {obj?.ToString() ?? "null"}," +
|
$"vector: {vector.ToString()}, quaternion: {quaternion.ToString()}, obj: {obj?.ToString() ?? "null"}," +
|
||||||
$"type: {type?.FullName ?? "null"}");
|
$"type: {type?.FullName ?? "null"}, go: {go?.ToString() ?? "null"}");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Init_Mono()
|
private static void Init_Mono()
|
||||||
|
@ -16,7 +16,7 @@ namespace UnityExplorer
|
|||||||
public static class ExplorerCore
|
public static class ExplorerCore
|
||||||
{
|
{
|
||||||
public const string NAME = "UnityExplorer";
|
public const string NAME = "UnityExplorer";
|
||||||
public const string VERSION = "4.4.3";
|
public const string VERSION = "4.4.4";
|
||||||
public const string AUTHOR = "Sinai";
|
public const string AUTHOR = "Sinai";
|
||||||
public const string GUID = "com.sinai.unityexplorer";
|
public const string GUID = "com.sinai.unityexplorer";
|
||||||
|
|
||||||
@ -45,7 +45,7 @@ namespace UnityExplorer
|
|||||||
RuntimeHelper.Init();
|
RuntimeHelper.Init();
|
||||||
ExplorerBehaviour.Setup();
|
ExplorerBehaviour.Setup();
|
||||||
|
|
||||||
UniverseLib.Universe.Init(ConfigManager.Startup_Delay_Time.Value, LateInit, Log, new UniverseLib.Config.UUConfig
|
UniverseLib.Universe.Init(ConfigManager.Startup_Delay_Time.Value, LateInit, Log, new()
|
||||||
{
|
{
|
||||||
Disable_EventSystem_Override = ConfigManager.Disable_EventSystem_Override.Value,
|
Disable_EventSystem_Override = ConfigManager.Disable_EventSystem_Override.Value,
|
||||||
Force_Unlock_Mouse = ConfigManager.Force_Unlock_Mouse.Value,
|
Force_Unlock_Mouse = ConfigManager.Force_Unlock_Mouse.Value,
|
||||||
|
@ -35,6 +35,15 @@ namespace UnityExplorer.Inspectors.MouseInspectors
|
|||||||
|
|
||||||
public override void UpdateMouseInspect(Vector2 mousePos)
|
public override void UpdateMouseInspect(Vector2 mousePos)
|
||||||
{
|
{
|
||||||
|
if (!MainCamera)
|
||||||
|
MainCamera = Camera.main;
|
||||||
|
if (!MainCamera)
|
||||||
|
{
|
||||||
|
ExplorerCore.LogWarning("No Main Camera was found, unable to inspect world!");
|
||||||
|
InspectUnderMouse.Instance.StopInspect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var ray = MainCamera.ScreenPointToRay(mousePos);
|
var ray = MainCamera.ScreenPointToRay(mousePos);
|
||||||
Physics.Raycast(ray, out RaycastHit hit, 1000f);
|
Physics.Raycast(ray, out RaycastHit hit, 1000f);
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||||
<ProjectGuid>{B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}</ProjectGuid>
|
<ProjectGuid>{B21DBDE3-5D6F-4726-93AB-CC3CC68BAE7D}</ProjectGuid>
|
||||||
<OutputType>Library</OutputType>
|
<OutputType>Library</OutputType>
|
||||||
|
<LangVersion>9.0</LangVersion>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<Deterministic>true</Deterministic>
|
<Deterministic>true</Deterministic>
|
||||||
|
Reference in New Issue
Block a user