Compare commits

...

7 Commits
3.2.4 ... 3.2.7

Author SHA1 Message Date
5e326916a2 bump version 2021-03-23 16:16:09 +11:00
31c2debb78 fix typo mistake in previous version 2021-03-23 16:15:16 +11:00
d919497e43 Config: use en-us culture, fix recursive exception 2021-03-23 04:47:55 +11:00
0c40b4fad9 Merge branch 'master' of https://github.com/sinai-dev/Explorer 2021-03-21 16:18:56 +11:00
bba912667f fix ToString exception 2021-03-21 16:18:47 +11:00
1807e7c5ff Update TextureUtilProvider.cs 2021-03-21 15:16:36 +11:00
9da2ea9b1b Update README and Lexer namespaces 2021-03-18 18:52:30 +11:00
17 changed files with 55 additions and 28 deletions

View File

@ -133,4 +133,4 @@ Written by Sinai.
This project uses code from:
* (GPL) [ManlyMarco](https://github.com/ManlyMarco)'s [Runtime Unity Editor](https://github.com/ManlyMarco/RuntimeUnityEditor), which I used for some aspects of the C# Console and Auto-Complete features. The snippets I used are indicated with a comment.
* (MIT) [denikson](https://github.com/denikson) (aka Horse)'s [mcs-unity](https://github.com/denikson/mcs-unity). I commented out the `SkipVisibilityExt` constructor since it was causing an exception with the Hook it attempted in IL2CPP.
* (Apache) [InGameCodeEditor](https://assetstore.unity.com/packages/tools/gui/ingame-code-editor-144254) was used as the base for the syntax highlighting for UnityExplorer's C# console, although it has been heavily rewritten and optimized. Used classes are in the `UnityExplorer.CSConsole.Lexer` namespace.
* (Apache) [InGameCodeEditor](https://assetstore.unity.com/packages/tools/gui/ingame-code-editor-144254) was used as the base for the syntax highlighting for UnityExplorer's C# console, although it has been heavily rewritten and optimized. Used classes are in the `UnityExplorer.UI.Main.CSConsole.Lexer` namespace.

View File

@ -3,6 +3,7 @@ using Mono.CSharp;
using UnityExplorer.UI;
using UnityExplorer.UI.Main;
using UnityExplorer.Core.Inspectors;
using UnityExplorer.UI.Main.CSConsole;
namespace UnityExplorer.Core.CSharp
{

View File

@ -5,7 +5,7 @@ using System.Reflection;
using UnityEngine;
using UnityExplorer.Core;
using UnityExplorer.Core.Unity;
using UnityExplorer.UI.CSConsole;
using UnityExplorer.UI.Main.CSConsole;
namespace UnityExplorer.Core.CSharp
{

View File

@ -4,6 +4,7 @@ using UnityEngine;
using IniParser;
using IniParser.Parser;
using UnityExplorer.UI;
using System.Globalization;
namespace UnityExplorer.Core.Config
{
@ -14,6 +15,8 @@ namespace UnityExplorer.Core.Config
internal static readonly IniDataParser _parser = new IniDataParser();
internal static readonly string INI_PATH = Path.Combine(ExplorerCore.Loader.ConfigFolder, "config.ini");
internal static CultureInfo _enCulture = new CultureInfo("en-US");
static ExplorerConfig()
{
_parser.Configuration.CommentString = "#";
@ -30,7 +33,7 @@ namespace UnityExplorer.Core.Config
public bool Hide_On_Startup = false;
public string Window_Anchors = DEFAULT_WINDOW_ANCHORS;
private const string DEFAULT_WINDOW_ANCHORS = "0.25,0.1,0.78,0.95";
private const string DEFAULT_WINDOW_ANCHORS = "0.25,0.10,0.78,0.95";
public static event Action OnConfigChanged;
@ -123,17 +126,20 @@ namespace UnityExplorer.Core.Config
try
{
var split = Window_Anchors.Split(',');
if (split.Length != 4)
throw new Exception();
Vector4 ret = Vector4.zero;
ret.x = float.Parse(split[0]);
ret.y = float.Parse(split[1]);
ret.z = float.Parse(split[2]);
ret.w = float.Parse(split[3]);
ret.x = float.Parse(split[0], _enCulture);
ret.y = float.Parse(split[1], _enCulture);
ret.z = float.Parse(split[2], _enCulture);
ret.w = float.Parse(split[3], _enCulture);
return ret;
}
catch
{
Window_Anchors = DEFAULT_WINDOW_ANCHORS;
return GetWindowAnchorsVector();
return DefaultWindowAnchors();
}
}
@ -142,12 +148,24 @@ namespace UnityExplorer.Core.Config
try
{
var rect = PanelDragger.Instance.Panel;
return $"{rect.anchorMin.x},{rect.anchorMin.y},{rect.anchorMax.x},{rect.anchorMax.y}";
return string.Format(_enCulture, "{0},{1},{2},{3}", new object[]
{
rect.anchorMin.x,
rect.anchorMin.y,
rect.anchorMax.x,
rect.anchorMax.y
});
}
catch
{
return DEFAULT_WINDOW_ANCHORS;
}
}
internal static Vector4 DefaultWindowAnchors()
{
Instance.Window_Anchors = DEFAULT_WINDOW_ANCHORS;
return new Vector4(0.25f, 0.1f, 0.78f, 0.95f);
}
}
}

View File

@ -255,6 +255,8 @@ namespace UnityExplorer.Core.Inspectors.Reflection
else
toString = (string)m_toStringMethod.Invoke(Value, new object[0]);
toString = toString ?? "";
string typeName = valueType.FullName;
if (typeName.StartsWith("Il2CppSystem."))
typeName = typeName.Substring(6, typeName.Length - 6);

View File

@ -55,7 +55,7 @@ namespace UnityExplorer.Core.Runtime
{
Color[] pixels;
if (IsReadable(orig))
if (!IsReadable(orig))
orig = ForceReadTexture(orig);
pixels = orig.GetPixels((int)rect.x, (int)rect.y, (int)rect.width, (int)rect.height);

View File

@ -17,7 +17,7 @@ namespace UnityExplorer
public class ExplorerCore
{
public const string NAME = "UnityExplorer";
public const string VERSION = "3.2.4";
public const string VERSION = "3.2.7";
public const string AUTHOR = "Sinai";
public const string GUID = "com.sinai.unityexplorer";

View File

@ -7,7 +7,6 @@ using UnityEngine.UI;
using UnityExplorer.Core.CSharp;
using UnityExplorer.Core.Unity;
using UnityExplorer.UI;
using UnityExplorer.UI.CSConsole;
using UnityExplorer.UI.Main;
namespace UnityExplorer.UI.Main.CSConsole

View File

@ -1,9 +1,9 @@
using System.Collections.Generic;
using System.Text;
using UnityEngine;
using UnityExplorer.UI.CSConsole.Lexer;
using UnityExplorer.UI.Main.CSConsole.Lexer;
namespace UnityExplorer.UI.CSConsole
namespace UnityExplorer.UI.Main.CSConsole
{
public struct LexerMatchInfo
{

View File

@ -4,7 +4,6 @@ using System.IO;
using System.Reflection;
using System.Text;
using UnityExplorer.Core.CSharp;
using UnityExplorer.UI.CSConsole;
using System.Linq;
using UnityExplorer.Core.Input;
using UnityEngine;
@ -14,7 +13,7 @@ using UnityExplorer.UI.Reusable;
using UnityExplorer.UI.Main.CSConsole;
using UnityExplorer.Core;
namespace UnityExplorer.UI.Main
namespace UnityExplorer.UI.Main.CSConsole
{
public class CSharpConsole : BaseMenuPage
{

View File

@ -1,7 +1,7 @@
using System.Collections.Generic;
using UnityEngine;
namespace UnityExplorer.UI.CSConsole.Lexer
namespace UnityExplorer.UI.Main.CSConsole.Lexer
{
public class CommentMatch : Matcher
{

View File

@ -1,7 +1,7 @@
using System.Collections.Generic;
using UnityEngine;
namespace UnityExplorer.UI.CSConsole.Lexer
namespace UnityExplorer.UI.Main.CSConsole.Lexer
{
// I use two different KeywordMatch instances (valid and invalid).
// This class just contains common implementations.

View File

@ -3,7 +3,7 @@ using UnityEngine;
using System.Linq;
using UnityExplorer.Core.Unity;
namespace UnityExplorer.UI.CSConsole.Lexer
namespace UnityExplorer.UI.Main.CSConsole.Lexer
{
public abstract class Matcher
{

View File

@ -1,6 +1,6 @@
using UnityEngine;
namespace UnityExplorer.UI.CSConsole.Lexer
namespace UnityExplorer.UI.Main.CSConsole.Lexer
{
public class NumberMatch : Matcher
{

View File

@ -1,7 +1,7 @@
using System.Collections.Generic;
using UnityEngine;
namespace UnityExplorer.UI.CSConsole.Lexer
namespace UnityExplorer.UI.Main.CSConsole.Lexer
{
public class StringMatch : Matcher
{

View File

@ -2,7 +2,7 @@
using System.Linq;
using UnityEngine;
namespace UnityExplorer.UI.CSConsole.Lexer
namespace UnityExplorer.UI.Main.CSConsole.Lexer
{
public class SymbolMatch : Matcher
{

View File

@ -5,7 +5,6 @@ using UnityEngine;
using UnityEngine.UI;
using UnityExplorer.Core.Config;
using UnityExplorer.Core.Unity;
using UnityExplorer.UI.CSConsole;
using UnityExplorer.UI.Main;
using UnityExplorer.UI.Main.CSConsole;
@ -152,11 +151,14 @@ namespace UnityExplorer.UI.Main
MainPanel = UIFactory.CreatePanel(UIManager.CanvasRoot, "MainMenu", out GameObject content);
RectTransform panelRect = MainPanel.GetComponent<RectTransform>();
//panelRect.anchorMin = new Vector2(0.25f, 0.1f);
//panelRect.anchorMax = new Vector2(0.78f, 0.95f);
var anchors = ExplorerConfig.Instance.GetWindowAnchorsVector();
panelRect.anchorMin = new Vector2(anchors.x, anchors.y);
panelRect.anchorMax = new Vector2(anchors.z, anchors.w);
SetPanelAnchors(panelRect, anchors);
if (panelRect.rect.width < 400 || panelRect.rect.height < 400)
{
anchors = ExplorerConfig.DefaultWindowAnchors();
SetPanelAnchors(panelRect, anchors);
}
MainPanel.AddComponent<Mask>();
@ -169,6 +171,12 @@ namespace UnityExplorer.UI.Main
new DebugConsole(content);
}
private void SetPanelAnchors(RectTransform panelRect, Vector4 anchors)
{
panelRect.anchorMin = new Vector2(anchors.x, anchors.y);
panelRect.anchorMax = new Vector2(anchors.z, anchors.w);
}
private void ConstructTitleBar(GameObject content)
{
// Core title bar holder