mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-15 07:56:41 +08:00

* Errors are now logged properly. * Can now define classes, methods, etc - no longer has to be an expression body. * Added `StartCoroutine(IEnumerator routine)` helper method to easily run a Coroutine * Disabling suggestions now properly stops Explorer trying to update suggestion cache instead of just not showing them. In the rare cases that suggestions cause a crash, disabling them will now prevent those crashes. * Various other misc improvements behind the scenes
68 lines
1.8 KiB
C#
68 lines
1.8 KiB
C#
using System;
|
|
using Mono.CSharp;
|
|
using UnityExplorer.UI;
|
|
using UnityExplorer.UI.Main;
|
|
using UnityExplorer.Core.Inspectors;
|
|
using UnityExplorer.UI.Main.CSConsole;
|
|
using System.Collections;
|
|
using UnityEngine;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using UnityExplorer.Core.Runtime;
|
|
|
|
namespace UnityExplorer.Core.CSharp
|
|
{
|
|
public class ScriptInteraction : InteractiveBase
|
|
{
|
|
public static void Log(object message)
|
|
{
|
|
ExplorerCore.Log(message);
|
|
}
|
|
|
|
public static void StartCoroutine(IEnumerator ienumerator)
|
|
{
|
|
RuntimeProvider.Instance.StartConsoleCoroutine(ienumerator);
|
|
}
|
|
|
|
public static void AddUsing(string directive)
|
|
{
|
|
CSharpConsole.Instance.AddUsing(directive);
|
|
}
|
|
|
|
public static void GetUsing()
|
|
{
|
|
ExplorerCore.Log(CSharpConsole.Instance.Evaluator.GetUsing());
|
|
}
|
|
|
|
public static void Reset()
|
|
{
|
|
CSharpConsole.Instance.ResetConsole();
|
|
}
|
|
|
|
public static object CurrentTarget()
|
|
{
|
|
return InspectorManager.Instance?.m_activeInspector?.Target;
|
|
}
|
|
|
|
public static object[] AllTargets()
|
|
{
|
|
int count = InspectorManager.Instance?.m_currentInspectors.Count ?? 0;
|
|
object[] ret = new object[count];
|
|
for (int i = 0; i < count; i++)
|
|
{
|
|
ret[i] = InspectorManager.Instance?.m_currentInspectors[i].Target;
|
|
}
|
|
return ret;
|
|
}
|
|
|
|
public static void Inspect(object obj)
|
|
{
|
|
InspectorManager.Instance.Inspect(obj);
|
|
}
|
|
|
|
public static void Inspect(Type type)
|
|
{
|
|
InspectorManager.Instance.Inspect(type);
|
|
}
|
|
}
|
|
} |