mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-27 18:42:46 +08:00
Compare commits
41 Commits
Author | SHA1 | Date | |
---|---|---|---|
bf59d9d6cd | |||
bb0c59534a | |||
802bb722bc | |||
9ca992b0d7 | |||
5f3b3a6870 | |||
f5bce439cb | |||
e2b2c9038a | |||
fbefccd6b7 | |||
271c91f0d0 | |||
eb221bd868 | |||
5b516eb4cc | |||
601567f9d2 | |||
7ff508b874 | |||
09a7cd35cf | |||
db4a338d26 | |||
c08e02057c | |||
362fcdc51a | |||
73bd172e4d | |||
454d3bd0b4 | |||
f815a13d9a | |||
65c4d49274 | |||
d99137526e | |||
92447b55cd | |||
87d5d5a2de | |||
08cff3386b | |||
6033200579 | |||
94ec1c4908 | |||
7a400e762c | |||
67f9f744bb | |||
7a59f9a2a1 | |||
9b42eef1b9 | |||
830000b019 | |||
34910ab273 | |||
86b036095e | |||
b57e5be2e6 | |||
2d8ae45814 | |||
66dc262a68 | |||
4342901206 | |||
58b7c72a5c | |||
623dc7b7be | |||
e6f4939cc9 |
62
.github/ISSUE_TEMPLATE/bug_report.yaml
vendored
Normal file
62
.github/ISSUE_TEMPLATE/bug_report.yaml
vendored
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
name: Bug Report
|
||||||
|
description: File a bug or crash report
|
||||||
|
title: "[Bug]: "
|
||||||
|
labels: [bug]
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Thanks for submitting a bug report, please fill out as much detail as possible.
|
||||||
|
- type: checkboxes
|
||||||
|
id: latestversion
|
||||||
|
attributes:
|
||||||
|
label: Are you on the latest version of UnityExplorer?
|
||||||
|
description: If not, you must update first.
|
||||||
|
options:
|
||||||
|
- label: Yes, I'm on the latest version of UnityExplorer.
|
||||||
|
required: true
|
||||||
|
- type: dropdown
|
||||||
|
id: version
|
||||||
|
attributes:
|
||||||
|
label: Which release are you using?
|
||||||
|
description: Please select your environment for UnityExplorer.
|
||||||
|
options:
|
||||||
|
- BepInEx IL2CPP
|
||||||
|
- BepInEx 6.X Mono
|
||||||
|
- BepInEx 5.X Mono
|
||||||
|
- MelonLoader 0.4+ IL2CPP
|
||||||
|
- MelonLoader 0.4+ Mono
|
||||||
|
- MelonLoader 0.3 IL2CPP
|
||||||
|
- MelonLoader 0.3 Mono
|
||||||
|
- Standalone IL2CPP
|
||||||
|
- Standalone Mono
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: game
|
||||||
|
attributes:
|
||||||
|
label: Which game did this occur on?
|
||||||
|
description: Please tell us the name of the game. If it's a personal or private project, just let us know the Unity version.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: what-happened
|
||||||
|
attributes:
|
||||||
|
label: Describe the issue.
|
||||||
|
description: What happened? Should something else have happened instead? Please provide steps to reproduce the issue if possible.
|
||||||
|
placeholder: Tell us what you see!
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: logs
|
||||||
|
attributes:
|
||||||
|
label: Relevant log output
|
||||||
|
description: |
|
||||||
|
Please copy and paste any relevant logs and stack traces.
|
||||||
|
* Unity log: `%userprofile%\AppData\LocalLow\{Company}\{Game}\Player.log` or `output_log.txt`
|
||||||
|
* BepInEx: `BepInEx\LogOutput.log`
|
||||||
|
* MelonLoader: `MelonLoader\latest.log`
|
||||||
|
* Standalone: `{DLL_Location}\UnityExplorer\Logs\` (pick the most recent one)
|
||||||
|
render: shell
|
||||||
|
validations:
|
||||||
|
required: false
|
1
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
1
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
blank_issues_enabled: false
|
18
.github/ISSUE_TEMPLATE/enhancement.yaml
vendored
Normal file
18
.github/ISSUE_TEMPLATE/enhancement.yaml
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
name: New feature or enhancement
|
||||||
|
description: Suggest or discuss a feature or enhancement for UnityExplorer
|
||||||
|
title: "[Enhancement]: "
|
||||||
|
labels: [enhancement]
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Thanks for taking the time to discuss UnityExplorer, please provide as much detail as possible.
|
||||||
|
- type: textarea
|
||||||
|
id: description
|
||||||
|
attributes:
|
||||||
|
label: Describe the new feature or enhancement
|
||||||
|
description: |
|
||||||
|
Please go into as much detail as necessary in describing the new feature or enhancement.
|
||||||
|
If providing examples or suggestions for the required C# code, please use syntax-highlighted code blocks.
|
||||||
|
validations:
|
||||||
|
required: true
|
13
.github/ISSUE_TEMPLATE/other.yaml
vendored
Normal file
13
.github/ISSUE_TEMPLATE/other.yaml
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
name: Other
|
||||||
|
description: Something else?
|
||||||
|
title: "[Other]: "
|
||||||
|
labels: [Other]
|
||||||
|
body:
|
||||||
|
- type: textarea
|
||||||
|
id: description
|
||||||
|
attributes:
|
||||||
|
label: Describe the issue
|
||||||
|
description: |
|
||||||
|
Please describe the issue in as much detail as possible.
|
||||||
|
validations:
|
||||||
|
required: true
|
16
README.md
16
README.md
@ -6,10 +6,10 @@
|
|||||||
🔍 An in-game UI for exploring, debugging and modifying Unity games.
|
🔍 An in-game UI for exploring, debugging and modifying Unity games.
|
||||||
</p>
|
</p>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
✔️ Supports most Unity versions from 5.2 to 2020+ (IL2CPP and Mono).
|
✔️ Supports most Unity versions from 5.2 to 2021+ (IL2CPP and Mono).
|
||||||
</p>
|
</p>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
☕ Enjoy this tool? Consider supporting me on <a href="https://ko-fi.com/sinaidev">ko-fi</a>!
|
⚡ UnityExplorer is on <a href="https://thunderstore.io/package/sinai-dev/UnityExplorer/">Thunderstore</a>! (and as <a href="https://gtfo.thunderstore.io/package/sinai-dev/UnityExplorer_IL2CPP/">IL2CPP</a>)
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
# Releases [](../../releases)
|
# Releases [](../../releases)
|
||||||
@ -32,8 +32,8 @@
|
|||||||
|
|
||||||
| Release | IL2CPP | Mono |
|
| Release | IL2CPP | Mono |
|
||||||
| ------- | ------ | ---- |
|
| ------- | ------ | ---- |
|
||||||
| ML 0.4.0 | ✅ [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) |
|
| 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) |
|
||||||
| ML 0.3.0 | ✅ [link](https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.MelonLoader_Legacy.Il2Cpp.zip) | ✅ [link](https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.MelonLoader_Legacy.Mono.zip) |
|
| ML 0.3 | ✅ [link](https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.MelonLoader_Legacy.Il2Cpp.zip) | ✅ [link](https://github.com/sinai-dev/UnityExplorer/releases/latest/download/UnityExplorer.MelonLoader_Legacy.Mono.zip) |
|
||||||
|
|
||||||
1. Take the `UnityExplorer.ML.[version].dll` file and put it in the `Mods\` folder created by MelonLoader.
|
1. Take the `UnityExplorer.ML.[version].dll` file and put it in the `Mods\` folder created by MelonLoader.
|
||||||
|
|
||||||
@ -50,11 +50,6 @@ The standalone release can be used with any injector or loader of your choice, b
|
|||||||
3. Create an instance of Unity Explorer with `UnityExplorer.ExplorerStandalone.CreateInstance();`
|
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
|
4. Optionally subscribe to the `ExplorerStandalone.OnLog` event to handle logging if you wish
|
||||||
|
|
||||||
# Known issues
|
|
||||||
* Any `MissingMethodException` or `NotSupportedException`: please report the issue and provide a copy of your mod loader log and/or Unity log.
|
|
||||||
* In IL2CPP, some IEnumerable and IDictionary types may fail enumeration. Waiting for the Unhollower rewrite to address this any further.
|
|
||||||
* The C# Console's completions have some minor issues such as not suggestion global classes which have no namespace, and erronously suggesting classes from using directives when they shouldn't be suggested. These are issues with mcs itself which I am looking into.
|
|
||||||
|
|
||||||
# Features
|
# Features
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
@ -88,6 +83,7 @@ The inspector is used to see detailed information on objects of any type and man
|
|||||||
### C# Console
|
### C# Console
|
||||||
|
|
||||||
* The C# Console uses the `Mono.CSharp.Evaluator` to define temporary classes or run immediate REPL code.
|
* The C# Console uses the `Mono.CSharp.Evaluator` to define temporary classes or run immediate REPL code.
|
||||||
|
* You can execute a script automatically on startup by naming it `startup.cs` and placing it in the `UnityExplorer\Scripts\` folder (this folder will be created where you placed the DLL file).
|
||||||
* See the "Help" dropdown in the C# console menu for more detailed information.
|
* See the "Help" dropdown in the C# console menu for more detailed information.
|
||||||
|
|
||||||
### Mouse-Inspect
|
### Mouse-Inspect
|
||||||
@ -115,7 +111,7 @@ For Visual Studio:
|
|||||||
|
|
||||||
0. Clone the repository and run `git submodule update --init --recursive` to get the submodules.
|
0. Clone the repository and run `git submodule update --init --recursive` to get the submodules.
|
||||||
1. Open the `src\UnityExplorer.sln` project.
|
1. Open the `src\UnityExplorer.sln` project.
|
||||||
2. Build `mcs`, and if using IL2CPP then build `UnhollowerBaseLib` as well.
|
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.
|
||||||
3. Build the UnityExplorer release(s) you want to use, either by selecting the config as the Active Config, or batch-building.
|
3. Build the UnityExplorer release(s) you want to use, either by selecting the config as the Active Config, or batch-building.
|
||||||
|
|
||||||
# Acknowledgments
|
# Acknowledgments
|
||||||
|
@ -3,10 +3,11 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityExplorer.UI.CSConsole.Lexers;
|
using UnityExplorer.CSConsole.Lexers;
|
||||||
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Widgets.AutoComplete;
|
using UnityExplorer.UI.Widgets.AutoComplete;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CSConsole
|
namespace UnityExplorer.CSConsole
|
||||||
{
|
{
|
||||||
public class CSAutoCompleter : ISuggestionProvider
|
public class CSAutoCompleter : ISuggestionProvider
|
||||||
{
|
{
|
@ -10,11 +10,12 @@ using UnityEngine;
|
|||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Core.Input;
|
using UnityExplorer.Core.Input;
|
||||||
using UnityExplorer.UI.CSConsole;
|
using UnityExplorer.CSConsole;
|
||||||
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
using UnityExplorer.UI.Widgets.AutoComplete;
|
using UnityExplorer.UI.Widgets.AutoComplete;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CSConsole
|
namespace UnityExplorer.CSConsole
|
||||||
{
|
{
|
||||||
public static class ConsoleController
|
public static class ConsoleController
|
||||||
{
|
{
|
||||||
@ -36,6 +37,8 @@ namespace UnityExplorer.UI.CSConsole
|
|||||||
public static bool EnableAutoIndent { get; private set; } = true;
|
public static bool EnableAutoIndent { get; private set; } = true;
|
||||||
public static bool EnableSuggestions { get; private set; } = true;
|
public static bool EnableSuggestions { get; private set; } = true;
|
||||||
|
|
||||||
|
internal static string ScriptsFolder => Path.Combine(ExplorerCore.Loader.ExplorerFolder, "Scripts");
|
||||||
|
|
||||||
internal static readonly string[] DefaultUsing = new string[]
|
internal static readonly string[] DefaultUsing = new string[]
|
||||||
{
|
{
|
||||||
"System",
|
"System",
|
||||||
@ -51,6 +54,7 @@ namespace UnityExplorer.UI.CSConsole
|
|||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
|
// Make sure console is supported on this platform
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ResetConsole(false);
|
ResetConsole(false);
|
||||||
@ -63,19 +67,41 @@ namespace UnityExplorer.UI.CSConsole
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Setup console
|
||||||
Lexer = new LexerBuilder();
|
Lexer = new LexerBuilder();
|
||||||
Completer = new CSAutoCompleter();
|
Completer = new CSAutoCompleter();
|
||||||
|
|
||||||
SetupHelpInteraction();
|
SetupHelpInteraction();
|
||||||
|
|
||||||
Panel.OnInputChanged += OnInputChanged;
|
Panel.OnInputChanged += OnInputChanged;
|
||||||
Panel.InputScroll.OnScroll += OnInputScrolled;
|
Panel.InputScroller.OnScroll += OnInputScrolled;
|
||||||
Panel.OnCompileClicked += Evaluate;
|
Panel.OnCompileClicked += Evaluate;
|
||||||
Panel.OnResetClicked += ResetConsole;
|
Panel.OnResetClicked += ResetConsole;
|
||||||
Panel.OnHelpDropdownChanged += HelpSelected;
|
Panel.OnHelpDropdownChanged += HelpSelected;
|
||||||
Panel.OnAutoIndentToggled += OnToggleAutoIndent;
|
Panel.OnAutoIndentToggled += OnToggleAutoIndent;
|
||||||
Panel.OnCtrlRToggled += OnToggleCtrlRShortcut;
|
Panel.OnCtrlRToggled += OnToggleCtrlRShortcut;
|
||||||
Panel.OnSuggestionsToggled += OnToggleSuggestions;
|
Panel.OnSuggestionsToggled += OnToggleSuggestions;
|
||||||
|
Panel.OnPanelResized += OnInputScrolled;
|
||||||
|
|
||||||
|
// Run startup script
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!Directory.Exists(ScriptsFolder))
|
||||||
|
Directory.CreateDirectory(ScriptsFolder);
|
||||||
|
|
||||||
|
var startupPath = Path.Combine(ScriptsFolder, "startup.cs");
|
||||||
|
if (File.Exists(startupPath))
|
||||||
|
{
|
||||||
|
ExplorerCore.Log($"Executing startup script from '{startupPath}'...");
|
||||||
|
var text = File.ReadAllText(startupPath);
|
||||||
|
Input.Text = text;
|
||||||
|
Evaluate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ExplorerCore.LogWarning($"Exception executing startup script: {ex}");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -317,7 +343,7 @@ namespace UnityExplorer.UI.CSConsole
|
|||||||
var charBot = charTop - CSCONSOLE_LINEHEIGHT;
|
var charBot = charTop - CSCONSOLE_LINEHEIGHT;
|
||||||
|
|
||||||
var viewportMin = Input.Rect.rect.height - Input.Rect.anchoredPosition.y - (Input.Rect.rect.height * 0.5f);
|
var viewportMin = Input.Rect.rect.height - Input.Rect.anchoredPosition.y - (Input.Rect.rect.height * 0.5f);
|
||||||
var viewportMax = viewportMin - Panel.InputScroll.ViewportRect.rect.height;
|
var viewportMax = viewportMin - Panel.InputScroller.ViewportRect.rect.height;
|
||||||
|
|
||||||
float diff = 0f;
|
float diff = 0f;
|
||||||
if (charTop > viewportMin)
|
if (charTop > viewportMin)
|
||||||
@ -337,7 +363,7 @@ namespace UnityExplorer.UI.CSConsole
|
|||||||
{
|
{
|
||||||
settingCaretCoroutine = true;
|
settingCaretCoroutine = true;
|
||||||
Input.Component.readOnly = true;
|
Input.Component.readOnly = true;
|
||||||
RuntimeProvider.Instance.StartCoroutine(SetAutocompleteCaretCoro(caretPosition));
|
RuntimeProvider.Instance.StartCoroutine(SetCaretCoroutine(caretPosition));
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static PropertyInfo SelectionGuardProperty => selectionGuardPropInfo ?? GetSelectionGuardPropInfo();
|
internal static PropertyInfo SelectionGuardProperty => selectionGuardPropInfo ?? GetSelectionGuardPropInfo();
|
||||||
@ -352,7 +378,7 @@ namespace UnityExplorer.UI.CSConsole
|
|||||||
|
|
||||||
private static PropertyInfo selectionGuardPropInfo;
|
private static PropertyInfo selectionGuardPropInfo;
|
||||||
|
|
||||||
private static IEnumerator SetAutocompleteCaretCoro(int caretPosition)
|
private static IEnumerator SetCaretCoroutine(int caretPosition)
|
||||||
{
|
{
|
||||||
var color = Input.Component.selectionColor;
|
var color = Input.Component.selectionColor;
|
||||||
color.a = 0f;
|
color.a = 0f;
|
||||||
@ -376,7 +402,6 @@ namespace UnityExplorer.UI.CSConsole
|
|||||||
settingCaretCoroutine = false;
|
settingCaretCoroutine = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#region Lexer Highlighting
|
#region Lexer Highlighting
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -384,20 +409,22 @@ namespace UnityExplorer.UI.CSConsole
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private static bool HighlightVisibleInput()
|
private static bool HighlightVisibleInput()
|
||||||
{
|
{
|
||||||
int startIdx = 0;
|
if (string.IsNullOrEmpty(Input.Text))
|
||||||
int endIdx = Input.Text.Length - 1;
|
|
||||||
int topLine = 0;
|
|
||||||
|
|
||||||
// Calculate visible text if necessary
|
|
||||||
if (Input.Rect.rect.height > Panel.InputScroll.ViewportRect.rect.height)
|
|
||||||
{
|
{
|
||||||
topLine = -1;
|
Panel.HighlightText.text = "";
|
||||||
|
Panel.LineNumberText.text = "1";
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate the visible lines
|
||||||
|
|
||||||
|
int topLine = -1;
|
||||||
int bottomLine = -1;
|
int bottomLine = -1;
|
||||||
|
|
||||||
// the top and bottom position of the viewport in relation to the text height
|
// 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.
|
// 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.Rect.rect.height - Input.Rect.anchoredPosition.y - (Input.Rect.rect.height * 0.5f);
|
||||||
var viewportMax = viewportMin - Panel.InputScroll.ViewportRect.rect.height;
|
var viewportMax = viewportMin - Panel.InputScroller.ViewportRect.rect.height;
|
||||||
|
|
||||||
for (int i = 0; i < Input.TextGenerator.lineCount; i++)
|
for (int i = 0; i < Input.TextGenerator.lineCount; i++)
|
||||||
{
|
{
|
||||||
@ -413,14 +440,52 @@ namespace UnityExplorer.UI.CSConsole
|
|||||||
topLine = Math.Max(0, topLine - 1);
|
topLine = Math.Max(0, topLine - 1);
|
||||||
bottomLine = Math.Min(Input.TextGenerator.lineCount - 1, bottomLine + 1);
|
bottomLine = Math.Min(Input.TextGenerator.lineCount - 1, bottomLine + 1);
|
||||||
|
|
||||||
startIdx = Input.TextGenerator.lines[topLine].startCharIdx;
|
int startIdx = Input.TextGenerator.lines[topLine].startCharIdx;
|
||||||
endIdx = (bottomLine >= Input.TextGenerator.lineCount - 1)
|
int endIdx = (bottomLine >= Input.TextGenerator.lineCount - 1)
|
||||||
? Input.Text.Length - 1
|
? Input.Text.Length - 1
|
||||||
: (Input.TextGenerator.lines[bottomLine + 1].startCharIdx - 1);
|
: (Input.TextGenerator.lines[bottomLine + 1].startCharIdx - 1);
|
||||||
}
|
|
||||||
|
|
||||||
// Highlight the visible text with the LexerBuilder
|
// Highlight the visible text with the LexerBuilder
|
||||||
|
|
||||||
Panel.HighlightText.text = Lexer.BuildHighlightedString(Input.Text, startIdx, endIdx, topLine, LastCaretPosition, out bool ret);
|
Panel.HighlightText.text = Lexer.BuildHighlightedString(Input.Text, startIdx, endIdx, topLine, LastCaretPosition, out bool ret);
|
||||||
|
|
||||||
|
// Set the line numbers
|
||||||
|
|
||||||
|
// determine true starting line number (not the same as the cached TextGenerator line numbers)
|
||||||
|
int realStartLine = 0;
|
||||||
|
for (int i = 0; i < startIdx; i++)
|
||||||
|
{
|
||||||
|
if (LexerBuilder.IsNewLine(Input.Text[i]))
|
||||||
|
realStartLine++;
|
||||||
|
}
|
||||||
|
realStartLine++;
|
||||||
|
char lastPrev = '\n';
|
||||||
|
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
|
||||||
|
// append leading new lines for spacing (no point rendering line numbers we cant see)
|
||||||
|
for (int i = 0; i < topLine; i++)
|
||||||
|
sb.Append('\n');
|
||||||
|
|
||||||
|
// append the displayed line numbers
|
||||||
|
for (int i = topLine; i <= bottomLine; i++)
|
||||||
|
{
|
||||||
|
if (i > 0)
|
||||||
|
lastPrev = Input.Text[Input.TextGenerator.lines[i].startCharIdx - 1];
|
||||||
|
|
||||||
|
// previous line ended with a newline character, this is an actual new line.
|
||||||
|
if (LexerBuilder.IsNewLine(lastPrev))
|
||||||
|
{
|
||||||
|
sb.Append(realStartLine.ToString());
|
||||||
|
realStartLine++;
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.Append('\n');
|
||||||
|
}
|
||||||
|
|
||||||
|
Panel.LineNumberText.text = sb.ToString();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -555,7 +620,9 @@ If the game was built with Unity's stubbed netstandard 2.0 runtime, you can fix
|
|||||||
internal const string STARTUP_TEXT = @"<color=#5d8556>// Welcome to the UnityExplorer C# Console!
|
internal const string STARTUP_TEXT = @"<color=#5d8556>// Welcome to the UnityExplorer C# Console!
|
||||||
|
|
||||||
// It is recommended to use the Log panel (or a console log window) while using this tool.
|
// It is recommended to use the Log panel (or a console log window) while using this tool.
|
||||||
// Use the Help dropdown to see detailed examples of how to use the console.</color>";
|
// Use the Help dropdown to see detailed examples of how to use the console.
|
||||||
|
|
||||||
|
// To execute a script automatically on startup, put the script at 'UnityExplorer\Scripts\startup.cs'</color>";
|
||||||
|
|
||||||
internal const string HELP_USINGS = @"// You can add a using directive to any namespace, but you must compile for it to take effect.
|
internal const string HELP_USINGS = @"// You can add a using directive to any namespace, but you must compile for it to take effect.
|
||||||
// It will remain in effect until you Reset the console.
|
// It will remain in effect until you Reset the console.
|
@ -5,16 +5,17 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.UI.CSConsole.Lexers;
|
using UnityExplorer.CSConsole.Lexers;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CSConsole
|
namespace UnityExplorer.CSConsole
|
||||||
{
|
{
|
||||||
public struct MatchInfo
|
public struct MatchInfo
|
||||||
{
|
{
|
||||||
public int startIndex;
|
public int startIndex;
|
||||||
public int endIndex;
|
public int endIndex;
|
||||||
public string htmlColorTag;
|
|
||||||
public bool isStringOrComment;
|
public bool isStringOrComment;
|
||||||
|
public bool matchToEndOfLine;
|
||||||
|
public string htmlColorTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class LexerBuilder
|
public class LexerBuilder
|
||||||
@ -112,12 +113,24 @@ namespace UnityExplorer.UI.CSConsole
|
|||||||
sb.Append(input[i]);
|
sb.Append(input[i]);
|
||||||
sb.Append(SignatureHighlighter.CLOSE_COLOR);
|
sb.Append(SignatureHighlighter.CLOSE_COLOR);
|
||||||
|
|
||||||
// check caretIdx to determine inStringOrComment state
|
|
||||||
if (caretIdx >= match.startIndex && (caretIdx <= match.endIndex || (caretIdx >= input.Length && match.endIndex >= input.Length - 1)))
|
|
||||||
caretInStringOrComment = match.isStringOrComment;
|
|
||||||
|
|
||||||
// update the last unhighlighted start index
|
// update the last unhighlighted start index
|
||||||
lastUnhighlighted = match.endIndex + 1;
|
lastUnhighlighted = match.endIndex + 1;
|
||||||
|
|
||||||
|
int matchEndIdx = match.endIndex;
|
||||||
|
if (match.matchToEndOfLine)
|
||||||
|
{
|
||||||
|
while (input.Length - 1 >= matchEndIdx)
|
||||||
|
{
|
||||||
|
if (IsNewLine(input[matchEndIdx]))
|
||||||
|
break;
|
||||||
|
matchEndIdx++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// check caretIdx to determine inStringOrComment state
|
||||||
|
if (caretIdx >= match.startIndex && (caretIdx <= matchEndIdx || (caretIdx >= input.Length && matchEndIdx >= input.Length - 1)))
|
||||||
|
caretInStringOrComment = match.isStringOrComment;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Append trailing unhighlighted input
|
// Append trailing unhighlighted input
|
@ -2,7 +2,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CSConsole.Lexers
|
namespace UnityExplorer.CSConsole.Lexers
|
||||||
{
|
{
|
||||||
public class CommentLexer : Lexer
|
public class CommentLexer : Lexer
|
||||||
{
|
{
|
@ -2,7 +2,7 @@
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CSConsole.Lexers
|
namespace UnityExplorer.CSConsole.Lexers
|
||||||
{
|
{
|
||||||
public class KeywordLexer : Lexer
|
public class KeywordLexer : Lexer
|
||||||
{
|
{
|
@ -2,7 +2,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CSConsole.Lexers
|
namespace UnityExplorer.CSConsole.Lexers
|
||||||
{
|
{
|
||||||
public abstract class Lexer
|
public abstract class Lexer
|
||||||
{
|
{
|
@ -1,6 +1,6 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CSConsole.Lexers
|
namespace UnityExplorer.CSConsole.Lexers
|
||||||
{
|
{
|
||||||
public class NumberLexer : Lexer
|
public class NumberLexer : Lexer
|
||||||
{
|
{
|
@ -1,7 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CSConsole.Lexers
|
namespace UnityExplorer.CSConsole.Lexers
|
||||||
{
|
{
|
||||||
public class StringLexer : Lexer
|
public class StringLexer : Lexer
|
||||||
{
|
{
|
@ -3,7 +3,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CSConsole.Lexers
|
namespace UnityExplorer.CSConsole.Lexers
|
||||||
{
|
{
|
||||||
public class SymbolLexer : Lexer
|
public class SymbolLexer : Lexer
|
||||||
{
|
{
|
@ -7,7 +7,7 @@ using System.Text;
|
|||||||
|
|
||||||
// Thanks to ManlyMarco for this
|
// Thanks to ManlyMarco for this
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CSConsole
|
namespace UnityExplorer.CSConsole
|
||||||
{
|
{
|
||||||
public class ScriptEvaluator : Evaluator, IDisposable
|
public class ScriptEvaluator : Evaluator, IDisposable
|
||||||
{
|
{
|
@ -7,13 +7,7 @@ using System.Text;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityExplorer.Core.Runtime;
|
using UnityExplorer.Core.Runtime;
|
||||||
|
|
||||||
/*
|
namespace UnityExplorer.CSConsole
|
||||||
Welcome to the UnityExplorer C# Console!
|
|
||||||
Use the Help dropdown to see detailed examples of how to use this console.
|
|
||||||
To see your output, use the Log panel or a Console Log window.
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CSConsole
|
|
||||||
{
|
{
|
||||||
public class ScriptInteraction : InteractiveBase
|
public class ScriptInteraction : InteractiveBase
|
||||||
{
|
{
|
@ -3,9 +3,9 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityExplorer.Core.Config;
|
using UnityExplorer.Core.Config;
|
||||||
using UnityExplorer.UI.CacheObject.Views;
|
using UnityExplorer.CacheObject.Views;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CacheObject
|
namespace UnityExplorer.CacheObject
|
||||||
{
|
{
|
||||||
public class CacheConfigEntry : CacheObjectBase
|
public class CacheConfigEntry : CacheObjectBase
|
||||||
{
|
{
|
@ -3,9 +3,9 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityExplorer.UI.Inspectors;
|
using UnityExplorer.Inspectors;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CacheObject
|
namespace UnityExplorer.CacheObject
|
||||||
{
|
{
|
||||||
public class CacheField : CacheMember
|
public class CacheField : CacheMember
|
||||||
{
|
{
|
@ -2,10 +2,10 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityExplorer.UI.CacheObject.IValues;
|
using UnityExplorer.CacheObject.IValues;
|
||||||
using UnityExplorer.UI.CacheObject.Views;
|
using UnityExplorer.CacheObject.Views;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CacheObject
|
namespace UnityExplorer.CacheObject
|
||||||
{
|
{
|
||||||
public class CacheKeyValuePair : CacheObjectBase
|
public class CacheKeyValuePair : CacheObjectBase
|
||||||
{
|
{
|
@ -2,10 +2,10 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityExplorer.UI.CacheObject.IValues;
|
using UnityExplorer.CacheObject.IValues;
|
||||||
using UnityExplorer.UI.CacheObject.Views;
|
using UnityExplorer.CacheObject.Views;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CacheObject
|
namespace UnityExplorer.CacheObject
|
||||||
{
|
{
|
||||||
public class CacheListEntry : CacheObjectBase
|
public class CacheListEntry : CacheObjectBase
|
||||||
{
|
{
|
@ -5,11 +5,12 @@ using System.Reflection;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityExplorer.Core.Runtime;
|
using UnityExplorer.Core.Runtime;
|
||||||
using UnityExplorer.UI.CacheObject.Views;
|
using UnityExplorer.CacheObject.Views;
|
||||||
using UnityExplorer.UI.Inspectors;
|
using UnityExplorer.Inspectors;
|
||||||
using UnityExplorer.UI.Models;
|
using UnityExplorer.UI.Models;
|
||||||
|
using UnityExplorer.UI;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CacheObject
|
namespace UnityExplorer.CacheObject
|
||||||
{
|
{
|
||||||
public abstract class CacheMember : CacheObjectBase
|
public abstract class CacheMember : CacheObjectBase
|
||||||
{
|
{
|
@ -3,9 +3,9 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityExplorer.UI.Inspectors;
|
using UnityExplorer.Inspectors;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CacheObject
|
namespace UnityExplorer.CacheObject
|
||||||
{
|
{
|
||||||
public class CacheMethod : CacheMember
|
public class CacheMethod : CacheMember
|
||||||
{
|
{
|
@ -7,11 +7,12 @@ using System.Text;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Core.Runtime;
|
using UnityExplorer.Core.Runtime;
|
||||||
using UnityExplorer.UI.CacheObject.IValues;
|
using UnityExplorer.CacheObject.IValues;
|
||||||
using UnityExplorer.UI.CacheObject.Views;
|
using UnityExplorer.CacheObject.Views;
|
||||||
using UnityExplorer.UI.Models;
|
using UnityExplorer.UI.Models;
|
||||||
|
using UnityExplorer.UI;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CacheObject
|
namespace UnityExplorer.CacheObject
|
||||||
{
|
{
|
||||||
public enum ValueState
|
public enum ValueState
|
||||||
{
|
{
|
@ -3,9 +3,9 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityExplorer.UI.Inspectors;
|
using UnityExplorer.Inspectors;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CacheObject
|
namespace UnityExplorer.CacheObject
|
||||||
{
|
{
|
||||||
public class CacheProperty : CacheMember
|
public class CacheProperty : CacheMember
|
||||||
{
|
{
|
@ -3,10 +3,10 @@ using System.Collections;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityExplorer.UI.CacheObject;
|
using UnityExplorer.CacheObject;
|
||||||
using UnityExplorer.UI.CacheObject.Views;
|
using UnityExplorer.CacheObject.Views;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CacheObject
|
namespace UnityExplorer.CacheObject
|
||||||
{
|
{
|
||||||
public interface ICacheObjectController
|
public interface ICacheObjectController
|
||||||
{
|
{
|
@ -4,9 +4,10 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.UI.CacheObject;
|
using UnityExplorer.CacheObject;
|
||||||
|
using UnityExplorer.UI;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CacheObject.IValues
|
namespace UnityExplorer.CacheObject.IValues
|
||||||
{
|
{
|
||||||
public class InteractiveColor : InteractiveValue
|
public class InteractiveColor : InteractiveValue
|
||||||
{
|
{
|
@ -5,13 +5,14 @@ using System.Linq;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.UI.CacheObject;
|
using UnityExplorer.CacheObject;
|
||||||
using UnityExplorer.UI.CacheObject.Views;
|
using UnityExplorer.CacheObject.Views;
|
||||||
using UnityExplorer.UI.Inspectors;
|
using UnityExplorer.Inspectors;
|
||||||
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
using UnityExplorer.UI.Widgets;
|
using UnityExplorer.UI.Widgets;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CacheObject.IValues
|
namespace UnityExplorer.CacheObject.IValues
|
||||||
{
|
{
|
||||||
public class InteractiveDictionary : InteractiveValue, ICellPoolDataSource<CacheKeyValuePairCell>, ICacheObjectController
|
public class InteractiveDictionary : InteractiveValue, ICellPoolDataSource<CacheKeyValuePairCell>, ICacheObjectController
|
||||||
{
|
{
|
@ -5,9 +5,10 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.UI.CacheObject;
|
using UnityExplorer.CacheObject;
|
||||||
|
using UnityExplorer.UI;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CacheObject.IValues
|
namespace UnityExplorer.CacheObject.IValues
|
||||||
{
|
{
|
||||||
public class InteractiveEnum : InteractiveValue
|
public class InteractiveEnum : InteractiveValue
|
||||||
{
|
{
|
@ -5,13 +5,14 @@ using System.Linq;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.UI.CacheObject;
|
using UnityExplorer.CacheObject;
|
||||||
using UnityExplorer.UI.CacheObject.Views;
|
using UnityExplorer.CacheObject.Views;
|
||||||
using UnityExplorer.UI.Inspectors;
|
using UnityExplorer.Inspectors;
|
||||||
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
using UnityExplorer.UI.Widgets;
|
using UnityExplorer.UI.Widgets;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CacheObject.IValues
|
namespace UnityExplorer.CacheObject.IValues
|
||||||
{
|
{
|
||||||
public class InteractiveList : InteractiveValue, ICellPoolDataSource<CacheListEntryCell>, ICacheObjectController
|
public class InteractiveList : InteractiveValue, ICellPoolDataSource<CacheListEntryCell>, ICacheObjectController
|
||||||
{
|
{
|
@ -6,10 +6,11 @@ using System.Text;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Core.Config;
|
using UnityExplorer.Core.Config;
|
||||||
using UnityExplorer.UI.CacheObject;
|
using UnityExplorer.CacheObject;
|
||||||
using UnityExplorer.UI.Widgets;
|
using UnityExplorer.UI.Widgets;
|
||||||
|
using UnityExplorer.UI;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CacheObject.IValues
|
namespace UnityExplorer.CacheObject.IValues
|
||||||
{
|
{
|
||||||
public class InteractiveString : InteractiveValue
|
public class InteractiveString : InteractiveValue
|
||||||
{
|
{
|
@ -4,10 +4,11 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.UI.CacheObject;
|
using UnityExplorer.CacheObject;
|
||||||
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Models;
|
using UnityExplorer.UI.Models;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CacheObject.IValues
|
namespace UnityExplorer.CacheObject.IValues
|
||||||
{
|
{
|
||||||
public abstract class InteractiveValue : IPooledObject
|
public abstract class InteractiveValue : IPooledObject
|
||||||
{
|
{
|
@ -5,9 +5,10 @@ using System.Reflection;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.UI.CacheObject;
|
using UnityExplorer.CacheObject;
|
||||||
|
using UnityExplorer.UI;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CacheObject.IValues
|
namespace UnityExplorer.CacheObject.IValues
|
||||||
{
|
{
|
||||||
public class InteractiveValueStruct : InteractiveValue
|
public class InteractiveValueStruct : InteractiveValue
|
||||||
{
|
{
|
@ -4,8 +4,9 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using UnityExplorer.UI;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CacheObject.Views
|
namespace UnityExplorer.CacheObject.Views
|
||||||
{
|
{
|
||||||
public class ConfigEntryCell : CacheObjectCell
|
public class ConfigEntryCell : CacheObjectCell
|
||||||
{
|
{
|
@ -4,11 +4,12 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.UI.CacheObject.IValues;
|
using UnityExplorer.CacheObject.IValues;
|
||||||
using UnityExplorer.UI.Inspectors;
|
using UnityExplorer.Inspectors;
|
||||||
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Widgets;
|
using UnityExplorer.UI.Widgets;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CacheObject.Views
|
namespace UnityExplorer.CacheObject.Views
|
||||||
{
|
{
|
||||||
public class CacheKeyValuePairCell : CacheObjectCell
|
public class CacheKeyValuePairCell : CacheObjectCell
|
||||||
{
|
{
|
@ -4,9 +4,9 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.UI.CacheObject.IValues;
|
using UnityExplorer.CacheObject.IValues;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CacheObject.Views
|
namespace UnityExplorer.CacheObject.Views
|
||||||
{
|
{
|
||||||
public class CacheListEntryCell : CacheObjectCell
|
public class CacheListEntryCell : CacheObjectCell
|
||||||
{
|
{
|
@ -4,9 +4,10 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Widgets;
|
using UnityExplorer.UI.Widgets;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CacheObject.Views
|
namespace UnityExplorer.CacheObject.Views
|
||||||
{
|
{
|
||||||
public class CacheMemberCell : CacheObjectCell
|
public class CacheMemberCell : CacheObjectCell
|
||||||
{
|
{
|
@ -4,11 +4,12 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.UI.CacheObject.IValues;
|
using UnityExplorer.CacheObject.IValues;
|
||||||
using UnityExplorer.UI.Inspectors;
|
using UnityExplorer.Inspectors;
|
||||||
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Widgets;
|
using UnityExplorer.UI.Widgets;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CacheObject.Views
|
namespace UnityExplorer.CacheObject.Views
|
||||||
{
|
{
|
||||||
public abstract class CacheObjectCell : ICell
|
public abstract class CacheObjectCell : ICell
|
||||||
{
|
{
|
@ -5,10 +5,11 @@ using System.Reflection;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Models;
|
using UnityExplorer.UI.Models;
|
||||||
using UnityExplorer.UI.Widgets.AutoComplete;
|
using UnityExplorer.UI.Widgets.AutoComplete;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.CacheObject.Views
|
namespace UnityExplorer.CacheObject.Views
|
||||||
{
|
{
|
||||||
public class EvaluateWidget : IPooledObject
|
public class EvaluateWidget : IPooledObject
|
||||||
{
|
{
|
@ -116,7 +116,7 @@ namespace UnityExplorer.Core.Config
|
|||||||
Reflection_Signature_Blacklist = new ConfigElement<string>("Member Signature Blacklist",
|
Reflection_Signature_Blacklist = new ConfigElement<string>("Member Signature Blacklist",
|
||||||
"Use this to blacklist certain member signatures if they are known to cause a crash or other issues.\r\n" +
|
"Use this to blacklist certain member signatures if they are known to cause a crash or other issues.\r\n" +
|
||||||
"Seperate signatures with a semicolon ';'.\r\n" +
|
"Seperate signatures with a semicolon ';'.\r\n" +
|
||||||
"For example, to blacklist Camera.main, you would add 'Camera.main;'",
|
"For example, to blacklist Camera.main, you would add 'UnityEngine.Camera.main;'",
|
||||||
"");
|
"");
|
||||||
|
|
||||||
// Internal configs (panel save data)
|
// Internal configs (panel save data)
|
||||||
|
@ -99,8 +99,10 @@ namespace UnityExplorer
|
|||||||
|
|
||||||
public static Exception GetInnerMostException(this Exception e)
|
public static Exception GetInnerMostException(this Exception e)
|
||||||
{
|
{
|
||||||
while (e.InnerException != null)
|
while (e != null)
|
||||||
{
|
{
|
||||||
|
if (e.InnerException == null)
|
||||||
|
break;
|
||||||
#if CPP
|
#if CPP
|
||||||
if (e.InnerException is System.Runtime.CompilerServices.RuntimeWrappedException)
|
if (e.InnerException is System.Runtime.CompilerServices.RuntimeWrappedException)
|
||||||
break;
|
break;
|
||||||
|
@ -132,7 +132,6 @@ namespace UnityExplorer
|
|||||||
return null;
|
return null;
|
||||||
|
|
||||||
var type = obj.GetType();
|
var type = obj.GetType();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (IsString(obj))
|
if (IsString(obj))
|
||||||
@ -216,7 +215,7 @@ namespace UnityExplorer
|
|||||||
// from other structs to il2cpp object
|
// from other structs to il2cpp object
|
||||||
else if (typeof(Il2CppSystem.Object).IsAssignableFrom(castTo))
|
else if (typeof(Il2CppSystem.Object).IsAssignableFrom(castTo))
|
||||||
{
|
{
|
||||||
return BoxIl2CppObject(obj);
|
return BoxIl2CppObject(obj).TryCast(castTo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return obj;
|
return obj;
|
||||||
@ -295,7 +294,27 @@ namespace UnityExplorer
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (toType.IsEnum)
|
if (toType.IsEnum)
|
||||||
|
{
|
||||||
|
// Check for nullable enums
|
||||||
|
var type = cppObj.GetType();
|
||||||
|
if (type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Il2CppSystem.Nullable<>))
|
||||||
|
{
|
||||||
|
var nullable = cppObj.TryCast(type);
|
||||||
|
var nullableHasValueProperty = type.GetProperty("HasValue");
|
||||||
|
if ((bool)nullableHasValueProperty.GetValue(nullable, null))
|
||||||
|
{
|
||||||
|
// nullable has a value.
|
||||||
|
var nullableValueProperty = type.GetProperty("Value");
|
||||||
|
return Enum.Parse(toType, nullableValueProperty.GetValue(nullable, null).ToString());
|
||||||
|
}
|
||||||
|
// nullable and no current value.
|
||||||
|
return cppObj;
|
||||||
|
}
|
||||||
|
|
||||||
return Enum.Parse(toType, cppObj.ToString());
|
return Enum.Parse(toType, cppObj.ToString());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Not enum, unbox with Il2CppObjectBase.Unbox
|
||||||
|
|
||||||
var name = toType.AssemblyQualifiedName;
|
var name = toType.AssemblyQualifiedName;
|
||||||
|
|
||||||
@ -780,21 +799,24 @@ namespace UnityExplorer
|
|||||||
|
|
||||||
// Some ugly reflection to use the il2cpp interface for the instance type
|
// Some ugly reflection to use the il2cpp interface for the instance type
|
||||||
|
|
||||||
var type = list.GetType();
|
var type = list.GetActualType();
|
||||||
var key = type.AssemblyQualifiedName;
|
var key = type.AssemblyQualifiedName;
|
||||||
|
|
||||||
if (!getEnumeratorMethods.ContainsKey(key))
|
if (!getEnumeratorMethods.ContainsKey(key))
|
||||||
{
|
{
|
||||||
getEnumeratorMethods.Add(key, type.GetMethod("GetEnumerator"));
|
var method = type.GetMethod("GetEnumerator")
|
||||||
|
?? type.GetMethod("System_Collections_IEnumerable_GetEnumerator", FLAGS);
|
||||||
|
getEnumeratorMethods.Add(key, method);
|
||||||
|
|
||||||
// ensure the enumerator type is supported
|
// ensure the enumerator type is supported
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var test = getEnumeratorMethods[key].Invoke(list, null);
|
var test = getEnumeratorMethods[key].Invoke(list, null);
|
||||||
test.GetType().GetMethod("MoveNext").Invoke(test, null);
|
test.GetActualType().GetMethod("MoveNext").Invoke(test, null);
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
ExplorerCore.Log($"IEnumerable failed to enumerate: {ex}");
|
||||||
notSupportedTypes.Add(key);
|
notSupportedTypes.Add(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -803,7 +825,7 @@ namespace UnityExplorer
|
|||||||
throw new NotSupportedException($"The IEnumerable type '{type.FullName}' does not support MoveNext.");
|
throw new NotSupportedException($"The IEnumerable type '{type.FullName}' does not support MoveNext.");
|
||||||
|
|
||||||
cppEnumerator = getEnumeratorMethods[key].Invoke(list, null);
|
cppEnumerator = getEnumeratorMethods[key].Invoke(list, null);
|
||||||
var enumeratorType = cppEnumerator.GetType();
|
var enumeratorType = cppEnumerator.GetActualType();
|
||||||
|
|
||||||
var enumInfoKey = enumeratorType.AssemblyQualifiedName;
|
var enumInfoKey = enumeratorType.AssemblyQualifiedName;
|
||||||
|
|
||||||
@ -857,7 +879,7 @@ namespace UnityExplorer
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var type = dictionary.GetType();
|
var type = dictionary.GetActualType();
|
||||||
|
|
||||||
if (typeof(Il2CppSystem.Collections.Hashtable).IsAssignableFrom(type))
|
if (typeof(Il2CppSystem.Collections.Hashtable).IsAssignableFrom(type))
|
||||||
{
|
{
|
||||||
@ -867,20 +889,23 @@ namespace UnityExplorer
|
|||||||
|
|
||||||
var keys = type.GetProperty("Keys").GetValue(dictionary, null);
|
var keys = type.GetProperty("Keys").GetValue(dictionary, null);
|
||||||
|
|
||||||
var keyCollType = keys.GetType();
|
var keyCollType = keys.GetActualType();
|
||||||
var cacheKey = keys.GetType().AssemblyQualifiedName;
|
var cacheKey = keyCollType.AssemblyQualifiedName;
|
||||||
if (!getEnumeratorMethods.ContainsKey(cacheKey))
|
if (!getEnumeratorMethods.ContainsKey(cacheKey))
|
||||||
{
|
{
|
||||||
getEnumeratorMethods.Add(cacheKey, keyCollType.GetMethod("GetEnumerator"));
|
var method = keyCollType.GetMethod("GetEnumerator")
|
||||||
|
?? keyCollType.GetMethod("System_Collections_IDictionary_GetEnumerator", FLAGS);
|
||||||
|
getEnumeratorMethods.Add(cacheKey, method);
|
||||||
|
|
||||||
// test support
|
// test support
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var test = getEnumeratorMethods[cacheKey].Invoke(keys, null);
|
var test = getEnumeratorMethods[cacheKey].Invoke(keys, null);
|
||||||
test.GetType().GetMethod("MoveNext").Invoke(test, null);
|
test.GetActualType().GetMethod("MoveNext").Invoke(test, null);
|
||||||
}
|
}
|
||||||
catch
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
ExplorerCore.Log($"IDictionary failed to enumerate: {ex}");
|
||||||
notSupportedTypes.Add(cacheKey);
|
notSupportedTypes.Add(cacheKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -891,16 +916,16 @@ namespace UnityExplorer
|
|||||||
var keyEnumerator = getEnumeratorMethods[cacheKey].Invoke(keys, null);
|
var keyEnumerator = getEnumeratorMethods[cacheKey].Invoke(keys, null);
|
||||||
var keyInfo = new EnumeratorInfo
|
var keyInfo = new EnumeratorInfo
|
||||||
{
|
{
|
||||||
current = keyEnumerator.GetType().GetProperty("Current"),
|
current = keyEnumerator.GetActualType().GetProperty("Current"),
|
||||||
moveNext = keyEnumerator.GetType().GetMethod("MoveNext"),
|
moveNext = keyEnumerator.GetActualType().GetMethod("MoveNext"),
|
||||||
};
|
};
|
||||||
|
|
||||||
var values = type.GetProperty("Values").GetValue(dictionary, null);
|
var values = type.GetProperty("Values").GetValue(dictionary, null);
|
||||||
var valueEnumerator = values.GetType().GetMethod("GetEnumerator").Invoke(values, null);
|
var valueEnumerator = values.GetActualType().GetMethod("GetEnumerator").Invoke(values, null);
|
||||||
var valueInfo = new EnumeratorInfo
|
var valueInfo = new EnumeratorInfo
|
||||||
{
|
{
|
||||||
current = valueEnumerator.GetType().GetProperty("Current"),
|
current = valueEnumerator.GetActualType().GetProperty("Current"),
|
||||||
moveNext = valueEnumerator.GetType().GetMethod("MoveNext"),
|
moveNext = valueEnumerator.GetActualType().GetMethod("MoveNext"),
|
||||||
};
|
};
|
||||||
|
|
||||||
dictEnumerator = EnumerateCppDict(keyInfo, keyEnumerator, valueInfo, valueEnumerator);
|
dictEnumerator = EnumerateCppDict(keyInfo, keyEnumerator, valueInfo, valueEnumerator);
|
||||||
|
@ -87,6 +87,7 @@ namespace UnityExplorer
|
|||||||
{
|
{
|
||||||
foreach (var type in asm.TryGetTypes())
|
foreach (var type in asm.TryGetTypes())
|
||||||
{
|
{
|
||||||
|
// Cache namespace if there is one
|
||||||
if (!string.IsNullOrEmpty(type.Namespace) && !uniqueNamespaces.Contains(type.Namespace))
|
if (!string.IsNullOrEmpty(type.Namespace) && !uniqueNamespaces.Contains(type.Namespace))
|
||||||
{
|
{
|
||||||
uniqueNamespaces.Add(type.Namespace);
|
uniqueNamespaces.Add(type.Namespace);
|
||||||
@ -100,16 +101,16 @@ namespace UnityExplorer
|
|||||||
AllNamespaces.Insert(i, type.Namespace);
|
AllNamespaces.Insert(i, type.Namespace);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cache the type. Overwrite type if one exists with the full name
|
||||||
if (AllTypes.ContainsKey(type.FullName))
|
if (AllTypes.ContainsKey(type.FullName))
|
||||||
AllTypes[type.FullName] = type;
|
AllTypes[type.FullName] = type;
|
||||||
else
|
else
|
||||||
{
|
|
||||||
AllTypes.Add(type.FullName, type);
|
AllTypes.Add(type.FullName, type);
|
||||||
//allTypeNames.Add(type.FullName);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Invoke listener
|
||||||
OnTypeLoaded?.Invoke(type);
|
OnTypeLoaded?.Invoke(type);
|
||||||
|
|
||||||
|
// Check type inheritance cache, add this to any lists it should be in
|
||||||
foreach (var key in typeInheritance.Keys)
|
foreach (var key in typeInheritance.Keys)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -154,13 +155,6 @@ namespace UnityExplorer
|
|||||||
internal virtual string Internal_ProcessTypeInString(string theString, Type type)
|
internal virtual string Internal_ProcessTypeInString(string theString, Type type)
|
||||||
=> theString;
|
=> theString;
|
||||||
|
|
||||||
//// Force loading modules
|
|
||||||
//public static bool LoadModule(string moduleName)
|
|
||||||
// => Instance.Internal_LoadModule(moduleName);
|
|
||||||
//
|
|
||||||
//internal virtual bool Internal_LoadModule(string moduleName)
|
|
||||||
// => false;
|
|
||||||
|
|
||||||
// Singleton finder
|
// Singleton finder
|
||||||
|
|
||||||
public static void FindSingleton(string[] possibleNames, Type type, BindingFlags flags, List<object> instances)
|
public static void FindSingleton(string[] possibleNames, Type type, BindingFlags flags, List<object> instances)
|
||||||
|
@ -6,7 +6,7 @@ using System.Reflection;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityExplorer.UI;
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.CacheObject.IValues;
|
using UnityExplorer.CacheObject.IValues;
|
||||||
#if CPP
|
#if CPP
|
||||||
using UnhollowerRuntimeLib;
|
using UnhollowerRuntimeLib;
|
||||||
using UnhollowerBaseLib;
|
using UnhollowerBaseLib;
|
||||||
|
@ -2,9 +2,11 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Events;
|
using UnityEngine.Events;
|
||||||
|
using UnityEngine.UI;
|
||||||
using Object = UnityEngine.Object;
|
using Object = UnityEngine.Object;
|
||||||
|
|
||||||
// Project-wide namespace for accessibility
|
// Project-wide namespace for accessibility
|
||||||
@ -107,5 +109,16 @@ namespace UnityExplorer
|
|||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static PropertyInfo onEndEdit;
|
||||||
|
|
||||||
|
public static UnityEvent<string> GetOnEndEdit(this InputField _this)
|
||||||
|
{
|
||||||
|
if (onEndEdit == null)
|
||||||
|
onEndEdit = typeof(InputField).GetProperty("onEndEdit")
|
||||||
|
?? throw new Exception("Could not get InputField.onEndEdit property!");
|
||||||
|
|
||||||
|
return onEndEdit.GetValue(_this, null).TryCast<UnityEvent<string>>();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,8 @@ using UnityExplorer.Core.Input;
|
|||||||
using UnityExplorer.Core.Runtime;
|
using UnityExplorer.Core.Runtime;
|
||||||
using UnityExplorer.Tests;
|
using UnityExplorer.Tests;
|
||||||
using UnityExplorer.UI;
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Inspectors;
|
using UnityExplorer.Inspectors;
|
||||||
using UnityExplorer.UI.ObjectExplorer;
|
using UnityExplorer.ObjectExplorer;
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
|
|
||||||
namespace UnityExplorer
|
namespace UnityExplorer
|
||||||
@ -20,7 +20,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.1.4";
|
public const string VERSION = "4.1.9";
|
||||||
public const string AUTHOR = "Sinai";
|
public const string AUTHOR = "Sinai";
|
||||||
public const string GUID = "com.sinai.unityexplorer";
|
public const string GUID = "com.sinai.unityexplorer";
|
||||||
|
|
||||||
|
@ -6,12 +6,13 @@ using System.Text;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Core.Input;
|
using UnityExplorer.Core.Input;
|
||||||
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Models;
|
using UnityExplorer.UI.Models;
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
using UnityExplorer.UI.Widgets;
|
using UnityExplorer.UI.Widgets;
|
||||||
using UnityExplorer.UI.Widgets.AutoComplete;
|
using UnityExplorer.UI.Widgets.AutoComplete;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Inspectors
|
namespace UnityExplorer.Inspectors
|
||||||
{
|
{
|
||||||
public class GameObjectInspector : InspectorBase
|
public class GameObjectInspector : InspectorBase
|
||||||
{
|
{
|
@ -4,9 +4,10 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Widgets;
|
using UnityExplorer.UI.Widgets;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Inspectors
|
namespace UnityExplorer.Inspectors
|
||||||
{
|
{
|
||||||
public class ComponentCell : ButtonCell
|
public class ComponentCell : ButtonCell
|
||||||
{
|
{
|
@ -5,7 +5,7 @@ using System.Text;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityExplorer.UI.Widgets;
|
using UnityExplorer.UI.Widgets;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Inspectors
|
namespace UnityExplorer.Inspectors
|
||||||
{
|
{
|
||||||
public class ComponentList : ButtonListHandler<Component, ComponentCell>
|
public class ComponentList : ButtonListHandler<Component, ComponentCell>
|
||||||
{
|
{
|
@ -5,8 +5,9 @@ using System.Text;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Core.Input;
|
using UnityExplorer.Core.Input;
|
||||||
|
using UnityExplorer.UI;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Inspectors
|
namespace UnityExplorer.Inspectors
|
||||||
{
|
{
|
||||||
public class GameObjectControls
|
public class GameObjectControls
|
||||||
{
|
{
|
||||||
@ -234,7 +235,7 @@ namespace UnityExplorer.UI.Inspectors
|
|||||||
|
|
||||||
private void OnExploreButtonClicked()
|
private void OnExploreButtonClicked()
|
||||||
{
|
{
|
||||||
var panel = UIManager.GetPanel<Panels.ObjectExplorerPanel>(UIManager.Panels.ObjectExplorer);
|
var panel = UIManager.GetPanel<UI.Panels.ObjectExplorerPanel>(UIManager.Panels.ObjectExplorer);
|
||||||
panel.SceneExplorer.JumpToTransform(this.Parent.GOTarget.transform);
|
panel.SceneExplorer.JumpToTransform(this.Parent.GOTarget.transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -468,7 +469,7 @@ namespace UnityExplorer.UI.Inspectors
|
|||||||
//UIFactory.SetLayoutElement(pathApplyBtn.Component.gameObject, minHeight: 25, minWidth: 120);
|
//UIFactory.SetLayoutElement(pathApplyBtn.Component.gameObject, minHeight: 25, minWidth: 120);
|
||||||
//pathApplyBtn.OnClick += () => { OnPathEndEdit(PathInput.Text); };
|
//pathApplyBtn.OnClick += () => { OnPathEndEdit(PathInput.Text); };
|
||||||
|
|
||||||
PathInput.Component.onEndEdit.AddListener((string val) => { OnPathEndEdit(val); });
|
PathInput.Component.GetOnEndEdit().AddListener((string val) => { OnPathEndEdit(val); });
|
||||||
|
|
||||||
// Title and update row
|
// Title and update row
|
||||||
|
|
||||||
@ -484,7 +485,7 @@ namespace UnityExplorer.UI.Inspectors
|
|||||||
NameInput = UIFactory.CreateInputField(titleRow, "NameInput", "untitled");
|
NameInput = UIFactory.CreateInputField(titleRow, "NameInput", "untitled");
|
||||||
UIFactory.SetLayoutElement(NameInput.Component.gameObject, minHeight: 30, minWidth: 100, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(NameInput.Component.gameObject, minHeight: 30, minWidth: 100, flexibleWidth: 9999);
|
||||||
NameInput.Component.textComponent.fontSize = 15;
|
NameInput.Component.textComponent.fontSize = 15;
|
||||||
NameInput.Component.onEndEdit.AddListener((string val) => { OnNameEndEdit(val); });
|
NameInput.Component.GetOnEndEdit().AddListener((string val) => { OnNameEndEdit(val); });
|
||||||
|
|
||||||
// second row (toggles, instanceID, tag, buttons)
|
// second row (toggles, instanceID, tag, buttons)
|
||||||
|
|
||||||
@ -521,7 +522,7 @@ namespace UnityExplorer.UI.Inspectors
|
|||||||
TagInput = UIFactory.CreateInputField(secondRow, "TagInput", "none");
|
TagInput = UIFactory.CreateInputField(secondRow, "TagInput", "none");
|
||||||
UIFactory.SetLayoutElement(TagInput.Component.gameObject, minHeight: 25, minWidth: 100, flexibleWidth: 999);
|
UIFactory.SetLayoutElement(TagInput.Component.gameObject, minHeight: 25, minWidth: 100, flexibleWidth: 999);
|
||||||
TagInput.Component.textComponent.color = Color.white;
|
TagInput.Component.textComponent.color = Color.white;
|
||||||
TagInput.Component.onEndEdit.AddListener((string val) => { OnTagEndEdit(val); });
|
TagInput.Component.GetOnEndEdit().AddListener((string val) => { OnTagEndEdit(val); });
|
||||||
|
|
||||||
// Instantiate
|
// Instantiate
|
||||||
var instantiateBtn = UIFactory.CreateButton(secondRow, "InstantiateBtn", "Instantiate", new Color(0.2f, 0.2f, 0.2f));
|
var instantiateBtn = UIFactory.CreateButton(secondRow, "InstantiateBtn", "Instantiate", new Color(0.2f, 0.2f, 0.2f));
|
||||||
@ -644,7 +645,7 @@ namespace UnityExplorer.UI.Inspectors
|
|||||||
var inputField = UIFactory.CreateInputField(rowObj, "InputField", "...");
|
var inputField = UIFactory.CreateInputField(rowObj, "InputField", "...");
|
||||||
UIFactory.SetLayoutElement(inputField.Component.gameObject, minHeight: 25, minWidth: 100, flexibleWidth: 999);
|
UIFactory.SetLayoutElement(inputField.Component.gameObject, minHeight: 25, minWidth: 100, flexibleWidth: 999);
|
||||||
|
|
||||||
inputField.Component.onEndEdit.AddListener((string value) => { OnTransformInputEndEdit(type, value); });
|
inputField.Component.GetOnEndEdit().AddListener((string value) => { OnTransformInputEndEdit(type, value); });
|
||||||
|
|
||||||
var control = new TransformControl(type, inputField);
|
var control = new TransformControl(type, inputField);
|
||||||
|
|
@ -11,7 +11,7 @@ using UnityExplorer.Core.Runtime;
|
|||||||
using UnityExplorer.UI;
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Inspectors
|
namespace UnityExplorer.Inspectors
|
||||||
{
|
{
|
||||||
public enum MouseInspectMode
|
public enum MouseInspectMode
|
||||||
{
|
{
|
||||||
@ -67,8 +67,12 @@ namespace UnityExplorer.UI.Inspectors
|
|||||||
public void StartInspect(MouseInspectMode mode)
|
public void StartInspect(MouseInspectMode mode)
|
||||||
{
|
{
|
||||||
MainCamera = Camera.main;
|
MainCamera = Camera.main;
|
||||||
if (!MainCamera)
|
|
||||||
|
if (!MainCamera && mode == MouseInspectMode.World)
|
||||||
|
{
|
||||||
|
ExplorerCore.LogWarning("No MainCamera found! Cannot inspect world!");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
PanelDragger.ForceEnd();
|
PanelDragger.ForceEnd();
|
||||||
|
|
@ -4,10 +4,11 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Models;
|
using UnityExplorer.UI.Models;
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Inspectors
|
namespace UnityExplorer.Inspectors
|
||||||
{
|
{
|
||||||
public abstract class InspectorBase : IPooledObject
|
public abstract class InspectorBase : IPooledObject
|
||||||
{
|
{
|
@ -5,8 +5,8 @@ using System.Text;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.UI;
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.CacheObject;
|
using UnityExplorer.CacheObject;
|
||||||
using UnityExplorer.UI.Inspectors;
|
using UnityExplorer.Inspectors;
|
||||||
using UnityExplorer.UI.Models;
|
using UnityExplorer.UI.Models;
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
|
|
@ -4,10 +4,11 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Models;
|
using UnityExplorer.UI.Models;
|
||||||
using UnityExplorer.UI.Widgets;
|
using UnityExplorer.UI.Widgets;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Inspectors
|
namespace UnityExplorer.Inspectors
|
||||||
{
|
{
|
||||||
public class InspectorTab : IPooledObject
|
public class InspectorTab : IPooledObject
|
||||||
{
|
{
|
@ -10,12 +10,13 @@ using UnityEngine;
|
|||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Core.Config;
|
using UnityExplorer.Core.Config;
|
||||||
using UnityExplorer.Core.Runtime;
|
using UnityExplorer.Core.Runtime;
|
||||||
using UnityExplorer.UI.CacheObject;
|
using UnityExplorer.CacheObject;
|
||||||
using UnityExplorer.UI.CacheObject.Views;
|
using UnityExplorer.CacheObject.Views;
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
using UnityExplorer.UI.Widgets;
|
using UnityExplorer.UI.Widgets;
|
||||||
|
using UnityExplorer.UI;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Inspectors
|
namespace UnityExplorer.Inspectors
|
||||||
{
|
{
|
||||||
public class ReflectionInspector : InspectorBase, ICellPoolDataSource<CacheMemberCell>, ICacheObjectController
|
public class ReflectionInspector : InspectorBase, ICellPoolDataSource<CacheMemberCell>, ICacheObjectController
|
||||||
{
|
{
|
@ -21,11 +21,7 @@ namespace UnityExplorer.Loader.BIE
|
|||||||
|
|
||||||
public override void RegisterConfigElement<T>(ConfigElement<T> config)
|
public override void RegisterConfigElement<T>(ConfigElement<T> config)
|
||||||
{
|
{
|
||||||
object[] tags = null;
|
var entry = Config.Bind(CTG_NAME, config.Name, config.Value, config.Description);
|
||||||
if (config.IsInternal)
|
|
||||||
tags = new[] { "Advanced" };
|
|
||||||
|
|
||||||
var entry = Config.Bind(CTG_NAME, config.Name, config.Value, new ConfigDescription(config.Description, null, tags));
|
|
||||||
|
|
||||||
entry.SettingChanged += (object o, EventArgs e) =>
|
entry.SettingChanged += (object o, EventArgs e) =>
|
||||||
{
|
{
|
||||||
|
@ -4,12 +4,13 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Models;
|
using UnityExplorer.UI.Models;
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
using UnityExplorer.UI.Widgets;
|
using UnityExplorer.UI.Widgets;
|
||||||
using UnityExplorer.UI.Widgets.AutoComplete;
|
using UnityExplorer.UI.Widgets.AutoComplete;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.ObjectExplorer
|
namespace UnityExplorer.ObjectExplorer
|
||||||
{
|
{
|
||||||
public class ObjectSearch : UIModel
|
public class ObjectSearch : UIModel
|
||||||
{
|
{
|
||||||
@ -52,8 +53,8 @@ namespace UnityExplorer.UI.ObjectExplorer
|
|||||||
|
|
||||||
if (m_context == SearchContext.Singleton)
|
if (m_context == SearchContext.Singleton)
|
||||||
currentResults = SearchProvider.SingletonSearch(nameInputField.Text);
|
currentResults = SearchProvider.SingletonSearch(nameInputField.Text);
|
||||||
else if (m_context == SearchContext.StaticClass)
|
else if (m_context == SearchContext.Class)
|
||||||
currentResults = SearchProvider.StaticClassSearch(nameInputField.Text);
|
currentResults = SearchProvider.ClassSearch(nameInputField.Text);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string compType = "";
|
string compType = "";
|
||||||
@ -129,8 +130,11 @@ namespace UnityExplorer.UI.ObjectExplorer
|
|||||||
if (!cachedCellTexts.ContainsKey(index))
|
if (!cachedCellTexts.ContainsKey(index))
|
||||||
{
|
{
|
||||||
string text;
|
string text;
|
||||||
if (m_context == SearchContext.StaticClass)
|
if (m_context == SearchContext.Class)
|
||||||
text = SignatureHighlighter.Parse(currentResults[index] as Type, true);
|
{
|
||||||
|
var type = currentResults[index] as Type;
|
||||||
|
text = $"{SignatureHighlighter.Parse(type, true)} <color=grey><i>({type.Assembly.GetName().Name})</i></color>";
|
||||||
|
}
|
||||||
else
|
else
|
||||||
text = ToStringUtility.ToStringWithType(currentResults[index], currentResults[index]?.GetActualType());
|
text = ToStringUtility.ToStringWithType(currentResults[index], currentResults[index]?.GetActualType());
|
||||||
|
|
||||||
@ -142,7 +146,7 @@ namespace UnityExplorer.UI.ObjectExplorer
|
|||||||
|
|
||||||
private void OnCellClicked(int dataIndex)
|
private void OnCellClicked(int dataIndex)
|
||||||
{
|
{
|
||||||
if (m_context == SearchContext.StaticClass)
|
if (m_context == SearchContext.Class)
|
||||||
InspectorManager.Inspect(currentResults[dataIndex] as Type);
|
InspectorManager.Inspect(currentResults[dataIndex] as Type);
|
||||||
else
|
else
|
||||||
InspectorManager.Inspect(currentResults[dataIndex]);
|
InspectorManager.Inspect(currentResults[dataIndex]);
|
@ -8,11 +8,12 @@ using UnityEngine;
|
|||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Core;
|
using UnityExplorer.Core;
|
||||||
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Models;
|
using UnityExplorer.UI.Models;
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
using UnityExplorer.UI.Widgets;
|
using UnityExplorer.UI.Widgets;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.ObjectExplorer
|
namespace UnityExplorer.ObjectExplorer
|
||||||
{
|
{
|
||||||
public class SceneExplorer : UIModel
|
public class SceneExplorer : UIModel
|
||||||
{
|
{
|
@ -6,7 +6,7 @@ using System.Text;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.ObjectExplorer
|
namespace UnityExplorer.ObjectExplorer
|
||||||
{
|
{
|
||||||
public static class SceneHandler
|
public static class SceneHandler
|
||||||
{
|
{
|
@ -8,14 +8,13 @@ using UnityEngine.SceneManagement;
|
|||||||
using UnityExplorer.Core;
|
using UnityExplorer.Core;
|
||||||
using UnityExplorer.Core.Runtime;
|
using UnityExplorer.Core.Runtime;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.ObjectExplorer
|
namespace UnityExplorer.ObjectExplorer
|
||||||
{
|
{
|
||||||
public enum SearchContext
|
public enum SearchContext
|
||||||
{
|
{
|
||||||
UnityObject,
|
UnityObject,
|
||||||
// GameObject,
|
|
||||||
Singleton,
|
Singleton,
|
||||||
StaticClass
|
Class
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ChildFilter
|
public enum ChildFilter
|
||||||
@ -134,7 +133,7 @@ namespace UnityExplorer.UI.ObjectExplorer
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static List<object> StaticClassSearch(string input)
|
internal static List<object> ClassSearch(string input)
|
||||||
{
|
{
|
||||||
var list = new List<object>();
|
var list = new List<object>();
|
||||||
|
|
||||||
@ -144,11 +143,10 @@ namespace UnityExplorer.UI.ObjectExplorer
|
|||||||
|
|
||||||
foreach (var asm in AppDomain.CurrentDomain.GetAssemblies())
|
foreach (var asm in AppDomain.CurrentDomain.GetAssemblies())
|
||||||
{
|
{
|
||||||
foreach (var type in asm.TryGetTypes().Where(it => it.IsSealed && it.IsAbstract))
|
foreach (var type in asm.TryGetTypes())
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(nameFilter) && !type.FullName.ContainsIgnoreCase(nameFilter))
|
if (!string.IsNullOrEmpty(nameFilter) && !type.FullName.ContainsIgnoreCase(nameFilter))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
list.Add(type);
|
list.Add(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
BIN
src/Resources/legacy.5.6.bundle
Normal file
BIN
src/Resources/legacy.5.6.bundle
Normal file
Binary file not shown.
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -6,7 +7,7 @@ using UnityEngine;
|
|||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Core.Config;
|
using UnityExplorer.Core.Config;
|
||||||
using UnityExplorer.UI.CSConsole;
|
using UnityExplorer.CSConsole;
|
||||||
using UnityExplorer.UI.Widgets;
|
using UnityExplorer.UI.Widgets;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Panels
|
namespace UnityExplorer.UI.Panels
|
||||||
@ -18,10 +19,11 @@ namespace UnityExplorer.UI.Panels
|
|||||||
public override int MinWidth => 750;
|
public override int MinWidth => 750;
|
||||||
public override int MinHeight => 300;
|
public override int MinHeight => 300;
|
||||||
|
|
||||||
public InputFieldScroller InputScroll { get; private set; }
|
public InputFieldScroller InputScroller { get; private set; }
|
||||||
public InputFieldRef Input => InputScroll.InputField;
|
public InputFieldRef Input => InputScroller.InputField;
|
||||||
public Text InputText { get; private set; }
|
public Text InputText { get; private set; }
|
||||||
public Text HighlightText { get; private set; }
|
public Text HighlightText { get; private set; }
|
||||||
|
public Text LineNumberText { get; private set; }
|
||||||
|
|
||||||
public Dropdown HelpDropdown { get; private set; }
|
public Dropdown HelpDropdown { get; private set; }
|
||||||
|
|
||||||
@ -33,6 +35,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
public Action<bool> OnCtrlRToggled;
|
public Action<bool> OnCtrlRToggled;
|
||||||
public Action<bool> OnSuggestionsToggled;
|
public Action<bool> OnSuggestionsToggled;
|
||||||
public Action<bool> OnAutoIndentToggled;
|
public Action<bool> OnAutoIndentToggled;
|
||||||
|
public Action OnPanelResized;
|
||||||
|
|
||||||
private void InvokeOnValueChanged(string value)
|
private void InvokeOnValueChanged(string value)
|
||||||
{
|
{
|
||||||
@ -60,6 +63,11 @@ namespace UnityExplorer.UI.Panels
|
|||||||
|
|
||||||
// UI Construction
|
// UI Construction
|
||||||
|
|
||||||
|
public override void OnFinishResize(RectTransform panel)
|
||||||
|
{
|
||||||
|
OnPanelResized?.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
protected internal override void DoSetDefaultPosAndAnchors()
|
protected internal override void DoSetDefaultPosAndAnchors()
|
||||||
{
|
{
|
||||||
Rect.localPosition = Vector2.zero;
|
Rect.localPosition = Vector2.zero;
|
||||||
@ -121,19 +129,53 @@ namespace UnityExplorer.UI.Panels
|
|||||||
|
|
||||||
// Console Input
|
// Console Input
|
||||||
|
|
||||||
|
var inputArea = UIFactory.CreateUIObject("InputGroup", content);
|
||||||
|
UIFactory.SetLayoutElement(inputArea, flexibleWidth: 9999, flexibleHeight: 9999);
|
||||||
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(inputArea, false, true, true, true);
|
||||||
|
inputArea.AddComponent<Image>().color = Color.white;
|
||||||
|
inputArea.AddComponent<Mask>().showMaskGraphic = false;
|
||||||
|
|
||||||
|
// line numbers
|
||||||
|
|
||||||
|
var linesHolder = UIFactory.CreateUIObject("LinesHolder", inputArea);
|
||||||
|
var linesRect = linesHolder.GetComponent<RectTransform>();
|
||||||
|
linesRect.pivot = new Vector2(0, 1);
|
||||||
|
linesRect.anchorMin = new Vector2(0, 0);
|
||||||
|
linesRect.anchorMax = new Vector2(0, 1);
|
||||||
|
linesRect.sizeDelta = new Vector2(0, 305000);
|
||||||
|
linesRect.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, 0, 50);
|
||||||
|
linesHolder.AddComponent<Image>().color = new Color(0.05f, 0.05f, 0.05f);
|
||||||
|
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(linesHolder, true, true, true, true);
|
||||||
|
|
||||||
|
LineNumberText = UIFactory.CreateLabel(linesHolder, "LineNumbers", "1", TextAnchor.UpperCenter, Color.grey, fontSize: 16);
|
||||||
|
LineNumberText.font = UIManager.ConsoleFont;
|
||||||
|
|
||||||
|
// input field
|
||||||
|
|
||||||
int fontSize = 16;
|
int fontSize = 16;
|
||||||
|
|
||||||
var inputObj = UIFactory.CreateScrollInputField(this.content, "ConsoleInput", ConsoleController.STARTUP_TEXT, out var inputScroller, fontSize);
|
var inputObj = UIFactory.CreateScrollInputField(inputArea, "ConsoleInput", ConsoleController.STARTUP_TEXT,
|
||||||
InputScroll = inputScroller;
|
out var inputScroller, fontSize);
|
||||||
|
InputScroller = inputScroller;
|
||||||
ConsoleController.defaultInputFieldAlpha = Input.Component.selectionColor.a;
|
ConsoleController.defaultInputFieldAlpha = Input.Component.selectionColor.a;
|
||||||
Input.OnValueChanged += InvokeOnValueChanged;
|
Input.OnValueChanged += InvokeOnValueChanged;
|
||||||
|
|
||||||
|
// move line number text with input field
|
||||||
|
linesRect.transform.SetParent(inputObj.transform.Find("Viewport"), false);
|
||||||
|
inputScroller.Slider.Scrollbar.onValueChanged.AddListener((float val) => { SetLinesPosition(); });
|
||||||
|
inputScroller.Slider.Slider.onValueChanged.AddListener((float val) => { SetLinesPosition(); });
|
||||||
|
void SetLinesPosition()
|
||||||
|
{
|
||||||
|
linesRect.anchoredPosition = new Vector2(linesRect.anchoredPosition.x, inputScroller.ContentRect.anchoredPosition.y);
|
||||||
|
//SetInputLayout();
|
||||||
|
}
|
||||||
|
|
||||||
InputText = Input.Component.textComponent;
|
InputText = Input.Component.textComponent;
|
||||||
InputText.supportRichText = false;
|
InputText.supportRichText = false;
|
||||||
Input.PlaceholderText.fontSize = fontSize;
|
|
||||||
InputText.color = Color.clear;
|
InputText.color = Color.clear;
|
||||||
Input.Component.customCaretColor = true;
|
Input.Component.customCaretColor = true;
|
||||||
Input.Component.caretColor = Color.white;
|
Input.Component.caretColor = Color.white;
|
||||||
|
Input.PlaceholderText.fontSize = fontSize;
|
||||||
|
|
||||||
// Lexer highlight text overlay
|
// Lexer highlight text overlay
|
||||||
var highlightTextObj = UIFactory.CreateUIObject("HighlightText", InputText.gameObject);
|
var highlightTextObj = UIFactory.CreateUIObject("HighlightText", InputText.gameObject);
|
||||||
@ -154,7 +196,19 @@ namespace UnityExplorer.UI.Panels
|
|||||||
Input.PlaceholderText.font = UIManager.ConsoleFont;
|
Input.PlaceholderText.font = UIManager.ConsoleFont;
|
||||||
HighlightText.font = UIManager.ConsoleFont;
|
HighlightText.font = UIManager.ConsoleFont;
|
||||||
|
|
||||||
|
RuntimeProvider.Instance.StartCoroutine(DelayedLayoutSetup());
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerator DelayedLayoutSetup()
|
||||||
|
{
|
||||||
|
yield return null;
|
||||||
|
SetInputLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetInputLayout()
|
||||||
|
{
|
||||||
|
Input.Rect.offsetMin = new Vector2(52, Input.Rect.offsetMin.y);
|
||||||
|
Input.Rect.offsetMax = new Vector2(2, Input.Rect.offsetMax.y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,7 @@ using System.Text;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Core.Config;
|
using UnityExplorer.Core.Config;
|
||||||
using UnityExplorer.UI.Inspectors;
|
using UnityExplorer.Inspectors;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Panels
|
namespace UnityExplorer.UI.Panels
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,7 @@ using UnityEngine.UI;
|
|||||||
using UnityExplorer.Core;
|
using UnityExplorer.Core;
|
||||||
using UnityExplorer.Core.Config;
|
using UnityExplorer.Core.Config;
|
||||||
using UnityExplorer.UI.Models;
|
using UnityExplorer.UI.Models;
|
||||||
using UnityExplorer.UI.ObjectExplorer;
|
using UnityExplorer.ObjectExplorer;
|
||||||
using UnityExplorer.UI.Widgets;
|
using UnityExplorer.UI.Widgets;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Panels
|
namespace UnityExplorer.UI.Panels
|
||||||
|
@ -5,8 +5,8 @@ using System.Text;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Core.Config;
|
using UnityExplorer.Core.Config;
|
||||||
using UnityExplorer.UI.CacheObject;
|
using UnityExplorer.CacheObject;
|
||||||
using UnityExplorer.UI.CacheObject.Views;
|
using UnityExplorer.CacheObject.Views;
|
||||||
using UnityExplorer.UI.Widgets;
|
using UnityExplorer.UI.Widgets;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Panels
|
namespace UnityExplorer.UI.Panels
|
||||||
|
@ -23,6 +23,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
{
|
{
|
||||||
s_resizeCursorObj.SetActive(false);
|
s_resizeCursorObj.SetActive(false);
|
||||||
wasAnyDragging = false;
|
wasAnyDragging = false;
|
||||||
|
Resizing = false;
|
||||||
|
|
||||||
foreach (var instance in Instances)
|
foreach (var instance in Instances)
|
||||||
{
|
{
|
||||||
|
@ -154,14 +154,13 @@ namespace UnityExplorer.UI.Panels
|
|||||||
// Prevent panel going oustide screen bounds
|
// Prevent panel going oustide screen bounds
|
||||||
var halfW = Screen.width * 0.5f;
|
var halfW = Screen.width * 0.5f;
|
||||||
var halfH = Screen.height * 0.5f;
|
var halfH = Screen.height * 0.5f;
|
||||||
pos.x = Math.Max(-halfW, Math.Min(pos.x, halfW - panel.rect.width));
|
|
||||||
pos.y = Math.Max(-halfH + panel.rect.height, Math.Min(pos.y, halfH));
|
pos.x = Math.Max(-halfW - panel.rect.width + 50, Math.Min(pos.x, halfW - 50));
|
||||||
|
pos.y = Math.Max(-halfH + 50, Math.Min(pos.y, halfH));
|
||||||
|
|
||||||
panel.localPosition = pos;
|
panel.localPosition = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#region Save Data
|
#region Save Data
|
||||||
|
|
||||||
public abstract void DoSaveToConfigElement();
|
public abstract void DoSaveToConfigElement();
|
||||||
|
@ -409,56 +409,49 @@ namespace UnityExplorer.UI
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a Toggle control.
|
/// Create a Toggle control.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static GameObject CreateToggle(GameObject parent, string name, out Toggle toggle, out Text text, Color bgColor = default)
|
public static GameObject CreateToggle(GameObject parent, string name, out Toggle toggle, out Text text, Color bgColor = default,
|
||||||
|
int checkWidth = 20, int checkHeight = 20)
|
||||||
{
|
{
|
||||||
|
// Main obj
|
||||||
GameObject toggleObj = CreateUIObject(name, parent, _smallElementSize);
|
GameObject toggleObj = CreateUIObject(name, parent, _smallElementSize);
|
||||||
|
SetLayoutGroup<HorizontalLayoutGroup>(toggleObj, false, false, true, true, 5, 0,0,0,0, childAlignment: TextAnchor.MiddleLeft);
|
||||||
GameObject bgObj = CreateUIObject("Background", toggleObj);
|
|
||||||
GameObject checkObj = CreateUIObject("Checkmark", bgObj);
|
|
||||||
GameObject labelObj = CreateUIObject("Label", toggleObj);
|
|
||||||
|
|
||||||
toggle = toggleObj.AddComponent<Toggle>();
|
toggle = toggleObj.AddComponent<Toggle>();
|
||||||
toggle.isOn = true;
|
toggle.isOn = true;
|
||||||
|
SetDefaultSelectableColors(toggle);
|
||||||
|
// need a second reference so we can use it inside the lambda, since 'toggle' is an out var.
|
||||||
|
Toggle t2 = toggle;
|
||||||
|
toggle.onValueChanged.AddListener((bool _) => { t2.OnDeselect(null); });
|
||||||
|
|
||||||
// second reference so we can use it inside the lambda, 'toggle' is an out var.
|
// Check mark background
|
||||||
Toggle toggleComp = toggle;
|
|
||||||
toggle.onValueChanged.AddListener(Deselect);
|
|
||||||
void Deselect(bool _)
|
|
||||||
{
|
|
||||||
toggleComp.OnDeselect(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
Image bgImage = bgObj.AddComponent<Image>();
|
GameObject checkBgObj = CreateUIObject("Background", toggleObj);
|
||||||
|
Image bgImage = checkBgObj.AddComponent<Image>();
|
||||||
bgImage.color = bgColor == default ? new Color(0.04f, 0.04f, 0.04f, 0.75f) : bgColor;
|
bgImage.color = bgColor == default ? new Color(0.04f, 0.04f, 0.04f, 0.75f) : bgColor;
|
||||||
|
|
||||||
Image checkImage = checkObj.AddComponent<Image>();
|
SetLayoutGroup<HorizontalLayoutGroup>(checkBgObj, true, true, true, true, 0, 2, 2, 2, 2);
|
||||||
|
SetLayoutElement(checkBgObj, minWidth: checkWidth, flexibleWidth: 0, minHeight: checkHeight, flexibleHeight: 0);
|
||||||
|
|
||||||
|
// Check mark image
|
||||||
|
|
||||||
|
GameObject checkMarkObj = CreateUIObject("Checkmark", checkBgObj);
|
||||||
|
Image checkImage = checkMarkObj.AddComponent<Image>();
|
||||||
checkImage.color = new Color(0.8f, 1, 0.8f, 0.3f);
|
checkImage.color = new Color(0.8f, 1, 0.8f, 0.3f);
|
||||||
|
|
||||||
|
// Label
|
||||||
|
|
||||||
|
GameObject labelObj = CreateUIObject("Label", toggleObj);
|
||||||
text = labelObj.AddComponent<Text>();
|
text = labelObj.AddComponent<Text>();
|
||||||
text.text = "Toggle";
|
text.text = "";
|
||||||
|
text.alignment = TextAnchor.MiddleLeft;
|
||||||
SetDefaultTextValues(text);
|
SetDefaultTextValues(text);
|
||||||
|
|
||||||
|
SetLayoutElement(labelObj, minWidth: 0, flexibleWidth: 0, minHeight: checkHeight, flexibleHeight: 0);
|
||||||
|
|
||||||
|
// References
|
||||||
|
|
||||||
toggle.graphic = checkImage;
|
toggle.graphic = checkImage;
|
||||||
toggle.targetGraphic = bgImage;
|
toggle.targetGraphic = bgImage;
|
||||||
SetDefaultSelectableColors(toggle);
|
|
||||||
|
|
||||||
RectTransform bgRect = bgObj.GetComponent<RectTransform>();
|
|
||||||
bgRect.anchorMin = new Vector2(0f, 1f);
|
|
||||||
bgRect.anchorMax = new Vector2(0f, 1f);
|
|
||||||
bgRect.anchoredPosition = new Vector2(13f, -13f);
|
|
||||||
bgRect.sizeDelta = new Vector2(20f, 20f);
|
|
||||||
|
|
||||||
RectTransform checkRect = checkObj.GetComponent<RectTransform>();
|
|
||||||
checkRect.anchorMin = new Vector2(0.5f, 0.5f);
|
|
||||||
checkRect.anchorMax = new Vector2(0.5f, 0.5f);
|
|
||||||
checkRect.anchoredPosition = Vector2.zero;
|
|
||||||
checkRect.sizeDelta = new Vector2(14f, 14f);
|
|
||||||
|
|
||||||
RectTransform labelRect = labelObj.GetComponent<RectTransform>();
|
|
||||||
labelRect.anchorMin = new Vector2(0f, 0f);
|
|
||||||
labelRect.anchorMax = new Vector2(1f, 1f);
|
|
||||||
labelRect.offsetMin = new Vector2(28f, 2f);
|
|
||||||
labelRect.offsetMax = new Vector2(-5f, -5f);
|
|
||||||
return toggleObj;
|
return toggleObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@ using UnityEngine.EventSystems;
|
|||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Core.Config;
|
using UnityExplorer.Core.Config;
|
||||||
using UnityExplorer.Core.Input;
|
using UnityExplorer.Core.Input;
|
||||||
using UnityExplorer.UI.CSConsole;
|
using UnityExplorer.CSConsole;
|
||||||
using UnityExplorer.UI.Inspectors;
|
using UnityExplorer.Inspectors;
|
||||||
using UnityExplorer.UI.Models;
|
using UnityExplorer.UI.Models;
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
using UnityExplorer.UI.Widgets;
|
using UnityExplorer.UI.Widgets;
|
||||||
@ -121,6 +121,12 @@ namespace UnityExplorer.UI
|
|||||||
lastScreenWidth = Screen.width;
|
lastScreenWidth = Screen.width;
|
||||||
lastScreenHeight = Screen.height;
|
lastScreenHeight = Screen.height;
|
||||||
|
|
||||||
|
// Failsafe fix
|
||||||
|
foreach (var dropdown in CanvasRoot.GetComponentsInChildren<Dropdown>(true))
|
||||||
|
dropdown.RefreshShownValue();
|
||||||
|
timeInput.Text = string.Empty;
|
||||||
|
timeInput.Text = Time.timeScale.ToString();
|
||||||
|
|
||||||
Initializing = false;
|
Initializing = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,7 +384,7 @@ namespace UnityExplorer.UI
|
|||||||
timeInput = UIFactory.CreateInputField(navbarPanel, "TimeInput", "timeScale");
|
timeInput = UIFactory.CreateInputField(navbarPanel, "TimeInput", "timeScale");
|
||||||
UIFactory.SetLayoutElement(timeInput.Component.gameObject, minHeight: 25, minWidth: 40);
|
UIFactory.SetLayoutElement(timeInput.Component.gameObject, minHeight: 25, minWidth: 40);
|
||||||
timeInput.Text = Time.timeScale.ToString("F2");
|
timeInput.Text = Time.timeScale.ToString("F2");
|
||||||
timeInput.Component.onEndEdit.AddListener(OnTimeInputEndEdit);
|
timeInput.Component.GetOnEndEdit().AddListener(OnTimeInputEndEdit);
|
||||||
|
|
||||||
pauseBtn = UIFactory.CreateButton(navbarPanel, "PauseButton", "||", new Color(0.2f, 0.2f, 0.2f));
|
pauseBtn = UIFactory.CreateButton(navbarPanel, "PauseButton", "||", new Color(0.2f, 0.2f, 0.2f));
|
||||||
UIFactory.SetLayoutElement(pauseBtn.Component.gameObject, minHeight: 25, minWidth: 25);
|
UIFactory.SetLayoutElement(pauseBtn.Component.gameObject, minHeight: 25, minWidth: 25);
|
||||||
@ -404,18 +410,47 @@ namespace UnityExplorer.UI
|
|||||||
closeBtn.OnClick += OnCloseButtonClicked;
|
closeBtn.OnClick += OnCloseButtonClicked;
|
||||||
}
|
}
|
||||||
|
|
||||||
#region UI AssetBundle
|
// UI AssetBundle
|
||||||
|
|
||||||
private static void LoadBundle()
|
private static void LoadBundle()
|
||||||
{
|
{
|
||||||
AssetBundle bundle = null;
|
AssetBundle bundle = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
// Get the Unity version (without the 'f' suffix).
|
||||||
|
// I'm not sure if Unity always includes the 'f' suffix.
|
||||||
|
int len;
|
||||||
|
if (Application.unityVersion.Contains("f"))
|
||||||
|
len = Application.unityVersion.LastIndexOf("f");
|
||||||
|
else
|
||||||
|
len = Application.unityVersion.Length;
|
||||||
|
Version version = new Version(Application.unityVersion.Substring(0, len));
|
||||||
|
|
||||||
|
// Use appropriate AssetBundle for Unity version
|
||||||
|
// >= 2017.3
|
||||||
|
if (version.Major > 2017 || (version.Major == 2017 && version.Minor >= 3))
|
||||||
bundle = LoadBundle("modern");
|
bundle = LoadBundle("modern");
|
||||||
if (bundle == null)
|
// 5.6.0 to 2017.3
|
||||||
|
else if (version.Major == 2017 || (version.Major == 5 && version.Minor >= 6))
|
||||||
|
bundle = LoadBundle("legacy.5.6");
|
||||||
|
// < 5.6.0
|
||||||
|
else
|
||||||
bundle = LoadBundle("legacy");
|
bundle = LoadBundle("legacy");
|
||||||
}
|
}
|
||||||
catch { }
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
ExplorerCore.LogWarning($"Exception loading Explorer AssetBundle!");
|
||||||
|
ExplorerCore.Log(ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
AssetBundle LoadBundle(string id)
|
||||||
|
{
|
||||||
|
ExplorerCore.Log($"Loading {id} bundle for Unity {Application.unityVersion}");
|
||||||
|
|
||||||
|
return AssetBundle.LoadFromMemory(ReadFully(typeof(ExplorerCore)
|
||||||
|
.Assembly
|
||||||
|
.GetManifestResourceStream($"UnityExplorer.Resources.{id}.bundle")));
|
||||||
|
}
|
||||||
|
|
||||||
if (bundle == null)
|
if (bundle == null)
|
||||||
{
|
{
|
||||||
@ -438,14 +473,6 @@ namespace UnityExplorer.UI
|
|||||||
ConsoleFont = bundle.LoadAsset<Font>("CONSOLA");
|
ConsoleFont = bundle.LoadAsset<Font>("CONSOLA");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static AssetBundle LoadBundle(string id)
|
|
||||||
{
|
|
||||||
var stream = typeof(ExplorerCore).Assembly
|
|
||||||
.GetManifestResourceStream($"UnityExplorer.Resources.explorerui.{id}.bundle");
|
|
||||||
|
|
||||||
return AssetBundle.LoadFromMemory(ReadFully(stream));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static byte[] ReadFully(Stream input)
|
private static byte[] ReadFully(Stream input)
|
||||||
{
|
{
|
||||||
using (var ms = new MemoryStream())
|
using (var ms = new MemoryStream())
|
||||||
@ -457,7 +484,5 @@ namespace UnityExplorer.UI
|
|||||||
return ms.ToArray();
|
return ms.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -80,12 +80,12 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
|
|
||||||
if (ContentRect.rect.height < desiredHeight)
|
if (ContentRect.rect.height < desiredHeight)
|
||||||
{
|
{
|
||||||
ContentRect.sizeDelta = new Vector2(0, desiredHeight);
|
ContentRect.sizeDelta = new Vector2(ContentRect.sizeDelta.x, desiredHeight);
|
||||||
this.Slider.UpdateSliderHandle();
|
this.Slider.UpdateSliderHandle();
|
||||||
}
|
}
|
||||||
else if (ContentRect.rect.height > desiredHeight)
|
else if (ContentRect.rect.height > desiredHeight)
|
||||||
{
|
{
|
||||||
ContentRect.sizeDelta = new Vector2(0, desiredHeight);
|
ContentRect.sizeDelta = new Vector2(ContentRect.sizeDelta.x, desiredHeight);
|
||||||
this.Slider.UpdateSliderHandle();
|
this.Slider.UpdateSliderHandle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -193,12 +193,11 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
RuntimeProvider.Instance.StartCoroutine(InitCoroutine(onHeightChangedListener));
|
RuntimeProvider.Instance.StartCoroutine(InitCoroutine(onHeightChangedListener));
|
||||||
}
|
}
|
||||||
|
|
||||||
private WaitForEndOfFrame waitForEndOfFrame = new WaitForEndOfFrame();
|
|
||||||
|
|
||||||
private IEnumerator InitCoroutine(Action onHeightChangedListener)
|
private IEnumerator InitCoroutine(Action onHeightChangedListener)
|
||||||
{
|
{
|
||||||
ScrollRect.content.anchoredPosition = Vector2.zero;
|
ScrollRect.content.anchoredPosition = Vector2.zero;
|
||||||
yield return waitForEndOfFrame ?? (waitForEndOfFrame = new WaitForEndOfFrame());
|
yield return null;
|
||||||
|
yield return null;
|
||||||
|
|
||||||
LayoutRebuilder.ForceRebuildLayoutImmediate(Content);
|
LayoutRebuilder.ForceRebuildLayoutImmediate(Content);
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.UI.Inspectors;
|
using UnityExplorer.Inspectors;
|
||||||
using UnityExplorer.UI.Widgets;
|
using UnityExplorer.UI.Widgets;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Widgets
|
namespace UnityExplorer.UI.Widgets
|
||||||
@ -17,6 +17,7 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
private bool m_enabled;
|
private bool m_enabled;
|
||||||
|
|
||||||
public Action<CachedTransform> OnExpandToggled;
|
public Action<CachedTransform> OnExpandToggled;
|
||||||
|
public Action<CachedTransform> OnEnableToggled;
|
||||||
public Action<GameObject> OnGameObjectClicked;
|
public Action<GameObject> OnGameObjectClicked;
|
||||||
|
|
||||||
public CachedTransform cachedTransform;
|
public CachedTransform cachedTransform;
|
||||||
@ -27,15 +28,20 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
|
|
||||||
public ButtonRef ExpandButton;
|
public ButtonRef ExpandButton;
|
||||||
public ButtonRef NameButton;
|
public ButtonRef NameButton;
|
||||||
|
public Toggle EnabledToggle;
|
||||||
|
|
||||||
public LayoutElement spacer;
|
public LayoutElement spacer;
|
||||||
|
|
||||||
public void OnMainButtonClicked()
|
public void Enable()
|
||||||
{
|
{
|
||||||
if (cachedTransform.Value)
|
m_enabled = true;
|
||||||
OnGameObjectClicked?.Invoke(cachedTransform.Value.gameObject);
|
UIRoot.SetActive(true);
|
||||||
else
|
}
|
||||||
ExplorerCore.LogWarning("The object was destroyed!");
|
|
||||||
|
public void Disable()
|
||||||
|
{
|
||||||
|
m_enabled = false;
|
||||||
|
UIRoot.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ConfigureCell(CachedTransform cached, int cellIndex)
|
public void ConfigureCell(CachedTransform cached, int cellIndex)
|
||||||
@ -59,6 +65,8 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
NameButton.ButtonText.text = cached.Value.name;
|
NameButton.ButtonText.text = cached.Value.name;
|
||||||
NameButton.ButtonText.color = cached.Value.gameObject.activeSelf ? Color.white : Color.grey;
|
NameButton.ButtonText.color = cached.Value.gameObject.activeSelf ? Color.white : Color.grey;
|
||||||
|
|
||||||
|
EnabledToggle.Set(cached.Value.gameObject.activeSelf, false);
|
||||||
|
|
||||||
int childCount = cached.Value.childCount;
|
int childCount = cached.Value.childCount;
|
||||||
if (childCount > 0)
|
if (childCount > 0)
|
||||||
{
|
{
|
||||||
@ -82,16 +90,12 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Disable()
|
public void OnMainButtonClicked()
|
||||||
{
|
{
|
||||||
m_enabled = false;
|
if (cachedTransform.Value)
|
||||||
UIRoot.SetActive(false);
|
OnGameObjectClicked?.Invoke(cachedTransform.Value.gameObject);
|
||||||
}
|
else
|
||||||
|
ExplorerCore.LogWarning("The object was destroyed!");
|
||||||
public void Enable()
|
|
||||||
{
|
|
||||||
m_enabled = true;
|
|
||||||
UIRoot.SetActive(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnExpandClicked()
|
public void OnExpandClicked()
|
||||||
@ -99,10 +103,15 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
OnExpandToggled?.Invoke(cachedTransform);
|
OnExpandToggled?.Invoke(cachedTransform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnEnableClicked(bool value)
|
||||||
|
{
|
||||||
|
OnEnableToggled?.Invoke(cachedTransform);
|
||||||
|
}
|
||||||
|
|
||||||
public GameObject CreateContent(GameObject parent)
|
public GameObject CreateContent(GameObject parent)
|
||||||
{
|
{
|
||||||
UIRoot = UIFactory.CreateUIObject("TransformCell", parent);
|
UIRoot = UIFactory.CreateUIObject("TransformCell", parent);
|
||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(UIRoot, true, true, true, true, 2, childAlignment: TextAnchor.MiddleCenter);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(UIRoot, false, false, true, true, 2, childAlignment: TextAnchor.MiddleCenter);
|
||||||
Rect = UIRoot.GetComponent<RectTransform>();
|
Rect = UIRoot.GetComponent<RectTransform>();
|
||||||
Rect.anchorMin = new Vector2(0, 1);
|
Rect.anchorMin = new Vector2(0, 1);
|
||||||
Rect.anchorMax = new Vector2(0, 1);
|
Rect.anchorMax = new Vector2(0, 1);
|
||||||
@ -114,9 +123,19 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
UIFactory.SetLayoutElement(spacerObj, minWidth: 0, flexibleWidth: 0, minHeight: 0, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(spacerObj, minWidth: 0, flexibleWidth: 0, minHeight: 0, flexibleHeight: 0);
|
||||||
this.spacer = spacerObj.GetComponent<LayoutElement>();
|
this.spacer = spacerObj.GetComponent<LayoutElement>();
|
||||||
|
|
||||||
|
// Expand arrow
|
||||||
|
|
||||||
ExpandButton = UIFactory.CreateButton(this.UIRoot, "ExpandButton", "►");
|
ExpandButton = UIFactory.CreateButton(this.UIRoot, "ExpandButton", "►");
|
||||||
UIFactory.SetLayoutElement(ExpandButton.Component.gameObject, minWidth: 15, flexibleWidth: 0, minHeight: 25, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(ExpandButton.Component.gameObject, minWidth: 15, flexibleWidth: 0, minHeight: 25, flexibleHeight: 0);
|
||||||
|
|
||||||
|
// Enabled toggle
|
||||||
|
|
||||||
|
var toggleObj = UIFactory.CreateToggle(UIRoot, "BehaviourToggle", out EnabledToggle, out var behavText, default, 17, 17);
|
||||||
|
UIFactory.SetLayoutElement(toggleObj, minHeight: 17, flexibleHeight: 0, minWidth: 17);
|
||||||
|
EnabledToggle.onValueChanged.AddListener(OnEnableClicked);
|
||||||
|
|
||||||
|
// Name button
|
||||||
|
|
||||||
NameButton = UIFactory.CreateButton(this.UIRoot, "NameButton", "Name", null);
|
NameButton = UIFactory.CreateButton(this.UIRoot, "NameButton", "Name", null);
|
||||||
UIFactory.SetLayoutElement(NameButton.Component.gameObject, flexibleWidth: 9999, minHeight: 25, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(NameButton.Component.gameObject, flexibleWidth: 9999, minHeight: 25, flexibleHeight: 0);
|
||||||
var nameLabel = NameButton.Component.GetComponentInChildren<Text>();
|
var nameLabel = NameButton.Component.GetComponentInChildren<Text>();
|
||||||
|
@ -60,8 +60,9 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
|
|
||||||
public void OnCellBorrowed(TransformCell cell)
|
public void OnCellBorrowed(TransformCell cell)
|
||||||
{
|
{
|
||||||
cell.OnExpandToggled += ToggleExpandCell;
|
cell.OnExpandToggled += OnCellExpandToggled;
|
||||||
cell.OnGameObjectClicked += OnGameObjectClicked;
|
cell.OnGameObjectClicked += OnGameObjectClicked;
|
||||||
|
cell.OnEnableToggled += OnCellEnableToggled;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnGameObjectClicked(GameObject obj)
|
private void OnGameObjectClicked(GameObject obj)
|
||||||
@ -72,6 +73,24 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
InspectorManager.Inspect(obj);
|
InspectorManager.Inspect(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnCellExpandToggled(CachedTransform cache)
|
||||||
|
{
|
||||||
|
var instanceID = cache.InstanceID;
|
||||||
|
if (expandedInstanceIDs.Contains(instanceID))
|
||||||
|
expandedInstanceIDs.Remove(instanceID);
|
||||||
|
else
|
||||||
|
expandedInstanceIDs.Add(instanceID);
|
||||||
|
|
||||||
|
RefreshData(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnCellEnableToggled(CachedTransform cache)
|
||||||
|
{
|
||||||
|
cache.Value.gameObject.SetActive(!cache.Value.gameObject.activeSelf);
|
||||||
|
|
||||||
|
RefreshData(true);
|
||||||
|
}
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
ScrollPool.Initialize(this);
|
ScrollPool.Initialize(this);
|
||||||
@ -261,16 +280,5 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
else
|
else
|
||||||
cell.Disable();
|
cell.Disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ToggleExpandCell(CachedTransform cache)
|
|
||||||
{
|
|
||||||
var instanceID = cache.InstanceID;
|
|
||||||
if (expandedInstanceIDs.Contains(instanceID))
|
|
||||||
expandedInstanceIDs.Remove(instanceID);
|
|
||||||
else
|
|
||||||
expandedInstanceIDs.Add(instanceID);
|
|
||||||
|
|
||||||
RefreshData(true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -241,54 +241,54 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Core\Config\InternalConfigHandler.cs" />
|
<Compile Include="Core\Config\InternalConfigHandler.cs" />
|
||||||
<Compile Include="UI\CacheObject\CacheConfigEntry.cs" />
|
<Compile Include="CacheObject\CacheConfigEntry.cs" />
|
||||||
<Compile Include="UI\CacheObject\Views\CacheConfigCell.cs" />
|
<Compile Include="CacheObject\Views\CacheConfigCell.cs" />
|
||||||
<Compile Include="UI\CSConsole\CSAutoCompleter.cs" />
|
<Compile Include="CSConsole\CSAutoCompleter.cs" />
|
||||||
<Compile Include="UI\CSConsole\LexerBuilder.cs" />
|
<Compile Include="CSConsole\LexerBuilder.cs" />
|
||||||
<Compile Include="UI\CSConsole\Lexers\CommentLexer.cs" />
|
<Compile Include="CSConsole\Lexers\CommentLexer.cs" />
|
||||||
<Compile Include="UI\CSConsole\Lexers\KeywordLexer.cs" />
|
<Compile Include="CSConsole\Lexers\KeywordLexer.cs" />
|
||||||
<Compile Include="UI\CSConsole\Lexers\Lexer.cs" />
|
<Compile Include="CSConsole\Lexers\Lexer.cs" />
|
||||||
<Compile Include="UI\CSConsole\Lexers\NumberLexer.cs" />
|
<Compile Include="CSConsole\Lexers\NumberLexer.cs" />
|
||||||
<Compile Include="UI\CSConsole\Lexers\StringLexer.cs" />
|
<Compile Include="CSConsole\Lexers\StringLexer.cs" />
|
||||||
<Compile Include="UI\CSConsole\Lexers\SymbolLexer.cs" />
|
<Compile Include="CSConsole\Lexers\SymbolLexer.cs" />
|
||||||
<Compile Include="UI\CSConsole\ScriptEvaluator.cs" />
|
<Compile Include="CSConsole\ScriptEvaluator.cs" />
|
||||||
<Compile Include="UI\CSConsole\ScriptInteraction.cs" />
|
<Compile Include="CSConsole\ScriptInteraction.cs" />
|
||||||
<Compile Include="Core\ExplorerBehaviour.cs" />
|
<Compile Include="Core\ExplorerBehaviour.cs" />
|
||||||
<Compile Include="Core\Reflection\Extensions.cs" />
|
<Compile Include="Core\Reflection\Extensions.cs" />
|
||||||
<Compile Include="Core\Reflection\Il2CppReflection.cs" />
|
<Compile Include="Core\Reflection\Il2CppReflection.cs" />
|
||||||
<Compile Include="Core\Utility\ArgumentUtility.cs" />
|
<Compile Include="Core\Utility\ArgumentUtility.cs" />
|
||||||
<Compile Include="Core\Utility\MiscUtility.cs" />
|
<Compile Include="Core\Utility\MiscUtility.cs" />
|
||||||
<Compile Include="Core\Utility\ParseUtility.cs" />
|
<Compile Include="Core\Utility\ParseUtility.cs" />
|
||||||
<Compile Include="UI\Inspectors\GameObjectWidgets\ComponentCell.cs" />
|
<Compile Include="Inspectors\GameObjectWidgets\ComponentCell.cs" />
|
||||||
<Compile Include="UI\Inspectors\GameObjectWidgets\ComponentList.cs" />
|
<Compile Include="Inspectors\GameObjectWidgets\ComponentList.cs" />
|
||||||
<Compile Include="UI\Inspectors\GameObjectWidgets\GameObjectControls.cs" />
|
<Compile Include="Inspectors\GameObjectWidgets\GameObjectControls.cs" />
|
||||||
<Compile Include="UI\Inspectors\InspectUnderMouse.cs" />
|
<Compile Include="Inspectors\InspectUnderMouse.cs" />
|
||||||
<Compile Include="UI\CSConsole\ConsoleController.cs" />
|
<Compile Include="CSConsole\ConsoleController.cs" />
|
||||||
<Compile Include="UI\CacheObject\CacheField.cs" />
|
<Compile Include="CacheObject\CacheField.cs" />
|
||||||
<Compile Include="UI\CacheObject\CacheKeyValuePair.cs" />
|
<Compile Include="CacheObject\CacheKeyValuePair.cs" />
|
||||||
<Compile Include="UI\CacheObject\CacheListEntry.cs" />
|
<Compile Include="CacheObject\CacheListEntry.cs" />
|
||||||
<Compile Include="UI\CacheObject\CacheMember.cs" />
|
<Compile Include="CacheObject\CacheMember.cs" />
|
||||||
<Compile Include="UI\CacheObject\CacheMethod.cs" />
|
<Compile Include="CacheObject\CacheMethod.cs" />
|
||||||
<Compile Include="UI\CacheObject\CacheObjectBase.cs" />
|
<Compile Include="CacheObject\CacheObjectBase.cs" />
|
||||||
<Compile Include="UI\CacheObject\CacheProperty.cs" />
|
<Compile Include="CacheObject\CacheProperty.cs" />
|
||||||
<Compile Include="UI\CacheObject\Views\CacheKeyValuePairCell.cs" />
|
<Compile Include="CacheObject\Views\CacheKeyValuePairCell.cs" />
|
||||||
<Compile Include="UI\CacheObject\Views\CacheListEntryCell.cs" />
|
<Compile Include="CacheObject\Views\CacheListEntryCell.cs" />
|
||||||
<Compile Include="UI\CacheObject\Views\CacheMemberCell.cs" />
|
<Compile Include="CacheObject\Views\CacheMemberCell.cs" />
|
||||||
<Compile Include="UI\CacheObject\Views\CacheObjectCell.cs" />
|
<Compile Include="CacheObject\Views\CacheObjectCell.cs" />
|
||||||
<Compile Include="UI\CacheObject\Views\EvaluateWidget.cs" />
|
<Compile Include="CacheObject\Views\EvaluateWidget.cs" />
|
||||||
<Compile Include="UI\Inspectors\GameObjectInspector.cs" />
|
<Compile Include="Inspectors\GameObjectInspector.cs" />
|
||||||
<Compile Include="UI\CacheObject\ICacheObjectController.cs" />
|
<Compile Include="CacheObject\ICacheObjectController.cs" />
|
||||||
<Compile Include="UI\Inspectors\InspectorManager.cs" />
|
<Compile Include="Inspectors\InspectorManager.cs" />
|
||||||
<Compile Include="UI\Inspectors\InspectorTab.cs" />
|
<Compile Include="Inspectors\InspectorTab.cs" />
|
||||||
<Compile Include="UI\Inspectors\InspectorBase.cs" />
|
<Compile Include="Inspectors\InspectorBase.cs" />
|
||||||
<Compile Include="UI\CacheObject\IValues\InteractiveColor.cs" />
|
<Compile Include="CacheObject\IValues\InteractiveColor.cs" />
|
||||||
<Compile Include="UI\CacheObject\IValues\InteractiveDictionary.cs" />
|
<Compile Include="CacheObject\IValues\InteractiveDictionary.cs" />
|
||||||
<Compile Include="UI\CacheObject\IValues\InteractiveEnum.cs" />
|
<Compile Include="CacheObject\IValues\InteractiveEnum.cs" />
|
||||||
<Compile Include="UI\CacheObject\IValues\InteractiveList.cs" />
|
<Compile Include="CacheObject\IValues\InteractiveList.cs" />
|
||||||
<Compile Include="UI\CacheObject\IValues\InteractiveString.cs" />
|
<Compile Include="CacheObject\IValues\InteractiveString.cs" />
|
||||||
<Compile Include="UI\CacheObject\IValues\InteractiveValue.cs" />
|
<Compile Include="CacheObject\IValues\InteractiveValue.cs" />
|
||||||
<Compile Include="UI\Inspectors\ReflectionInspector.cs" />
|
<Compile Include="Inspectors\ReflectionInspector.cs" />
|
||||||
<Compile Include="UI\CacheObject\IValues\InteractiveValueStruct.cs" />
|
<Compile Include="CacheObject\IValues\InteractiveValueStruct.cs" />
|
||||||
<Compile Include="UI\Models\InputFieldRef.cs" />
|
<Compile Include="UI\Models\InputFieldRef.cs" />
|
||||||
<Compile Include="UI\Pool.cs" />
|
<Compile Include="UI\Pool.cs" />
|
||||||
<Compile Include="UI\Panels\LogPanel.cs" />
|
<Compile Include="UI\Panels\LogPanel.cs" />
|
||||||
@ -318,8 +318,8 @@
|
|||||||
<Compile Include="Core\Runtime\RuntimeContext.cs" />
|
<Compile Include="Core\Runtime\RuntimeContext.cs" />
|
||||||
<Compile Include="Core\Runtime\RuntimeProvider.cs" />
|
<Compile Include="Core\Runtime\RuntimeProvider.cs" />
|
||||||
<Compile Include="Core\Runtime\TextureUtilProvider.cs" />
|
<Compile Include="Core\Runtime\TextureUtilProvider.cs" />
|
||||||
<Compile Include="UI\ObjectExplorer\SceneHandler.cs" />
|
<Compile Include="ObjectExplorer\SceneHandler.cs" />
|
||||||
<Compile Include="UI\ObjectExplorer\SearchProvider.cs" />
|
<Compile Include="ObjectExplorer\SearchProvider.cs" />
|
||||||
<Compile Include="Core\Tests\TestClass.cs" />
|
<Compile Include="Core\Tests\TestClass.cs" />
|
||||||
<Compile Include="Core\Utility\UnityHelpers.cs" />
|
<Compile Include="Core\Utility\UnityHelpers.cs" />
|
||||||
<Compile Include="ExplorerCore.cs" />
|
<Compile Include="ExplorerCore.cs" />
|
||||||
@ -344,8 +344,8 @@
|
|||||||
<Compile Include="UI\Widgets\AutoComplete\AutoCompleteModal.cs" />
|
<Compile Include="UI\Widgets\AutoComplete\AutoCompleteModal.cs" />
|
||||||
<Compile Include="UI\Widgets\AutoComplete\TypeCompleter.cs" />
|
<Compile Include="UI\Widgets\AutoComplete\TypeCompleter.cs" />
|
||||||
<Compile Include="UI\Models\ButtonRef.cs" />
|
<Compile Include="UI\Models\ButtonRef.cs" />
|
||||||
<Compile Include="UI\ObjectExplorer\ObjectSearch.cs" />
|
<Compile Include="ObjectExplorer\ObjectSearch.cs" />
|
||||||
<Compile Include="UI\ObjectExplorer\SceneExplorer.cs" />
|
<Compile Include="ObjectExplorer\SceneExplorer.cs" />
|
||||||
<Compile Include="UI\Widgets\ScrollPool\DataHeightCache.cs" />
|
<Compile Include="UI\Widgets\ScrollPool\DataHeightCache.cs" />
|
||||||
<Compile Include="UI\Widgets\ScrollPool\ICell.cs" />
|
<Compile Include="UI\Widgets\ScrollPool\ICell.cs" />
|
||||||
<Compile Include="UI\Widgets\ScrollPool\ICellPoolDataSource.cs" />
|
<Compile Include="UI\Widgets\ScrollPool\ICellPoolDataSource.cs" />
|
||||||
|
Reference in New Issue
Block a user