mirror of
https://github.com/GrahamKracker/UnityExplorer.git
synced 2025-07-01 19:13:03 +08:00
Automatic code cleanup (no real changes)
- Use explicit type of var - Use 'new()' - Remove unnecessary usings - Sort usings - Apply formatting
This commit is contained in:
Binary file not shown.
@ -2,12 +2,9 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
|
||||||
using UnityExplorer.CSConsole.Lexers;
|
using UnityExplorer.CSConsole.Lexers;
|
||||||
using UnityExplorer.UI;
|
|
||||||
using UnityExplorer.UI.Widgets.AutoComplete;
|
using UnityExplorer.UI.Widgets.AutoComplete;
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
using UniverseLib.UI;
|
|
||||||
using UniverseLib.UI.Models;
|
using UniverseLib.UI.Models;
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
|
|
||||||
@ -29,10 +26,23 @@ namespace UnityExplorer.CSConsole
|
|||||||
|
|
||||||
private readonly HashSet<char> delimiters = new()
|
private readonly HashSet<char> delimiters = new()
|
||||||
{
|
{
|
||||||
'{', '}', ',', ';', '<', '>', '(', ')', '[', ']', '=', '|', '&', '?'
|
'{',
|
||||||
|
'}',
|
||||||
|
',',
|
||||||
|
';',
|
||||||
|
'<',
|
||||||
|
'>',
|
||||||
|
'(',
|
||||||
|
')',
|
||||||
|
'[',
|
||||||
|
']',
|
||||||
|
'=',
|
||||||
|
'|',
|
||||||
|
'&',
|
||||||
|
'?'
|
||||||
};
|
};
|
||||||
|
|
||||||
private readonly List<Suggestion> suggestions = new List<Suggestion>();
|
private readonly List<Suggestion> suggestions = new();
|
||||||
|
|
||||||
public void CheckAutocompletes()
|
public void CheckAutocompletes()
|
||||||
{
|
{
|
||||||
@ -83,7 +93,7 @@ namespace UnityExplorer.CSConsole
|
|||||||
|
|
||||||
// Get manual namespace completions
|
// Get manual namespace completions
|
||||||
|
|
||||||
foreach (var ns in ReflectionUtility.AllNamespaces)
|
foreach (string ns in ReflectionUtility.AllNamespaces)
|
||||||
{
|
{
|
||||||
if (ns.StartsWith(input))
|
if (ns.StartsWith(input))
|
||||||
{
|
{
|
||||||
@ -97,7 +107,7 @@ namespace UnityExplorer.CSConsole
|
|||||||
|
|
||||||
// Get manual keyword completions
|
// Get manual keyword completions
|
||||||
|
|
||||||
foreach (var kw in KeywordLexer.keywords)
|
foreach (string kw in KeywordLexer.keywords)
|
||||||
{
|
{
|
||||||
if (kw.StartsWith(input))// && kw.Length > input.Length)
|
if (kw.StartsWith(input))// && kw.Length > input.Length)
|
||||||
{
|
{
|
||||||
@ -121,11 +131,11 @@ namespace UnityExplorer.CSConsole
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private readonly Dictionary<string, string> namespaceHighlights = new Dictionary<string, string>();
|
private readonly Dictionary<string, string> namespaceHighlights = new();
|
||||||
|
|
||||||
private readonly Dictionary<string, string> keywordHighlights = new Dictionary<string, string>();
|
private readonly Dictionary<string, string> keywordHighlights = new();
|
||||||
|
|
||||||
private readonly StringBuilder highlightBuilder = new StringBuilder();
|
private readonly StringBuilder highlightBuilder = new();
|
||||||
private const string OPEN_HIGHLIGHT = "<color=cyan>";
|
private const string OPEN_HIGHLIGHT = "<color=cyan>";
|
||||||
|
|
||||||
private string GetHighlightString(string prefix, string completion)
|
private string GetHighlightString(string prefix, string completion)
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
using System;
|
using HarmonyLib;
|
||||||
|
using Mono.CSharp;
|
||||||
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@ -8,18 +10,14 @@ using System.Text;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UniverseLib.Input;
|
|
||||||
using UnityExplorer.CSConsole;
|
|
||||||
using UnityExplorer.UI;
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
using UnityExplorer.UI.Widgets.AutoComplete;
|
using UnityExplorer.UI.Widgets.AutoComplete;
|
||||||
using UniverseLib.UI;
|
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
|
using UniverseLib.Input;
|
||||||
|
using UniverseLib.Runtime;
|
||||||
using UniverseLib.UI.Models;
|
using UniverseLib.UI.Models;
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
using HarmonyLib;
|
|
||||||
using UniverseLib.Runtime;
|
|
||||||
using Mono.CSharp;
|
|
||||||
|
|
||||||
namespace UnityExplorer.CSConsole
|
namespace UnityExplorer.CSConsole
|
||||||
{
|
{
|
||||||
@ -99,11 +97,11 @@ namespace UnityExplorer.CSConsole
|
|||||||
if (!Directory.Exists(ScriptsFolder))
|
if (!Directory.Exists(ScriptsFolder))
|
||||||
Directory.CreateDirectory(ScriptsFolder);
|
Directory.CreateDirectory(ScriptsFolder);
|
||||||
|
|
||||||
var startupPath = Path.Combine(ScriptsFolder, "startup.cs");
|
string startupPath = Path.Combine(ScriptsFolder, "startup.cs");
|
||||||
if (File.Exists(startupPath))
|
if (File.Exists(startupPath))
|
||||||
{
|
{
|
||||||
ExplorerCore.Log($"Executing startup script from '{startupPath}'...");
|
ExplorerCore.Log($"Executing startup script from '{startupPath}'...");
|
||||||
var text = File.ReadAllText(startupPath);
|
string text = File.ReadAllText(startupPath);
|
||||||
Input.Text = text;
|
Input.Text = text;
|
||||||
Evaluate();
|
Evaluate();
|
||||||
}
|
}
|
||||||
@ -161,7 +159,7 @@ namespace UnityExplorer.CSConsole
|
|||||||
};
|
};
|
||||||
|
|
||||||
usingDirectives = new HashSet<string>();
|
usingDirectives = new HashSet<string>();
|
||||||
foreach (var use in DefaultUsing)
|
foreach (string use in DefaultUsing)
|
||||||
AddUsing(use);
|
AddUsing(use);
|
||||||
|
|
||||||
if (logSuccess)
|
if (logSuccess)
|
||||||
@ -208,7 +206,7 @@ namespace UnityExplorer.CSConsole
|
|||||||
{
|
{
|
||||||
object ret = null;
|
object ret = null;
|
||||||
repl.Invoke(ref ret);
|
repl.Invoke(ref ret);
|
||||||
var result = ret?.ToString();
|
string result = ret?.ToString();
|
||||||
if (!string.IsNullOrEmpty(result))
|
if (!string.IsNullOrEmpty(result))
|
||||||
ExplorerCore.Log($"Invoked REPL, result: {ret}");
|
ExplorerCore.Log($"Invoked REPL, result: {ret}");
|
||||||
else
|
else
|
||||||
@ -224,7 +222,7 @@ namespace UnityExplorer.CSConsole
|
|||||||
// The compiled code was not REPL, so it was a using directive or it defined classes.
|
// The compiled code was not REPL, so it was a using directive or it defined classes.
|
||||||
|
|
||||||
string output = Evaluator._textWriter.ToString();
|
string output = Evaluator._textWriter.ToString();
|
||||||
var outputSplit = output.Split('\n');
|
string[] outputSplit = output.Split('\n');
|
||||||
if (outputSplit.Length >= 2)
|
if (outputSplit.Length >= 2)
|
||||||
output = outputSplit[outputSplit.Length - 2];
|
output = outputSplit[outputSplit.Length - 2];
|
||||||
evaluatorOutput.Clear();
|
evaluatorOutput.Clear();
|
||||||
@ -286,7 +284,7 @@ namespace UnityExplorer.CSConsole
|
|||||||
DoAutoIndent();
|
DoAutoIndent();
|
||||||
}
|
}
|
||||||
|
|
||||||
var inStringOrComment = HighlightVisibleInput();
|
bool inStringOrComment = HighlightVisibleInput();
|
||||||
|
|
||||||
if (!settingCaretCoroutine)
|
if (!settingCaretCoroutine)
|
||||||
{
|
{
|
||||||
@ -359,12 +357,12 @@ namespace UnityExplorer.CSConsole
|
|||||||
// If caret moved, ensure caret is visible in the viewport
|
// If caret moved, ensure caret is visible in the viewport
|
||||||
if (caretMoved)
|
if (caretMoved)
|
||||||
{
|
{
|
||||||
var charInfo = Input.TextGenerator.characters[LastCaretPosition];
|
UICharInfo charInfo = Input.TextGenerator.characters[LastCaretPosition];
|
||||||
var charTop = charInfo.cursorPos.y;
|
float charTop = charInfo.cursorPos.y;
|
||||||
var charBot = charTop - CSCONSOLE_LINEHEIGHT;
|
float charBot = charTop - CSCONSOLE_LINEHEIGHT;
|
||||||
|
|
||||||
var viewportMin = Input.Transform.rect.height - Input.Transform.anchoredPosition.y - (Input.Transform.rect.height * 0.5f);
|
float viewportMin = Input.Transform.rect.height - Input.Transform.anchoredPosition.y - (Input.Transform.rect.height * 0.5f);
|
||||||
var viewportMax = viewportMin - Panel.InputScroller.ViewportRect.rect.height;
|
float viewportMax = viewportMin - Panel.InputScroller.ViewportRect.rect.height;
|
||||||
|
|
||||||
float diff = 0f;
|
float diff = 0f;
|
||||||
if (charTop > viewportMin)
|
if (charTop > viewportMin)
|
||||||
@ -374,7 +372,7 @@ namespace UnityExplorer.CSConsole
|
|||||||
|
|
||||||
if (Math.Abs(diff) > 1)
|
if (Math.Abs(diff) > 1)
|
||||||
{
|
{
|
||||||
var rect = Input.Transform;
|
RectTransform rect = Input.Transform;
|
||||||
rect.anchoredPosition = new Vector2(rect.anchoredPosition.x, rect.anchoredPosition.y - diff);
|
rect.anchoredPosition = new Vector2(rect.anchoredPosition.x, rect.anchoredPosition.y - diff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -391,7 +389,7 @@ namespace UnityExplorer.CSConsole
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
foreach (var member in typeof(EventSystem).GetMembers(AccessTools.all))
|
foreach (MemberInfo member in typeof(EventSystem).GetMembers(AccessTools.all))
|
||||||
{
|
{
|
||||||
if (member.Name == "m_CurrentSelected")
|
if (member.Name == "m_CurrentSelected")
|
||||||
{
|
{
|
||||||
@ -444,7 +442,7 @@ namespace UnityExplorer.CSConsole
|
|||||||
|
|
||||||
private static IEnumerator SetCaretCoroutine(int caretPosition)
|
private static IEnumerator SetCaretCoroutine(int caretPosition)
|
||||||
{
|
{
|
||||||
var color = Input.Component.selectionColor;
|
Color color = Input.Component.selectionColor;
|
||||||
color.a = 0f;
|
color.a = 0f;
|
||||||
Input.Component.selectionColor = color;
|
Input.Component.selectionColor = color;
|
||||||
|
|
||||||
@ -495,12 +493,12 @@ namespace UnityExplorer.CSConsole
|
|||||||
|
|
||||||
// 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.Transform.rect.height - Input.Transform.anchoredPosition.y - (Input.Transform.rect.height * 0.5f);
|
float viewportMin = Input.Transform.rect.height - Input.Transform.anchoredPosition.y - (Input.Transform.rect.height * 0.5f);
|
||||||
var viewportMax = viewportMin - Panel.InputScroller.ViewportRect.rect.height;
|
float 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++)
|
||||||
{
|
{
|
||||||
var line = Input.TextGenerator.lines[i];
|
UILineInfo line = Input.TextGenerator.lines[i];
|
||||||
// if not set the top line yet, and top of line is below the viewport top
|
// if not set the top line yet, and top of line is below the viewport top
|
||||||
if (topLine == -1 && line.topY <= viewportMin)
|
if (topLine == -1 && line.topY <= viewportMin)
|
||||||
topLine = i;
|
topLine = i;
|
||||||
@ -534,7 +532,7 @@ namespace UnityExplorer.CSConsole
|
|||||||
realStartLine++;
|
realStartLine++;
|
||||||
char lastPrev = '\n';
|
char lastPrev = '\n';
|
||||||
|
|
||||||
var sb = new StringBuilder();
|
StringBuilder sb = new();
|
||||||
|
|
||||||
// append leading new lines for spacing (no point rendering line numbers we cant see)
|
// append leading new lines for spacing (no point rendering line numbers we cant see)
|
||||||
for (int i = 0; i < topLine; i++)
|
for (int i = 0; i < topLine; i++)
|
||||||
@ -676,7 +674,7 @@ Doorstop example:
|
|||||||
|
|
||||||
public static void SetupHelpInteraction()
|
public static void SetupHelpInteraction()
|
||||||
{
|
{
|
||||||
var drop = Panel.HelpDropdown;
|
Dropdown drop = Panel.HelpDropdown;
|
||||||
|
|
||||||
helpDict.Add("Help", "");
|
helpDict.Add("Help", "");
|
||||||
helpDict.Add("Usings", HELP_USINGS);
|
helpDict.Add("Usings", HELP_USINGS);
|
||||||
@ -684,7 +682,7 @@ Doorstop example:
|
|||||||
helpDict.Add("Classes", HELP_CLASSES);
|
helpDict.Add("Classes", HELP_CLASSES);
|
||||||
helpDict.Add("Coroutines", HELP_COROUTINES);
|
helpDict.Add("Coroutines", HELP_COROUTINES);
|
||||||
|
|
||||||
foreach (var opt in helpDict)
|
foreach (KeyValuePair<string, string> opt in helpDict)
|
||||||
drop.options.Add(new Dropdown.OptionData(opt.Key));
|
drop.options.Add(new Dropdown.OptionData(opt.Key));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -693,7 +691,7 @@ Doorstop example:
|
|||||||
if (index == 0)
|
if (index == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var helpText = helpDict.ElementAt(index);
|
KeyValuePair<string, string> helpText = helpDict.ElementAt(index);
|
||||||
|
|
||||||
Input.Text = helpText.Value;
|
Input.Text = helpText.Value;
|
||||||
|
|
||||||
|
@ -1,12 +1,7 @@
|
|||||||
using Mono.CSharp;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
|
||||||
using UnityExplorer.CSConsole.Lexers;
|
using UnityExplorer.CSConsole.Lexers;
|
||||||
using UniverseLib;
|
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
|
|
||||||
namespace UnityExplorer.CSConsole
|
namespace UnityExplorer.CSConsole
|
||||||
@ -25,14 +20,14 @@ namespace UnityExplorer.CSConsole
|
|||||||
#region Core and initialization
|
#region Core and initialization
|
||||||
|
|
||||||
public const char WHITESPACE = ' ';
|
public const char WHITESPACE = ' ';
|
||||||
public readonly HashSet<char> IndentOpenChars = new HashSet<char> { '{', '(' };
|
public readonly HashSet<char> IndentOpenChars = new() { '{', '(' };
|
||||||
public readonly HashSet<char> IndentCloseChars = new HashSet<char> { '}', ')' };
|
public readonly HashSet<char> IndentCloseChars = new() { '}', ')' };
|
||||||
|
|
||||||
private readonly Lexer[] lexers;
|
private readonly Lexer[] lexers;
|
||||||
private readonly HashSet<char> delimiters = new HashSet<char>();
|
private readonly HashSet<char> delimiters = new();
|
||||||
|
|
||||||
private readonly StringLexer stringLexer = new StringLexer();
|
private readonly StringLexer stringLexer = new();
|
||||||
private readonly CommentLexer commentLexer = new CommentLexer();
|
private readonly CommentLexer commentLexer = new();
|
||||||
|
|
||||||
public LexerBuilder()
|
public LexerBuilder()
|
||||||
{
|
{
|
||||||
@ -45,7 +40,7 @@ namespace UnityExplorer.CSConsole
|
|||||||
new KeywordLexer(),
|
new KeywordLexer(),
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var matcher in lexers)
|
foreach (Lexer matcher in lexers)
|
||||||
{
|
{
|
||||||
foreach (char c in matcher.Delimiters)
|
foreach (char c in matcher.Delimiters)
|
||||||
{
|
{
|
||||||
@ -97,13 +92,13 @@ namespace UnityExplorer.CSConsole
|
|||||||
currentStartIdx = startIdx;
|
currentStartIdx = startIdx;
|
||||||
currentEndIdx = endIdx;
|
currentEndIdx = endIdx;
|
||||||
|
|
||||||
var sb = new StringBuilder();
|
StringBuilder sb = new();
|
||||||
|
|
||||||
for (int i = 0; i < leadingLines; i++)
|
for (int i = 0; i < leadingLines; i++)
|
||||||
sb.Append('\n');
|
sb.Append('\n');
|
||||||
|
|
||||||
int lastUnhighlighted = startIdx;
|
int lastUnhighlighted = startIdx;
|
||||||
foreach (var match in GetMatches())
|
foreach (MatchInfo match in GetMatches())
|
||||||
{
|
{
|
||||||
// append non-highlighted text between last match and this
|
// append non-highlighted text between last match and this
|
||||||
for (int i = lastUnhighlighted; i < match.startIndex; i++)
|
for (int i = lastUnhighlighted; i < match.startIndex; i++)
|
||||||
@ -130,7 +125,7 @@ namespace UnityExplorer.CSConsole
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check caretIdx to determine inStringOrComment state
|
// check caretIdx to determine inStringOrComment state
|
||||||
if (caretIdx >= match.startIndex && (caretIdx <= (matchEndIdx+1) || (caretIdx >= input.Length && matchEndIdx >= input.Length - 1)))
|
if (caretIdx >= match.startIndex && (caretIdx <= (matchEndIdx + 1) || (caretIdx >= input.Length && matchEndIdx >= input.Length - 1)))
|
||||||
caretInStringOrComment = match.isStringOrComment;
|
caretInStringOrComment = match.isStringOrComment;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,7 +153,7 @@ namespace UnityExplorer.CSConsole
|
|||||||
bool anyMatch = false;
|
bool anyMatch = false;
|
||||||
int startIndex = CommittedIndex + 1;
|
int startIndex = CommittedIndex + 1;
|
||||||
|
|
||||||
foreach (var lexer in lexers)
|
foreach (Lexer lexer in lexers)
|
||||||
{
|
{
|
||||||
if (lexer.TryMatchCurrent(this))
|
if (lexer.TryMatchCurrent(this))
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using UnityEngine;
|
||||||
using System.Linq;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace UnityExplorer.CSConsole.Lexers
|
namespace UnityExplorer.CSConsole.Lexers
|
||||||
{
|
{
|
||||||
@ -13,7 +11,7 @@ namespace UnityExplorer.CSConsole.Lexers
|
|||||||
}
|
}
|
||||||
|
|
||||||
// forest green
|
// forest green
|
||||||
protected override Color HighlightColor => new Color(0.34f, 0.65f, 0.29f, 1.0f);
|
protected override Color HighlightColor => new(0.34f, 0.65f, 0.29f, 1.0f);
|
||||||
|
|
||||||
public override bool TryMatchCurrent(LexerBuilder lexer)
|
public override bool TryMatchCurrent(LexerBuilder lexer)
|
||||||
{
|
{
|
||||||
|
@ -7,9 +7,9 @@ namespace UnityExplorer.CSConsole.Lexers
|
|||||||
public class KeywordLexer : Lexer
|
public class KeywordLexer : Lexer
|
||||||
{
|
{
|
||||||
// system blue
|
// system blue
|
||||||
protected override Color HighlightColor => new Color(0.33f, 0.61f, 0.83f, 1.0f);
|
protected override Color HighlightColor => new(0.33f, 0.61f, 0.83f, 1.0f);
|
||||||
|
|
||||||
public static readonly HashSet<string> keywords = new HashSet<string>
|
public static readonly HashSet<string> keywords = new()
|
||||||
{
|
{
|
||||||
// reserved keywords
|
// reserved keywords
|
||||||
"abstract", "as", "base", "bool", "break", "byte", "case", "catch", "char", "checked", "class", "const", "continue",
|
"abstract", "as", "base", "bool", "break", "byte", "case", "catch", "char", "checked", "class", "const", "continue",
|
||||||
@ -28,15 +28,15 @@ namespace UnityExplorer.CSConsole.Lexers
|
|||||||
|
|
||||||
public override bool TryMatchCurrent(LexerBuilder lexer)
|
public override bool TryMatchCurrent(LexerBuilder lexer)
|
||||||
{
|
{
|
||||||
var prev = lexer.Previous;
|
char prev = lexer.Previous;
|
||||||
var first = lexer.Current;
|
char first = lexer.Current;
|
||||||
|
|
||||||
// check for keywords
|
// check for keywords
|
||||||
if (lexer.IsDelimiter(prev, true) && char.IsLetter(first))
|
if (lexer.IsDelimiter(prev, true) && char.IsLetter(first))
|
||||||
{
|
{
|
||||||
// can be a keyword...
|
// can be a keyword...
|
||||||
|
|
||||||
var sb = new StringBuilder();
|
StringBuilder sb = new();
|
||||||
sb.Append(lexer.Current);
|
sb.Append(lexer.Current);
|
||||||
while (!lexer.EndOfInput && char.IsLetter(lexer.PeekNext()))
|
while (!lexer.EndOfInput && char.IsLetter(lexer.PeekNext()))
|
||||||
sb.Append(lexer.Current);
|
sb.Append(lexer.Current);
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UniverseLib;
|
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
|
|
||||||
namespace UnityExplorer.CSConsole.Lexers
|
namespace UnityExplorer.CSConsole.Lexers
|
||||||
|
@ -5,7 +5,7 @@ namespace UnityExplorer.CSConsole.Lexers
|
|||||||
public class NumberLexer : Lexer
|
public class NumberLexer : Lexer
|
||||||
{
|
{
|
||||||
// Maroon
|
// Maroon
|
||||||
protected override Color HighlightColor => new Color(0.58f, 0.33f, 0.33f, 1.0f);
|
protected override Color HighlightColor => new(0.58f, 0.33f, 0.33f, 1.0f);
|
||||||
|
|
||||||
private bool IsNumeric(char c) => char.IsNumber(c) || c == '.';
|
private bool IsNumeric(char c) => char.IsNumber(c) || c == '.';
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ namespace UnityExplorer.CSConsole.Lexers
|
|||||||
public override IEnumerable<char> Delimiters => new[] { '"', '\'', };
|
public override IEnumerable<char> Delimiters => new[] { '"', '\'', };
|
||||||
|
|
||||||
// orange
|
// orange
|
||||||
protected override Color HighlightColor => new Color(0.79f, 0.52f, 0.32f, 1.0f);
|
protected override Color HighlightColor => new(0.79f, 0.52f, 0.32f, 1.0f);
|
||||||
|
|
||||||
public override bool TryMatchCurrent(LexerBuilder lexer)
|
public override bool TryMatchCurrent(LexerBuilder lexer)
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace UnityExplorer.CSConsole.Lexers
|
namespace UnityExplorer.CSConsole.Lexers
|
||||||
@ -8,14 +7,14 @@ namespace UnityExplorer.CSConsole.Lexers
|
|||||||
public class SymbolLexer : Lexer
|
public class SymbolLexer : Lexer
|
||||||
{
|
{
|
||||||
// silver
|
// silver
|
||||||
protected override Color HighlightColor => new Color(0.6f, 0.6f, 0.6f);
|
protected override Color HighlightColor => new(0.6f, 0.6f, 0.6f);
|
||||||
|
|
||||||
// all symbols are delimiters
|
// all symbols are delimiters
|
||||||
public override IEnumerable<char> Delimiters => symbols.Where(it => it != '.'); // '.' is not a delimiter, only a separator.
|
public override IEnumerable<char> Delimiters => symbols.Where(it => it != '.'); // '.' is not a delimiter, only a separator.
|
||||||
|
|
||||||
public static bool IsSymbol(char c) => symbols.Contains(c);
|
public static bool IsSymbol(char c) => symbols.Contains(c);
|
||||||
|
|
||||||
public static readonly HashSet<char> symbols = new HashSet<char>
|
public static readonly HashSet<char> symbols = new()
|
||||||
{
|
{
|
||||||
'[', '{', '(', // open
|
'[', '{', '(', // open
|
||||||
']', '}', ')', // close
|
']', '}', ')', // close
|
||||||
|
@ -3,7 +3,6 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
// Thanks to ManlyMarco for this
|
// Thanks to ManlyMarco for this
|
||||||
|
|
||||||
@ -13,7 +12,10 @@ namespace UnityExplorer.CSConsole
|
|||||||
{
|
{
|
||||||
private static readonly HashSet<string> StdLib = new(StringComparer.InvariantCultureIgnoreCase)
|
private static readonly HashSet<string> StdLib = new(StringComparer.InvariantCultureIgnoreCase)
|
||||||
{
|
{
|
||||||
"mscorlib", "System.Core", "System", "System.Xml"
|
"mscorlib",
|
||||||
|
"System.Core",
|
||||||
|
"System",
|
||||||
|
"System.Xml"
|
||||||
};
|
};
|
||||||
|
|
||||||
internal TextWriter _textWriter;
|
internal TextWriter _textWriter;
|
||||||
@ -45,7 +47,7 @@ namespace UnityExplorer.CSConsole
|
|||||||
|
|
||||||
private void Reference(Assembly asm)
|
private void Reference(Assembly asm)
|
||||||
{
|
{
|
||||||
var name = asm.GetName().Name;
|
string name = asm.GetName().Name;
|
||||||
if (name == "completions")
|
if (name == "completions")
|
||||||
return;
|
return;
|
||||||
ReferenceAssembly(asm);
|
ReferenceAssembly(asm);
|
||||||
@ -55,7 +57,7 @@ namespace UnityExplorer.CSConsole
|
|||||||
{
|
{
|
||||||
_reportPrinter = new StreamReportPrinter(tw);
|
_reportPrinter = new StreamReportPrinter(tw);
|
||||||
|
|
||||||
var settings = new CompilerSettings
|
CompilerSettings settings = new()
|
||||||
{
|
{
|
||||||
Version = LanguageVersion.Experimental,
|
Version = LanguageVersion.Experimental,
|
||||||
GenerateDebugInfo = false,
|
GenerateDebugInfo = false,
|
||||||
|
@ -2,11 +2,9 @@
|
|||||||
using Mono.CSharp;
|
using Mono.CSharp;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityExplorer.Runtime;
|
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
|
|
||||||
@ -46,7 +44,7 @@ namespace UnityExplorer.CSConsole
|
|||||||
|
|
||||||
public static void GetVars()
|
public static void GetVars()
|
||||||
{
|
{
|
||||||
var vars = Evaluator.GetVars()?.Trim();
|
string vars = Evaluator.GetVars()?.Trim();
|
||||||
if (string.IsNullOrEmpty(vars))
|
if (string.IsNullOrEmpty(vars))
|
||||||
ExplorerCore.LogWarning("No variables seem to be defined!");
|
ExplorerCore.LogWarning("No variables seem to be defined!");
|
||||||
else
|
else
|
||||||
@ -59,12 +57,12 @@ namespace UnityExplorer.CSConsole
|
|||||||
.GetValue(Evaluator) is CompilationSourceFile sourceFile
|
.GetValue(Evaluator) is CompilationSourceFile sourceFile
|
||||||
&& sourceFile.Containers.Any())
|
&& sourceFile.Containers.Any())
|
||||||
{
|
{
|
||||||
var sb = new StringBuilder();
|
StringBuilder sb = new();
|
||||||
sb.Append($"There are {sourceFile.Containers.Count} defined classes:");
|
sb.Append($"There are {sourceFile.Containers.Count} defined classes:");
|
||||||
foreach (TypeDefinition type in sourceFile.Containers.Where(it => it is TypeDefinition))
|
foreach (TypeDefinition type in sourceFile.Containers.Where(it => it is TypeDefinition))
|
||||||
{
|
{
|
||||||
sb.Append($"\n\n{type.MemberName.Name}:");
|
sb.Append($"\n\n{type.MemberName.Name}:");
|
||||||
foreach (var member in type.Members)
|
foreach (MemberCore member in type.Members)
|
||||||
sb.Append($"\n\t- {member.AttributeTargets}: \"{member.MemberName.Name}\" ({member.ModFlags})");
|
sb.Append($"\n\t- {member.AttributeTargets}: \"{member.MemberName.Name}\" ({member.ModFlags})");
|
||||||
}
|
}
|
||||||
Log(sb.ToString());
|
Log(sb.ToString());
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
using System;
|
using UnityExplorer.CacheObject.Views;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityExplorer.Config;
|
using UnityExplorer.Config;
|
||||||
using UnityExplorer.CacheObject.Views;
|
|
||||||
|
|
||||||
namespace UnityExplorer.CacheObject
|
namespace UnityExplorer.CacheObject
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
|
||||||
using UnityExplorer.Inspectors;
|
using UnityExplorer.Inspectors;
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
|
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
|
||||||
using UnityExplorer.Inspectors;
|
using UnityExplorer.Inspectors;
|
||||||
|
|
||||||
namespace UnityExplorer.CacheObject
|
namespace UnityExplorer.CacheObject
|
||||||
@ -31,7 +28,7 @@ namespace UnityExplorer.CacheObject
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var ret = FieldInfo.GetValue(DeclaringInstance);
|
object ret = FieldInfo.GetValue(DeclaringInstance);
|
||||||
LastException = null;
|
LastException = null;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityExplorer.CacheObject.IValues;
|
using UnityExplorer.CacheObject.IValues;
|
||||||
using UnityExplorer.CacheObject.Views;
|
using UnityExplorer.CacheObject.Views;
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
@ -41,7 +38,7 @@ namespace UnityExplorer.CacheObject
|
|||||||
this.DictKey = key;
|
this.DictKey = key;
|
||||||
this.DisplayedKey = key.TryCast();
|
this.DisplayedKey = key.TryCast();
|
||||||
|
|
||||||
var type = DisplayedKey.GetType();
|
Type type = DisplayedKey.GetType();
|
||||||
if (ParseUtility.CanParse(type))
|
if (ParseUtility.CanParse(type))
|
||||||
{
|
{
|
||||||
KeyInputWanted = true;
|
KeyInputWanted = true;
|
||||||
@ -60,7 +57,7 @@ namespace UnityExplorer.CacheObject
|
|||||||
{
|
{
|
||||||
base.SetDataToCell(cell);
|
base.SetDataToCell(cell);
|
||||||
|
|
||||||
var kvpCell = cell as CacheKeyValuePairCell;
|
CacheKeyValuePairCell kvpCell = cell as CacheKeyValuePairCell;
|
||||||
|
|
||||||
kvpCell.NameLabel.text = $"{DictIndex}:";
|
kvpCell.NameLabel.text = $"{DictIndex}:";
|
||||||
kvpCell.HiddenNameLabel.Text = "";
|
kvpCell.HiddenNameLabel.Text = "";
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
using System;
|
using UnityExplorer.CacheObject.IValues;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityExplorer.CacheObject.IValues;
|
|
||||||
using UnityExplorer.CacheObject.Views;
|
using UnityExplorer.CacheObject.Views;
|
||||||
|
|
||||||
namespace UnityExplorer.CacheObject
|
namespace UnityExplorer.CacheObject
|
||||||
@ -25,7 +21,7 @@ namespace UnityExplorer.CacheObject
|
|||||||
{
|
{
|
||||||
base.SetDataToCell(cell);
|
base.SetDataToCell(cell);
|
||||||
|
|
||||||
var listCell = cell as CacheListEntryCell;
|
CacheListEntryCell listCell = cell as CacheListEntryCell;
|
||||||
|
|
||||||
listCell.NameLabel.text = $"{ListIndex}:";
|
listCell.NameLabel.text = $"{ListIndex}:";
|
||||||
listCell.HiddenNameLabel.Text = "";
|
listCell.HiddenNameLabel.Text = "";
|
||||||
|
@ -1,21 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityExplorer.Runtime;
|
|
||||||
using UnityExplorer.CacheObject.Views;
|
using UnityExplorer.CacheObject.Views;
|
||||||
using UnityExplorer.Inspectors;
|
using UnityExplorer.Inspectors;
|
||||||
using UniverseLib.UI.Models;
|
|
||||||
using UnityExplorer.UI;
|
|
||||||
using UniverseLib;
|
|
||||||
using UniverseLib.UI;
|
|
||||||
using UnityExplorer.UI.Widgets;
|
using UnityExplorer.UI.Widgets;
|
||||||
using UniverseLib.Utility;
|
using UniverseLib;
|
||||||
using UniverseLib.UI.ObjectPool;
|
using UniverseLib.UI.ObjectPool;
|
||||||
using System.Collections;
|
using UniverseLib.Utility;
|
||||||
using HarmonyLib;
|
|
||||||
|
|
||||||
namespace UnityExplorer.CacheObject
|
namespace UnityExplorer.CacheObject
|
||||||
{
|
{
|
||||||
@ -105,7 +96,7 @@ namespace UnityExplorer.CacheObject
|
|||||||
|
|
||||||
protected override bool TryAutoEvaluateIfUnitialized(CacheObjectCell objectcell)
|
protected override bool TryAutoEvaluateIfUnitialized(CacheObjectCell objectcell)
|
||||||
{
|
{
|
||||||
var cell = objectcell as CacheMemberCell;
|
CacheMemberCell cell = objectcell as CacheMemberCell;
|
||||||
|
|
||||||
cell.EvaluateHolder.SetActive(!ShouldAutoEvaluate);
|
cell.EvaluateHolder.SetActive(!ShouldAutoEvaluate);
|
||||||
if (!ShouldAutoEvaluate)
|
if (!ShouldAutoEvaluate)
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
using System;
|
using HarmonyLib;
|
||||||
using System.Collections;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
|
||||||
using UnityExplorer.Inspectors;
|
using UnityExplorer.Inspectors;
|
||||||
using UnityExplorer.Runtime;
|
using UnityExplorer.Runtime;
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
using HarmonyLib;
|
|
||||||
using HarmonyLib.Tools;
|
|
||||||
|
|
||||||
namespace UnityExplorer.CacheObject
|
namespace UnityExplorer.CacheObject
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
|
||||||
using UnityExplorer.Inspectors;
|
using UnityExplorer.Inspectors;
|
||||||
using UniverseLib;
|
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
|
|
||||||
namespace UnityExplorer.CacheObject
|
namespace UnityExplorer.CacheObject
|
||||||
@ -18,7 +14,7 @@ namespace UnityExplorer.CacheObject
|
|||||||
|
|
||||||
public override bool ShouldAutoEvaluate => false;
|
public override bool ShouldAutoEvaluate => false;
|
||||||
|
|
||||||
public CacheMethod (MethodInfo mi)
|
public CacheMethod(MethodInfo mi)
|
||||||
{
|
{
|
||||||
this.MethodInfo = mi;
|
this.MethodInfo = mi;
|
||||||
}
|
}
|
||||||
@ -36,7 +32,7 @@ namespace UnityExplorer.CacheObject
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var methodInfo = MethodInfo;
|
MethodInfo methodInfo = MethodInfo;
|
||||||
if (methodInfo.IsGenericMethod)
|
if (methodInfo.IsGenericMethod)
|
||||||
methodInfo = MethodInfo.MakeGenericMethod(Evaluator.TryParseGenericArguments());
|
methodInfo = MethodInfo.MakeGenericMethod(Evaluator.TryParseGenericArguments());
|
||||||
|
|
||||||
|
@ -1,20 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
using UnityExplorer.Runtime;
|
|
||||||
using UnityExplorer.CacheObject.IValues;
|
using UnityExplorer.CacheObject.IValues;
|
||||||
using UnityExplorer.CacheObject.Views;
|
using UnityExplorer.CacheObject.Views;
|
||||||
using UniverseLib.UI.Models;
|
|
||||||
using UnityExplorer.UI;
|
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
using UniverseLib.Utility;
|
|
||||||
using UniverseLib.UI.ObjectPool;
|
using UniverseLib.UI.ObjectPool;
|
||||||
|
using UniverseLib.Utility;
|
||||||
|
|
||||||
namespace UnityExplorer.CacheObject
|
namespace UnityExplorer.CacheObject
|
||||||
{
|
{
|
||||||
@ -134,7 +126,7 @@ namespace UnityExplorer.CacheObject
|
|||||||
|
|
||||||
protected virtual void ProcessOnEvaluate()
|
protected virtual void ProcessOnEvaluate()
|
||||||
{
|
{
|
||||||
var prevState = State;
|
ValueState prevState = State;
|
||||||
|
|
||||||
if (LastException != null)
|
if (LastException != null)
|
||||||
{
|
{
|
||||||
@ -319,7 +311,7 @@ namespace UnityExplorer.CacheObject
|
|||||||
SetValueState(cell, new(true, inspectActive: !LastValueWasNull, subContentButtonActive: !LastValueWasNull));
|
SetValueState(cell, new(true, inspectActive: !LastValueWasNull, subContentButtonActive: !LastValueWasNull));
|
||||||
break;
|
break;
|
||||||
case ValueState.Unsupported:
|
case ValueState.Unsupported:
|
||||||
SetValueState(cell, new (true, inspectActive: !LastValueWasNull));
|
SetValueState(cell, new(true, inspectActive: !LastValueWasNull));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityExplorer.Inspectors;
|
using UnityExplorer.Inspectors;
|
||||||
using UnityExplorer.Runtime;
|
|
||||||
|
|
||||||
namespace UnityExplorer.CacheObject
|
namespace UnityExplorer.CacheObject
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityExplorer.CacheObject;
|
|
||||||
using UnityExplorer.CacheObject.Views;
|
using UnityExplorer.CacheObject.Views;
|
||||||
|
|
||||||
namespace UnityExplorer.CacheObject
|
namespace UnityExplorer.CacheObject
|
||||||
@ -33,7 +29,7 @@ namespace UnityExplorer.CacheObject
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var entry = (CacheObjectBase)cachedEntries[index];
|
CacheObjectBase entry = (CacheObjectBase)cachedEntries[index];
|
||||||
|
|
||||||
if (entry.CellView != null && entry.CellView != cell)
|
if (entry.CellView != null && entry.CellView != cell)
|
||||||
entry.UnlinkFromView();
|
entry.UnlinkFromView();
|
||||||
|
@ -1,11 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.CacheObject;
|
|
||||||
using UnityExplorer.UI;
|
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
using UniverseLib.UI.Models;
|
using UniverseLib.UI.Models;
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
@ -32,9 +27,9 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
|
|
||||||
applyButton.Component.gameObject.SetActive(owner.CanWrite);
|
applyButton.Component.gameObject.SetActive(owner.CanWrite);
|
||||||
|
|
||||||
foreach (var slider in sliders)
|
foreach (Slider slider in sliders)
|
||||||
slider.interactable = owner.CanWrite;
|
slider.interactable = owner.CanWrite;
|
||||||
foreach (var input in inputs)
|
foreach (InputFieldRef input in inputs)
|
||||||
input.Component.readOnly = !owner.CanWrite;
|
input.Component.readOnly = !owner.CanWrite;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +49,7 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
inputs[1].Text = c32.g.ToString();
|
inputs[1].Text = c32.g.ToString();
|
||||||
inputs[2].Text = c32.b.ToString();
|
inputs[2].Text = c32.b.ToString();
|
||||||
inputs[3].Text = c32.a.ToString();
|
inputs[3].Text = c32.a.ToString();
|
||||||
foreach (var slider in sliders)
|
foreach (Slider slider in sliders)
|
||||||
slider.maxValue = 255;
|
slider.maxValue = 255;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -65,7 +60,7 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
inputs[1].Text = EditedColor.g.ToString();
|
inputs[1].Text = EditedColor.g.ToString();
|
||||||
inputs[2].Text = EditedColor.b.ToString();
|
inputs[2].Text = EditedColor.b.ToString();
|
||||||
inputs[3].Text = EditedColor.a.ToString();
|
inputs[3].Text = EditedColor.a.ToString();
|
||||||
foreach (var slider in sliders)
|
foreach (Slider slider in sliders)
|
||||||
slider.maxValue = 1;
|
slider.maxValue = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,12 +151,12 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
|
|
||||||
// hori group
|
// hori group
|
||||||
|
|
||||||
var horiGroup = UIFactory.CreateHorizontalGroup(UIRoot, "ColorEditor", false, false, true, true, 5,
|
GameObject horiGroup = UIFactory.CreateHorizontalGroup(UIRoot, "ColorEditor", false, false, true, true, 5,
|
||||||
default, new Color(1, 1, 1, 0), TextAnchor.MiddleLeft);
|
default, new Color(1, 1, 1, 0), TextAnchor.MiddleLeft);
|
||||||
|
|
||||||
// sliders / inputs
|
// sliders / inputs
|
||||||
|
|
||||||
var grid = UIFactory.CreateGridGroup(horiGroup, "Grid", new Vector2(140, 25), new Vector2(2, 2), new Color(1, 1, 1, 0));
|
GameObject grid = UIFactory.CreateGridGroup(horiGroup, "Grid", new Vector2(140, 25), new Vector2(2, 2), new Color(1, 1, 1, 0));
|
||||||
UIFactory.SetLayoutElement(grid, minWidth: 580, minHeight: 25, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(grid, minWidth: 580, minHeight: 25, flexibleWidth: 0);
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
@ -175,7 +170,7 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
|
|
||||||
// image of color
|
// image of color
|
||||||
|
|
||||||
var imgObj = UIFactory.CreateUIObject("ColorImageHelper", horiGroup);
|
GameObject imgObj = UIFactory.CreateUIObject("ColorImageHelper", horiGroup);
|
||||||
UIFactory.SetLayoutElement(imgObj, minHeight: 25, minWidth: 50, flexibleWidth: 50);
|
UIFactory.SetLayoutElement(imgObj, minHeight: 25, minWidth: 50, flexibleWidth: 50);
|
||||||
colorImage = imgObj.AddComponent<Image>();
|
colorImage = imgObj.AddComponent<Image>();
|
||||||
|
|
||||||
@ -184,18 +179,18 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
|
|
||||||
internal void AddEditorRow(int index, GameObject groupObj)
|
internal void AddEditorRow(int index, GameObject groupObj)
|
||||||
{
|
{
|
||||||
var row = UIFactory.CreateHorizontalGroup(groupObj, "EditorRow_" + fieldNames[index],
|
GameObject row = UIFactory.CreateHorizontalGroup(groupObj, "EditorRow_" + fieldNames[index],
|
||||||
false, true, true, true, 5, default, new Color(1, 1, 1, 0));
|
false, true, true, true, 5, default, new Color(1, 1, 1, 0));
|
||||||
|
|
||||||
var label = UIFactory.CreateLabel(row, "RowLabel", $"{fieldNames[index]}:", TextAnchor.MiddleRight, Color.cyan);
|
Text label = UIFactory.CreateLabel(row, "RowLabel", $"{fieldNames[index]}:", TextAnchor.MiddleRight, Color.cyan);
|
||||||
UIFactory.SetLayoutElement(label.gameObject, minWidth: 17, flexibleWidth: 0, minHeight: 25);
|
UIFactory.SetLayoutElement(label.gameObject, minWidth: 17, flexibleWidth: 0, minHeight: 25);
|
||||||
|
|
||||||
var input = UIFactory.CreateInputField(row, "Input", "...");
|
InputFieldRef input = UIFactory.CreateInputField(row, "Input", "...");
|
||||||
UIFactory.SetLayoutElement(input.UIRoot, minWidth: 40, minHeight: 25, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(input.UIRoot, minWidth: 40, minHeight: 25, flexibleHeight: 0);
|
||||||
inputs[index] = input;
|
inputs[index] = input;
|
||||||
input.OnValueChanged += (string val) => { OnInputChanged(val, index); };
|
input.OnValueChanged += (string val) => { OnInputChanged(val, index); };
|
||||||
|
|
||||||
var sliderObj = UIFactory.CreateSlider(row, "Slider", out Slider slider);
|
GameObject sliderObj = UIFactory.CreateSlider(row, "Slider", out Slider slider);
|
||||||
sliders[index] = slider;
|
sliders[index] = slider;
|
||||||
UIFactory.SetLayoutElement(sliderObj, minHeight: 25, minWidth: 70, flexibleWidth: 999, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(sliderObj, minHeight: 25, minWidth: 70, flexibleWidth: 999, flexibleHeight: 0);
|
||||||
slider.minValue = 0;
|
slider.minValue = 0;
|
||||||
|
@ -1,19 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.CacheObject;
|
|
||||||
using UnityExplorer.CacheObject.Views;
|
using UnityExplorer.CacheObject.Views;
|
||||||
using UnityExplorer.Inspectors;
|
|
||||||
using UnityExplorer.UI;
|
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
using UnityExplorer.UI.Widgets;
|
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
using UniverseLib.UI.Widgets;
|
|
||||||
using UniverseLib.UI.Widgets.ScrollView;
|
using UniverseLib.UI.Widgets.ScrollView;
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
|
|
||||||
@ -32,7 +25,7 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
public IDictionary RefIDictionary;
|
public IDictionary RefIDictionary;
|
||||||
|
|
||||||
public int ItemCount => cachedEntries.Count;
|
public int ItemCount => cachedEntries.Count;
|
||||||
private readonly List<CacheKeyValuePair> cachedEntries = new List<CacheKeyValuePair>();
|
private readonly List<CacheKeyValuePair> cachedEntries = new();
|
||||||
|
|
||||||
public ScrollPool<CacheKeyValuePairCell> DictScrollPool { get; private set; }
|
public ScrollPool<CacheKeyValuePairCell> DictScrollPool { get; private set; }
|
||||||
|
|
||||||
@ -61,7 +54,7 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
{
|
{
|
||||||
RefIDictionary = null;
|
RefIDictionary = null;
|
||||||
|
|
||||||
foreach (var entry in cachedEntries)
|
foreach (CacheKeyValuePair entry in cachedEntries)
|
||||||
{
|
{
|
||||||
entry.UnlinkFromView();
|
entry.UnlinkFromView();
|
||||||
entry.ReleasePooledObjects();
|
entry.ReleasePooledObjects();
|
||||||
@ -80,7 +73,7 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var type = value.GetActualType();
|
Type type = value.GetActualType();
|
||||||
ReflectionUtility.TryGetEntryTypes(type, out KeysType, out ValuesType);
|
ReflectionUtility.TryGetEntryTypes(type, out KeysType, out ValuesType);
|
||||||
|
|
||||||
CacheEntries(value);
|
CacheEntries(value);
|
||||||
@ -124,7 +117,7 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
{
|
{
|
||||||
for (int i = cachedEntries.Count - 1; i >= idx; i--)
|
for (int i = cachedEntries.Count - 1; i >= idx; i--)
|
||||||
{
|
{
|
||||||
var cache = cachedEntries[i];
|
CacheKeyValuePair cache = cachedEntries[i];
|
||||||
if (cache.CellView != null)
|
if (cache.CellView != null)
|
||||||
cache.UnlinkFromView();
|
cache.UnlinkFromView();
|
||||||
|
|
||||||
@ -153,7 +146,7 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
|
|
||||||
RefIDictionary[key] = value;
|
RefIDictionary[key] = value;
|
||||||
|
|
||||||
var entry = cachedEntries[keyIndex];
|
CacheKeyValuePair entry = cachedEntries[keyIndex];
|
||||||
entry.SetValueFromSource(value);
|
entry.SetValueFromSource(value);
|
||||||
if (entry.CellView != null)
|
if (entry.CellView != null)
|
||||||
entry.SetDataToCell(entry.CellView);
|
entry.SetDataToCell(entry.CellView);
|
||||||
@ -177,12 +170,12 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
|
|
||||||
public override void SetLayout()
|
public override void SetLayout()
|
||||||
{
|
{
|
||||||
var minHeight = 5f;
|
float minHeight = 5f;
|
||||||
|
|
||||||
KeyTitleLayout.minWidth = AdjustedWidth * 0.44f;
|
KeyTitleLayout.minWidth = AdjustedWidth * 0.44f;
|
||||||
ValueTitleLayout.minWidth = AdjustedWidth * 0.55f;
|
ValueTitleLayout.minWidth = AdjustedWidth * 0.55f;
|
||||||
|
|
||||||
foreach (var cell in DictScrollPool.CellPool)
|
foreach (CacheKeyValuePairCell cell in DictScrollPool.CellPool)
|
||||||
{
|
{
|
||||||
SetCellLayout(cell);
|
SetCellLayout(cell);
|
||||||
if (cell.Enabled)
|
if (cell.Enabled)
|
||||||
@ -194,7 +187,7 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
|
|
||||||
private void SetCellLayout(CacheObjectCell objcell)
|
private void SetCellLayout(CacheObjectCell objcell)
|
||||||
{
|
{
|
||||||
var cell = objcell as CacheKeyValuePairCell;
|
CacheKeyValuePairCell cell = objcell as CacheKeyValuePairCell;
|
||||||
cell.KeyGroupLayout.minWidth = cell.AdjustedWidth * 0.44f;
|
cell.KeyGroupLayout.minWidth = cell.AdjustedWidth * 0.44f;
|
||||||
cell.RightGroupLayout.minWidth = cell.AdjustedWidth * 0.55f;
|
cell.RightGroupLayout.minWidth = cell.AdjustedWidth * 0.55f;
|
||||||
|
|
||||||
@ -221,15 +214,15 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
|
|
||||||
// key / value titles
|
// key / value titles
|
||||||
|
|
||||||
var titleGroup = UIFactory.CreateUIObject("TitleGroup", UIRoot);
|
GameObject titleGroup = UIFactory.CreateUIObject("TitleGroup", UIRoot);
|
||||||
UIFactory.SetLayoutElement(titleGroup, minHeight: 25, flexibleWidth: 9999, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(titleGroup, minHeight: 25, flexibleWidth: 9999, flexibleHeight: 0);
|
||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(titleGroup, false, true, true, true, padLeft: 65, padRight: 0, childAlignment: TextAnchor.LowerLeft);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(titleGroup, false, true, true, true, padLeft: 65, padRight: 0, childAlignment: TextAnchor.LowerLeft);
|
||||||
|
|
||||||
var keyTitle = UIFactory.CreateLabel(titleGroup, "KeyTitle", "Keys", TextAnchor.MiddleLeft);
|
Text keyTitle = UIFactory.CreateLabel(titleGroup, "KeyTitle", "Keys", TextAnchor.MiddleLeft);
|
||||||
UIFactory.SetLayoutElement(keyTitle.gameObject, minWidth: 100, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(keyTitle.gameObject, minWidth: 100, flexibleWidth: 0);
|
||||||
KeyTitleLayout = keyTitle.GetComponent<LayoutElement>();
|
KeyTitleLayout = keyTitle.GetComponent<LayoutElement>();
|
||||||
|
|
||||||
var valueTitle = UIFactory.CreateLabel(titleGroup, "ValueTitle", "Values", TextAnchor.MiddleLeft);
|
Text valueTitle = UIFactory.CreateLabel(titleGroup, "ValueTitle", "Values", TextAnchor.MiddleLeft);
|
||||||
UIFactory.SetLayoutElement(valueTitle.gameObject, minWidth: 100, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(valueTitle.gameObject, minWidth: 100, flexibleWidth: 0);
|
||||||
ValueTitleLayout = valueTitle.GetComponent<LayoutElement>();
|
ValueTitleLayout = valueTitle.GetComponent<LayoutElement>();
|
||||||
|
|
||||||
|
@ -2,13 +2,9 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.CacheObject;
|
|
||||||
using UnityExplorer.UI;
|
|
||||||
using UnityExplorer.UI.Widgets.AutoComplete;
|
using UnityExplorer.UI.Widgets.AutoComplete;
|
||||||
using UniverseLib;
|
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
using UniverseLib.UI.Models;
|
using UniverseLib.UI.Models;
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
@ -110,7 +106,7 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
List<string> values = new List<string>();
|
List<string> values = new();
|
||||||
for (int i = 0; i < CurrentValues.Count; i++)
|
for (int i = 0; i < CurrentValues.Count; i++)
|
||||||
{
|
{
|
||||||
if (flagToggles[i].isOn)
|
if (flagToggles[i].isOn)
|
||||||
@ -138,11 +134,11 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
new Color(0.06f, 0.06f, 0.06f));
|
new Color(0.06f, 0.06f, 0.06f));
|
||||||
UIFactory.SetLayoutElement(UIRoot, minHeight: 25, flexibleHeight: 9999, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(UIRoot, minHeight: 25, flexibleHeight: 9999, flexibleWidth: 9999);
|
||||||
|
|
||||||
var hori = UIFactory.CreateUIObject("Hori", UIRoot);
|
GameObject hori = UIFactory.CreateUIObject("Hori", UIRoot);
|
||||||
UIFactory.SetLayoutElement(hori, minHeight: 25, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(hori, minHeight: 25, flexibleWidth: 9999);
|
||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(hori, false, false, true, true, 2);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(hori, false, false, true, true, 2);
|
||||||
|
|
||||||
var applyButton = UIFactory.CreateButton(hori, "ApplyButton", "Apply", new Color(0.2f, 0.27f, 0.2f));
|
ButtonRef applyButton = UIFactory.CreateButton(hori, "ApplyButton", "Apply", new Color(0.2f, 0.27f, 0.2f));
|
||||||
UIFactory.SetLayoutElement(applyButton.Component.gameObject, minHeight: 25, minWidth: 100);
|
UIFactory.SetLayoutElement(applyButton.Component.gameObject, minHeight: 25, minWidth: 100);
|
||||||
applyButton.OnClick += OnApplyClicked;
|
applyButton.OnClick += OnApplyClicked;
|
||||||
|
|
||||||
@ -192,11 +188,11 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
|
|
||||||
private void AddToggleRow()
|
private void AddToggleRow()
|
||||||
{
|
{
|
||||||
var row = UIFactory.CreateUIObject("ToggleRow", toggleHolder);
|
GameObject row = UIFactory.CreateUIObject("ToggleRow", toggleHolder);
|
||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(row, false, false, true, true, 2);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(row, false, false, true, true, 2);
|
||||||
UIFactory.SetLayoutElement(row, minHeight: 25, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(row, minHeight: 25, flexibleWidth: 9999);
|
||||||
|
|
||||||
var toggleObj = UIFactory.CreateToggle(row, "ToggleObj", out Toggle toggle, out Text toggleText);
|
GameObject toggleObj = UIFactory.CreateToggle(row, "ToggleObj", out Toggle toggle, out Text toggleText);
|
||||||
UIFactory.SetLayoutElement(toggleObj, minHeight: 25, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(toggleObj, minHeight: 25, flexibleWidth: 9999);
|
||||||
|
|
||||||
flagToggles.Add(toggle);
|
flagToggles.Add(toggle);
|
||||||
@ -205,7 +201,7 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
|
|
||||||
#region Enum cache
|
#region Enum cache
|
||||||
|
|
||||||
internal static readonly Dictionary<string, OrderedDictionary> enumCache = new Dictionary<string, OrderedDictionary>();
|
internal static readonly Dictionary<string, OrderedDictionary> enumCache = new();
|
||||||
|
|
||||||
internal static OrderedDictionary GetEnumValues(Type enumType)
|
internal static OrderedDictionary GetEnumValues(Type enumType)
|
||||||
{
|
{
|
||||||
@ -213,13 +209,13 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
|
|
||||||
if (!enumCache.ContainsKey(enumType.AssemblyQualifiedName))
|
if (!enumCache.ContainsKey(enumType.AssemblyQualifiedName))
|
||||||
{
|
{
|
||||||
var dict = new OrderedDictionary();
|
OrderedDictionary dict = new();
|
||||||
var addedNames = new HashSet<string>();
|
HashSet<string> addedNames = new();
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach (var value in Enum.GetValues(enumType))
|
foreach (object value in Enum.GetValues(enumType))
|
||||||
{
|
{
|
||||||
var name = value.ToString();
|
string name = value.ToString();
|
||||||
if (addedNames.Contains(name))
|
if (addedNames.Contains(name))
|
||||||
continue;
|
continue;
|
||||||
addedNames.Add(name);
|
addedNames.Add(name);
|
||||||
|
@ -5,15 +5,10 @@ using System.Linq;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.CacheObject;
|
|
||||||
using UnityExplorer.CacheObject.Views;
|
using UnityExplorer.CacheObject.Views;
|
||||||
using UnityExplorer.Inspectors;
|
|
||||||
using UnityExplorer.UI;
|
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
using UnityExplorer.UI.Widgets;
|
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
using UniverseLib.UI.Widgets;
|
|
||||||
using UniverseLib.UI.Widgets.ScrollView;
|
using UniverseLib.UI.Widgets.ScrollView;
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
|
|
||||||
@ -60,7 +55,7 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
{
|
{
|
||||||
RefIList = null;
|
RefIList = null;
|
||||||
|
|
||||||
foreach (var entry in cachedEntries)
|
foreach (CacheListEntry entry in cachedEntries)
|
||||||
{
|
{
|
||||||
entry.UnlinkFromView();
|
entry.UnlinkFromView();
|
||||||
entry.ReleasePooledObjects();
|
entry.ReleasePooledObjects();
|
||||||
@ -73,9 +68,9 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
|
|
||||||
public override void SetLayout()
|
public override void SetLayout()
|
||||||
{
|
{
|
||||||
var minHeight = 5f;
|
float minHeight = 5f;
|
||||||
|
|
||||||
foreach (var cell in ListScrollPool.CellPool)
|
foreach (CacheListEntryCell cell in ListScrollPool.CellPool)
|
||||||
{
|
{
|
||||||
if (cell.Enabled)
|
if (cell.Enabled)
|
||||||
minHeight += cell.Rect.rect.height;
|
minHeight += cell.Rect.rect.height;
|
||||||
@ -102,7 +97,7 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var type = value.GetActualType();
|
Type type = value.GetActualType();
|
||||||
ReflectionUtility.TryGetEntryType(type, out EntryType);
|
ReflectionUtility.TryGetEntryType(type, out EntryType);
|
||||||
|
|
||||||
CacheEntries(value);
|
CacheEntries(value);
|
||||||
@ -132,7 +127,7 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
|
|
||||||
while (enumerator.MoveNext())
|
while (enumerator.MoveNext())
|
||||||
{
|
{
|
||||||
var entry = enumerator.Current;
|
object entry = enumerator.Current;
|
||||||
|
|
||||||
// If list count increased, create new cache entries
|
// If list count increased, create new cache entries
|
||||||
CacheListEntry cache;
|
CacheListEntry cache;
|
||||||
@ -155,7 +150,7 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
{
|
{
|
||||||
for (int i = cachedEntries.Count - 1; i >= idx; i--)
|
for (int i = cachedEntries.Count - 1; i >= idx; i--)
|
||||||
{
|
{
|
||||||
var cache = cachedEntries[i];
|
CacheListEntry cache = cachedEntries[i];
|
||||||
if (cache.CellView != null)
|
if (cache.CellView != null)
|
||||||
cache.UnlinkFromView();
|
cache.UnlinkFromView();
|
||||||
|
|
||||||
@ -174,7 +169,7 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var type = value.GetType();
|
Type type = value.GetType();
|
||||||
if (type.GetInterfaces().Any(it => it.IsGenericType && it.GetGenericTypeDefinition() == typeof(IList<>)))
|
if (type.GetInterfaces().Any(it => it.IsGenericType && it.GetGenericTypeDefinition() == typeof(IList<>)))
|
||||||
IsWritableGenericIList = !(bool)type.GetProperty("IsReadOnly").GetValue(value, null);
|
IsWritableGenericIList = !(bool)type.GetProperty("IsReadOnly").GetValue(value, null);
|
||||||
else
|
else
|
||||||
@ -184,7 +179,7 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
{
|
{
|
||||||
// Find the "this[int index]" property.
|
// Find the "this[int index]" property.
|
||||||
// It might be a private implementation.
|
// It might be a private implementation.
|
||||||
foreach (var prop in type.GetProperties(ReflectionUtility.FLAGS))
|
foreach (PropertyInfo prop in type.GetProperties(ReflectionUtility.FLAGS))
|
||||||
{
|
{
|
||||||
if ((prop.Name == "Item"
|
if ((prop.Name == "Item"
|
||||||
|| (prop.Name.StartsWith("System.Collections.Generic.IList<") && prop.Name.EndsWith(">.Item")))
|
|| (prop.Name.StartsWith("System.Collections.Generic.IList<") && prop.Name.EndsWith(">.Item")))
|
||||||
@ -226,7 +221,7 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
genericIndexer.SetValue(CurrentOwner.Value, value, new object[] { index });
|
genericIndexer.SetValue(CurrentOwner.Value, value, new object[] { index });
|
||||||
}
|
}
|
||||||
|
|
||||||
var entry = cachedEntries[index];
|
CacheListEntry entry = cachedEntries[index];
|
||||||
entry.SetValueFromSource(value);
|
entry.SetValueFromSource(value);
|
||||||
|
|
||||||
if (entry.CellView != null)
|
if (entry.CellView != null)
|
||||||
|
@ -1,16 +1,8 @@
|
|||||||
using System;
|
using System.IO;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Config;
|
using UnityExplorer.Config;
|
||||||
using UnityExplorer.CacheObject;
|
|
||||||
using UnityExplorer.UI.Widgets;
|
|
||||||
using UnityExplorer.UI;
|
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
using UniverseLib;
|
|
||||||
using UniverseLib.UI.Models;
|
using UniverseLib.UI.Models;
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
|
|
||||||
@ -88,7 +80,7 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var path = IOUtility.EnsureValidFilePath(SaveFilePath.Text);
|
string path = IOUtility.EnsureValidFilePath(SaveFilePath.Text);
|
||||||
|
|
||||||
if (File.Exists(path))
|
if (File.Exists(path))
|
||||||
File.Delete(path);
|
File.Delete(path);
|
||||||
@ -110,10 +102,10 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
UIFactory.CreateLabel(SaveFileRow, "Info", "<color=red>String is too long! Save to file if you want to see the full string.</color>",
|
UIFactory.CreateLabel(SaveFileRow, "Info", "<color=red>String is too long! Save to file if you want to see the full string.</color>",
|
||||||
TextAnchor.MiddleLeft);
|
TextAnchor.MiddleLeft);
|
||||||
|
|
||||||
var horizRow = UIFactory.CreateUIObject("Horiz", SaveFileRow);
|
GameObject horizRow = UIFactory.CreateUIObject("Horiz", SaveFileRow);
|
||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(horizRow, false, false, true, true, 4);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(horizRow, false, false, true, true, 4);
|
||||||
|
|
||||||
var saveButton = UIFactory.CreateButton(horizRow, "SaveButton", "Save file");
|
ButtonRef saveButton = UIFactory.CreateButton(horizRow, "SaveButton", "Save file");
|
||||||
UIFactory.SetLayoutElement(saveButton.Component.gameObject, minHeight: 25, minWidth: 100, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(saveButton.Component.gameObject, minHeight: 25, minWidth: 100, flexibleWidth: 0);
|
||||||
saveButton.OnClick += OnSaveFileClicked;
|
saveButton.OnClick += OnSaveFileClicked;
|
||||||
|
|
||||||
|
@ -1,13 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
using UnityExplorer.CacheObject;
|
|
||||||
using UnityExplorer.UI;
|
|
||||||
using UniverseLib.UI;
|
|
||||||
using UniverseLib.UI.Models;
|
|
||||||
using UniverseLib.UI.ObjectPool;
|
using UniverseLib.UI.ObjectPool;
|
||||||
|
|
||||||
namespace UnityExplorer.CacheObject.IValues
|
namespace UnityExplorer.CacheObject.IValues
|
||||||
|
@ -2,11 +2,8 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.CacheObject;
|
|
||||||
using UnityExplorer.UI;
|
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
using UniverseLib.UI.Models;
|
using UniverseLib.UI.Models;
|
||||||
@ -31,7 +28,7 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
|
|
||||||
public void SetValue(object instance, string input, int fieldIndex)
|
public void SetValue(object instance, string input, int fieldIndex)
|
||||||
{
|
{
|
||||||
var field = Fields[fieldIndex];
|
FieldInfo field = Fields[fieldIndex];
|
||||||
|
|
||||||
object val;
|
object val;
|
||||||
if (field.FieldType == typeof(string))
|
if (field.FieldType == typeof(string))
|
||||||
@ -51,8 +48,8 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
|
|
||||||
public string GetValue(object instance, int fieldIndex)
|
public string GetValue(object instance, int fieldIndex)
|
||||||
{
|
{
|
||||||
var field = Fields[fieldIndex];
|
FieldInfo field = Fields[fieldIndex];
|
||||||
var value = field.GetValue(instance);
|
object value = field.GetValue(instance);
|
||||||
return ParseUtility.ToStringForInput(value, field.FieldType);
|
return ParseUtility.ToStringForInput(value, field.FieldType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -67,12 +64,12 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
if (!type.IsValueType || string.IsNullOrEmpty(type.AssemblyQualifiedName) || type.FullName == SYSTEM_VOID)
|
if (!type.IsValueType || string.IsNullOrEmpty(type.AssemblyQualifiedName) || type.FullName == SYSTEM_VOID)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (typeSupportCache.TryGetValue(type.AssemblyQualifiedName, out var info))
|
if (typeSupportCache.TryGetValue(type.AssemblyQualifiedName, out StructInfo info))
|
||||||
return info.IsSupported;
|
return info.IsSupported;
|
||||||
|
|
||||||
var supported = false;
|
bool supported = false;
|
||||||
|
|
||||||
var fields = type.GetFields(INSTANCE_FLAGS);
|
FieldInfo[] fields = type.GetFields(INSTANCE_FLAGS);
|
||||||
if (fields.Length > 0)
|
if (fields.Length > 0)
|
||||||
{
|
{
|
||||||
if (fields.Any(it => !ParseUtility.CanParse(it.FieldType)))
|
if (fields.Any(it => !ParseUtility.CanParse(it.FieldType)))
|
||||||
@ -100,9 +97,9 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
private Type lastStructType;
|
private Type lastStructType;
|
||||||
|
|
||||||
private ButtonRef applyButton;
|
private ButtonRef applyButton;
|
||||||
private readonly List<GameObject> fieldRows = new List<GameObject>();
|
private readonly List<GameObject> fieldRows = new();
|
||||||
private readonly List<InputFieldRef> inputFields = new List<InputFieldRef>();
|
private readonly List<InputFieldRef> inputFields = new();
|
||||||
private readonly List<Text> labels = new List<Text>();
|
private readonly List<Text> labels = new();
|
||||||
|
|
||||||
public override void OnBorrowed(CacheObjectBase owner)
|
public override void OnBorrowed(CacheObjectBase owner)
|
||||||
{
|
{
|
||||||
@ -117,7 +114,7 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
{
|
{
|
||||||
RefInstance = value;
|
RefInstance = value;
|
||||||
|
|
||||||
var type = RefInstance.GetType();
|
Type type = RefInstance.GetType();
|
||||||
|
|
||||||
if (type != lastStructType)
|
if (type != lastStructType)
|
||||||
{
|
{
|
||||||
@ -177,21 +174,21 @@ namespace UnityExplorer.CacheObject.IValues
|
|||||||
|
|
||||||
private void AddEditorRow()
|
private void AddEditorRow()
|
||||||
{
|
{
|
||||||
var row = UIFactory.CreateUIObject("HoriGroup", UIRoot);
|
GameObject row = UIFactory.CreateUIObject("HoriGroup", UIRoot);
|
||||||
//row.AddComponent<ContentSizeFitter>().horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
|
//row.AddComponent<ContentSizeFitter>().horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
|
||||||
UIFactory.SetLayoutElement(row, minHeight: 25, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(row, minHeight: 25, flexibleWidth: 9999);
|
||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(row, false, false, true, true, 8, childAlignment: TextAnchor.MiddleLeft);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(row, false, false, true, true, 8, childAlignment: TextAnchor.MiddleLeft);
|
||||||
|
|
||||||
fieldRows.Add(row);
|
fieldRows.Add(row);
|
||||||
|
|
||||||
var label = UIFactory.CreateLabel(row, "Label", "notset", TextAnchor.MiddleLeft);
|
Text label = UIFactory.CreateLabel(row, "Label", "notset", TextAnchor.MiddleLeft);
|
||||||
UIFactory.SetLayoutElement(label.gameObject, minHeight: 25, minWidth: 50, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(label.gameObject, minHeight: 25, minWidth: 50, flexibleWidth: 0);
|
||||||
label.horizontalOverflow = HorizontalWrapMode.Wrap;
|
label.horizontalOverflow = HorizontalWrapMode.Wrap;
|
||||||
labels.Add(label);
|
labels.Add(label);
|
||||||
|
|
||||||
var input = UIFactory.CreateInputField(row, "InputField", "...");
|
InputFieldRef input = UIFactory.CreateInputField(row, "InputField", "...");
|
||||||
UIFactory.SetLayoutElement(input.UIRoot, minHeight: 25, minWidth: 200);
|
UIFactory.SetLayoutElement(input.UIRoot, minHeight: 25, minWidth: 200);
|
||||||
var fitter = input.UIRoot.AddComponent<ContentSizeFitter>();
|
ContentSizeFitter fitter = input.UIRoot.AddComponent<ContentSizeFitter>();
|
||||||
fitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
|
fitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
|
||||||
fitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
|
fitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
|
||||||
input.Component.lineType = InputField.LineType.MultiLineNewline;
|
input.Component.lineType = InputField.LineType.MultiLineNewline;
|
||||||
|
@ -1,13 +1,8 @@
|
|||||||
using System;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.UI;
|
|
||||||
using UniverseLib;
|
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
|
using UniverseLib;
|
||||||
|
|
||||||
namespace UnityExplorer.CacheObject.Views
|
namespace UnityExplorer.CacheObject.Views
|
||||||
{
|
{
|
||||||
@ -32,7 +27,7 @@ namespace UnityExplorer.CacheObject.Views
|
|||||||
|
|
||||||
// horizontal group
|
// horizontal group
|
||||||
|
|
||||||
var horiGroup = UIFactory.CreateUIObject("RightHoriGroup", UIRoot);
|
GameObject horiGroup = UIFactory.CreateUIObject("RightHoriGroup", UIRoot);
|
||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(horiGroup, false, false, true, true, 4, childAlignment: TextAnchor.UpperLeft);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(horiGroup, false, false, true, true, 4, childAlignment: TextAnchor.UpperLeft);
|
||||||
UIFactory.SetLayoutElement(horiGroup, minHeight: 25, minWidth: 200, flexibleWidth: 9999, flexibleHeight: 800);
|
UIFactory.SetLayoutElement(horiGroup, minHeight: 25, minWidth: 200, flexibleWidth: 9999, flexibleHeight: 800);
|
||||||
|
|
||||||
@ -48,7 +43,7 @@ namespace UnityExplorer.CacheObject.Views
|
|||||||
|
|
||||||
// Bool and number value interaction
|
// Bool and number value interaction
|
||||||
|
|
||||||
var toggleObj = UIFactory.CreateToggle(horiGroup, "Toggle", out Toggle, out ToggleText);
|
GameObject toggleObj = UIFactory.CreateToggle(horiGroup, "Toggle", out Toggle, out ToggleText);
|
||||||
UIFactory.SetLayoutElement(toggleObj, minWidth: 70, minHeight: 25, flexibleWidth: 0, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(toggleObj, minWidth: 70, minHeight: 25, flexibleWidth: 0, flexibleHeight: 0);
|
||||||
ToggleText.color = SignatureHighlighter.KeywordBlue;
|
ToggleText.color = SignatureHighlighter.KeywordBlue;
|
||||||
Toggle.onValueChanged.AddListener(ToggleClicked);
|
Toggle.onValueChanged.AddListener(ToggleClicked);
|
||||||
@ -77,7 +72,7 @@ namespace UnityExplorer.CacheObject.Views
|
|||||||
SubContentHolder.SetActive(false);
|
SubContentHolder.SetActive(false);
|
||||||
|
|
||||||
// Bottom separator
|
// Bottom separator
|
||||||
var separator = UIFactory.CreateUIObject("BottomSeperator", UIRoot);
|
GameObject separator = UIFactory.CreateUIObject("BottomSeperator", UIRoot);
|
||||||
UIFactory.SetLayoutElement(separator, minHeight: 1, flexibleHeight: 0, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(separator, minHeight: 1, flexibleHeight: 0, flexibleWidth: 9999);
|
||||||
separator.AddComponent<Image>().color = Color.black;
|
separator.AddComponent<Image>().color = Color.black;
|
||||||
|
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
using System;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.CacheObject.IValues;
|
using UnityExplorer.CacheObject.IValues;
|
||||||
using UnityExplorer.Inspectors;
|
|
||||||
using UnityExplorer.UI;
|
|
||||||
using UnityExplorer.UI.Widgets;
|
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
using UniverseLib.UI.Models;
|
using UniverseLib.UI.Models;
|
||||||
|
|
||||||
@ -24,8 +17,8 @@ namespace UnityExplorer.CacheObject.Views
|
|||||||
public InputFieldRef KeyInputField;
|
public InputFieldRef KeyInputField;
|
||||||
public Text KeyInputTypeLabel;
|
public Text KeyInputTypeLabel;
|
||||||
|
|
||||||
public static Color EvenColor = new Color(0.07f, 0.07f, 0.07f);
|
public static Color EvenColor = new(0.07f, 0.07f, 0.07f);
|
||||||
public static Color OddColor = new Color(0.063f, 0.063f, 0.063f);
|
public static Color OddColor = new(0.063f, 0.063f, 0.063f);
|
||||||
|
|
||||||
public int AdjustedWidth => (int)Rect.rect.width - 70;
|
public int AdjustedWidth => (int)Rect.rect.width - 70;
|
||||||
|
|
||||||
@ -40,7 +33,7 @@ namespace UnityExplorer.CacheObject.Views
|
|||||||
|
|
||||||
public override GameObject CreateContent(GameObject parent)
|
public override GameObject CreateContent(GameObject parent)
|
||||||
{
|
{
|
||||||
var root = base.CreateContent(parent);
|
GameObject root = base.CreateContent(parent);
|
||||||
|
|
||||||
Image = root.AddComponent<Image>();
|
Image = root.AddComponent<Image>();
|
||||||
|
|
||||||
@ -53,7 +46,7 @@ namespace UnityExplorer.CacheObject.Views
|
|||||||
this.RightGroupLayout.minWidth = AdjustedWidth * 0.55f;
|
this.RightGroupLayout.minWidth = AdjustedWidth * 0.55f;
|
||||||
|
|
||||||
// Key area
|
// Key area
|
||||||
var keyGroup = UIFactory.CreateUIObject("KeyHolder", root.transform.Find("HoriGroup").gameObject);
|
GameObject keyGroup = UIFactory.CreateUIObject("KeyHolder", root.transform.Find("HoriGroup").gameObject);
|
||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(keyGroup, false, false, true, true, 2, 0, 0, 4, 4, childAlignment: TextAnchor.MiddleLeft);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(keyGroup, false, false, true, true, 2, 0, 0, 4, 4, childAlignment: TextAnchor.MiddleLeft);
|
||||||
KeyGroupLayout = UIFactory.SetLayoutElement(keyGroup, minHeight: 30, minWidth: (int)(AdjustedWidth * 0.44f), flexibleWidth: 0);
|
KeyGroupLayout = UIFactory.SetLayoutElement(keyGroup, minHeight: 30, minWidth: (int)(AdjustedWidth * 0.44f), flexibleWidth: 0);
|
||||||
|
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
using System;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.CacheObject.IValues;
|
using UnityExplorer.CacheObject.IValues;
|
||||||
|
|
||||||
@ -13,12 +9,12 @@ namespace UnityExplorer.CacheObject.Views
|
|||||||
public Image Image { get; private set; }
|
public Image Image { get; private set; }
|
||||||
public InteractiveList ListOwner => Occupant.Owner as InteractiveList;
|
public InteractiveList ListOwner => Occupant.Owner as InteractiveList;
|
||||||
|
|
||||||
public static Color EvenColor = new Color(0.12f, 0.12f, 0.12f);
|
public static Color EvenColor = new(0.12f, 0.12f, 0.12f);
|
||||||
public static Color OddColor = new Color(0.1f, 0.1f, 0.1f);
|
public static Color OddColor = new(0.1f, 0.1f, 0.1f);
|
||||||
|
|
||||||
public override GameObject CreateContent(GameObject parent)
|
public override GameObject CreateContent(GameObject parent)
|
||||||
{
|
{
|
||||||
var root = base.CreateContent(parent);
|
GameObject root = base.CreateContent(parent);
|
||||||
|
|
||||||
Image = root.AddComponent<Image>();
|
Image = root.AddComponent<Image>();
|
||||||
|
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
using System;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.UI;
|
|
||||||
using UnityExplorer.UI.Widgets;
|
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
using UniverseLib.UI.Models;
|
using UniverseLib.UI.Models;
|
||||||
|
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
using System;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
@ -116,7 +112,7 @@ namespace UnityExplorer.CacheObject.Views
|
|||||||
UIFactory.SetLayoutElement(UIRoot, minWidth: 100, flexibleWidth: 9999, minHeight: 30, flexibleHeight: 600);
|
UIFactory.SetLayoutElement(UIRoot, minWidth: 100, flexibleWidth: 9999, minHeight: 30, flexibleHeight: 600);
|
||||||
UIRoot.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;
|
UIRoot.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;
|
||||||
|
|
||||||
var horiRow = UIFactory.CreateUIObject("HoriGroup", UIRoot);
|
GameObject horiRow = UIFactory.CreateUIObject("HoriGroup", UIRoot);
|
||||||
UIFactory.SetLayoutElement(horiRow, minHeight: 29, flexibleHeight: 150, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(horiRow, minHeight: 29, flexibleHeight: 150, flexibleWidth: 9999);
|
||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(horiRow, false, false, true, true, 5, 2, childAlignment: TextAnchor.UpperLeft);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(horiRow, false, false, true, true, 5, 2, childAlignment: TextAnchor.UpperLeft);
|
||||||
horiRow.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;
|
horiRow.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;
|
||||||
@ -129,7 +125,7 @@ namespace UnityExplorer.CacheObject.Views
|
|||||||
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(NameLabel.gameObject, true, true, true, true);
|
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(NameLabel.gameObject, true, true, true, true);
|
||||||
|
|
||||||
HiddenNameLabel = UIFactory.CreateInputField(NameLabel.gameObject, "HiddenNameLabel", "");
|
HiddenNameLabel = UIFactory.CreateInputField(NameLabel.gameObject, "HiddenNameLabel", "");
|
||||||
var hiddenRect = HiddenNameLabel.Component.GetComponent<RectTransform>();
|
RectTransform hiddenRect = HiddenNameLabel.Component.GetComponent<RectTransform>();
|
||||||
hiddenRect.anchorMin = Vector2.zero;
|
hiddenRect.anchorMin = Vector2.zero;
|
||||||
hiddenRect.anchorMax = Vector2.one;
|
hiddenRect.anchorMax = Vector2.one;
|
||||||
HiddenNameLabel.Component.readOnly = true;
|
HiddenNameLabel.Component.readOnly = true;
|
||||||
@ -150,7 +146,7 @@ namespace UnityExplorer.CacheObject.Views
|
|||||||
|
|
||||||
// Right horizontal group
|
// Right horizontal group
|
||||||
|
|
||||||
var rightHoriGroup = UIFactory.CreateUIObject("RightHoriGroup", RightGroupContent);
|
GameObject rightHoriGroup = UIFactory.CreateUIObject("RightHoriGroup", RightGroupContent);
|
||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(rightHoriGroup, false, false, true, true, 4, childAlignment: TextAnchor.UpperLeft);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(rightHoriGroup, false, false, true, true, 4, childAlignment: TextAnchor.UpperLeft);
|
||||||
UIFactory.SetLayoutElement(rightHoriGroup, minHeight: 25, minWidth: 200, flexibleWidth: 9999, flexibleHeight: 800);
|
UIFactory.SetLayoutElement(rightHoriGroup, minHeight: 25, minWidth: 200, flexibleWidth: 9999, flexibleHeight: 800);
|
||||||
|
|
||||||
@ -166,7 +162,7 @@ namespace UnityExplorer.CacheObject.Views
|
|||||||
|
|
||||||
// Bool and number value interaction
|
// Bool and number value interaction
|
||||||
|
|
||||||
var toggleObj = UIFactory.CreateToggle(rightHoriGroup, "Toggle", out Toggle, out ToggleText);
|
GameObject toggleObj = UIFactory.CreateToggle(rightHoriGroup, "Toggle", out Toggle, out ToggleText);
|
||||||
UIFactory.SetLayoutElement(toggleObj, minWidth: 70, minHeight: 25, flexibleWidth: 0, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(toggleObj, minWidth: 70, minHeight: 25, flexibleWidth: 0, flexibleHeight: 0);
|
||||||
ToggleText.color = SignatureHighlighter.KeywordBlue;
|
ToggleText.color = SignatureHighlighter.KeywordBlue;
|
||||||
Toggle.onValueChanged.AddListener(ToggleClicked);
|
Toggle.onValueChanged.AddListener(ToggleClicked);
|
||||||
@ -194,8 +190,8 @@ namespace UnityExplorer.CacheObject.Views
|
|||||||
|
|
||||||
// Copy and Paste buttons
|
// Copy and Paste buttons
|
||||||
|
|
||||||
var buttonHolder = UIFactory.CreateHorizontalGroup(rightHoriGroup, "CopyPasteButtons", false, false, true, true, 4,
|
GameObject buttonHolder = UIFactory.CreateHorizontalGroup(rightHoriGroup, "CopyPasteButtons", false, false, true, true, 4,
|
||||||
bgColor: new(1,1,1,0), childAlignment: TextAnchor.MiddleLeft);
|
bgColor: new(1, 1, 1, 0), childAlignment: TextAnchor.MiddleLeft);
|
||||||
UIFactory.SetLayoutElement(buttonHolder, minWidth: 60, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(buttonHolder, minWidth: 60, flexibleWidth: 0);
|
||||||
|
|
||||||
CopyButton = UIFactory.CreateButton(buttonHolder, "CopyButton", "Copy", new Color(0.13f, 0.13f, 0.13f, 1f));
|
CopyButton = UIFactory.CreateButton(buttonHolder, "CopyButton", "Copy", new Color(0.13f, 0.13f, 0.13f, 1f));
|
||||||
@ -219,7 +215,7 @@ namespace UnityExplorer.CacheObject.Views
|
|||||||
SubContentHolder.SetActive(false);
|
SubContentHolder.SetActive(false);
|
||||||
|
|
||||||
// Bottom separator
|
// Bottom separator
|
||||||
var separator = UIFactory.CreateUIObject("BottomSeperator", UIRoot);
|
GameObject separator = UIFactory.CreateUIObject("BottomSeperator", UIRoot);
|
||||||
UIFactory.SetLayoutElement(separator, minHeight: 1, flexibleHeight: 0, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(separator, minHeight: 1, flexibleHeight: 0, flexibleWidth: 9999);
|
||||||
separator.AddComponent<Image>().color = Color.black;
|
separator.AddComponent<Image>().color = Color.black;
|
||||||
|
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace UnityExplorer.Config
|
namespace UnityExplorer.Config
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
using System;
|
namespace UnityExplorer.Config
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace UnityExplorer.Config
|
|
||||||
{
|
{
|
||||||
public abstract class ConfigHandler
|
public abstract class ConfigHandler
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Globalization;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityExplorer.UI;
|
using UnityExplorer.UI;
|
||||||
|
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityExplorer.UI;
|
|
||||||
using Tomlet;
|
using Tomlet;
|
||||||
using Tomlet.Models;
|
using Tomlet.Models;
|
||||||
|
using UnityExplorer.UI;
|
||||||
|
|
||||||
namespace UnityExplorer.Config
|
namespace UnityExplorer.Config
|
||||||
{
|
{
|
||||||
@ -49,9 +46,9 @@ namespace UnityExplorer.Config
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
TomlDocument document = TomlParser.ParseFile(CONFIG_PATH);
|
TomlDocument document = TomlParser.ParseFile(CONFIG_PATH);
|
||||||
foreach (var key in document.Keys)
|
foreach (string key in document.Keys)
|
||||||
{
|
{
|
||||||
var panelKey = (UIManager.Panels)Enum.Parse(typeof(UIManager.Panels), key);
|
UIManager.Panels panelKey = (UIManager.Panels)Enum.Parse(typeof(UIManager.Panels), key);
|
||||||
ConfigManager.GetPanelSaveData(panelKey).Value = document.GetString(key);
|
ConfigManager.GetPanelSaveData(panelKey).Value = document.GetString(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,8 +66,8 @@ namespace UnityExplorer.Config
|
|||||||
if (UIManager.Initializing)
|
if (UIManager.Initializing)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var tomlDocument = TomlDocument.CreateEmpty();
|
TomlDocument tomlDocument = TomlDocument.CreateEmpty();
|
||||||
foreach (var entry in ConfigManager.InternalConfigs)
|
foreach (KeyValuePair<string, IConfigElement> entry in ConfigManager.InternalConfigs)
|
||||||
tomlDocument.Put(entry.Key, entry.Value.BoxedValue as string, false);
|
tomlDocument.Put(entry.Key, entry.Value.BoxedValue as string, false);
|
||||||
|
|
||||||
File.WriteAllText(CONFIG_PATH, tomlDocument.SerializedValue);
|
File.WriteAllText(CONFIG_PATH, tomlDocument.SerializedValue);
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
using System;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
|
||||||
#if CPP
|
#if CPP
|
||||||
using UnhollowerRuntimeLib;
|
using UnhollowerRuntimeLib;
|
||||||
#endif
|
#endif
|
||||||
@ -14,7 +10,7 @@ namespace UnityExplorer
|
|||||||
internal static ExplorerBehaviour Instance { get; private set; }
|
internal static ExplorerBehaviour Instance { get; private set; }
|
||||||
|
|
||||||
#if CPP
|
#if CPP
|
||||||
public ExplorerBehaviour(IntPtr ptr) : base(ptr) { }
|
public ExplorerBehaviour(System.IntPtr ptr) : base(ptr) { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
internal static void Setup()
|
internal static void Setup()
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityExplorer.CacheObject;
|
|
||||||
using UnityExplorer.Config;
|
using UnityExplorer.Config;
|
||||||
using UnityExplorer.ObjectExplorer;
|
using UnityExplorer.ObjectExplorer;
|
||||||
using UnityExplorer.Runtime;
|
using UnityExplorer.Runtime;
|
||||||
@ -76,60 +75,6 @@ namespace UnityExplorer
|
|||||||
UIManager.ShowMenu = !UIManager.ShowMenu;
|
UIManager.ShowMenu = !UIManager.ShowMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Can be removed eventually. For migration from <4.7.0
|
|
||||||
static void CheckLegacyExplorerFolder()
|
|
||||||
{
|
|
||||||
string legacyPath = Path.Combine(Loader.ExplorerFolderDestination, "UnityExplorer");
|
|
||||||
if (Directory.Exists(legacyPath))
|
|
||||||
{
|
|
||||||
LogWarning($"Attempting to migrate old 'UnityExplorer/' folder to 'sinai-dev-UnityExplorer/'...");
|
|
||||||
|
|
||||||
// If new folder doesn't exist yet, let's just use Move().
|
|
||||||
if (!Directory.Exists(ExplorerFolder))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Directory.Move(legacyPath, ExplorerFolder);
|
|
||||||
Log("Migrated successfully.");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
LogWarning($"Exception migrating folder: {ex}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // We have to merge
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
CopyAll(new(legacyPath), new(ExplorerFolder));
|
|
||||||
Directory.Delete(legacyPath, true);
|
|
||||||
Log("Migrated successfully.");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
LogWarning($"Exception migrating folder: {ex}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void CopyAll(DirectoryInfo source, DirectoryInfo target)
|
|
||||||
{
|
|
||||||
// Check if the target directory exists, if not, create it.
|
|
||||||
if (!Directory.Exists(target.FullName))
|
|
||||||
Directory.CreateDirectory(target.FullName);
|
|
||||||
|
|
||||||
// Copy each file into it's new directory.
|
|
||||||
foreach (FileInfo fi in source.GetFiles())
|
|
||||||
fi.MoveTo(Path.Combine(target.ToString(), fi.Name));
|
|
||||||
|
|
||||||
// Copy each subdirectory using recursion.
|
|
||||||
foreach (DirectoryInfo diSourceSubDir in source.GetDirectories())
|
|
||||||
{
|
|
||||||
DirectoryInfo nextTargetSubDir = target.CreateSubdirectory(diSourceSubDir.Name);
|
|
||||||
CopyAll(diSourceSubDir, nextTargetSubDir);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#region LOGGING
|
#region LOGGING
|
||||||
|
|
||||||
@ -175,5 +120,63 @@ namespace UnityExplorer
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
#region LEGACY FOLDER MIGRATION
|
||||||
|
|
||||||
|
// Can be removed eventually. For migration from <4.7.0
|
||||||
|
static void CheckLegacyExplorerFolder()
|
||||||
|
{
|
||||||
|
string legacyPath = Path.Combine(Loader.ExplorerFolderDestination, "UnityExplorer");
|
||||||
|
if (Directory.Exists(legacyPath))
|
||||||
|
{
|
||||||
|
LogWarning($"Attempting to migrate old 'UnityExplorer/' folder to 'sinai-dev-UnityExplorer/'...");
|
||||||
|
|
||||||
|
// If new folder doesn't exist yet, let's just use Move().
|
||||||
|
if (!Directory.Exists(ExplorerFolder))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Directory.Move(legacyPath, ExplorerFolder);
|
||||||
|
Log("Migrated successfully.");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogWarning($"Exception migrating folder: {ex}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // We have to merge
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
CopyAll(new(legacyPath), new(ExplorerFolder));
|
||||||
|
Directory.Delete(legacyPath, true);
|
||||||
|
Log("Migrated successfully.");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LogWarning($"Exception migrating folder: {ex}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void CopyAll(DirectoryInfo source, DirectoryInfo target)
|
||||||
|
{
|
||||||
|
Directory.CreateDirectory(target.FullName);
|
||||||
|
|
||||||
|
// Copy each file into it's new directory.
|
||||||
|
foreach (FileInfo fi in source.GetFiles())
|
||||||
|
fi.MoveTo(Path.Combine(target.ToString(), fi.Name));
|
||||||
|
|
||||||
|
// Copy each subdirectory using recursion.
|
||||||
|
foreach (DirectoryInfo diSourceSubDir in source.GetDirectories())
|
||||||
|
{
|
||||||
|
DirectoryInfo nextTargetSubDir = target.CreateSubdirectory(diSourceSubDir.Name);
|
||||||
|
CopyAll(diSourceSubDir, nextTargetSubDir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,7 @@
|
|||||||
using System;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.UI;
|
|
||||||
using UnityExplorer.UI.Widgets;
|
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
using UniverseLib.UI.Models;
|
using UniverseLib.UI.Models;
|
||||||
using UniverseLib.UI.Widgets;
|
|
||||||
using UniverseLib.UI.Widgets.ScrollView;
|
using UniverseLib.UI.Widgets.ScrollView;
|
||||||
|
|
||||||
namespace UnityExplorer.Hooks
|
namespace UnityExplorer.Hooks
|
||||||
|
@ -1,12 +1,7 @@
|
|||||||
using System;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
using UniverseLib.UI.Models;
|
using UniverseLib.UI.Models;
|
||||||
using UniverseLib.UI.Widgets;
|
|
||||||
using UniverseLib.UI.Widgets.ScrollView;
|
using UniverseLib.UI.Widgets.ScrollView;
|
||||||
|
|
||||||
namespace UnityExplorer.Hooks
|
namespace UnityExplorer.Hooks
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
using System;
|
using HarmonyLib;
|
||||||
using System.CodeDom.Compiler;
|
using Mono.CSharp;
|
||||||
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using HarmonyLib;
|
|
||||||
using Mono.CSharp;
|
|
||||||
using UnityExplorer.CSConsole;
|
using UnityExplorer.CSConsole;
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
|
|
||||||
@ -66,7 +65,7 @@ namespace UnityExplorer.Hooks
|
|||||||
|
|
||||||
// Dynamically compile the patch method
|
// Dynamically compile the patch method
|
||||||
|
|
||||||
var codeBuilder = new StringBuilder();
|
StringBuilder codeBuilder = new();
|
||||||
|
|
||||||
codeBuilder.AppendLine($"public class DynamicPatch_{DateTime.Now.Ticks}");
|
codeBuilder.AppendLine($"public class DynamicPatch_{DateTime.Now.Ticks}");
|
||||||
codeBuilder.AppendLine("{");
|
codeBuilder.AppendLine("{");
|
||||||
@ -80,11 +79,11 @@ namespace UnityExplorer.Hooks
|
|||||||
|
|
||||||
// TODO: Publicize MCS to avoid this reflection
|
// TODO: Publicize MCS to avoid this reflection
|
||||||
// Get the most recent Patch type in the source file
|
// Get the most recent Patch type in the source file
|
||||||
var typeContainer = ((CompilationSourceFile)fi_sourceFile.GetValue(scriptEvaluator))
|
TypeContainer typeContainer = ((CompilationSourceFile)fi_sourceFile.GetValue(scriptEvaluator))
|
||||||
.Containers
|
.Containers
|
||||||
.Last(it => it.MemberName.Name.StartsWith("DynamicPatch_"));
|
.Last(it => it.MemberName.Name.StartsWith("DynamicPatch_"));
|
||||||
// Get the TypeSpec from the TypeDefinition, then get its "MetaInfo" (System.Type)
|
// Get the TypeSpec from the TypeDefinition, then get its "MetaInfo" (System.Type)
|
||||||
var patchClass = ((TypeSpec)pi_Definition.GetValue((Class)typeContainer, null)).GetMetaInfo();
|
Type patchClass = ((TypeSpec)pi_Definition.GetValue((Class)typeContainer, null)).GetMetaInfo();
|
||||||
|
|
||||||
// Create the harmony patches as defined
|
// Create the harmony patches as defined
|
||||||
|
|
||||||
@ -115,7 +114,7 @@ namespace UnityExplorer.Hooks
|
|||||||
|
|
||||||
private string GenerateDefaultPatchSourceCode(MethodInfo targetMethod)
|
private string GenerateDefaultPatchSourceCode(MethodInfo targetMethod)
|
||||||
{
|
{
|
||||||
var codeBuilder = new StringBuilder();
|
StringBuilder codeBuilder = new();
|
||||||
// Arguments
|
// Arguments
|
||||||
|
|
||||||
codeBuilder.Append("public static void Postfix(System.Reflection.MethodBase __originalMethod");
|
codeBuilder.Append("public static void Postfix(System.Reflection.MethodBase __originalMethod");
|
||||||
@ -126,10 +125,10 @@ namespace UnityExplorer.Hooks
|
|||||||
if (targetMethod.ReturnType != typeof(void))
|
if (targetMethod.ReturnType != typeof(void))
|
||||||
codeBuilder.Append($", {targetMethod.ReturnType.FullName} __result");
|
codeBuilder.Append($", {targetMethod.ReturnType.FullName} __result");
|
||||||
|
|
||||||
var parameters = targetMethod.GetParameters();
|
ParameterInfo[] parameters = targetMethod.GetParameters();
|
||||||
|
|
||||||
int paramIdx = 0;
|
int paramIdx = 0;
|
||||||
foreach (var param in parameters)
|
foreach (ParameterInfo param in parameters)
|
||||||
{
|
{
|
||||||
codeBuilder.Append($", {param.ParameterType.FullDescription().Replace("&", "")} __{paramIdx}");
|
codeBuilder.Append($", {param.ParameterType.FullDescription().Replace("&", "")} __{paramIdx}");
|
||||||
paramIdx++;
|
paramIdx++;
|
||||||
@ -145,14 +144,14 @@ namespace UnityExplorer.Hooks
|
|||||||
|
|
||||||
// Log message
|
// Log message
|
||||||
|
|
||||||
var logMessage = new StringBuilder();
|
StringBuilder logMessage = new();
|
||||||
logMessage.Append($"Patch called: {shortSignature}\\n");
|
logMessage.Append($"Patch called: {shortSignature}\\n");
|
||||||
|
|
||||||
if (!targetMethod.IsStatic)
|
if (!targetMethod.IsStatic)
|
||||||
logMessage.Append("__instance: {__instance.ToString()}\\n");
|
logMessage.Append("__instance: {__instance.ToString()}\\n");
|
||||||
|
|
||||||
paramIdx = 0;
|
paramIdx = 0;
|
||||||
foreach (var param in parameters)
|
foreach (ParameterInfo param in parameters)
|
||||||
{
|
{
|
||||||
logMessage.Append($"Parameter {paramIdx} {param.Name}: ");
|
logMessage.Append($"Parameter {paramIdx} {param.Name}: ");
|
||||||
Type pType = param.ParameterType;
|
Type pType = param.ParameterType;
|
||||||
|
@ -1,18 +1,14 @@
|
|||||||
using System;
|
using HarmonyLib;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
|
||||||
using HarmonyLib;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityExplorer.Runtime;
|
|
||||||
using UnityExplorer.CSConsole;
|
using UnityExplorer.CSConsole;
|
||||||
|
using UnityExplorer.Runtime;
|
||||||
using UnityExplorer.UI;
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
using UnityExplorer.UI.Widgets;
|
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
using UniverseLib.UI.Widgets;
|
|
||||||
using UniverseLib.UI.Widgets.ScrollView;
|
using UniverseLib.UI.Widgets.ScrollView;
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
|
|
||||||
@ -32,22 +28,22 @@ namespace UnityExplorer.Hooks
|
|||||||
public int ItemCount => isAddingMethods ? filteredEligableMethods.Count : currentHooks.Count;
|
public int ItemCount => isAddingMethods ? filteredEligableMethods.Count : currentHooks.Count;
|
||||||
|
|
||||||
// current hooks
|
// current hooks
|
||||||
private readonly HashSet<string> hookedSignatures = new HashSet<string>();
|
private readonly HashSet<string> hookedSignatures = new();
|
||||||
private readonly OrderedDictionary currentHooks = new OrderedDictionary();
|
private readonly OrderedDictionary currentHooks = new();
|
||||||
|
|
||||||
// adding hooks
|
// adding hooks
|
||||||
private readonly List<MethodInfo> currentAddEligableMethods = new List<MethodInfo>();
|
private readonly List<MethodInfo> currentAddEligableMethods = new();
|
||||||
private readonly List<MethodInfo> filteredEligableMethods = new List<MethodInfo>();
|
private readonly List<MethodInfo> filteredEligableMethods = new();
|
||||||
|
|
||||||
// hook editor
|
// hook editor
|
||||||
private readonly LexerBuilder Lexer = new LexerBuilder();
|
private readonly LexerBuilder Lexer = new();
|
||||||
private HookInstance currentEditedHook;
|
private HookInstance currentEditedHook;
|
||||||
|
|
||||||
// ~~~~~~~~~~~ Main Current Hooks window ~~~~~~~~~~~
|
// ~~~~~~~~~~~ Main Current Hooks window ~~~~~~~~~~~
|
||||||
|
|
||||||
public void EnableOrDisableHookClicked(int index)
|
public void EnableOrDisableHookClicked(int index)
|
||||||
{
|
{
|
||||||
var hook = (HookInstance)currentHooks[index];
|
HookInstance hook = (HookInstance)currentHooks[index];
|
||||||
hook.TogglePatch();
|
hook.TogglePatch();
|
||||||
|
|
||||||
Panel.HooksScrollPool.Refresh(true, false);
|
Panel.HooksScrollPool.Refresh(true, false);
|
||||||
@ -55,7 +51,7 @@ namespace UnityExplorer.Hooks
|
|||||||
|
|
||||||
public void DeleteHookClicked(int index)
|
public void DeleteHookClicked(int index)
|
||||||
{
|
{
|
||||||
var hook = (HookInstance)currentHooks[index];
|
HookInstance hook = (HookInstance)currentHooks[index];
|
||||||
hook.Unpatch();
|
hook.Unpatch();
|
||||||
currentHooks.RemoveAt(index);
|
currentHooks.RemoveAt(index);
|
||||||
hookedSignatures.Remove(hook.TargetMethod.FullDescription());
|
hookedSignatures.Remove(hook.TargetMethod.FullDescription());
|
||||||
@ -66,7 +62,7 @@ namespace UnityExplorer.Hooks
|
|||||||
public void EditPatchClicked(int index)
|
public void EditPatchClicked(int index)
|
||||||
{
|
{
|
||||||
Panel.SetPage(HookManagerPanel.Pages.HookSourceEditor);
|
Panel.SetPage(HookManagerPanel.Pages.HookSourceEditor);
|
||||||
var hook = (HookInstance)currentHooks[index];
|
HookInstance hook = (HookInstance)currentHooks[index];
|
||||||
currentEditedHook = hook;
|
currentEditedHook = hook;
|
||||||
Panel.EditorInput.Text = hook.PatchSourceCode;
|
Panel.EditorInput.Text = hook.PatchSourceCode;
|
||||||
}
|
}
|
||||||
@ -84,7 +80,7 @@ namespace UnityExplorer.Hooks
|
|||||||
}
|
}
|
||||||
|
|
||||||
cell.CurrentDisplayedIndex = index;
|
cell.CurrentDisplayedIndex = index;
|
||||||
var hook = (HookInstance)this.currentHooks[index];
|
HookInstance hook = (HookInstance)this.currentHooks[index];
|
||||||
|
|
||||||
cell.MethodNameLabel.text = SignatureHighlighter.HighlightMethod(hook.TargetMethod);
|
cell.MethodNameLabel.text = SignatureHighlighter.HighlightMethod(hook.TargetMethod);
|
||||||
|
|
||||||
@ -97,7 +93,7 @@ namespace UnityExplorer.Hooks
|
|||||||
|
|
||||||
public void OnClassSelectedForHooks(string typeFullName)
|
public void OnClassSelectedForHooks(string typeFullName)
|
||||||
{
|
{
|
||||||
var type = ReflectionUtility.GetTypeByName(typeFullName);
|
Type type = ReflectionUtility.GetTypeByName(typeFullName);
|
||||||
if (type == null)
|
if (type == null)
|
||||||
{
|
{
|
||||||
ExplorerCore.LogWarning($"Could not find any type by name {typeFullName}!");
|
ExplorerCore.LogWarning($"Could not find any type by name {typeFullName}!");
|
||||||
@ -109,7 +105,7 @@ namespace UnityExplorer.Hooks
|
|||||||
Panel.ResetMethodFilter();
|
Panel.ResetMethodFilter();
|
||||||
filteredEligableMethods.Clear();
|
filteredEligableMethods.Clear();
|
||||||
currentAddEligableMethods.Clear();
|
currentAddEligableMethods.Clear();
|
||||||
foreach (var method in type.GetMethods(ReflectionUtility.FLAGS))
|
foreach (MethodInfo method in type.GetMethods(ReflectionUtility.FLAGS))
|
||||||
{
|
{
|
||||||
if (method.IsGenericMethod || UERuntimeHelper.IsBlacklisted(method))
|
if (method.IsGenericMethod || UERuntimeHelper.IsBlacklisted(method))
|
||||||
continue;
|
continue;
|
||||||
@ -140,11 +136,11 @@ namespace UnityExplorer.Hooks
|
|||||||
|
|
||||||
public void AddHook(MethodInfo method)
|
public void AddHook(MethodInfo method)
|
||||||
{
|
{
|
||||||
var sig = method.FullDescription();
|
string sig = method.FullDescription();
|
||||||
if (hookedSignatures.Contains(sig))
|
if (hookedSignatures.Contains(sig))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var hook = new HookInstance(method);
|
HookInstance hook = new(method);
|
||||||
if (hook.Enabled)
|
if (hook.Enabled)
|
||||||
{
|
{
|
||||||
hookedSignatures.Add(sig);
|
hookedSignatures.Add(sig);
|
||||||
@ -160,7 +156,7 @@ namespace UnityExplorer.Hooks
|
|||||||
filteredEligableMethods.AddRange(currentAddEligableMethods);
|
filteredEligableMethods.AddRange(currentAddEligableMethods);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (var method in currentAddEligableMethods)
|
foreach (MethodInfo method in currentAddEligableMethods)
|
||||||
{
|
{
|
||||||
if (method.Name.ContainsIgnoreCase(input))
|
if (method.Name.ContainsIgnoreCase(input))
|
||||||
filteredEligableMethods.Add(method);
|
filteredEligableMethods.Add(method);
|
||||||
@ -183,11 +179,11 @@ namespace UnityExplorer.Hooks
|
|||||||
}
|
}
|
||||||
|
|
||||||
cell.CurrentDisplayedIndex = index;
|
cell.CurrentDisplayedIndex = index;
|
||||||
var method = this.filteredEligableMethods[index];
|
MethodInfo method = this.filteredEligableMethods[index];
|
||||||
|
|
||||||
cell.MethodNameLabel.text = SignatureHighlighter.HighlightMethod(method);
|
cell.MethodNameLabel.text = SignatureHighlighter.HighlightMethod(method);
|
||||||
|
|
||||||
var sig = method.FullDescription();
|
string sig = method.FullDescription();
|
||||||
if (hookedSignatures.Contains(sig))
|
if (hookedSignatures.Contains(sig))
|
||||||
{
|
{
|
||||||
cell.HookButton.Component.gameObject.SetActive(false);
|
cell.HookButton.Component.gameObject.SetActive(false);
|
||||||
@ -216,7 +212,7 @@ namespace UnityExplorer.Hooks
|
|||||||
|
|
||||||
public void EditorInputSave()
|
public void EditorInputSave()
|
||||||
{
|
{
|
||||||
var input = Panel.EditorInput.Text;
|
string input = Panel.EditorInput.Text;
|
||||||
bool wasEnabled = currentEditedHook.Enabled;
|
bool wasEnabled = currentEditedHook.Enabled;
|
||||||
if (currentEditedHook.CompileAndGenerateProcessor(input))
|
if (currentEditedHook.CompileAndGenerateProcessor(input))
|
||||||
{
|
{
|
||||||
|
@ -2,18 +2,15 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UniverseLib.Input;
|
|
||||||
using UnityExplorer.UI;
|
|
||||||
using UniverseLib.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;
|
||||||
using UniverseLib.UI.Widgets;
|
|
||||||
using UniverseLib.UI;
|
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
|
using UniverseLib.UI;
|
||||||
|
using UniverseLib.UI.Models;
|
||||||
|
using UniverseLib.UI.Widgets;
|
||||||
using UniverseLib.UI.Widgets.ScrollView;
|
using UniverseLib.UI.Widgets.ScrollView;
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
|
|
||||||
@ -29,7 +26,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
public TransformTree TransformTree;
|
public TransformTree TransformTree;
|
||||||
private ScrollPool<TransformCell> transformScroll;
|
private ScrollPool<TransformCell> transformScroll;
|
||||||
private readonly List<GameObject> cachedChildren = new List<GameObject>();
|
private readonly List<GameObject> cachedChildren = new();
|
||||||
|
|
||||||
public ComponentList ComponentList;
|
public ComponentList ComponentList;
|
||||||
private ScrollPool<ComponentCell> componentScroll;
|
private ScrollPool<ComponentCell> componentScroll;
|
||||||
@ -127,10 +124,10 @@ namespace UnityExplorer.Inspectors
|
|||||||
return cachedChildren;
|
return cachedChildren;
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly List<Component> componentEntries = new List<Component>();
|
private readonly List<Component> componentEntries = new();
|
||||||
private readonly HashSet<int> compInstanceIDs = new HashSet<int>();
|
private readonly HashSet<int> compInstanceIDs = new();
|
||||||
private readonly List<Behaviour> behaviourEntries = new List<Behaviour>();
|
private readonly List<Behaviour> behaviourEntries = new();
|
||||||
private readonly List<bool> behaviourEnabledStates = new List<bool>();
|
private readonly List<bool> behaviourEnabledStates = new();
|
||||||
|
|
||||||
// ComponentList.GetRootEntriesMethod
|
// ComponentList.GetRootEntriesMethod
|
||||||
private List<Component> GetComponentEntries() => GOTarget ? componentEntries : Enumerable.Empty<Component>().ToList();
|
private List<Component> GetComponentEntries() => GOTarget ? componentEntries : Enumerable.Empty<Component>().ToList();
|
||||||
@ -149,13 +146,13 @@ namespace UnityExplorer.Inspectors
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if we actually need to refresh the component cells or not.
|
// Check if we actually need to refresh the component cells or not.
|
||||||
var comps = GOTarget.GetComponents<Component>();
|
IEnumerable<Component> comps = GOTarget.GetComponents<Component>();
|
||||||
var behaviours = GOTarget.GetComponents<Behaviour>();
|
IEnumerable<Behaviour> behaviours = GOTarget.GetComponents<Behaviour>();
|
||||||
|
|
||||||
bool needRefresh = false;
|
bool needRefresh = false;
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
foreach (var comp in comps)
|
foreach (Component comp in comps)
|
||||||
{
|
{
|
||||||
if (!comp)
|
if (!comp)
|
||||||
continue;
|
continue;
|
||||||
@ -173,7 +170,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
count = 0;
|
count = 0;
|
||||||
foreach (var behaviour in behaviours)
|
foreach (Behaviour behaviour in behaviours)
|
||||||
{
|
{
|
||||||
if (!behaviour)
|
if (!behaviour)
|
||||||
continue;
|
continue;
|
||||||
@ -194,7 +191,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
componentEntries.Clear();
|
componentEntries.Clear();
|
||||||
compInstanceIDs.Clear();
|
compInstanceIDs.Clear();
|
||||||
foreach (var comp in comps)
|
foreach (Component comp in comps)
|
||||||
{
|
{
|
||||||
if (!comp) continue;
|
if (!comp) continue;
|
||||||
componentEntries.Add(comp);
|
componentEntries.Add(comp);
|
||||||
@ -203,7 +200,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
behaviourEntries.Clear();
|
behaviourEntries.Clear();
|
||||||
behaviourEnabledStates.Clear();
|
behaviourEnabledStates.Clear();
|
||||||
foreach (var behaviour in behaviours)
|
foreach (Behaviour behaviour in behaviours)
|
||||||
{
|
{
|
||||||
if (!behaviour) continue;
|
if (!behaviour) continue;
|
||||||
behaviourEntries.Add(behaviour);
|
behaviourEntries.Add(behaviour);
|
||||||
@ -217,7 +214,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
private void OnAddChildClicked(string input)
|
private void OnAddChildClicked(string input)
|
||||||
{
|
{
|
||||||
var newObject = new GameObject(input);
|
GameObject newObject = new(input);
|
||||||
newObject.transform.parent = GOTarget.transform;
|
newObject.transform.parent = GOTarget.transform;
|
||||||
|
|
||||||
TransformTree.RefreshData(true, false, true, false);
|
TransformTree.RefreshData(true, false, true, false);
|
||||||
@ -250,7 +247,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
UIRoot = UIFactory.CreateVerticalGroup(parent, "GameObjectInspector", true, false, true, true, 5,
|
UIRoot = UIFactory.CreateVerticalGroup(parent, "GameObjectInspector", true, false, true, true, 5,
|
||||||
new Vector4(4, 4, 4, 4), new Color(0.065f, 0.065f, 0.065f));
|
new Vector4(4, 4, 4, 4), new Color(0.065f, 0.065f, 0.065f));
|
||||||
|
|
||||||
var scrollObj = UIFactory.CreateScrollView(UIRoot, "GameObjectInspector", out Content, out var scrollbar,
|
GameObject scrollObj = UIFactory.CreateScrollView(UIRoot, "GameObjectInspector", out Content, out AutoSliderScrollbar scrollbar,
|
||||||
new Color(0.065f, 0.065f, 0.065f));
|
new Color(0.065f, 0.065f, 0.065f));
|
||||||
UIFactory.SetLayoutElement(scrollObj, minHeight: 250, preferredHeight: 300, flexibleHeight: 0, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(scrollObj, minHeight: 250, preferredHeight: 300, flexibleHeight: 0, flexibleWidth: 9999);
|
||||||
|
|
||||||
@ -268,27 +265,27 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
private void ConstructLists()
|
private void ConstructLists()
|
||||||
{
|
{
|
||||||
var listHolder = UIFactory.CreateUIObject("ListHolders", UIRoot);
|
GameObject listHolder = UIFactory.CreateUIObject("ListHolders", UIRoot);
|
||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(listHolder, false, true, true, true, 8, 2, 2, 2, 2);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(listHolder, false, true, true, true, 8, 2, 2, 2, 2);
|
||||||
UIFactory.SetLayoutElement(listHolder, minHeight: 150, flexibleWidth: 9999, flexibleHeight: 9999);
|
UIFactory.SetLayoutElement(listHolder, minHeight: 150, flexibleWidth: 9999, flexibleHeight: 9999);
|
||||||
|
|
||||||
// Left group (Children)
|
// Left group (Children)
|
||||||
|
|
||||||
var leftGroup = UIFactory.CreateUIObject("ChildrenGroup", listHolder);
|
GameObject leftGroup = UIFactory.CreateUIObject("ChildrenGroup", listHolder);
|
||||||
UIFactory.SetLayoutElement(leftGroup, flexibleWidth: 9999, flexibleHeight: 9999);
|
UIFactory.SetLayoutElement(leftGroup, flexibleWidth: 9999, flexibleHeight: 9999);
|
||||||
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(leftGroup, false, false, true, true, 2);
|
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(leftGroup, false, false, true, true, 2);
|
||||||
|
|
||||||
var childrenLabel = UIFactory.CreateLabel(leftGroup, "ChildListTitle", "Children", TextAnchor.MiddleCenter, default, false, 16);
|
Text childrenLabel = UIFactory.CreateLabel(leftGroup, "ChildListTitle", "Children", TextAnchor.MiddleCenter, default, false, 16);
|
||||||
UIFactory.SetLayoutElement(childrenLabel.gameObject, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(childrenLabel.gameObject, flexibleWidth: 9999);
|
||||||
|
|
||||||
// Add Child
|
// Add Child
|
||||||
var addChildRow = UIFactory.CreateUIObject("AddChildRow", leftGroup);
|
GameObject addChildRow = UIFactory.CreateUIObject("AddChildRow", leftGroup);
|
||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(addChildRow, false, false, true, true, 2);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(addChildRow, false, false, true, true, 2);
|
||||||
|
|
||||||
addChildInput = UIFactory.CreateInputField(addChildRow, "AddChildInput", "Enter a name...");
|
addChildInput = UIFactory.CreateInputField(addChildRow, "AddChildInput", "Enter a name...");
|
||||||
UIFactory.SetLayoutElement(addChildInput.Component.gameObject, minHeight: 25, preferredWidth: 9999);
|
UIFactory.SetLayoutElement(addChildInput.Component.gameObject, minHeight: 25, preferredWidth: 9999);
|
||||||
|
|
||||||
var addChildButton = UIFactory.CreateButton(addChildRow, "AddChildButton", "Add Child");
|
ButtonRef addChildButton = UIFactory.CreateButton(addChildRow, "AddChildButton", "Add Child");
|
||||||
UIFactory.SetLayoutElement(addChildButton.Component.gameObject, minHeight: 25, minWidth: 80);
|
UIFactory.SetLayoutElement(addChildButton.Component.gameObject, minHeight: 25, minWidth: 80);
|
||||||
addChildButton.OnClick += () => { OnAddChildClicked(addChildInput.Text); };
|
addChildButton.OnClick += () => { OnAddChildClicked(addChildInput.Text); };
|
||||||
|
|
||||||
@ -305,21 +302,21 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
// Right group (Components)
|
// Right group (Components)
|
||||||
|
|
||||||
var rightGroup = UIFactory.CreateUIObject("ComponentGroup", listHolder);
|
GameObject rightGroup = UIFactory.CreateUIObject("ComponentGroup", listHolder);
|
||||||
UIFactory.SetLayoutElement(rightGroup, flexibleWidth: 9999, flexibleHeight: 9999);
|
UIFactory.SetLayoutElement(rightGroup, flexibleWidth: 9999, flexibleHeight: 9999);
|
||||||
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(rightGroup, false, false, true, true, 2);
|
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(rightGroup, false, false, true, true, 2);
|
||||||
|
|
||||||
var compLabel = UIFactory.CreateLabel(rightGroup, "CompListTitle", "Components", TextAnchor.MiddleCenter, default, false, 16);
|
Text compLabel = UIFactory.CreateLabel(rightGroup, "CompListTitle", "Components", TextAnchor.MiddleCenter, default, false, 16);
|
||||||
UIFactory.SetLayoutElement(compLabel.gameObject, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(compLabel.gameObject, flexibleWidth: 9999);
|
||||||
|
|
||||||
// Add Comp
|
// Add Comp
|
||||||
var addCompRow = UIFactory.CreateUIObject("AddCompRow", rightGroup);
|
GameObject addCompRow = UIFactory.CreateUIObject("AddCompRow", rightGroup);
|
||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(addCompRow, false, false, true, true, 2);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(addCompRow, false, false, true, true, 2);
|
||||||
|
|
||||||
addCompInput = UIFactory.CreateInputField(addCompRow, "AddCompInput", "Enter a Component type...");
|
addCompInput = UIFactory.CreateInputField(addCompRow, "AddCompInput", "Enter a Component type...");
|
||||||
UIFactory.SetLayoutElement(addCompInput.Component.gameObject, minHeight: 25, preferredWidth: 9999);
|
UIFactory.SetLayoutElement(addCompInput.Component.gameObject, minHeight: 25, preferredWidth: 9999);
|
||||||
|
|
||||||
var addCompButton = UIFactory.CreateButton(addCompRow, "AddCompButton", "Add Comp");
|
ButtonRef addCompButton = UIFactory.CreateButton(addCompRow, "AddCompButton", "Add Comp");
|
||||||
UIFactory.SetLayoutElement(addCompButton.Component.gameObject, minHeight: 25, minWidth: 80);
|
UIFactory.SetLayoutElement(addCompButton.Component.gameObject, minHeight: 25, minWidth: 80);
|
||||||
addCompButton.OnClick += () => { OnAddComponentClicked(addCompInput.Text); };
|
addCompButton.OnClick += () => { OnAddComponentClicked(addCompInput.Text); };
|
||||||
|
|
||||||
@ -333,8 +330,10 @@ namespace UnityExplorer.Inspectors
|
|||||||
UIFactory.SetLayoutElement(compObj, flexibleHeight: 9999);
|
UIFactory.SetLayoutElement(compObj, flexibleHeight: 9999);
|
||||||
UIFactory.SetLayoutElement(compContent, flexibleHeight: 9999);
|
UIFactory.SetLayoutElement(compContent, flexibleHeight: 9999);
|
||||||
|
|
||||||
ComponentList = new ComponentList(componentScroll, GetComponentEntries);
|
ComponentList = new ComponentList(componentScroll, GetComponentEntries)
|
||||||
ComponentList.Parent = this;
|
{
|
||||||
|
Parent = this
|
||||||
|
};
|
||||||
componentScroll.Initialize(ComponentList);
|
componentScroll.Initialize(ComponentList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,13 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UniverseLib;
|
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
using UniverseLib.UI.Models;
|
using UniverseLib.UI.Models;
|
||||||
using UniverseLib.UI.Widgets.ButtonList;
|
using UniverseLib.UI.Widgets.ButtonList;
|
||||||
|
using UniverseLib;
|
||||||
|
|
||||||
namespace UnityExplorer.Inspectors
|
namespace UnityExplorer.Inspectors
|
||||||
{
|
{
|
||||||
@ -31,7 +28,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
public override GameObject CreateContent(GameObject parent)
|
public override GameObject CreateContent(GameObject parent)
|
||||||
{
|
{
|
||||||
var root = base.CreateContent(parent);
|
GameObject root = base.CreateContent(parent);
|
||||||
|
|
||||||
// Add mask to button so text doesnt overlap on Close button
|
// Add mask to button so text doesnt overlap on Close button
|
||||||
//this.Button.Component.gameObject.AddComponent<Mask>().showMaskGraphic = true;
|
//this.Button.Component.gameObject.AddComponent<Mask>().showMaskGraphic = true;
|
||||||
@ -39,7 +36,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
// Behaviour toggle
|
// Behaviour toggle
|
||||||
|
|
||||||
var toggleObj = UIFactory.CreateToggle(UIRoot, "BehaviourToggle", out BehaviourToggle, out var behavText);
|
GameObject toggleObj = UIFactory.CreateToggle(UIRoot, "BehaviourToggle", out BehaviourToggle, out Text behavText);
|
||||||
UIFactory.SetLayoutElement(toggleObj, minHeight: 25, minWidth: 25);
|
UIFactory.SetLayoutElement(toggleObj, minHeight: 25, minWidth: 25);
|
||||||
BehaviourToggle.onValueChanged.AddListener(BehaviourToggled);
|
BehaviourToggle.onValueChanged.AddListener(BehaviourToggled);
|
||||||
// put at first object
|
// put at first object
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
using UniverseLib.UI.Widgets.ButtonList;
|
using UniverseLib.UI.Widgets.ButtonList;
|
||||||
@ -45,12 +43,12 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
private void OnComponentClicked(int index)
|
private void OnComponentClicked(int index)
|
||||||
{
|
{
|
||||||
var entries = GetEntries();
|
List<Component> entries = GetEntries();
|
||||||
|
|
||||||
if (index < 0 || index >= entries.Count)
|
if (index < 0 || index >= entries.Count)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var comp = entries[index];
|
Component comp = entries[index];
|
||||||
if (comp)
|
if (comp)
|
||||||
InspectorManager.Inspect(comp);
|
InspectorManager.Inspect(comp);
|
||||||
}
|
}
|
||||||
@ -59,8 +57,8 @@ namespace UnityExplorer.Inspectors
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var entries = GetEntries();
|
List<Component> entries = GetEntries();
|
||||||
var comp = entries[index];
|
Component comp = entries[index];
|
||||||
|
|
||||||
if (comp.TryCast<Behaviour>() is Behaviour behaviour)
|
if (comp.TryCast<Behaviour>() is Behaviour behaviour)
|
||||||
behaviour.enabled = value;
|
behaviour.enabled = value;
|
||||||
@ -75,8 +73,8 @@ namespace UnityExplorer.Inspectors
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var entries = GetEntries();
|
List<Component> entries = GetEntries();
|
||||||
var comp = entries[index];
|
Component comp = entries[index];
|
||||||
|
|
||||||
GameObject.DestroyImmediate(comp);
|
GameObject.DestroyImmediate(comp);
|
||||||
|
|
||||||
@ -88,16 +86,16 @@ namespace UnityExplorer.Inspectors
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly Dictionary<string, string> compToStringCache = new Dictionary<string, string>();
|
private static readonly Dictionary<string, string> compToStringCache = new();
|
||||||
|
|
||||||
// Called from ButtonListHandler.SetCell, will be valid
|
// Called from ButtonListHandler.SetCell, will be valid
|
||||||
private void SetComponentCell(ComponentCell cell, int index)
|
private void SetComponentCell(ComponentCell cell, int index)
|
||||||
{
|
{
|
||||||
var entries = GetEntries();
|
List<Component> entries = GetEntries();
|
||||||
cell.Enable();
|
cell.Enable();
|
||||||
|
|
||||||
var comp = entries[index];
|
Component comp = entries[index];
|
||||||
var type = comp.GetActualType();
|
Type type = comp.GetActualType();
|
||||||
|
|
||||||
if (!compToStringCache.ContainsKey(type.AssemblyQualifiedName))
|
if (!compToStringCache.ContainsKey(type.AssemblyQualifiedName))
|
||||||
compToStringCache.Add(type.AssemblyQualifiedName, SignatureHighlighter.Parse(type, true));
|
compToStringCache.Add(type.AssemblyQualifiedName, SignatureHighlighter.Parse(type, true));
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UniverseLib.Input;
|
|
||||||
using UnityExplorer.UI;
|
using UnityExplorer.UI;
|
||||||
using UniverseLib.UI;
|
|
||||||
using UniverseLib;
|
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
|
using UniverseLib;
|
||||||
|
using UniverseLib.Input;
|
||||||
|
using UniverseLib.UI;
|
||||||
using UniverseLib.UI.Models;
|
using UniverseLib.UI.Models;
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
|
|
||||||
@ -176,14 +175,14 @@ namespace UnityExplorer.Inspectors
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// look for inactive objects
|
// look for inactive objects
|
||||||
var name = input.Split('/').Last();
|
string name = input.Split('/').Last();
|
||||||
var allObjects = RuntimeHelper.FindObjectsOfTypeAll(typeof(GameObject));
|
UnityEngine.Object[] allObjects = RuntimeHelper.FindObjectsOfTypeAll(typeof(GameObject));
|
||||||
var shortList = new List<GameObject>();
|
List<GameObject> shortList = new();
|
||||||
foreach (var obj in allObjects)
|
foreach (UnityEngine.Object obj in allObjects)
|
||||||
if (obj.name == name) shortList.Add(obj.TryCast<GameObject>());
|
if (obj.name == name) shortList.Add(obj.TryCast<GameObject>());
|
||||||
foreach (var go in shortList)
|
foreach (GameObject go in shortList)
|
||||||
{
|
{
|
||||||
var path = go.transform.GetTransformPath(true);
|
string path = go.transform.GetTransformPath(true);
|
||||||
if (path.EndsWith("/"))
|
if (path.EndsWith("/"))
|
||||||
path = path.Remove(path.Length - 1);
|
path = path.Remove(path.Length - 1);
|
||||||
if (path == input)
|
if (path == input)
|
||||||
@ -245,7 +244,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
private void OnExploreButtonClicked()
|
private void OnExploreButtonClicked()
|
||||||
{
|
{
|
||||||
var panel = UIManager.GetPanel<UI.Panels.ObjectExplorerPanel>(UIManager.Panels.ObjectExplorer);
|
ObjectExplorerPanel panel = UIManager.GetPanel<UI.Panels.ObjectExplorerPanel>(UIManager.Panels.ObjectExplorer);
|
||||||
panel.SceneExplorer.JumpToTransform(this.Parent.GOTarget.transform);
|
panel.SceneExplorer.JumpToTransform(this.Parent.GOTarget.transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -259,7 +258,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var enumVal = hideFlagsValues[FlagsDropdown.options[value].text];
|
HideFlags enumVal = hideFlagsValues[FlagsDropdown.options[value].text];
|
||||||
GOTarget.hideFlags = enumVal;
|
GOTarget.hideFlags = enumVal;
|
||||||
|
|
||||||
UpdateGameObjectInfo(false, true);
|
UpdateGameObjectInfo(false, true);
|
||||||
@ -278,7 +277,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
private void OnInstantiateClicked()
|
private void OnInstantiateClicked()
|
||||||
{
|
{
|
||||||
var clone = GameObject.Instantiate(this.GOTarget);
|
GameObject clone = GameObject.Instantiate(this.GOTarget);
|
||||||
InspectorManager.Inspect(clone);
|
InspectorManager.Inspect(clone);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,7 +321,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
public void UpdateTransformControlValues(bool force)
|
public void UpdateTransformControlValues(bool force)
|
||||||
{
|
{
|
||||||
var transform = GOTarget.transform;
|
Transform transform = GOTarget.transform;
|
||||||
if (force || (!PositionControl.Input.Component.isFocused && lastPosValue != transform.position))
|
if (force || (!PositionControl.Input.Component.isFocused && lastPosValue != transform.position))
|
||||||
{
|
{
|
||||||
PositionControl.Input.Text = ParseUtility.ToStringForInput(transform.position, typeof(Vector3));
|
PositionControl.Input.Text = ParseUtility.ToStringForInput(transform.position, typeof(Vector3));
|
||||||
@ -404,7 +403,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var transform = GOTarget.transform;
|
Transform transform = GOTarget.transform;
|
||||||
|
|
||||||
Vector3 vector = Vector2.zero;
|
Vector3 vector = Vector2.zero;
|
||||||
switch (currentSlidingVectorControl.parentControl.Type)
|
switch (currentSlidingVectorControl.parentControl.Type)
|
||||||
@ -453,14 +452,14 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
private void ConstructTopInfo()
|
private void ConstructTopInfo()
|
||||||
{
|
{
|
||||||
var topInfoHolder = UIFactory.CreateVerticalGroup(Parent.Content, "TopInfoHolder", false, false, true, true, 3,
|
GameObject topInfoHolder = UIFactory.CreateVerticalGroup(Parent.Content, "TopInfoHolder", false, false, true, true, 3,
|
||||||
new Vector4(3, 3, 3, 3), new Color(0.1f, 0.1f, 0.1f), TextAnchor.MiddleLeft);
|
new Vector4(3, 3, 3, 3), new Color(0.1f, 0.1f, 0.1f), TextAnchor.MiddleLeft);
|
||||||
UIFactory.SetLayoutElement(topInfoHolder, minHeight: 100, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(topInfoHolder, minHeight: 100, flexibleWidth: 9999);
|
||||||
topInfoHolder.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;
|
topInfoHolder.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;
|
||||||
|
|
||||||
// first row (parent, path)
|
// first row (parent, path)
|
||||||
|
|
||||||
var firstRow = UIFactory.CreateUIObject("ParentRow", topInfoHolder);
|
GameObject firstRow = UIFactory.CreateUIObject("ParentRow", topInfoHolder);
|
||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(firstRow, false, false, true, true, 5, 0, 0, 0, 0, default);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(firstRow, false, false, true, true, 5, 0, 0, 0, 0, default);
|
||||||
UIFactory.SetLayoutElement(firstRow, minHeight: 25, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(firstRow, minHeight: 25, flexibleWidth: 9999);
|
||||||
|
|
||||||
@ -475,7 +474,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
UIFactory.SetLayoutElement(PathInput.UIRoot, minHeight: 25, minWidth: 100, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(PathInput.UIRoot, minHeight: 25, minWidth: 100, flexibleWidth: 9999);
|
||||||
PathInput.Component.lineType = InputField.LineType.MultiLineSubmit;
|
PathInput.Component.lineType = InputField.LineType.MultiLineSubmit;
|
||||||
|
|
||||||
var copyButton = UIFactory.CreateButton(firstRow, "CopyButton", "Copy to Clipboard", new Color(0.2f, 0.2f, 0.2f, 1));
|
ButtonRef copyButton = UIFactory.CreateButton(firstRow, "CopyButton", "Copy to Clipboard", new Color(0.2f, 0.2f, 0.2f, 1));
|
||||||
copyButton.ButtonText.color = Color.yellow;
|
copyButton.ButtonText.color = Color.yellow;
|
||||||
UIFactory.SetLayoutElement(copyButton.Component.gameObject, minHeight: 25, minWidth: 120);
|
UIFactory.SetLayoutElement(copyButton.Component.gameObject, minHeight: 25, minWidth: 120);
|
||||||
copyButton.OnClick += OnCopyClicked;
|
copyButton.OnClick += OnCopyClicked;
|
||||||
@ -488,10 +487,10 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
// Title and update row
|
// Title and update row
|
||||||
|
|
||||||
var titleRow = UIFactory.CreateUIObject("TitleRow", topInfoHolder);
|
GameObject titleRow = UIFactory.CreateUIObject("TitleRow", topInfoHolder);
|
||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(titleRow, false, false, true, true, 5);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(titleRow, false, false, true, true, 5);
|
||||||
|
|
||||||
var titleLabel = UIFactory.CreateLabel(titleRow, "Title", SignatureHighlighter.Parse(typeof(GameObject), false),
|
Text titleLabel = UIFactory.CreateLabel(titleRow, "Title", SignatureHighlighter.Parse(typeof(GameObject), false),
|
||||||
TextAnchor.MiddleLeft, fontSize: 17);
|
TextAnchor.MiddleLeft, fontSize: 17);
|
||||||
UIFactory.SetLayoutElement(titleLabel.gameObject, minHeight: 30, minWidth: 100);
|
UIFactory.SetLayoutElement(titleLabel.gameObject, minHeight: 30, minWidth: 100);
|
||||||
|
|
||||||
@ -504,25 +503,25 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
// second row (toggles, instanceID, tag, buttons)
|
// second row (toggles, instanceID, tag, buttons)
|
||||||
|
|
||||||
var secondRow = UIFactory.CreateUIObject("ParentRow", topInfoHolder);
|
GameObject secondRow = UIFactory.CreateUIObject("ParentRow", topInfoHolder);
|
||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(secondRow, false, false, true, true, 5, 0, 0, 0, 0, default);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(secondRow, false, false, true, true, 5, 0, 0, 0, 0, default);
|
||||||
UIFactory.SetLayoutElement(secondRow, minHeight: 25, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(secondRow, minHeight: 25, flexibleWidth: 9999);
|
||||||
|
|
||||||
// activeSelf
|
// activeSelf
|
||||||
var activeToggleObj = UIFactory.CreateToggle(secondRow, "ActiveSelf", out ActiveSelfToggle, out ActiveSelfText);
|
GameObject activeToggleObj = UIFactory.CreateToggle(secondRow, "ActiveSelf", out ActiveSelfToggle, out ActiveSelfText);
|
||||||
UIFactory.SetLayoutElement(activeToggleObj, minHeight: 25, minWidth: 100);
|
UIFactory.SetLayoutElement(activeToggleObj, minHeight: 25, minWidth: 100);
|
||||||
ActiveSelfText.text = "ActiveSelf";
|
ActiveSelfText.text = "ActiveSelf";
|
||||||
ActiveSelfToggle.onValueChanged.AddListener(OnActiveSelfToggled);
|
ActiveSelfToggle.onValueChanged.AddListener(OnActiveSelfToggled);
|
||||||
|
|
||||||
// isStatic
|
// isStatic
|
||||||
var isStaticObj = UIFactory.CreateToggle(secondRow, "IsStatic", out IsStaticToggle, out Text staticText);
|
GameObject isStaticObj = UIFactory.CreateToggle(secondRow, "IsStatic", out IsStaticToggle, out Text staticText);
|
||||||
UIFactory.SetLayoutElement(isStaticObj, minHeight: 25, minWidth: 80);
|
UIFactory.SetLayoutElement(isStaticObj, minHeight: 25, minWidth: 80);
|
||||||
staticText.text = "IsStatic";
|
staticText.text = "IsStatic";
|
||||||
staticText.color = Color.grey;
|
staticText.color = Color.grey;
|
||||||
IsStaticToggle.interactable = false;
|
IsStaticToggle.interactable = false;
|
||||||
|
|
||||||
// InstanceID
|
// InstanceID
|
||||||
var instanceIdLabel = UIFactory.CreateLabel(secondRow, "InstanceIDLabel", "Instance ID:", TextAnchor.MiddleRight, Color.grey);
|
Text instanceIdLabel = UIFactory.CreateLabel(secondRow, "InstanceIDLabel", "Instance ID:", TextAnchor.MiddleRight, Color.grey);
|
||||||
UIFactory.SetLayoutElement(instanceIdLabel.gameObject, minHeight: 25, minWidth: 90);
|
UIFactory.SetLayoutElement(instanceIdLabel.gameObject, minHeight: 25, minWidth: 90);
|
||||||
|
|
||||||
InstanceIDInput = UIFactory.CreateInputField(secondRow, "InstanceIDInput", "error");
|
InstanceIDInput = UIFactory.CreateInputField(secondRow, "InstanceIDInput", "error");
|
||||||
@ -531,7 +530,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
InstanceIDInput.Component.readOnly = true;
|
InstanceIDInput.Component.readOnly = true;
|
||||||
|
|
||||||
//Tag
|
//Tag
|
||||||
var tagLabel = UIFactory.CreateLabel(secondRow, "TagLabel", "Tag:", TextAnchor.MiddleRight, Color.grey);
|
Text tagLabel = UIFactory.CreateLabel(secondRow, "TagLabel", "Tag:", TextAnchor.MiddleRight, Color.grey);
|
||||||
UIFactory.SetLayoutElement(tagLabel.gameObject, minHeight: 25, minWidth: 40);
|
UIFactory.SetLayoutElement(tagLabel.gameObject, minHeight: 25, minWidth: 40);
|
||||||
|
|
||||||
TagInput = UIFactory.CreateInputField(secondRow, "TagInput", "none");
|
TagInput = UIFactory.CreateInputField(secondRow, "TagInput", "none");
|
||||||
@ -540,29 +539,29 @@ namespace UnityExplorer.Inspectors
|
|||||||
TagInput.Component.GetOnEndEdit().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));
|
ButtonRef instantiateBtn = UIFactory.CreateButton(secondRow, "InstantiateBtn", "Instantiate", new Color(0.2f, 0.2f, 0.2f));
|
||||||
UIFactory.SetLayoutElement(instantiateBtn.Component.gameObject, minHeight: 25, minWidth: 120);
|
UIFactory.SetLayoutElement(instantiateBtn.Component.gameObject, minHeight: 25, minWidth: 120);
|
||||||
instantiateBtn.OnClick += OnInstantiateClicked;
|
instantiateBtn.OnClick += OnInstantiateClicked;
|
||||||
|
|
||||||
// Destroy
|
// Destroy
|
||||||
var destroyBtn = UIFactory.CreateButton(secondRow, "DestroyBtn", "Destroy", new Color(0.3f, 0.2f, 0.2f));
|
ButtonRef destroyBtn = UIFactory.CreateButton(secondRow, "DestroyBtn", "Destroy", new Color(0.3f, 0.2f, 0.2f));
|
||||||
UIFactory.SetLayoutElement(destroyBtn.Component.gameObject, minHeight: 25, minWidth: 80);
|
UIFactory.SetLayoutElement(destroyBtn.Component.gameObject, minHeight: 25, minWidth: 80);
|
||||||
destroyBtn.OnClick += OnDestroyClicked;
|
destroyBtn.OnClick += OnDestroyClicked;
|
||||||
|
|
||||||
// third row (scene, layer, flags)
|
// third row (scene, layer, flags)
|
||||||
|
|
||||||
var thirdrow = UIFactory.CreateUIObject("ParentRow", topInfoHolder);
|
GameObject thirdrow = UIFactory.CreateUIObject("ParentRow", topInfoHolder);
|
||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(thirdrow, false, false, true, true, 5, 0, 0, 0, 0, default);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(thirdrow, false, false, true, true, 5, 0, 0, 0, 0, default);
|
||||||
UIFactory.SetLayoutElement(thirdrow, minHeight: 25, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(thirdrow, minHeight: 25, flexibleWidth: 9999);
|
||||||
|
|
||||||
// Inspect in Explorer button
|
// Inspect in Explorer button
|
||||||
var explorerBtn = UIFactory.CreateButton(thirdrow, "ExploreBtn", "Show in Explorer", new Color(0.15f, 0.15f, 0.15f));
|
ButtonRef explorerBtn = UIFactory.CreateButton(thirdrow, "ExploreBtn", "Show in Explorer", new Color(0.15f, 0.15f, 0.15f));
|
||||||
UIFactory.SetLayoutElement(explorerBtn.Component.gameObject, minHeight: 25, minWidth: 100);
|
UIFactory.SetLayoutElement(explorerBtn.Component.gameObject, minHeight: 25, minWidth: 100);
|
||||||
explorerBtn.ButtonText.fontSize = 12;
|
explorerBtn.ButtonText.fontSize = 12;
|
||||||
explorerBtn.OnClick += OnExploreButtonClicked;
|
explorerBtn.OnClick += OnExploreButtonClicked;
|
||||||
|
|
||||||
// Scene
|
// Scene
|
||||||
var sceneLabel = UIFactory.CreateLabel(thirdrow, "SceneLabel", "Scene:", TextAnchor.MiddleLeft, Color.grey);
|
Text sceneLabel = UIFactory.CreateLabel(thirdrow, "SceneLabel", "Scene:", TextAnchor.MiddleLeft, Color.grey);
|
||||||
UIFactory.SetLayoutElement(sceneLabel.gameObject, minHeight: 25, minWidth: 50);
|
UIFactory.SetLayoutElement(sceneLabel.gameObject, minHeight: 25, minWidth: 50);
|
||||||
|
|
||||||
SceneInput = UIFactory.CreateInputField(thirdrow, "SceneInput", "untitled");
|
SceneInput = UIFactory.CreateInputField(thirdrow, "SceneInput", "untitled");
|
||||||
@ -571,29 +570,29 @@ namespace UnityExplorer.Inspectors
|
|||||||
SceneInput.Component.textComponent.color = new Color(0.7f, 0.7f, 0.7f);
|
SceneInput.Component.textComponent.color = new Color(0.7f, 0.7f, 0.7f);
|
||||||
|
|
||||||
// Layer
|
// Layer
|
||||||
var layerLabel = UIFactory.CreateLabel(thirdrow, "LayerLabel", "Layer:", TextAnchor.MiddleLeft, Color.grey);
|
Text layerLabel = UIFactory.CreateLabel(thirdrow, "LayerLabel", "Layer:", TextAnchor.MiddleLeft, Color.grey);
|
||||||
UIFactory.SetLayoutElement(layerLabel.gameObject, minHeight: 25, minWidth: 50);
|
UIFactory.SetLayoutElement(layerLabel.gameObject, minHeight: 25, minWidth: 50);
|
||||||
|
|
||||||
var layerDrop = UIFactory.CreateDropdown(thirdrow, "LayerDropdown", out LayerDropdown, "0", 14, OnLayerDropdownChanged);
|
GameObject layerDrop = UIFactory.CreateDropdown(thirdrow, "LayerDropdown", out LayerDropdown, "0", 14, OnLayerDropdownChanged);
|
||||||
UIFactory.SetLayoutElement(layerDrop, minHeight: 25, minWidth: 110, flexibleWidth: 999);
|
UIFactory.SetLayoutElement(layerDrop, minHeight: 25, minWidth: 110, flexibleWidth: 999);
|
||||||
LayerDropdown.captionText.color = SignatureHighlighter.EnumGreen;
|
LayerDropdown.captionText.color = SignatureHighlighter.EnumGreen;
|
||||||
if (layerToNames == null)
|
if (layerToNames == null)
|
||||||
GetLayerNames();
|
GetLayerNames();
|
||||||
foreach (var name in layerToNames)
|
foreach (string name in layerToNames)
|
||||||
LayerDropdown.options.Add(new Dropdown.OptionData(name));
|
LayerDropdown.options.Add(new Dropdown.OptionData(name));
|
||||||
LayerDropdown.value = 0;
|
LayerDropdown.value = 0;
|
||||||
LayerDropdown.RefreshShownValue();
|
LayerDropdown.RefreshShownValue();
|
||||||
|
|
||||||
// Flags
|
// Flags
|
||||||
var flagsLabel = UIFactory.CreateLabel(thirdrow, "FlagsLabel", "Flags:", TextAnchor.MiddleRight, Color.grey);
|
Text flagsLabel = UIFactory.CreateLabel(thirdrow, "FlagsLabel", "Flags:", TextAnchor.MiddleRight, Color.grey);
|
||||||
UIFactory.SetLayoutElement(flagsLabel.gameObject, minHeight: 25, minWidth: 50);
|
UIFactory.SetLayoutElement(flagsLabel.gameObject, minHeight: 25, minWidth: 50);
|
||||||
|
|
||||||
var flagsDrop = UIFactory.CreateDropdown(thirdrow, "FlagsDropdown", out FlagsDropdown, "None", 14, OnFlagsDropdownChanged);
|
GameObject flagsDrop = UIFactory.CreateDropdown(thirdrow, "FlagsDropdown", out FlagsDropdown, "None", 14, OnFlagsDropdownChanged);
|
||||||
FlagsDropdown.captionText.color = SignatureHighlighter.EnumGreen;
|
FlagsDropdown.captionText.color = SignatureHighlighter.EnumGreen;
|
||||||
UIFactory.SetLayoutElement(flagsDrop, minHeight: 25, minWidth: 135, flexibleWidth: 999);
|
UIFactory.SetLayoutElement(flagsDrop, minHeight: 25, minWidth: 135, flexibleWidth: 999);
|
||||||
if (hideFlagsValues == null)
|
if (hideFlagsValues == null)
|
||||||
GetHideFlagNames();
|
GetHideFlagNames();
|
||||||
foreach (var name in hideFlagsValues.Keys)
|
foreach (string name in hideFlagsValues.Keys)
|
||||||
FlagsDropdown.options.Add(new Dropdown.OptionData(name));
|
FlagsDropdown.options.Add(new Dropdown.OptionData(name));
|
||||||
FlagsDropdown.value = 0;
|
FlagsDropdown.value = 0;
|
||||||
FlagsDropdown.RefreshShownValue();
|
FlagsDropdown.RefreshShownValue();
|
||||||
@ -606,7 +605,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
layerToNames = new List<string>();
|
layerToNames = new List<string>();
|
||||||
for (int i = 0; i < 32; i++)
|
for (int i = 0; i < 32; i++)
|
||||||
{
|
{
|
||||||
var name = RuntimeHelper.LayerToName(i);
|
string name = RuntimeHelper.LayerToName(i);
|
||||||
if (string.IsNullOrEmpty(name))
|
if (string.IsNullOrEmpty(name))
|
||||||
name = i.ToString();
|
name = i.ToString();
|
||||||
layerToNames.Add(name);
|
layerToNames.Add(name);
|
||||||
@ -619,7 +618,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
{
|
{
|
||||||
hideFlagsValues = new Dictionary<string, HideFlags>();
|
hideFlagsValues = new Dictionary<string, HideFlags>();
|
||||||
|
|
||||||
var names = Enum.GetValues(typeof(HideFlags));
|
Array names = Enum.GetValues(typeof(HideFlags));
|
||||||
foreach (HideFlags value in names)
|
foreach (HideFlags value in names)
|
||||||
{
|
{
|
||||||
hideFlagsValues.Add(value.ToString(), value);
|
hideFlagsValues.Add(value.ToString(), value);
|
||||||
@ -633,7 +632,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
private void ConstructTransformControls()
|
private void ConstructTransformControls()
|
||||||
{
|
{
|
||||||
var transformGroup = UIFactory.CreateVerticalGroup(Parent.Content, "TransformControls", false, false, true, true, 2,
|
GameObject transformGroup = UIFactory.CreateVerticalGroup(Parent.Content, "TransformControls", false, false, true, true, 2,
|
||||||
new Vector4(2, 2, 0, 0), new Color(0.1f, 0.1f, 0.1f));
|
new Vector4(2, 2, 0, 0), new Color(0.1f, 0.1f, 0.1f));
|
||||||
UIFactory.SetLayoutElement(transformGroup, minHeight: 100, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(transformGroup, minHeight: 100, flexibleWidth: 9999);
|
||||||
//transformGroup.SetActive(false);
|
//transformGroup.SetActive(false);
|
||||||
@ -650,19 +649,19 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
private TransformControl AddTransformRow(GameObject transformGroup, string title, TransformType type)
|
private TransformControl AddTransformRow(GameObject transformGroup, string title, TransformType type)
|
||||||
{
|
{
|
||||||
var rowObj = UIFactory.CreateUIObject("Row_" + title, transformGroup);
|
GameObject rowObj = UIFactory.CreateUIObject("Row_" + title, transformGroup);
|
||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(rowObj, false, false, true, true, 5, 0, 0, 0, 0, default);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(rowObj, false, false, true, true, 5, 0, 0, 0, 0, default);
|
||||||
UIFactory.SetLayoutElement(rowObj, minHeight: 25, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(rowObj, minHeight: 25, flexibleWidth: 9999);
|
||||||
|
|
||||||
var titleLabel = UIFactory.CreateLabel(rowObj, "PositionLabel", title, TextAnchor.MiddleRight, Color.grey);
|
Text titleLabel = UIFactory.CreateLabel(rowObj, "PositionLabel", title, TextAnchor.MiddleRight, Color.grey);
|
||||||
UIFactory.SetLayoutElement(titleLabel.gameObject, minHeight: 25, minWidth: 110);
|
UIFactory.SetLayoutElement(titleLabel.gameObject, minHeight: 25, minWidth: 110);
|
||||||
|
|
||||||
var inputField = UIFactory.CreateInputField(rowObj, "InputField", "...");
|
InputFieldRef 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.GetOnEndEdit().AddListener((string value) => { OnTransformInputEndEdit(type, value); });
|
inputField.Component.GetOnEndEdit().AddListener((string value) => { OnTransformInputEndEdit(type, value); });
|
||||||
|
|
||||||
var control = new TransformControl(type, inputField);
|
TransformControl control = new(type, inputField);
|
||||||
|
|
||||||
AddVectorAxisSlider(rowObj, "X", 0, control);
|
AddVectorAxisSlider(rowObj, "X", 0, control);
|
||||||
AddVectorAxisSlider(rowObj, "Y", 1, control);
|
AddVectorAxisSlider(rowObj, "Y", 1, control);
|
||||||
@ -673,16 +672,16 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
private VectorSlider AddVectorAxisSlider(GameObject parent, string title, int axis, TransformControl control)
|
private VectorSlider AddVectorAxisSlider(GameObject parent, string title, int axis, TransformControl control)
|
||||||
{
|
{
|
||||||
var label = UIFactory.CreateLabel(parent, "Label_" + title, title + ":", TextAnchor.MiddleRight, Color.grey);
|
Text label = UIFactory.CreateLabel(parent, "Label_" + title, title + ":", TextAnchor.MiddleRight, Color.grey);
|
||||||
UIFactory.SetLayoutElement(label.gameObject, minHeight: 25, minWidth: 30);
|
UIFactory.SetLayoutElement(label.gameObject, minHeight: 25, minWidth: 30);
|
||||||
|
|
||||||
var sliderObj = UIFactory.CreateSlider(parent, "Slider_" + title, out var slider);
|
GameObject sliderObj = UIFactory.CreateSlider(parent, "Slider_" + title, out Slider slider);
|
||||||
UIFactory.SetLayoutElement(sliderObj, minHeight: 25, minWidth: 120, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(sliderObj, minHeight: 25, minWidth: 120, flexibleWidth: 0);
|
||||||
slider.m_FillImage.color = Color.clear;
|
slider.m_FillImage.color = Color.clear;
|
||||||
|
|
||||||
slider.minValue = -1;
|
slider.minValue = -1;
|
||||||
slider.maxValue = 1;
|
slider.maxValue = 1;
|
||||||
var sliderControl = new VectorSlider(axis, slider, control);
|
VectorSlider sliderControl = new(axis, slider, control);
|
||||||
|
|
||||||
slider.onValueChanged.AddListener((float val) =>
|
slider.onValueChanged.AddListener((float val) =>
|
||||||
{
|
{
|
||||||
|
@ -1,13 +1,6 @@
|
|||||||
using System;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.UI;
|
|
||||||
using UniverseLib.UI.Models;
|
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
using UniverseLib.UI;
|
|
||||||
using UniverseLib.UI.ObjectPool;
|
using UniverseLib.UI.ObjectPool;
|
||||||
|
|
||||||
namespace UnityExplorer.Inspectors
|
namespace UnityExplorer.Inspectors
|
||||||
|
@ -1,16 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
using UnityExplorer.UI;
|
|
||||||
using UnityExplorer.CacheObject;
|
using UnityExplorer.CacheObject;
|
||||||
using UnityExplorer.Inspectors;
|
using UnityExplorer.Inspectors;
|
||||||
using UniverseLib.UI.Models;
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
using UniverseLib.UI;
|
|
||||||
using UniverseLib.UI.ObjectPool;
|
using UniverseLib.UI.ObjectPool;
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
|
|
||||||
@ -50,7 +46,7 @@ namespace UnityExplorer
|
|||||||
|
|
||||||
private static bool TryFocusActiveInspector(object target)
|
private static bool TryFocusActiveInspector(object target)
|
||||||
{
|
{
|
||||||
foreach (var inspector in Inspectors)
|
foreach (InspectorBase inspector in Inspectors)
|
||||||
{
|
{
|
||||||
if (inspector.Target.ReferenceEqual(target))
|
if (inspector.Target.ReferenceEqual(target))
|
||||||
{
|
{
|
||||||
@ -96,7 +92,7 @@ namespace UnityExplorer
|
|||||||
private static void CreateInspector<T>(object target, bool staticReflection = false,
|
private static void CreateInspector<T>(object target, bool staticReflection = false,
|
||||||
CacheObjectBase parentObject = null) where T : InspectorBase
|
CacheObjectBase parentObject = null) where T : InspectorBase
|
||||||
{
|
{
|
||||||
var inspector = Pool<T>.Borrow();
|
T inspector = Pool<T>.Borrow();
|
||||||
Inspectors.Add(inspector);
|
Inspectors.Add(inspector);
|
||||||
inspector.Target = target;
|
inspector.Target = target;
|
||||||
|
|
||||||
@ -164,7 +160,7 @@ namespace UnityExplorer
|
|||||||
{
|
{
|
||||||
PanelWidth = width;
|
PanelWidth = width;
|
||||||
|
|
||||||
foreach (var obj in Inspectors)
|
foreach (InspectorBase obj in Inspectors)
|
||||||
{
|
{
|
||||||
if (obj is ReflectionInspector inspector)
|
if (obj is ReflectionInspector inspector)
|
||||||
{
|
{
|
||||||
|
@ -1,15 +1,8 @@
|
|||||||
using System;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.UI;
|
|
||||||
using UniverseLib.UI.Models;
|
|
||||||
using UnityExplorer.UI.Widgets;
|
|
||||||
using UniverseLib.UI;
|
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
using UnityExplorer.UI.Panels;
|
using UniverseLib.UI;
|
||||||
|
using UniverseLib.UI.Models;
|
||||||
using UniverseLib.UI.ObjectPool;
|
using UniverseLib.UI.ObjectPool;
|
||||||
|
|
||||||
namespace UnityExplorer.Inspectors
|
namespace UnityExplorer.Inspectors
|
||||||
|
@ -1,19 +1,12 @@
|
|||||||
using System;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.EventSystems;
|
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UniverseLib.Input;
|
using UnityExplorer.Config;
|
||||||
using UnityExplorer.Runtime;
|
|
||||||
using UnityExplorer.Inspectors.MouseInspectors;
|
using UnityExplorer.Inspectors.MouseInspectors;
|
||||||
using UnityExplorer.UI;
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
using UniverseLib;
|
using UniverseLib.Input;
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
using UnityExplorer.Config;
|
|
||||||
|
|
||||||
namespace UnityExplorer.Inspectors
|
namespace UnityExplorer.Inspectors
|
||||||
{
|
{
|
||||||
@ -108,7 +101,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
UIManager.NavBarRect.gameObject.SetActive(true);
|
UIManager.NavBarRect.gameObject.SetActive(true);
|
||||||
UIManager.PanelHolder.SetActive(true);
|
UIManager.PanelHolder.SetActive(true);
|
||||||
|
|
||||||
var drop = InspectorPanel.Instance.MouseInspectDropdown;
|
Dropdown drop = InspectorPanel.Instance.MouseInspectDropdown;
|
||||||
if (drop.transform.Find("Dropdown List") is Transform list)
|
if (drop.transform.Find("Dropdown List") is Transform list)
|
||||||
drop.DestroyDropdownList(list.gameObject);
|
drop.DestroyDropdownList(list.gameObject);
|
||||||
|
|
||||||
@ -152,7 +145,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var mousePos = InputManager.MousePosition;
|
Vector3 mousePos = InputManager.MousePosition;
|
||||||
if (mousePos != lastMousePos)
|
if (mousePos != lastMousePos)
|
||||||
UpdatePosition(mousePos);
|
UpdatePosition(mousePos);
|
||||||
|
|
||||||
@ -181,7 +174,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
mousePos.y -= 10;
|
mousePos.y -= 10;
|
||||||
|
|
||||||
// calculate and set our UI position
|
// calculate and set our UI position
|
||||||
var inversePos = inspectorUIBase.RootObject.transform.InverseTransformPoint(mousePos);
|
Vector3 inversePos = inspectorUIBase.RootObject.transform.InverseTransformPoint(mousePos);
|
||||||
UIRoot.transform.localPosition = new Vector3(inversePos.x, inversePos.y, 0);
|
UIRoot.transform.localPosition = new Vector3(inversePos.x, inversePos.y, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,12 +194,12 @@ namespace UnityExplorer.Inspectors
|
|||||||
this.TitleBar.SetActive(false);
|
this.TitleBar.SetActive(false);
|
||||||
this.UIRoot.transform.SetParent(UIManager.UIRoot.transform, false);
|
this.UIRoot.transform.SetParent(UIManager.UIRoot.transform, false);
|
||||||
|
|
||||||
var inspectContent = UIFactory.CreateVerticalGroup(this.uiContent, "InspectContent", true, true, true, true, 3, new Vector4(2, 2, 2, 2));
|
GameObject inspectContent = UIFactory.CreateVerticalGroup(this.uiContent, "InspectContent", true, true, true, true, 3, new Vector4(2, 2, 2, 2));
|
||||||
UIFactory.SetLayoutElement(inspectContent, flexibleWidth: 9999, flexibleHeight: 9999);
|
UIFactory.SetLayoutElement(inspectContent, flexibleWidth: 9999, flexibleHeight: 9999);
|
||||||
|
|
||||||
// Title text
|
// Title text
|
||||||
|
|
||||||
var title = UIFactory.CreateLabel(inspectContent,
|
Text title = UIFactory.CreateLabel(inspectContent,
|
||||||
"InspectLabel",
|
"InspectLabel",
|
||||||
"<b>Mouse Inspector</b> (press <b>ESC</b> to cancel)",
|
"<b>Mouse Inspector</b> (press <b>ESC</b> to cancel)",
|
||||||
TextAnchor.MiddleCenter);
|
TextAnchor.MiddleCenter);
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
using System;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace UnityExplorer.Inspectors.MouseInspectors
|
namespace UnityExplorer.Inspectors.MouseInspectors
|
||||||
{
|
{
|
||||||
|
@ -1,29 +1,26 @@
|
|||||||
using System;
|
using System.Collections;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.UI;
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
using UniverseLib.Input;
|
|
||||||
|
|
||||||
namespace UnityExplorer.Inspectors.MouseInspectors
|
namespace UnityExplorer.Inspectors.MouseInspectors
|
||||||
{
|
{
|
||||||
public class UiInspector : MouseInspectorBase
|
public class UiInspector : MouseInspectorBase
|
||||||
{
|
{
|
||||||
public static readonly List<GameObject> LastHitObjects = new List<GameObject>();
|
public static readonly List<GameObject> LastHitObjects = new();
|
||||||
|
|
||||||
private static GraphicRaycaster[] graphicRaycasters;
|
private static GraphicRaycaster[] graphicRaycasters;
|
||||||
|
|
||||||
private static readonly List<GameObject> currentHitObjects = new List<GameObject>();
|
private static readonly List<GameObject> currentHitObjects = new();
|
||||||
|
|
||||||
private static readonly List<Graphic> wasDisabledGraphics = new List<Graphic>();
|
private static readonly List<Graphic> wasDisabledGraphics = new();
|
||||||
private static readonly List<CanvasGroup> wasDisabledCanvasGroups = new List<CanvasGroup>();
|
private static readonly List<CanvasGroup> wasDisabledCanvasGroups = new();
|
||||||
private static readonly List<GameObject> objectsAddedCastersTo = new List<GameObject>();
|
private static readonly List<GameObject> objectsAddedCastersTo = new();
|
||||||
|
|
||||||
public override void OnBeginMouseInspect()
|
public override void OnBeginMouseInspect()
|
||||||
{
|
{
|
||||||
@ -46,7 +43,7 @@ namespace UnityExplorer.Inspectors.MouseInspectors
|
|||||||
IEnumerator SetPanelActiveCoro()
|
IEnumerator SetPanelActiveCoro()
|
||||||
{
|
{
|
||||||
yield return null;
|
yield return null;
|
||||||
var panel = UIManager.GetPanel<MouseInspectorResultsPanel>(UIManager.Panels.UIInspectorResults);
|
MouseInspectorResultsPanel panel = UIManager.GetPanel<MouseInspectorResultsPanel>(UIManager.Panels.UIInspectorResults);
|
||||||
panel.SetActive(true);
|
panel.SetActive(true);
|
||||||
panel.ShowResults();
|
panel.ShowResults();
|
||||||
}
|
}
|
||||||
@ -55,21 +52,21 @@ namespace UnityExplorer.Inspectors.MouseInspectors
|
|||||||
{
|
{
|
||||||
currentHitObjects.Clear();
|
currentHitObjects.Clear();
|
||||||
|
|
||||||
var ped = new PointerEventData(null)
|
PointerEventData ped = new(null)
|
||||||
{
|
{
|
||||||
position = mousePos
|
position = mousePos
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach (var gr in graphicRaycasters)
|
foreach (GraphicRaycaster gr in graphicRaycasters)
|
||||||
{
|
{
|
||||||
if (!gr || !gr.canvas)
|
if (!gr || !gr.canvas)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var list = new List<RaycastResult>();
|
List<RaycastResult> list = new();
|
||||||
RuntimeHelper.GraphicRaycast(gr, ped, list);
|
RuntimeHelper.GraphicRaycast(gr, ped, list);
|
||||||
if (list.Count > 0)
|
if (list.Count > 0)
|
||||||
{
|
{
|
||||||
foreach (var hit in list)
|
foreach (RaycastResult hit in list)
|
||||||
{
|
{
|
||||||
if (hit.gameObject)
|
if (hit.gameObject)
|
||||||
currentHitObjects.Add(hit.gameObject);
|
currentHitObjects.Add(hit.gameObject);
|
||||||
@ -85,9 +82,9 @@ namespace UnityExplorer.Inspectors.MouseInspectors
|
|||||||
|
|
||||||
private static void SetupUIRaycast()
|
private static void SetupUIRaycast()
|
||||||
{
|
{
|
||||||
foreach (var obj in RuntimeHelper.FindObjectsOfTypeAll(typeof(Canvas)))
|
foreach (UnityEngine.Object obj in RuntimeHelper.FindObjectsOfTypeAll(typeof(Canvas)))
|
||||||
{
|
{
|
||||||
var canvas = obj.TryCast<Canvas>();
|
Canvas canvas = obj.TryCast<Canvas>();
|
||||||
if (!canvas || !canvas.enabled || !canvas.gameObject.activeInHierarchy)
|
if (!canvas || !canvas.enabled || !canvas.gameObject.activeInHierarchy)
|
||||||
continue;
|
continue;
|
||||||
if (!canvas.GetComponent<GraphicRaycaster>())
|
if (!canvas.GetComponent<GraphicRaycaster>())
|
||||||
@ -99,7 +96,7 @@ namespace UnityExplorer.Inspectors.MouseInspectors
|
|||||||
}
|
}
|
||||||
|
|
||||||
// recache Graphic Raycasters each time we start
|
// recache Graphic Raycasters each time we start
|
||||||
var casters = RuntimeHelper.FindObjectsOfTypeAll(typeof(GraphicRaycaster));
|
UnityEngine.Object[] casters = RuntimeHelper.FindObjectsOfTypeAll(typeof(GraphicRaycaster));
|
||||||
graphicRaycasters = new GraphicRaycaster[casters.Length];
|
graphicRaycasters = new GraphicRaycaster[casters.Length];
|
||||||
for (int i = 0; i < casters.Length; i++)
|
for (int i = 0; i < casters.Length; i++)
|
||||||
{
|
{
|
||||||
@ -107,9 +104,9 @@ namespace UnityExplorer.Inspectors.MouseInspectors
|
|||||||
}
|
}
|
||||||
|
|
||||||
// enable raycastTarget on Graphics
|
// enable raycastTarget on Graphics
|
||||||
foreach (var obj in RuntimeHelper.FindObjectsOfTypeAll(typeof(Graphic)))
|
foreach (UnityEngine.Object obj in RuntimeHelper.FindObjectsOfTypeAll(typeof(Graphic)))
|
||||||
{
|
{
|
||||||
var graphic = obj.TryCast<Graphic>();
|
Graphic graphic = obj.TryCast<Graphic>();
|
||||||
if (!graphic || !graphic.enabled || graphic.raycastTarget || !graphic.gameObject.activeInHierarchy)
|
if (!graphic || !graphic.enabled || graphic.raycastTarget || !graphic.gameObject.activeInHierarchy)
|
||||||
continue;
|
continue;
|
||||||
graphic.raycastTarget = true;
|
graphic.raycastTarget = true;
|
||||||
@ -118,9 +115,9 @@ namespace UnityExplorer.Inspectors.MouseInspectors
|
|||||||
}
|
}
|
||||||
|
|
||||||
// enable blocksRaycasts on CanvasGroups
|
// enable blocksRaycasts on CanvasGroups
|
||||||
foreach (var obj in RuntimeHelper.FindObjectsOfTypeAll(typeof(CanvasGroup)))
|
foreach (UnityEngine.Object obj in RuntimeHelper.FindObjectsOfTypeAll(typeof(CanvasGroup)))
|
||||||
{
|
{
|
||||||
var canvas = obj.TryCast<CanvasGroup>();
|
CanvasGroup canvas = obj.TryCast<CanvasGroup>();
|
||||||
if (!canvas || !canvas.gameObject.activeInHierarchy || canvas.blocksRaycasts)
|
if (!canvas || !canvas.gameObject.activeInHierarchy || canvas.blocksRaycasts)
|
||||||
continue;
|
continue;
|
||||||
canvas.blocksRaycasts = true;
|
canvas.blocksRaycasts = true;
|
||||||
@ -131,16 +128,16 @@ namespace UnityExplorer.Inspectors.MouseInspectors
|
|||||||
|
|
||||||
public override void OnEndInspect()
|
public override void OnEndInspect()
|
||||||
{
|
{
|
||||||
foreach (var obj in objectsAddedCastersTo)
|
foreach (GameObject obj in objectsAddedCastersTo)
|
||||||
{
|
{
|
||||||
if (obj.GetComponent<GraphicRaycaster>() is GraphicRaycaster raycaster)
|
if (obj.GetComponent<GraphicRaycaster>() is GraphicRaycaster raycaster)
|
||||||
GameObject.Destroy(raycaster);
|
GameObject.Destroy(raycaster);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var graphic in wasDisabledGraphics)
|
foreach (Graphic graphic in wasDisabledGraphics)
|
||||||
graphic.raycastTarget = false;
|
graphic.raycastTarget = false;
|
||||||
|
|
||||||
foreach (var canvas in wasDisabledCanvasGroups)
|
foreach (CanvasGroup canvas in wasDisabledCanvasGroups)
|
||||||
canvas.blocksRaycasts = false;
|
canvas.blocksRaycasts = false;
|
||||||
|
|
||||||
objectsAddedCastersTo.Clear();
|
objectsAddedCastersTo.Clear();
|
||||||
|
@ -1,9 +1,4 @@
|
|||||||
using System;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
|
||||||
using UniverseLib;
|
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
|
|
||||||
namespace UnityExplorer.Inspectors.MouseInspectors
|
namespace UnityExplorer.Inspectors.MouseInspectors
|
||||||
@ -45,7 +40,7 @@ namespace UnityExplorer.Inspectors.MouseInspectors
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var ray = MainCamera.ScreenPointToRay(mousePos);
|
Ray ray = MainCamera.ScreenPointToRay(mousePos);
|
||||||
Physics.Raycast(ray, out RaycastHit hit, 1000f);
|
Physics.Raycast(ray, out RaycastHit hit, 1000f);
|
||||||
|
|
||||||
if (hit.transform)
|
if (hit.transform)
|
||||||
|
@ -107,7 +107,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
public override void OnReturnToPool()
|
public override void OnReturnToPool()
|
||||||
{
|
{
|
||||||
foreach (var member in members)
|
foreach (CacheMember member in members)
|
||||||
{
|
{
|
||||||
member.UnlinkFromView();
|
member.UnlinkFromView();
|
||||||
member.ReleasePooledObjects();
|
member.ReleasePooledObjects();
|
||||||
@ -175,7 +175,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
scopeFilterButtons[BindingFlags.Default].Component.gameObject.SetActive(!StaticOnly);
|
scopeFilterButtons[BindingFlags.Default].Component.gameObject.SetActive(!StaticOnly);
|
||||||
scopeFilterButtons[BindingFlags.Instance].Component.gameObject.SetActive(!StaticOnly);
|
scopeFilterButtons[BindingFlags.Instance].Component.gameObject.SetActive(!StaticOnly);
|
||||||
|
|
||||||
foreach (var toggle in memberTypeToggles)
|
foreach (Toggle toggle in memberTypeToggles)
|
||||||
toggle.isOn = true;
|
toggle.isOn = true;
|
||||||
|
|
||||||
refreshWanted = true;
|
refreshWanted = true;
|
||||||
@ -236,7 +236,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
if (flags != scopeFlagsFilter)
|
if (flags != scopeFlagsFilter)
|
||||||
{
|
{
|
||||||
var btn = scopeFilterButtons[scopeFlagsFilter].Component;
|
Button btn = scopeFilterButtons[scopeFlagsFilter].Component;
|
||||||
RuntimeHelper.SetColorBlock(btn, disabledButtonColor, disabledButtonColor * 1.3f);
|
RuntimeHelper.SetColorBlock(btn, disabledButtonColor, disabledButtonColor * 1.3f);
|
||||||
|
|
||||||
this.scopeFlagsFilter = flags;
|
this.scopeFlagsFilter = flags;
|
||||||
@ -259,7 +259,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
for (int i = 0; i < members.Count; i++)
|
for (int i = 0; i < members.Count; i++)
|
||||||
{
|
{
|
||||||
var member = members[i];
|
CacheMember member = members[i];
|
||||||
|
|
||||||
if (scopeFlagsFilter != BindingFlags.Default)
|
if (scopeFlagsFilter != BindingFlags.Default)
|
||||||
{
|
{
|
||||||
@ -284,11 +284,11 @@ namespace UnityExplorer.Inspectors
|
|||||||
private void UpdateDisplayedMembers()
|
private void UpdateDisplayedMembers()
|
||||||
{
|
{
|
||||||
bool shouldRefresh = false;
|
bool shouldRefresh = false;
|
||||||
foreach (var cell in MemberScrollPool.CellPool)
|
foreach (CacheMemberCell cell in MemberScrollPool.CellPool)
|
||||||
{
|
{
|
||||||
if (!cell.Enabled || cell.Occupant == null)
|
if (!cell.Enabled || cell.Occupant == null)
|
||||||
continue;
|
continue;
|
||||||
var member = cell.MemberOccupant;
|
CacheMember member = cell.MemberOccupant;
|
||||||
if (member.ShouldAutoEvaluate)
|
if (member.ShouldAutoEvaluate)
|
||||||
{
|
{
|
||||||
shouldRefresh = true;
|
shouldRefresh = true;
|
||||||
@ -316,7 +316,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
{
|
{
|
||||||
CalculateLayouts();
|
CalculateLayouts();
|
||||||
|
|
||||||
foreach (var cell in MemberScrollPool.CellPool)
|
foreach (CacheMemberCell cell in MemberScrollPool.CellPool)
|
||||||
SetCellLayout(cell);
|
SetCellLayout(cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -349,21 +349,21 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
// Class name, assembly
|
// Class name, assembly
|
||||||
|
|
||||||
var topRow = UIFactory.CreateHorizontalGroup(UIRoot, "TopRow", false, false, true, true, 4, default, new(1, 1, 1, 0), TextAnchor.MiddleLeft);
|
GameObject topRow = UIFactory.CreateHorizontalGroup(UIRoot, "TopRow", false, false, true, true, 4, default, new(1, 1, 1, 0), TextAnchor.MiddleLeft);
|
||||||
UIFactory.SetLayoutElement(topRow, minHeight: 25, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(topRow, minHeight: 25, flexibleWidth: 9999);
|
||||||
|
|
||||||
var titleHolder = UIFactory.CreateUIObject("TitleHolder", topRow);
|
GameObject titleHolder = UIFactory.CreateUIObject("TitleHolder", topRow);
|
||||||
UIFactory.SetLayoutElement(titleHolder, minHeight: 35, flexibleHeight: 0, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(titleHolder, minHeight: 35, flexibleHeight: 0, flexibleWidth: 9999);
|
||||||
|
|
||||||
NameText = UIFactory.CreateLabel(titleHolder, "VisibleTitle", "NotSet", TextAnchor.MiddleLeft);
|
NameText = UIFactory.CreateLabel(titleHolder, "VisibleTitle", "NotSet", TextAnchor.MiddleLeft);
|
||||||
var namerect = NameText.GetComponent<RectTransform>();
|
RectTransform namerect = NameText.GetComponent<RectTransform>();
|
||||||
namerect.anchorMin = new Vector2(0, 0);
|
namerect.anchorMin = new Vector2(0, 0);
|
||||||
namerect.anchorMax = new Vector2(1, 1);
|
namerect.anchorMax = new Vector2(1, 1);
|
||||||
NameText.fontSize = 17;
|
NameText.fontSize = 17;
|
||||||
UIFactory.SetLayoutElement(NameText.gameObject, minHeight: 35, flexibleHeight: 0, minWidth: 300, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(NameText.gameObject, minHeight: 35, flexibleHeight: 0, minWidth: 300, flexibleWidth: 9999);
|
||||||
|
|
||||||
HiddenNameText = UIFactory.CreateInputField(titleHolder, "Title", "not set");
|
HiddenNameText = UIFactory.CreateInputField(titleHolder, "Title", "not set");
|
||||||
var hiddenrect = HiddenNameText.Component.gameObject.GetComponent<RectTransform>();
|
RectTransform hiddenrect = HiddenNameText.Component.gameObject.GetComponent<RectTransform>();
|
||||||
hiddenrect.anchorMin = new Vector2(0, 0);
|
hiddenrect.anchorMin = new Vector2(0, 0);
|
||||||
hiddenrect.anchorMax = new Vector2(1, 1);
|
hiddenrect.anchorMax = new Vector2(1, 1);
|
||||||
HiddenNameText.Component.readOnly = true;
|
HiddenNameText.Component.readOnly = true;
|
||||||
@ -374,7 +374,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
HiddenNameText.Component.textComponent.color = Color.clear;
|
HiddenNameText.Component.textComponent.color = Color.clear;
|
||||||
UIFactory.SetLayoutElement(HiddenNameText.Component.gameObject, minHeight: 35, flexibleHeight: 0, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(HiddenNameText.Component.gameObject, minHeight: 35, flexibleHeight: 0, flexibleWidth: 9999);
|
||||||
|
|
||||||
var copyButton = UIFactory.CreateButton(topRow, "CopyButton", "Copy to Clipboard", new Color(0.2f, 0.2f, 0.2f, 1));
|
ButtonRef copyButton = UIFactory.CreateButton(topRow, "CopyButton", "Copy to Clipboard", new Color(0.2f, 0.2f, 0.2f, 1));
|
||||||
copyButton.ButtonText.color = Color.yellow;
|
copyButton.ButtonText.color = Color.yellow;
|
||||||
UIFactory.SetLayoutElement(copyButton.Component.gameObject, minHeight: 25, minWidth: 120, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(copyButton.Component.gameObject, minHeight: 25, minWidth: 120, flexibleWidth: 0);
|
||||||
copyButton.OnClick += OnCopyClicked;
|
copyButton.OnClick += OnCopyClicked;
|
||||||
@ -392,7 +392,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
// Member scroll pool
|
// Member scroll pool
|
||||||
|
|
||||||
var memberBorder = UIFactory.CreateVerticalGroup(mainContentHolder, "ScrollPoolHolder", false, false, true, true, padding: new Vector4(2, 2, 2, 2),
|
GameObject memberBorder = UIFactory.CreateVerticalGroup(mainContentHolder, "ScrollPoolHolder", false, false, true, true, padding: new Vector4(2, 2, 2, 2),
|
||||||
bgColor: new Color(0.05f, 0.05f, 0.05f));
|
bgColor: new Color(0.05f, 0.05f, 0.05f));
|
||||||
UIFactory.SetLayoutElement(memberBorder, flexibleWidth: 9999, flexibleHeight: 9999);
|
UIFactory.SetLayoutElement(memberBorder, flexibleWidth: 9999, flexibleHeight: 9999);
|
||||||
|
|
||||||
@ -413,27 +413,27 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
private void ConstructFirstRow(GameObject parent)
|
private void ConstructFirstRow(GameObject parent)
|
||||||
{
|
{
|
||||||
var rowObj = UIFactory.CreateUIObject("FirstRow", parent);
|
GameObject rowObj = UIFactory.CreateUIObject("FirstRow", parent);
|
||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(rowObj, true, true, true, true, 5, 2, 2, 2, 2);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(rowObj, true, true, true, true, 5, 2, 2, 2, 2);
|
||||||
UIFactory.SetLayoutElement(rowObj, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(rowObj, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
|
||||||
|
|
||||||
var nameLabel = UIFactory.CreateLabel(rowObj, "NameFilterLabel", "Filter names:", TextAnchor.MiddleLeft, Color.grey);
|
Text nameLabel = UIFactory.CreateLabel(rowObj, "NameFilterLabel", "Filter names:", TextAnchor.MiddleLeft, Color.grey);
|
||||||
UIFactory.SetLayoutElement(nameLabel.gameObject, minHeight: 25, minWidth: 90, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(nameLabel.gameObject, minHeight: 25, minWidth: 90, flexibleWidth: 0);
|
||||||
|
|
||||||
filterInputField = UIFactory.CreateInputField(rowObj, "NameFilterInput", "...");
|
filterInputField = UIFactory.CreateInputField(rowObj, "NameFilterInput", "...");
|
||||||
UIFactory.SetLayoutElement(filterInputField.UIRoot, minHeight: 25, flexibleWidth: 300);
|
UIFactory.SetLayoutElement(filterInputField.UIRoot, minHeight: 25, flexibleWidth: 300);
|
||||||
filterInputField.OnValueChanged += (string val) => { SetFilter(val); };
|
filterInputField.OnValueChanged += (string val) => { SetFilter(val); };
|
||||||
|
|
||||||
var spacer = UIFactory.CreateUIObject("Spacer", rowObj);
|
GameObject spacer = UIFactory.CreateUIObject("Spacer", rowObj);
|
||||||
UIFactory.SetLayoutElement(spacer, minWidth: 25);
|
UIFactory.SetLayoutElement(spacer, minWidth: 25);
|
||||||
|
|
||||||
// Update button and toggle
|
// Update button and toggle
|
||||||
|
|
||||||
var updateButton = UIFactory.CreateButton(rowObj, "UpdateButton", "Update displayed values", new Color(0.22f, 0.28f, 0.22f));
|
ButtonRef updateButton = UIFactory.CreateButton(rowObj, "UpdateButton", "Update displayed values", new Color(0.22f, 0.28f, 0.22f));
|
||||||
UIFactory.SetLayoutElement(updateButton.Component.gameObject, minHeight: 25, minWidth: 175, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(updateButton.Component.gameObject, minHeight: 25, minWidth: 175, flexibleWidth: 0);
|
||||||
updateButton.OnClick += UpdateClicked;
|
updateButton.OnClick += UpdateClicked;
|
||||||
|
|
||||||
var toggleObj = UIFactory.CreateToggle(rowObj, "AutoUpdateToggle", out autoUpdateToggle, out Text toggleText);
|
GameObject toggleObj = UIFactory.CreateToggle(rowObj, "AutoUpdateToggle", out autoUpdateToggle, out Text toggleText);
|
||||||
UIFactory.SetLayoutElement(toggleObj, minWidth: 125, minHeight: 25);
|
UIFactory.SetLayoutElement(toggleObj, minWidth: 125, minHeight: 25);
|
||||||
autoUpdateToggle.isOn = false;
|
autoUpdateToggle.isOn = false;
|
||||||
toggleText.text = "Auto-update";
|
toggleText.text = "Auto-update";
|
||||||
@ -443,19 +443,19 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
private void ConstructSecondRow(GameObject parent)
|
private void ConstructSecondRow(GameObject parent)
|
||||||
{
|
{
|
||||||
var rowObj = UIFactory.CreateUIObject("SecondRow", parent);
|
GameObject rowObj = UIFactory.CreateUIObject("SecondRow", parent);
|
||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(rowObj, false, false, true, true, 5, 2, 2, 2, 2);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(rowObj, false, false, true, true, 5, 2, 2, 2, 2);
|
||||||
UIFactory.SetLayoutElement(rowObj, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(rowObj, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
|
||||||
|
|
||||||
// Scope buttons
|
// Scope buttons
|
||||||
|
|
||||||
var scopeLabel = UIFactory.CreateLabel(rowObj, "ScopeLabel", "Scope:", TextAnchor.MiddleLeft, Color.grey);
|
Text scopeLabel = UIFactory.CreateLabel(rowObj, "ScopeLabel", "Scope:", TextAnchor.MiddleLeft, Color.grey);
|
||||||
UIFactory.SetLayoutElement(scopeLabel.gameObject, minHeight: 25, minWidth: 60, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(scopeLabel.gameObject, minHeight: 25, minWidth: 60, flexibleWidth: 0);
|
||||||
AddScopeFilterButton(rowObj, BindingFlags.Default, true);
|
AddScopeFilterButton(rowObj, BindingFlags.Default, true);
|
||||||
AddScopeFilterButton(rowObj, BindingFlags.Instance);
|
AddScopeFilterButton(rowObj, BindingFlags.Instance);
|
||||||
AddScopeFilterButton(rowObj, BindingFlags.Static);
|
AddScopeFilterButton(rowObj, BindingFlags.Static);
|
||||||
|
|
||||||
var spacer = UIFactory.CreateUIObject("Spacer", rowObj);
|
GameObject spacer = UIFactory.CreateUIObject("Spacer", rowObj);
|
||||||
UIFactory.SetLayoutElement(spacer, minWidth: 15);
|
UIFactory.SetLayoutElement(spacer, minWidth: 15);
|
||||||
|
|
||||||
// Member type toggles
|
// Member type toggles
|
||||||
@ -469,9 +469,9 @@ namespace UnityExplorer.Inspectors
|
|||||||
private void AddScopeFilterButton(GameObject parent, BindingFlags flags, bool setAsActive = false)
|
private void AddScopeFilterButton(GameObject parent, BindingFlags flags, bool setAsActive = false)
|
||||||
{
|
{
|
||||||
string lbl = flags == BindingFlags.Default ? "All" : flags.ToString();
|
string lbl = flags == BindingFlags.Default ? "All" : flags.ToString();
|
||||||
var color = setAsActive ? enabledButtonColor : disabledButtonColor;
|
Color color = setAsActive ? enabledButtonColor : disabledButtonColor;
|
||||||
|
|
||||||
var button = UIFactory.CreateButton(parent, "Filter_" + flags, lbl, color);
|
ButtonRef button = UIFactory.CreateButton(parent, "Filter_" + flags, lbl, color);
|
||||||
UIFactory.SetLayoutElement(button.Component.gameObject, minHeight: 25, flexibleHeight: 0, minWidth: 70, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(button.Component.gameObject, minHeight: 25, flexibleHeight: 0, minWidth: 70, flexibleWidth: 0);
|
||||||
scopeFilterButtons.Add(flags, button);
|
scopeFilterButtons.Add(flags, button);
|
||||||
|
|
||||||
@ -480,7 +480,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
private void AddMemberTypeToggle(GameObject parent, MemberTypes type, int width)
|
private void AddMemberTypeToggle(GameObject parent, MemberTypes type, int width)
|
||||||
{
|
{
|
||||||
var toggleObj = UIFactory.CreateToggle(parent, "Toggle_" + type, out Toggle toggle, out Text toggleText);
|
GameObject toggleObj = UIFactory.CreateToggle(parent, "Toggle_" + type, out Toggle toggle, out Text toggleText);
|
||||||
UIFactory.SetLayoutElement(toggleObj, minHeight: 25, minWidth: width);
|
UIFactory.SetLayoutElement(toggleObj, minHeight: 25, minWidth: width);
|
||||||
string color = type switch
|
string color = type switch
|
||||||
{
|
{
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
using BepInEx.Configuration;
|
using BepInEx.Configuration;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityExplorer.Config;
|
using UnityExplorer.Config;
|
||||||
|
|
||||||
namespace UnityExplorer.Loader.BIE
|
namespace UnityExplorer.Loader.BIE
|
||||||
@ -21,7 +19,7 @@ namespace UnityExplorer.Loader.BIE
|
|||||||
|
|
||||||
public override void RegisterConfigElement<T>(ConfigElement<T> config)
|
public override void RegisterConfigElement<T>(ConfigElement<T> config)
|
||||||
{
|
{
|
||||||
var entry = Config.Bind(CTG_NAME, config.Name, config.Value, config.Description);
|
ConfigEntry<T> entry = Config.Bind(CTG_NAME, config.Name, config.Value, config.Description);
|
||||||
|
|
||||||
entry.SettingChanged += (object o, EventArgs e) =>
|
entry.SettingChanged += (object o, EventArgs e) =>
|
||||||
{
|
{
|
||||||
@ -47,13 +45,13 @@ namespace UnityExplorer.Loader.BIE
|
|||||||
|
|
||||||
public override void LoadConfig()
|
public override void LoadConfig()
|
||||||
{
|
{
|
||||||
foreach (var entry in ConfigManager.ConfigElements)
|
foreach (KeyValuePair<string, IConfigElement> entry in ConfigManager.ConfigElements)
|
||||||
{
|
{
|
||||||
var key = entry.Key;
|
string key = entry.Key;
|
||||||
var def = new ConfigDefinition(CTG_NAME, key);
|
ConfigDefinition def = new(CTG_NAME, key);
|
||||||
if (Config.ContainsKey(def) && Config[def] is ConfigEntryBase configEntry)
|
if (Config.ContainsKey(def) && Config[def] is ConfigEntryBase configEntry)
|
||||||
{
|
{
|
||||||
var config = entry.Value;
|
IConfigElement config = entry.Value;
|
||||||
config.BoxedValue = configEntry.BoxedValue;
|
config.BoxedValue = configEntry.BoxedValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,14 +3,8 @@ using BepInEx;
|
|||||||
using BepInEx.Logging;
|
using BepInEx.Logging;
|
||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.EventSystems;
|
|
||||||
using UnityExplorer.Config;
|
using UnityExplorer.Config;
|
||||||
using UniverseLib.Input;
|
|
||||||
using UnityExplorer.Loader.BIE;
|
using UnityExplorer.Loader.BIE;
|
||||||
#if CPP
|
#if CPP
|
||||||
using BepInEx.IL2CPP;
|
using BepInEx.IL2CPP;
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityExplorer.Config;
|
using UnityExplorer.Config;
|
||||||
|
|
||||||
namespace UnityExplorer
|
namespace UnityExplorer
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UniverseLib.UI.Models;
|
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
using UnityExplorer.UI.Widgets.AutoComplete;
|
using UnityExplorer.UI.Widgets.AutoComplete;
|
||||||
using UniverseLib.UI;
|
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
|
using UniverseLib.UI;
|
||||||
|
using UniverseLib.UI.Models;
|
||||||
using UniverseLib.UI.Widgets.ButtonList;
|
using UniverseLib.UI.Widgets.ButtonList;
|
||||||
using UniverseLib.UI.Widgets.ScrollView;
|
using UniverseLib.UI.Widgets.ScrollView;
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
@ -73,7 +72,7 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
//var type = ReflectionUtility.GetTypeByName(desiredTypeInput);
|
//var type = ReflectionUtility.GetTypeByName(desiredTypeInput);
|
||||||
if (ReflectionUtility.GetTypeByName(desiredTypeInput) is Type cachedType)
|
if (ReflectionUtility.GetTypeByName(desiredTypeInput) is Type cachedType)
|
||||||
{
|
{
|
||||||
var type = cachedType;
|
Type type = cachedType;
|
||||||
lastTypeCanHaveGameObject = typeof(Component).IsAssignableFrom(type) || type == typeof(GameObject);
|
lastTypeCanHaveGameObject = typeof(Component).IsAssignableFrom(type) || type == typeof(GameObject);
|
||||||
sceneFilterRow.SetActive(lastTypeCanHaveGameObject);
|
sceneFilterRow.SetActive(lastTypeCanHaveGameObject);
|
||||||
childFilterRow.SetActive(lastTypeCanHaveGameObject);
|
childFilterRow.SetActive(lastTypeCanHaveGameObject);
|
||||||
@ -135,7 +134,7 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
string text;
|
string text;
|
||||||
if (context == SearchContext.Class)
|
if (context == SearchContext.Class)
|
||||||
{
|
{
|
||||||
var type = currentResults[index] as Type;
|
Type type = currentResults[index] as Type;
|
||||||
text = $"{SignatureHighlighter.Parse(type, true)} <color=grey><i>({type.Assembly.GetName().Name})</i></color>";
|
text = $"{SignatureHighlighter.Parse(type, true)} <color=grey><i>({type.Assembly.GetName().Name})</i></color>";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -164,14 +163,14 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
|
|
||||||
// Search context row
|
// Search context row
|
||||||
|
|
||||||
var contextGroup = UIFactory.CreateHorizontalGroup(uiRoot, "SearchContextRow", false, true, true, true, 2, new Vector4(2, 2, 2, 2));
|
GameObject contextGroup = UIFactory.CreateHorizontalGroup(uiRoot, "SearchContextRow", false, true, true, true, 2, new Vector4(2, 2, 2, 2));
|
||||||
UIFactory.SetLayoutElement(contextGroup, minHeight: 25, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(contextGroup, minHeight: 25, flexibleHeight: 0);
|
||||||
|
|
||||||
var contextLbl = UIFactory.CreateLabel(contextGroup, "SearchContextLabel", "Searching for:", TextAnchor.MiddleLeft);
|
Text contextLbl = UIFactory.CreateLabel(contextGroup, "SearchContextLabel", "Searching for:", TextAnchor.MiddleLeft);
|
||||||
UIFactory.SetLayoutElement(contextLbl.gameObject, minWidth: 110, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(contextLbl.gameObject, minWidth: 110, flexibleWidth: 0);
|
||||||
|
|
||||||
var contextDropObj = UIFactory.CreateDropdown(contextGroup, "ContextDropdown", out Dropdown contextDrop, null, 14, OnContextDropdownChanged);
|
GameObject contextDropObj = UIFactory.CreateDropdown(contextGroup, "ContextDropdown", out Dropdown contextDrop, null, 14, OnContextDropdownChanged);
|
||||||
foreach (var name in Enum.GetNames(typeof(SearchContext)))
|
foreach (string name in Enum.GetNames(typeof(SearchContext)))
|
||||||
contextDrop.options.Add(new Dropdown.OptionData(name));
|
contextDrop.options.Add(new Dropdown.OptionData(name));
|
||||||
UIFactory.SetLayoutElement(contextDropObj, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(contextDropObj, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
|
||||||
|
|
||||||
@ -180,10 +179,10 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
classInputRow = UIFactory.CreateHorizontalGroup(uiRoot, "ClassRow", false, true, true, true, 2, new Vector4(2, 2, 2, 2));
|
classInputRow = UIFactory.CreateHorizontalGroup(uiRoot, "ClassRow", false, true, true, true, 2, new Vector4(2, 2, 2, 2));
|
||||||
UIFactory.SetLayoutElement(classInputRow, minHeight: 25, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(classInputRow, minHeight: 25, flexibleHeight: 0);
|
||||||
|
|
||||||
var unityClassLbl = UIFactory.CreateLabel(classInputRow, "ClassLabel", "Class filter:", TextAnchor.MiddleLeft);
|
Text unityClassLbl = UIFactory.CreateLabel(classInputRow, "ClassLabel", "Class filter:", TextAnchor.MiddleLeft);
|
||||||
UIFactory.SetLayoutElement(unityClassLbl.gameObject, minWidth: 110, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(unityClassLbl.gameObject, minWidth: 110, flexibleWidth: 0);
|
||||||
|
|
||||||
var classInputField = UIFactory.CreateInputField(classInputRow, "ClassInput", "...");
|
InputFieldRef classInputField = UIFactory.CreateInputField(classInputRow, "ClassInput", "...");
|
||||||
UIFactory.SetLayoutElement(classInputField.UIRoot, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(classInputField.UIRoot, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
|
||||||
|
|
||||||
typeAutocompleter = new TypeCompleter(typeof(UnityEngine.Object), classInputField);
|
typeAutocompleter = new TypeCompleter(typeof(UnityEngine.Object), classInputField);
|
||||||
@ -196,11 +195,11 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
childFilterRow = UIFactory.CreateHorizontalGroup(uiRoot, "ChildFilterRow", false, true, true, true, 2, new Vector4(2, 2, 2, 2));
|
childFilterRow = UIFactory.CreateHorizontalGroup(uiRoot, "ChildFilterRow", false, true, true, true, 2, new Vector4(2, 2, 2, 2));
|
||||||
UIFactory.SetLayoutElement(childFilterRow, minHeight: 25, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(childFilterRow, minHeight: 25, flexibleHeight: 0);
|
||||||
|
|
||||||
var childLbl = UIFactory.CreateLabel(childFilterRow, "ChildLabel", "Child filter:", TextAnchor.MiddleLeft);
|
Text childLbl = UIFactory.CreateLabel(childFilterRow, "ChildLabel", "Child filter:", TextAnchor.MiddleLeft);
|
||||||
UIFactory.SetLayoutElement(childLbl.gameObject, minWidth: 110, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(childLbl.gameObject, minWidth: 110, flexibleWidth: 0);
|
||||||
|
|
||||||
var childDropObj = UIFactory.CreateDropdown(childFilterRow, "ChildFilterDropdown", out Dropdown childDrop, null, 14, OnChildFilterDropChanged);
|
GameObject childDropObj = UIFactory.CreateDropdown(childFilterRow, "ChildFilterDropdown", out Dropdown childDrop, null, 14, OnChildFilterDropChanged);
|
||||||
foreach (var name in Enum.GetNames(typeof(ChildFilter)))
|
foreach (string name in Enum.GetNames(typeof(ChildFilter)))
|
||||||
childDrop.options.Add(new Dropdown.OptionData(name));
|
childDrop.options.Add(new Dropdown.OptionData(name));
|
||||||
UIFactory.SetLayoutElement(childDropObj, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(childDropObj, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
|
||||||
|
|
||||||
@ -211,11 +210,11 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
sceneFilterRow = UIFactory.CreateHorizontalGroup(uiRoot, "SceneFilterRow", false, true, true, true, 2, new Vector4(2, 2, 2, 2));
|
sceneFilterRow = UIFactory.CreateHorizontalGroup(uiRoot, "SceneFilterRow", false, true, true, true, 2, new Vector4(2, 2, 2, 2));
|
||||||
UIFactory.SetLayoutElement(sceneFilterRow, minHeight: 25, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(sceneFilterRow, minHeight: 25, flexibleHeight: 0);
|
||||||
|
|
||||||
var sceneLbl = UIFactory.CreateLabel(sceneFilterRow, "SceneLabel", "Scene filter:", TextAnchor.MiddleLeft);
|
Text sceneLbl = UIFactory.CreateLabel(sceneFilterRow, "SceneLabel", "Scene filter:", TextAnchor.MiddleLeft);
|
||||||
UIFactory.SetLayoutElement(sceneLbl.gameObject, minWidth: 110, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(sceneLbl.gameObject, minWidth: 110, flexibleWidth: 0);
|
||||||
|
|
||||||
var sceneDropObj = UIFactory.CreateDropdown(sceneFilterRow, "SceneFilterDropdown", out Dropdown sceneDrop, null, 14, OnSceneFilterDropChanged);
|
GameObject sceneDropObj = UIFactory.CreateDropdown(sceneFilterRow, "SceneFilterDropdown", out Dropdown sceneDrop, null, 14, OnSceneFilterDropChanged);
|
||||||
foreach (var name in Enum.GetNames(typeof(SceneFilter)))
|
foreach (string name in Enum.GetNames(typeof(SceneFilter)))
|
||||||
{
|
{
|
||||||
if (!SceneHandler.DontDestroyExists && name == "DontDestroyOnLoad")
|
if (!SceneHandler.DontDestroyExists && name == "DontDestroyOnLoad")
|
||||||
continue;
|
continue;
|
||||||
@ -230,7 +229,7 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
nameInputRow = UIFactory.CreateHorizontalGroup(uiRoot, "NameRow", true, true, true, true, 2, new Vector4(2, 2, 2, 2));
|
nameInputRow = UIFactory.CreateHorizontalGroup(uiRoot, "NameRow", true, true, true, true, 2, new Vector4(2, 2, 2, 2));
|
||||||
UIFactory.SetLayoutElement(nameInputRow, minHeight: 25, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(nameInputRow, minHeight: 25, flexibleHeight: 0);
|
||||||
|
|
||||||
var nameLbl = UIFactory.CreateLabel(nameInputRow, "NameFilterLabel", "Name contains:", TextAnchor.MiddleLeft);
|
Text nameLbl = UIFactory.CreateLabel(nameInputRow, "NameFilterLabel", "Name contains:", TextAnchor.MiddleLeft);
|
||||||
UIFactory.SetLayoutElement(nameLbl.gameObject, minWidth: 110, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(nameLbl.gameObject, minWidth: 110, flexibleWidth: 0);
|
||||||
|
|
||||||
nameInputField = UIFactory.CreateInputField(nameInputRow, "NameFilterInput", "...");
|
nameInputField = UIFactory.CreateInputField(nameInputRow, "NameFilterInput", "...");
|
||||||
@ -238,13 +237,13 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
|
|
||||||
// Search button
|
// Search button
|
||||||
|
|
||||||
var searchButton = UIFactory.CreateButton(uiRoot, "SearchButton", "Search");
|
ButtonRef searchButton = UIFactory.CreateButton(uiRoot, "SearchButton", "Search");
|
||||||
UIFactory.SetLayoutElement(searchButton.Component.gameObject, minHeight: 25, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(searchButton.Component.gameObject, minHeight: 25, flexibleHeight: 0);
|
||||||
searchButton.OnClick += DoSearch;
|
searchButton.OnClick += DoSearch;
|
||||||
|
|
||||||
// Results count label
|
// Results count label
|
||||||
|
|
||||||
var resultsCountRow = UIFactory.CreateHorizontalGroup(uiRoot, "ResultsCountRow", true, true, true, true);
|
GameObject resultsCountRow = UIFactory.CreateHorizontalGroup(uiRoot, "ResultsCountRow", true, true, true, true);
|
||||||
UIFactory.SetLayoutElement(resultsCountRow, minHeight: 25, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(resultsCountRow, minHeight: 25, flexibleHeight: 0);
|
||||||
|
|
||||||
resultsLabel = UIFactory.CreateLabel(resultsCountRow, "ResultsLabel", "0 results", TextAnchor.MiddleCenter);
|
resultsLabel = UIFactory.CreateLabel(resultsCountRow, "ResultsLabel", "0 results", TextAnchor.MiddleCenter);
|
||||||
|
@ -1,19 +1,17 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.UI;
|
using UnityExplorer.UI;
|
||||||
using UniverseLib.UI.Models;
|
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
using UnityExplorer.UI.Widgets;
|
using UnityExplorer.UI.Widgets;
|
||||||
using UniverseLib.UI;
|
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
using System.Collections;
|
using UniverseLib.UI;
|
||||||
|
using UniverseLib.UI.Models;
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
|
|
||||||
namespace UnityExplorer.ObjectExplorer
|
namespace UnityExplorer.ObjectExplorer
|
||||||
@ -76,7 +74,7 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
this.Parent.SetTab(0);
|
this.Parent.SetTab(0);
|
||||||
|
|
||||||
// select the transform's scene
|
// select the transform's scene
|
||||||
var go = transform.gameObject;
|
GameObject go = transform.gameObject;
|
||||||
if (SceneHandler.SelectedScene != go.scene)
|
if (SceneHandler.SelectedScene != go.scene)
|
||||||
{
|
{
|
||||||
int idx;
|
int idx;
|
||||||
@ -109,7 +107,7 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
|
|
||||||
if (sceneToDropdownOption.ContainsKey(scene))
|
if (sceneToDropdownOption.ContainsKey(scene))
|
||||||
{
|
{
|
||||||
var opt = sceneToDropdownOption[scene];
|
Dropdown.OptionData opt = sceneToDropdownOption[scene];
|
||||||
int idx = sceneDropdown.options.IndexOf(opt);
|
int idx = sceneDropdown.options.IndexOf(opt);
|
||||||
if (sceneDropdown.value != idx)
|
if (sceneDropdown.value != idx)
|
||||||
sceneDropdown.value = idx;
|
sceneDropdown.value = idx;
|
||||||
@ -136,7 +134,7 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
sceneToDropdownOption.Clear();
|
sceneToDropdownOption.Clear();
|
||||||
sceneDropdown.options.Clear();
|
sceneDropdown.options.Clear();
|
||||||
|
|
||||||
foreach (var scene in loadedScenes)
|
foreach (Scene scene in loadedScenes)
|
||||||
{
|
{
|
||||||
if (sceneToDropdownOption.ContainsKey(scene))
|
if (sceneToDropdownOption.ContainsKey(scene))
|
||||||
continue;
|
continue;
|
||||||
@ -148,7 +146,7 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
else if (string.IsNullOrEmpty(name))
|
else if (string.IsNullOrEmpty(name))
|
||||||
name = "<untitled>";
|
name = "<untitled>";
|
||||||
|
|
||||||
var option = new Dropdown.OptionData(name);
|
Dropdown.OptionData option = new(name);
|
||||||
sceneDropdown.options.Add(option);
|
sceneDropdown.options.Add(option);
|
||||||
sceneToDropdownOption.Add(scene, option);
|
sceneToDropdownOption.Add(scene, option);
|
||||||
}
|
}
|
||||||
@ -167,7 +165,7 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
|
|
||||||
private void TryLoadScene(LoadSceneMode mode, Dropdown allSceneDrop)
|
private void TryLoadScene(LoadSceneMode mode, Dropdown allSceneDrop)
|
||||||
{
|
{
|
||||||
var text = allSceneDrop.captionText.text;
|
string text = allSceneDrop.captionText.text;
|
||||||
|
|
||||||
if (text == DEFAULT_LOAD_TEXT)
|
if (text == DEFAULT_LOAD_TEXT)
|
||||||
return;
|
return;
|
||||||
@ -191,18 +189,18 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
|
|
||||||
// Tool bar (top area)
|
// Tool bar (top area)
|
||||||
|
|
||||||
var toolbar = UIFactory.CreateVerticalGroup(uiRoot, "Toolbar", true, true, true, true, 2, new Vector4(2, 2, 2, 2),
|
GameObject toolbar = UIFactory.CreateVerticalGroup(uiRoot, "Toolbar", true, true, true, true, 2, new Vector4(2, 2, 2, 2),
|
||||||
new Color(0.15f, 0.15f, 0.15f));
|
new Color(0.15f, 0.15f, 0.15f));
|
||||||
|
|
||||||
// Scene selector dropdown
|
// Scene selector dropdown
|
||||||
|
|
||||||
var dropRow = UIFactory.CreateHorizontalGroup(toolbar, "DropdownRow", true, true, true, true, 5, default, new Color(1, 1, 1, 0));
|
GameObject dropRow = UIFactory.CreateHorizontalGroup(toolbar, "DropdownRow", true, true, true, true, 5, default, new Color(1, 1, 1, 0));
|
||||||
UIFactory.SetLayoutElement(dropRow, minHeight: 25, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(dropRow, minHeight: 25, flexibleWidth: 9999);
|
||||||
|
|
||||||
var dropLabel = UIFactory.CreateLabel(dropRow, "SelectorLabel", "Scene:", TextAnchor.MiddleLeft, Color.cyan, false, 15);
|
Text dropLabel = UIFactory.CreateLabel(dropRow, "SelectorLabel", "Scene:", TextAnchor.MiddleLeft, Color.cyan, false, 15);
|
||||||
UIFactory.SetLayoutElement(dropLabel.gameObject, minHeight: 25, minWidth: 60, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(dropLabel.gameObject, minHeight: 25, minWidth: 60, flexibleWidth: 0);
|
||||||
|
|
||||||
var dropdownObj = UIFactory.CreateDropdown(dropRow, "SceneDropdown", out sceneDropdown, "<notset>", 13, OnSceneSelectionDropdownChanged);
|
GameObject dropdownObj = UIFactory.CreateDropdown(dropRow, "SceneDropdown", out sceneDropdown, "<notset>", 13, OnSceneSelectionDropdownChanged);
|
||||||
UIFactory.SetLayoutElement(dropdownObj, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(dropdownObj, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
|
||||||
|
|
||||||
SceneHandler.Update();
|
SceneHandler.Update();
|
||||||
@ -211,11 +209,11 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
|
|
||||||
// Filter row
|
// Filter row
|
||||||
|
|
||||||
var filterRow = UIFactory.CreateHorizontalGroup(toolbar, "FilterGroup", true, true, true, true, 2, new Vector4(2, 2, 2, 2));
|
GameObject filterRow = UIFactory.CreateHorizontalGroup(toolbar, "FilterGroup", true, true, true, true, 2, new Vector4(2, 2, 2, 2));
|
||||||
UIFactory.SetLayoutElement(filterRow, minHeight: 25, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(filterRow, minHeight: 25, flexibleHeight: 0);
|
||||||
|
|
||||||
//Filter input field
|
//Filter input field
|
||||||
var inputField = UIFactory.CreateInputField(filterRow, "FilterInput", "Search and press enter...");
|
InputFieldRef inputField = UIFactory.CreateInputField(filterRow, "FilterInput", "Search and press enter...");
|
||||||
inputField.Component.targetGraphic.color = new Color(0.2f, 0.2f, 0.2f);
|
inputField.Component.targetGraphic.color = new Color(0.2f, 0.2f, 0.2f);
|
||||||
RuntimeHelper.SetColorBlock(inputField.Component, new Color(0.4f, 0.4f, 0.4f), new Color(0.2f, 0.2f, 0.2f),
|
RuntimeHelper.SetColorBlock(inputField.Component, new Color(0.4f, 0.4f, 0.4f), new Color(0.2f, 0.2f, 0.2f),
|
||||||
new Color(0.08f, 0.08f, 0.08f));
|
new Color(0.08f, 0.08f, 0.08f));
|
||||||
@ -228,11 +226,11 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
refreshRow = UIFactory.CreateHorizontalGroup(toolbar, "RefreshGroup", true, true, true, true, 2, new Vector4(2, 2, 2, 2));
|
refreshRow = UIFactory.CreateHorizontalGroup(toolbar, "RefreshGroup", true, true, true, true, 2, new Vector4(2, 2, 2, 2));
|
||||||
UIFactory.SetLayoutElement(refreshRow, minHeight: 30, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(refreshRow, minHeight: 30, flexibleHeight: 0);
|
||||||
|
|
||||||
var refreshButton = UIFactory.CreateButton(refreshRow, "RefreshButton", "Update");
|
ButtonRef refreshButton = UIFactory.CreateButton(refreshRow, "RefreshButton", "Update");
|
||||||
UIFactory.SetLayoutElement(refreshButton.Component.gameObject, minWidth: 65, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(refreshButton.Component.gameObject, minWidth: 65, flexibleWidth: 0);
|
||||||
refreshButton.OnClick += UpdateTree;
|
refreshButton.OnClick += UpdateTree;
|
||||||
|
|
||||||
var refreshToggle = UIFactory.CreateToggle(refreshRow, "RefreshToggle", out Toggle toggle, out Text text);
|
GameObject refreshToggle = UIFactory.CreateToggle(refreshRow, "RefreshToggle", out Toggle toggle, out Text text);
|
||||||
UIFactory.SetLayoutElement(refreshToggle, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(refreshToggle, flexibleWidth: 9999);
|
||||||
text.text = "Auto-update (1 second)";
|
text.text = "Auto-update (1 second)";
|
||||||
text.alignment = TextAnchor.MiddleLeft;
|
text.alignment = TextAnchor.MiddleLeft;
|
||||||
@ -245,18 +243,18 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
|
|
||||||
// tree labels row
|
// tree labels row
|
||||||
|
|
||||||
var labelsRow = UIFactory.CreateHorizontalGroup(toolbar, "LabelsRow", true, true, true, true, 2, new Vector4(2, 2, 2, 2));
|
GameObject labelsRow = UIFactory.CreateHorizontalGroup(toolbar, "LabelsRow", true, true, true, true, 2, new Vector4(2, 2, 2, 2));
|
||||||
UIFactory.SetLayoutElement(labelsRow, minHeight: 30, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(labelsRow, minHeight: 30, flexibleHeight: 0);
|
||||||
|
|
||||||
var nameLabel = UIFactory.CreateLabel(labelsRow, "NameLabel", "Name", TextAnchor.MiddleLeft, color: Color.grey);
|
Text nameLabel = UIFactory.CreateLabel(labelsRow, "NameLabel", "Name", TextAnchor.MiddleLeft, color: Color.grey);
|
||||||
UIFactory.SetLayoutElement(nameLabel.gameObject, flexibleWidth: 9999, minHeight: 25);
|
UIFactory.SetLayoutElement(nameLabel.gameObject, flexibleWidth: 9999, minHeight: 25);
|
||||||
|
|
||||||
var indexLabel = UIFactory.CreateLabel(labelsRow, "IndexLabel", "Sibling Index", TextAnchor.MiddleLeft, fontSize: 12, color: Color.grey);
|
Text indexLabel = UIFactory.CreateLabel(labelsRow, "IndexLabel", "Sibling Index", TextAnchor.MiddleLeft, fontSize: 12, color: Color.grey);
|
||||||
UIFactory.SetLayoutElement(indexLabel.gameObject, minWidth: 100, flexibleWidth: 0, minHeight: 25);
|
UIFactory.SetLayoutElement(indexLabel.gameObject, minWidth: 100, flexibleWidth: 0, minHeight: 25);
|
||||||
|
|
||||||
// Transform Tree
|
// Transform Tree
|
||||||
|
|
||||||
var scrollPool = UIFactory.CreateScrollPool<TransformCell>(uiRoot, "TransformTree", out GameObject scrollObj,
|
UniverseLib.UI.Widgets.ScrollView.ScrollPool<TransformCell> scrollPool = UIFactory.CreateScrollPool<TransformCell>(uiRoot, "TransformTree", out GameObject scrollObj,
|
||||||
out GameObject scrollContent, new Color(0.11f, 0.11f, 0.11f));
|
out GameObject scrollContent, new Color(0.11f, 0.11f, 0.11f));
|
||||||
UIFactory.SetLayoutElement(scrollObj, flexibleHeight: 9999);
|
UIFactory.SetLayoutElement(scrollObj, flexibleHeight: 9999);
|
||||||
UIFactory.SetLayoutElement(scrollContent, flexibleHeight: 9999);
|
UIFactory.SetLayoutElement(scrollContent, flexibleHeight: 9999);
|
||||||
@ -294,7 +292,7 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
allSceneDropdown.options.Clear();
|
allSceneDropdown.options.Clear();
|
||||||
allSceneDropdown.options.Add(new Dropdown.OptionData(DEFAULT_LOAD_TEXT));
|
allSceneDropdown.options.Add(new Dropdown.OptionData(DEFAULT_LOAD_TEXT));
|
||||||
|
|
||||||
foreach (var scene in SceneHandler.AllSceneNames)
|
foreach (string scene in SceneHandler.AllSceneNames)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(filter) || scene.ContainsIgnoreCase(filter))
|
if (string.IsNullOrEmpty(filter) || scene.ContainsIgnoreCase(filter))
|
||||||
allSceneDropdown.options.Add(new Dropdown.OptionData(Path.GetFileNameWithoutExtension(scene)));
|
allSceneDropdown.options.Add(new Dropdown.OptionData(Path.GetFileNameWithoutExtension(scene)));
|
||||||
@ -308,7 +306,7 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
|
|
||||||
private void RefreshSceneLoaderButtons()
|
private void RefreshSceneLoaderButtons()
|
||||||
{
|
{
|
||||||
var text = allSceneDropdown.captionText.text;
|
string text = allSceneDropdown.captionText.text;
|
||||||
if (text == DEFAULT_LOAD_TEXT)
|
if (text == DEFAULT_LOAD_TEXT)
|
||||||
{
|
{
|
||||||
loadButton.Component.interactable = false;
|
loadButton.Component.interactable = false;
|
||||||
@ -328,30 +326,30 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
{
|
{
|
||||||
if (SceneHandler.WasAbleToGetScenesInBuild)
|
if (SceneHandler.WasAbleToGetScenesInBuild)
|
||||||
{
|
{
|
||||||
var sceneLoaderObj = UIFactory.CreateVerticalGroup(uiRoot, "SceneLoader", true, true, true, true);
|
GameObject sceneLoaderObj = UIFactory.CreateVerticalGroup(uiRoot, "SceneLoader", true, true, true, true);
|
||||||
UIFactory.SetLayoutElement(sceneLoaderObj, minHeight: 25);
|
UIFactory.SetLayoutElement(sceneLoaderObj, minHeight: 25);
|
||||||
|
|
||||||
// Title
|
// Title
|
||||||
|
|
||||||
var loaderTitle = UIFactory.CreateLabel(sceneLoaderObj, "SceneLoaderLabel", "Scene Loader", TextAnchor.MiddleLeft, Color.white, true, 14);
|
Text loaderTitle = UIFactory.CreateLabel(sceneLoaderObj, "SceneLoaderLabel", "Scene Loader", TextAnchor.MiddleLeft, Color.white, true, 14);
|
||||||
UIFactory.SetLayoutElement(loaderTitle.gameObject, minHeight: 25, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(loaderTitle.gameObject, minHeight: 25, flexibleHeight: 0);
|
||||||
|
|
||||||
// Search filter
|
// Search filter
|
||||||
|
|
||||||
var searchFilterObj = UIFactory.CreateInputField(sceneLoaderObj, "SearchFilterInput", "Filter scene names...");
|
InputFieldRef searchFilterObj = UIFactory.CreateInputField(sceneLoaderObj, "SearchFilterInput", "Filter scene names...");
|
||||||
UIFactory.SetLayoutElement(searchFilterObj.UIRoot, minHeight: 25, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(searchFilterObj.UIRoot, minHeight: 25, flexibleHeight: 0);
|
||||||
searchFilterObj.OnValueChanged += RefreshSceneLoaderOptions;
|
searchFilterObj.OnValueChanged += RefreshSceneLoaderOptions;
|
||||||
|
|
||||||
// Dropdown
|
// Dropdown
|
||||||
|
|
||||||
var allSceneDropObj = UIFactory.CreateDropdown(sceneLoaderObj, "SceneLoaderDropdown", out allSceneDropdown, "", 14, null);
|
GameObject allSceneDropObj = UIFactory.CreateDropdown(sceneLoaderObj, "SceneLoaderDropdown", out allSceneDropdown, "", 14, null);
|
||||||
UIFactory.SetLayoutElement(allSceneDropObj, minHeight: 25, minWidth: 150, flexibleWidth: 0, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(allSceneDropObj, minHeight: 25, minWidth: 150, flexibleWidth: 0, flexibleHeight: 0);
|
||||||
|
|
||||||
RefreshSceneLoaderOptions(string.Empty);
|
RefreshSceneLoaderOptions(string.Empty);
|
||||||
|
|
||||||
// Button row
|
// Button row
|
||||||
|
|
||||||
var buttonRow = UIFactory.CreateHorizontalGroup(sceneLoaderObj, "LoadButtons", true, true, true, true, 4);
|
GameObject buttonRow = UIFactory.CreateHorizontalGroup(sceneLoaderObj, "LoadButtons", true, true, true, true, 4);
|
||||||
|
|
||||||
loadButton = UIFactory.CreateButton(buttonRow, "LoadSceneButton", "Load (Single)", new Color(0.1f, 0.3f, 0.3f));
|
loadButton = UIFactory.CreateButton(buttonRow, "LoadSceneButton", "Load (Single)", new Color(0.1f, 0.3f, 0.3f));
|
||||||
UIFactory.SetLayoutElement(loadButton.Component.gameObject, minHeight: 25, minWidth: 150);
|
UIFactory.SetLayoutElement(loadButton.Component.gameObject, minHeight: 25, minWidth: 150);
|
||||||
@ -367,7 +365,7 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
TryLoadScene(LoadSceneMode.Additive, allSceneDropdown);
|
TryLoadScene(LoadSceneMode.Additive, allSceneDropdown);
|
||||||
};
|
};
|
||||||
|
|
||||||
var disabledColor = new Color(0.24f, 0.24f, 0.24f);
|
Color disabledColor = new(0.24f, 0.24f, 0.24f);
|
||||||
RuntimeHelper.SetColorBlock(loadButton.Component, disabled: disabledColor);
|
RuntimeHelper.SetColorBlock(loadButton.Component, disabled: disabledColor);
|
||||||
RuntimeHelper.SetColorBlock(loadAdditiveButton.Component, disabled: disabledColor);
|
RuntimeHelper.SetColorBlock(loadAdditiveButton.Component, disabled: disabledColor);
|
||||||
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
@ -65,11 +63,11 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
if (sceneUtil == null)
|
if (sceneUtil == null)
|
||||||
throw new Exception("This version of Unity does not ship with the 'SceneUtility' class, or it was not unstripped.");
|
throw new Exception("This version of Unity does not ship with the 'SceneUtility' class, or it was not unstripped.");
|
||||||
|
|
||||||
var method = sceneUtil.GetMethod("GetScenePathByBuildIndex", ReflectionUtility.FLAGS);
|
System.Reflection.MethodInfo method = sceneUtil.GetMethod("GetScenePathByBuildIndex", ReflectionUtility.FLAGS);
|
||||||
int sceneCount = SceneManager.sceneCountInBuildSettings;
|
int sceneCount = SceneManager.sceneCountInBuildSettings;
|
||||||
for (int i = 0; i < sceneCount; i++)
|
for (int i = 0; i < sceneCount; i++)
|
||||||
{
|
{
|
||||||
var scenePath = (string)method.Invoke(null, new object[] { i });
|
string scenePath = (string)method.Invoke(null, new object[] { i });
|
||||||
AllSceneNames.Add(scenePath);
|
AllSceneNames.Add(scenePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -121,11 +119,11 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
CurrentRootObjects = RuntimeHelper.GetRootGameObjects((Scene)SelectedScene);
|
CurrentRootObjects = RuntimeHelper.GetRootGameObjects((Scene)SelectedScene);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var allObjects = RuntimeHelper.FindObjectsOfTypeAll(typeof(GameObject));
|
UnityEngine.Object[] allObjects = RuntimeHelper.FindObjectsOfTypeAll(typeof(GameObject));
|
||||||
var objects = new List<GameObject>();
|
List<GameObject> objects = new();
|
||||||
foreach (var obj in allObjects)
|
foreach (UnityEngine.Object obj in allObjects)
|
||||||
{
|
{
|
||||||
var go = obj.TryCast<GameObject>();
|
GameObject go = obj.TryCast<GameObject>();
|
||||||
if (go.transform.parent == null && !go.scene.IsValid())
|
if (go.transform.parent == null && !go.scene.IsValid())
|
||||||
objects.Add(go);
|
objects.Add(go);
|
||||||
}
|
}
|
||||||
|
@ -2,12 +2,9 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityExplorer.Runtime;
|
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
using UniverseLib.Input;
|
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
|
|
||||||
namespace UnityExplorer.ObjectExplorer
|
namespace UnityExplorer.ObjectExplorer
|
||||||
@ -50,7 +47,7 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
|
|
||||||
internal static List<object> UnityObjectSearch(string input, string customTypeInput, ChildFilter childFilter, SceneFilter sceneFilter)
|
internal static List<object> UnityObjectSearch(string input, string customTypeInput, ChildFilter childFilter, SceneFilter sceneFilter)
|
||||||
{
|
{
|
||||||
var results = new List<object>();
|
List<object> results = new();
|
||||||
|
|
||||||
Type searchType = null;
|
Type searchType = null;
|
||||||
if (!string.IsNullOrEmpty(customTypeInput))
|
if (!string.IsNullOrEmpty(customTypeInput))
|
||||||
@ -69,7 +66,7 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
if (searchType == null)
|
if (searchType == null)
|
||||||
searchType = typeof(UnityEngine.Object);
|
searchType = typeof(UnityEngine.Object);
|
||||||
|
|
||||||
var allObjects = RuntimeHelper.FindObjectsOfTypeAll(searchType);
|
UnityEngine.Object[] allObjects = RuntimeHelper.FindObjectsOfTypeAll(searchType);
|
||||||
|
|
||||||
// perform filter comparers
|
// perform filter comparers
|
||||||
|
|
||||||
@ -79,14 +76,14 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
|
|
||||||
bool shouldFilterGOs = searchType == typeof(GameObject) || typeof(Component).IsAssignableFrom(searchType);
|
bool shouldFilterGOs = searchType == typeof(GameObject) || typeof(Component).IsAssignableFrom(searchType);
|
||||||
|
|
||||||
foreach (var obj in allObjects)
|
foreach (UnityEngine.Object obj in allObjects)
|
||||||
{
|
{
|
||||||
// name check
|
// name check
|
||||||
if (!string.IsNullOrEmpty(nameFilter) && !obj.name.ContainsIgnoreCase(nameFilter))
|
if (!string.IsNullOrEmpty(nameFilter) && !obj.name.ContainsIgnoreCase(nameFilter))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
GameObject go = null;
|
GameObject go = null;
|
||||||
var type = obj.GetActualType();
|
Type type = obj.GetActualType();
|
||||||
|
|
||||||
if (type == typeof(GameObject))
|
if (type == typeof(GameObject))
|
||||||
go = obj.TryCast<GameObject>();
|
go = obj.TryCast<GameObject>();
|
||||||
@ -130,15 +127,15 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
|
|
||||||
internal static List<object> ClassSearch(string input)
|
internal static List<object> ClassSearch(string input)
|
||||||
{
|
{
|
||||||
var list = new List<object>();
|
List<object> list = new();
|
||||||
|
|
||||||
var nameFilter = "";
|
string nameFilter = "";
|
||||||
if (!string.IsNullOrEmpty(input))
|
if (!string.IsNullOrEmpty(input))
|
||||||
nameFilter = input;
|
nameFilter = input;
|
||||||
|
|
||||||
foreach (var asm in AppDomain.CurrentDomain.GetAssemblies())
|
foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
|
||||||
{
|
{
|
||||||
foreach (var type in asm.TryGetTypes())
|
foreach (Type type in asm.TryGetTypes())
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(nameFilter) && !type.FullName.ContainsIgnoreCase(nameFilter))
|
if (!string.IsNullOrEmpty(nameFilter) && !type.FullName.ContainsIgnoreCase(nameFilter))
|
||||||
continue;
|
continue;
|
||||||
@ -165,18 +162,18 @@ namespace UnityExplorer.ObjectExplorer
|
|||||||
|
|
||||||
internal static List<object> InstanceSearch(string input)
|
internal static List<object> InstanceSearch(string input)
|
||||||
{
|
{
|
||||||
var instances = new List<object>();
|
List<object> instances = new();
|
||||||
|
|
||||||
var nameFilter = "";
|
string nameFilter = "";
|
||||||
if (!string.IsNullOrEmpty(input))
|
if (!string.IsNullOrEmpty(input))
|
||||||
nameFilter = input;
|
nameFilter = input;
|
||||||
|
|
||||||
var flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static;
|
BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static;
|
||||||
|
|
||||||
foreach (var asm in AppDomain.CurrentDomain.GetAssemblies())
|
foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies())
|
||||||
{
|
{
|
||||||
// Search all non-static, non-enum classes.
|
// Search all non-static, non-enum classes.
|
||||||
foreach (var type in asm.TryGetTypes().Where(it => !(it.IsSealed && it.IsAbstract) && !it.IsEnum))
|
foreach (Type type in asm.TryGetTypes().Where(it => !(it.IsSealed && it.IsAbstract) && !it.IsEnum))
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -1,13 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.EventSystems;
|
|
||||||
using UnityEngine.SceneManagement;
|
|
||||||
using UnityEngine.UI;
|
|
||||||
using UnityExplorer.Config;
|
using UnityExplorer.Config;
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
|
|
||||||
@ -50,10 +44,10 @@ namespace UnityExplorer.Runtime
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var sigs = blacklist.Split(';');
|
string[] sigs = blacklist.Split(';');
|
||||||
foreach (var sig in sigs)
|
foreach (string sig in sigs)
|
||||||
{
|
{
|
||||||
var s = sig.Trim();
|
string s = sig.Trim();
|
||||||
if (string.IsNullOrEmpty(s))
|
if (string.IsNullOrEmpty(s))
|
||||||
continue;
|
continue;
|
||||||
if (!currentBlacklist.Contains(s))
|
if (!currentBlacklist.Contains(s))
|
||||||
@ -65,7 +59,7 @@ namespace UnityExplorer.Runtime
|
|||||||
ExplorerCore.LogWarning($"Exception parsing blacklist string: {ex.ReflectionExToString()}");
|
ExplorerCore.LogWarning($"Exception parsing blacklist string: {ex.ReflectionExToString()}");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var sig in Instance.DefaultReflectionBlacklist)
|
foreach (string sig in Instance.DefaultReflectionBlacklist)
|
||||||
{
|
{
|
||||||
if (!currentBlacklist.Contains(sig))
|
if (!currentBlacklist.Contains(sig))
|
||||||
currentBlacklist.Add(sig);
|
currentBlacklist.Add(sig);
|
||||||
@ -84,7 +78,7 @@ namespace UnityExplorer.Runtime
|
|||||||
if (string.IsNullOrEmpty(member.DeclaringType?.Namespace))
|
if (string.IsNullOrEmpty(member.DeclaringType?.Namespace))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var sig = $"{member.DeclaringType.FullName}.{member.Name}";
|
string sig = $"{member.DeclaringType.FullName}.{member.Name}";
|
||||||
|
|
||||||
return currentBlacklist.Contains(sig);
|
return currentBlacklist.Contains(sig);
|
||||||
}
|
}
|
||||||
|
@ -2,15 +2,13 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityExplorer.CacheObject;
|
|
||||||
|
|
||||||
namespace UnityExplorer.Runtime
|
namespace UnityExplorer.Runtime
|
||||||
{
|
{
|
||||||
internal static class UnityCrashPrevention
|
internal static class UnityCrashPrevention
|
||||||
{
|
{
|
||||||
static readonly HarmonyLib.Harmony harmony = new ($"{ExplorerCore.GUID}.crashprevention");
|
static readonly HarmonyLib.Harmony harmony = new($"{ExplorerCore.GUID}.crashprevention");
|
||||||
|
|
||||||
internal static void Init()
|
internal static void Init()
|
||||||
{
|
{
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityExplorer.UI;
|
|
||||||
using UnityExplorer.CacheObject.IValues;
|
|
||||||
#if CPP
|
#if CPP
|
||||||
using UnhollowerRuntimeLib;
|
using UnhollowerRuntimeLib;
|
||||||
using UnhollowerBaseLib;
|
using UnhollowerBaseLib;
|
||||||
@ -74,7 +70,7 @@ namespace UnityExplorer.Tests
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
var list = new List<object>();
|
List<object> list = new();
|
||||||
int count = UnityEngine.Random.Range(0, 100);
|
int count = UnityEngine.Random.Range(0, 100);
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
list.Add(GetRandomObject());
|
list.Add(GetRandomObject());
|
||||||
@ -209,12 +205,12 @@ namespace UnityExplorer.Tests
|
|||||||
IL2CPP_HashTable.Add("key3", "value3");
|
IL2CPP_HashTable.Add("key3", "value3");
|
||||||
|
|
||||||
ExplorerCore.Log($"IL2CPP 3: Il2Cpp IDictionary");
|
ExplorerCore.Log($"IL2CPP 3: Il2Cpp IDictionary");
|
||||||
var dict2 = new Il2CppSystem.Collections.Generic.Dictionary<string, string>();
|
Il2CppSystem.Collections.Generic.Dictionary<string, string> dict2 = new Il2CppSystem.Collections.Generic.Dictionary<string, string>();
|
||||||
dict2.Add("key1", "value1");
|
dict2.Add("key1", "value1");
|
||||||
IL2CPP_IDict = dict2.TryCast<Il2CppSystem.Collections.IDictionary>();
|
IL2CPP_IDict = dict2.TryCast<Il2CppSystem.Collections.IDictionary>();
|
||||||
|
|
||||||
ExplorerCore.Log($"IL2CPP 4: Il2Cpp List of Il2Cpp Object");
|
ExplorerCore.Log($"IL2CPP 4: Il2Cpp List of Il2Cpp Object");
|
||||||
var list = new Il2CppSystem.Collections.Generic.List<Il2CppSystem.Object>(5);
|
Il2CppSystem.Collections.Generic.List<Il2CppSystem.Object> list = new Il2CppSystem.Collections.Generic.List<Il2CppSystem.Object>(5);
|
||||||
list.Add("one");
|
list.Add("one");
|
||||||
list.Add("two");
|
list.Add("two");
|
||||||
IL2CPP_IList = list.TryCast<Il2CppSystem.Collections.IList>();
|
IL2CPP_IList = list.TryCast<Il2CppSystem.Collections.IList>();
|
||||||
@ -240,14 +236,14 @@ namespace UnityExplorer.Tests
|
|||||||
// boxed enum test
|
// boxed enum test
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var cppType = Il2CppType.Of<CameraClearFlags>();
|
Il2CppSystem.Type cppType = Il2CppType.Of<CameraClearFlags>();
|
||||||
if (cppType != null)
|
if (cppType != null)
|
||||||
{
|
{
|
||||||
var boxedEnum = Il2CppSystem.Enum.Parse(cppType, "Color");
|
Il2CppSystem.Object boxedEnum = Il2CppSystem.Enum.Parse(cppType, "Color");
|
||||||
IL2CPP_listOfBoxedObjects.Add(boxedEnum);
|
IL2CPP_listOfBoxedObjects.Add(boxedEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
var structBox = Vector3.one.BoxIl2CppObject();
|
Il2CppSystem.Object structBox = Vector3.one.BoxIl2CppObject();
|
||||||
IL2CPP_listOfBoxedObjects.Add(structBox);
|
IL2CPP_listOfBoxedObjects.Add(structBox);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
using System;
|
using System.Collections;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityExplorer.Config;
|
using UnityExplorer.Config;
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
@ -72,7 +68,7 @@ namespace UnityExplorer.UI
|
|||||||
yield return null;
|
yield return null;
|
||||||
yield return null;
|
yield return null;
|
||||||
|
|
||||||
foreach (var panel in UIManager.UIPanels.Values)
|
foreach (Panels.UIPanel panel in UIManager.UIPanels.Values)
|
||||||
{
|
{
|
||||||
panel.EnsureValidSize();
|
panel.EnsureValidSize();
|
||||||
panel.EnsureValidPosition();
|
panel.EnsureValidPosition();
|
||||||
|
@ -1,10 +1,5 @@
|
|||||||
using System;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UniverseLib.Input;
|
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
|
|
||||||
namespace UnityExplorer.UI
|
namespace UnityExplorer.UI
|
||||||
@ -48,7 +43,7 @@ namespace UnityExplorer.UI
|
|||||||
popupLabel = UIFactory.CreateLabel(UIManager.UIRoot, "ClipboardNotification", "", TextAnchor.MiddleCenter);
|
popupLabel = UIFactory.CreateLabel(UIManager.UIRoot, "ClipboardNotification", "", TextAnchor.MiddleCenter);
|
||||||
popupLabel.rectTransform.sizeDelta = new(500, 100);
|
popupLabel.rectTransform.sizeDelta = new(500, 100);
|
||||||
popupLabel.gameObject.AddComponent<Outline>();
|
popupLabel.gameObject.AddComponent<Outline>();
|
||||||
var popupGroup = popupLabel.gameObject.AddComponent<CanvasGroup>();
|
CanvasGroup popupGroup = popupLabel.gameObject.AddComponent<CanvasGroup>();
|
||||||
popupGroup.blocksRaycasts = false;
|
popupGroup.blocksRaycasts = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,19 +2,15 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UniverseLib.Input;
|
|
||||||
using UnityExplorer.Runtime;
|
|
||||||
using UnityExplorer.UI;
|
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
using UniverseLib.UI.Widgets;
|
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
|
using UniverseLib.Input;
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
|
using UniverseLib.UI.Models;
|
||||||
using UniverseLib.UI.Widgets.ButtonList;
|
using UniverseLib.UI.Widgets.ButtonList;
|
||||||
using UniverseLib.UI.Widgets.ScrollView;
|
using UniverseLib.UI.Widgets.ScrollView;
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
using UniverseLib.UI.Models;
|
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Widgets.AutoComplete
|
namespace UnityExplorer.UI.Widgets.AutoComplete
|
||||||
{
|
{
|
||||||
@ -184,7 +180,7 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
|
|||||||
|
|
||||||
private void OnCellClicked(int dataIndex)
|
private void OnCellClicked(int dataIndex)
|
||||||
{
|
{
|
||||||
var suggestion = Suggestions[dataIndex];
|
Suggestion suggestion = Suggestions[dataIndex];
|
||||||
CurrentHandler.OnSuggestionClicked(suggestion);
|
CurrentHandler.OnSuggestionClicked(suggestion);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,7 +194,7 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var suggestion = Suggestions[index];
|
Suggestion suggestion = Suggestions[index];
|
||||||
cell.Button.ButtonText.text = suggestion.DisplayText;
|
cell.Button.ButtonText.text = suggestion.DisplayText;
|
||||||
|
|
||||||
if (CurrentHandler.AllowNavigation && index == SelectedIndex && setFirstCell)
|
if (CurrentHandler.AllowNavigation && index == SelectedIndex && setFirstCell)
|
||||||
@ -230,7 +226,7 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
|
|||||||
|
|
||||||
if (CurrentHandler.AnchorToCaretPosition)
|
if (CurrentHandler.AnchorToCaretPosition)
|
||||||
{
|
{
|
||||||
var textGen = input.Component.cachedInputTextGenerator;
|
TextGenerator textGen = input.Component.cachedInputTextGenerator;
|
||||||
int caretIdx = Math.Max(0, Math.Min(textGen.characterCount - 1, input.Component.caretPosition));
|
int caretIdx = Math.Max(0, Math.Min(textGen.characterCount - 1, input.Component.caretPosition));
|
||||||
|
|
||||||
// normalize the caret horizontal position
|
// normalize the caret horizontal position
|
||||||
|
@ -1,14 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Config;
|
|
||||||
using UnityExplorer.CSConsole;
|
using UnityExplorer.CSConsole;
|
||||||
using UnityExplorer.UI.Widgets;
|
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
using UniverseLib.UI.Models;
|
using UniverseLib.UI.Models;
|
||||||
@ -75,32 +69,32 @@ namespace UnityExplorer.UI.Panels
|
|||||||
{
|
{
|
||||||
// Tools Row
|
// Tools Row
|
||||||
|
|
||||||
var toolsRow = UIFactory.CreateHorizontalGroup(this.uiContent, "ToggleRow", false, false, true, true, 5, new Vector4(8, 8, 10, 5),
|
GameObject toolsRow = UIFactory.CreateHorizontalGroup(this.uiContent, "ToggleRow", false, false, true, true, 5, new Vector4(8, 8, 10, 5),
|
||||||
default, TextAnchor.MiddleLeft);
|
default, TextAnchor.MiddleLeft);
|
||||||
UIFactory.SetLayoutElement(toolsRow, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(toolsRow, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
|
||||||
|
|
||||||
// Buttons
|
// Buttons
|
||||||
|
|
||||||
var compileButton = UIFactory.CreateButton(toolsRow, "CompileButton", "Compile", new Color(0.33f, 0.5f, 0.33f));
|
ButtonRef compileButton = UIFactory.CreateButton(toolsRow, "CompileButton", "Compile", new Color(0.33f, 0.5f, 0.33f));
|
||||||
UIFactory.SetLayoutElement(compileButton.Component.gameObject, minHeight: 28, minWidth: 130, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(compileButton.Component.gameObject, minHeight: 28, minWidth: 130, flexibleHeight: 0);
|
||||||
compileButton.ButtonText.fontSize = 15;
|
compileButton.ButtonText.fontSize = 15;
|
||||||
compileButton.OnClick += () => { OnCompileClicked?.Invoke(); };
|
compileButton.OnClick += () => { OnCompileClicked?.Invoke(); };
|
||||||
|
|
||||||
var resetButton = UIFactory.CreateButton(toolsRow, "ResetButton", "Reset", new Color(0.33f, 0.33f, 0.33f));
|
ButtonRef resetButton = UIFactory.CreateButton(toolsRow, "ResetButton", "Reset", new Color(0.33f, 0.33f, 0.33f));
|
||||||
UIFactory.SetLayoutElement(resetButton.Component.gameObject, minHeight: 28, minWidth: 80, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(resetButton.Component.gameObject, minHeight: 28, minWidth: 80, flexibleHeight: 0);
|
||||||
resetButton.ButtonText.fontSize = 15;
|
resetButton.ButtonText.fontSize = 15;
|
||||||
resetButton.OnClick += () => { OnResetClicked?.Invoke(); };
|
resetButton.OnClick += () => { OnResetClicked?.Invoke(); };
|
||||||
|
|
||||||
// Help dropdown
|
// Help dropdown
|
||||||
|
|
||||||
var helpDrop = UIFactory.CreateDropdown(toolsRow, "HelpDropdown", out var dropdown, "Help", 14, null);
|
GameObject helpDrop = UIFactory.CreateDropdown(toolsRow, "HelpDropdown", out Dropdown dropdown, "Help", 14, null);
|
||||||
UIFactory.SetLayoutElement(helpDrop, minHeight: 25, minWidth: 100);
|
UIFactory.SetLayoutElement(helpDrop, minHeight: 25, minWidth: 100);
|
||||||
HelpDropdown = dropdown;
|
HelpDropdown = dropdown;
|
||||||
HelpDropdown.onValueChanged.AddListener((int val) => { this.OnHelpDropdownChanged?.Invoke(val); });
|
HelpDropdown.onValueChanged.AddListener((int val) => { this.OnHelpDropdownChanged?.Invoke(val); });
|
||||||
|
|
||||||
// Enable Ctrl+R toggle
|
// Enable Ctrl+R toggle
|
||||||
|
|
||||||
var ctrlRToggleObj = UIFactory.CreateToggle(toolsRow, "CtrlRToggle", out var CtrlRToggle, out Text ctrlRToggleText);
|
GameObject ctrlRToggleObj = UIFactory.CreateToggle(toolsRow, "CtrlRToggle", out Toggle CtrlRToggle, out Text ctrlRToggleText);
|
||||||
UIFactory.SetLayoutElement(ctrlRToggleObj, minWidth: 150, flexibleWidth: 0, minHeight: 25);
|
UIFactory.SetLayoutElement(ctrlRToggleObj, minWidth: 150, flexibleWidth: 0, minHeight: 25);
|
||||||
ctrlRToggleText.alignment = TextAnchor.UpperLeft;
|
ctrlRToggleText.alignment = TextAnchor.UpperLeft;
|
||||||
ctrlRToggleText.text = "Compile on Ctrl+R";
|
ctrlRToggleText.text = "Compile on Ctrl+R";
|
||||||
@ -108,7 +102,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
|
|
||||||
// Enable Suggestions toggle
|
// Enable Suggestions toggle
|
||||||
|
|
||||||
var suggestToggleObj = UIFactory.CreateToggle(toolsRow, "SuggestionToggle", out var SuggestionsToggle, out Text suggestToggleText);
|
GameObject suggestToggleObj = UIFactory.CreateToggle(toolsRow, "SuggestionToggle", out Toggle SuggestionsToggle, out Text suggestToggleText);
|
||||||
UIFactory.SetLayoutElement(suggestToggleObj, minWidth: 120, flexibleWidth: 0, minHeight: 25);
|
UIFactory.SetLayoutElement(suggestToggleObj, minWidth: 120, flexibleWidth: 0, minHeight: 25);
|
||||||
suggestToggleText.alignment = TextAnchor.UpperLeft;
|
suggestToggleText.alignment = TextAnchor.UpperLeft;
|
||||||
suggestToggleText.text = "Suggestions";
|
suggestToggleText.text = "Suggestions";
|
||||||
@ -116,7 +110,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
|
|
||||||
// Enable Auto-indent toggle
|
// Enable Auto-indent toggle
|
||||||
|
|
||||||
var autoIndentToggleObj = UIFactory.CreateToggle(toolsRow, "IndentToggle", out var AutoIndentToggle, out Text autoIndentToggleText);
|
GameObject autoIndentToggleObj = UIFactory.CreateToggle(toolsRow, "IndentToggle", out Toggle AutoIndentToggle, out Text autoIndentToggleText);
|
||||||
UIFactory.SetLayoutElement(autoIndentToggleObj, minWidth: 120, flexibleWidth: 0, minHeight: 25);
|
UIFactory.SetLayoutElement(autoIndentToggleObj, minWidth: 120, flexibleWidth: 0, minHeight: 25);
|
||||||
autoIndentToggleText.alignment = TextAnchor.UpperLeft;
|
autoIndentToggleText.alignment = TextAnchor.UpperLeft;
|
||||||
autoIndentToggleText.text = "Auto-indent";
|
autoIndentToggleText.text = "Auto-indent";
|
||||||
@ -124,7 +118,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
|
|
||||||
// Console Input
|
// Console Input
|
||||||
|
|
||||||
var inputArea = UIFactory.CreateUIObject("InputGroup", uiContent);
|
GameObject inputArea = UIFactory.CreateUIObject("InputGroup", uiContent);
|
||||||
UIFactory.SetLayoutElement(inputArea, flexibleWidth: 9999, flexibleHeight: 9999);
|
UIFactory.SetLayoutElement(inputArea, flexibleWidth: 9999, flexibleHeight: 9999);
|
||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(inputArea, false, true, true, true);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(inputArea, false, true, true, true);
|
||||||
inputArea.AddComponent<Image>().color = Color.white;
|
inputArea.AddComponent<Image>().color = Color.white;
|
||||||
@ -132,8 +126,8 @@ namespace UnityExplorer.UI.Panels
|
|||||||
|
|
||||||
// line numbers
|
// line numbers
|
||||||
|
|
||||||
var linesHolder = UIFactory.CreateUIObject("LinesHolder", inputArea);
|
GameObject linesHolder = UIFactory.CreateUIObject("LinesHolder", inputArea);
|
||||||
var linesRect = linesHolder.GetComponent<RectTransform>();
|
RectTransform linesRect = linesHolder.GetComponent<RectTransform>();
|
||||||
linesRect.pivot = new Vector2(0, 1);
|
linesRect.pivot = new Vector2(0, 1);
|
||||||
linesRect.anchorMin = new Vector2(0, 0);
|
linesRect.anchorMin = new Vector2(0, 0);
|
||||||
linesRect.anchorMax = new Vector2(0, 1);
|
linesRect.anchorMax = new Vector2(0, 1);
|
||||||
@ -149,8 +143,8 @@ namespace UnityExplorer.UI.Panels
|
|||||||
|
|
||||||
int fontSize = 16;
|
int fontSize = 16;
|
||||||
|
|
||||||
var inputObj = UIFactory.CreateScrollInputField(inputArea, "ConsoleInput", ConsoleController.STARTUP_TEXT,
|
GameObject inputObj = UIFactory.CreateScrollInputField(inputArea, "ConsoleInput", ConsoleController.STARTUP_TEXT,
|
||||||
out var inputScroller, fontSize);
|
out InputFieldScroller inputScroller, fontSize);
|
||||||
InputScroller = inputScroller;
|
InputScroller = inputScroller;
|
||||||
ConsoleController.defaultInputFieldAlpha = Input.Component.selectionColor.a;
|
ConsoleController.defaultInputFieldAlpha = Input.Component.selectionColor.a;
|
||||||
Input.OnValueChanged += InvokeOnValueChanged;
|
Input.OnValueChanged += InvokeOnValueChanged;
|
||||||
@ -173,8 +167,8 @@ namespace UnityExplorer.UI.Panels
|
|||||||
Input.PlaceholderText.fontSize = fontSize;
|
Input.PlaceholderText.fontSize = fontSize;
|
||||||
|
|
||||||
// Lexer highlight text overlay
|
// Lexer highlight text overlay
|
||||||
var highlightTextObj = UIFactory.CreateUIObject("HighlightText", InputText.gameObject);
|
GameObject highlightTextObj = UIFactory.CreateUIObject("HighlightText", InputText.gameObject);
|
||||||
var highlightTextRect = highlightTextObj.GetComponent<RectTransform>();
|
RectTransform highlightTextRect = highlightTextObj.GetComponent<RectTransform>();
|
||||||
highlightTextRect.pivot = new Vector2(0, 1);
|
highlightTextRect.pivot = new Vector2(0, 1);
|
||||||
highlightTextRect.anchorMin = Vector2.zero;
|
highlightTextRect.anchorMin = Vector2.zero;
|
||||||
highlightTextRect.anchorMax = Vector2.one;
|
highlightTextRect.anchorMax = Vector2.one;
|
||||||
|
@ -1,17 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.CacheObject;
|
|
||||||
using UnityExplorer.CacheObject.Views;
|
|
||||||
using UnityExplorer.Config;
|
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
using UniverseLib.Input;
|
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
using UniverseLib.UI.Widgets;
|
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Panels
|
namespace UnityExplorer.UI.Panels
|
||||||
@ -41,7 +32,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
public static bool TryPaste(Type targetType, out object paste)
|
public static bool TryPaste(Type targetType, out object paste)
|
||||||
{
|
{
|
||||||
paste = Current;
|
paste = Current;
|
||||||
var pasteType = Current?.GetActualType();
|
Type pasteType = Current?.GetActualType();
|
||||||
|
|
||||||
if (Current != null && !targetType.IsAssignableFrom(pasteType))
|
if (Current != null && !targetType.IsAssignableFrom(pasteType))
|
||||||
{
|
{
|
||||||
@ -89,20 +80,20 @@ namespace UnityExplorer.UI.Panels
|
|||||||
|
|
||||||
// Actual panel content
|
// Actual panel content
|
||||||
|
|
||||||
var firstRow = UIFactory.CreateHorizontalGroup(uiContent, "FirstRow", false, false, true, true, 5, new(2,2,2,2), new(1,1,1,0));
|
GameObject firstRow = UIFactory.CreateHorizontalGroup(uiContent, "FirstRow", false, false, true, true, 5, new(2, 2, 2, 2), new(1, 1, 1, 0));
|
||||||
UIFactory.SetLayoutElement(firstRow, minHeight: 25, flexibleWidth: 999);
|
UIFactory.SetLayoutElement(firstRow, minHeight: 25, flexibleWidth: 999);
|
||||||
|
|
||||||
// Title for "Current Paste:"
|
// Title for "Current Paste:"
|
||||||
var currentPasteTitle = UIFactory.CreateLabel(firstRow, "CurrentPasteTitle", "Current paste:", TextAnchor.MiddleLeft, color: Color.grey);
|
Text currentPasteTitle = UIFactory.CreateLabel(firstRow, "CurrentPasteTitle", "Current paste:", TextAnchor.MiddleLeft, color: Color.grey);
|
||||||
UIFactory.SetLayoutElement(currentPasteTitle.gameObject, minHeight: 25, minWidth: 100, flexibleWidth: 999);
|
UIFactory.SetLayoutElement(currentPasteTitle.gameObject, minHeight: 25, minWidth: 100, flexibleWidth: 999);
|
||||||
|
|
||||||
// Clear clipboard button
|
// Clear clipboard button
|
||||||
var clearButton = UIFactory.CreateButton(firstRow, "ClearPasteButton", "Clear Clipboard");
|
UniverseLib.UI.Models.ButtonRef clearButton = UIFactory.CreateButton(firstRow, "ClearPasteButton", "Clear Clipboard");
|
||||||
UIFactory.SetLayoutElement(clearButton.Component.gameObject, minWidth: 120, minHeight: 25, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(clearButton.Component.gameObject, minWidth: 120, minHeight: 25, flexibleWidth: 0);
|
||||||
clearButton.OnClick += () => Copy(null);
|
clearButton.OnClick += () => Copy(null);
|
||||||
|
|
||||||
// Current Paste info row
|
// Current Paste info row
|
||||||
var currentPasteHolder = UIFactory.CreateHorizontalGroup(uiContent, "SecondRow", false, false, true, true, 0,
|
GameObject currentPasteHolder = UIFactory.CreateHorizontalGroup(uiContent, "SecondRow", false, false, true, true, 0,
|
||||||
new(2, 2, 2, 2), childAlignment: TextAnchor.UpperCenter);
|
new(2, 2, 2, 2), childAlignment: TextAnchor.UpperCenter);
|
||||||
|
|
||||||
// Actual current paste info label
|
// Actual current paste info label
|
||||||
@ -111,7 +102,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
UpdateCurrentPasteInfo();
|
UpdateCurrentPasteInfo();
|
||||||
|
|
||||||
// Inspect button
|
// Inspect button
|
||||||
var inspectButton = UIFactory.CreateButton(currentPasteHolder, "InspectButton", "Inspect");
|
UniverseLib.UI.Models.ButtonRef inspectButton = UIFactory.CreateButton(currentPasteHolder, "InspectButton", "Inspect");
|
||||||
UIFactory.SetLayoutElement(inspectButton.Component.gameObject, minHeight: 25, flexibleHeight: 0, minWidth: 80, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(inspectButton.Component.gameObject, minHeight: 25, flexibleHeight: 0, minWidth: 80, flexibleWidth: 0);
|
||||||
inspectButton.OnClick += InspectClipboard;
|
inspectButton.OnClick += InspectClipboard;
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,6 @@
|
|||||||
using System;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Config;
|
|
||||||
using UnityExplorer.Hooks;
|
using UnityExplorer.Hooks;
|
||||||
using UnityExplorer.UI.Widgets;
|
|
||||||
using UnityExplorer.UI.Widgets.AutoComplete;
|
using UnityExplorer.UI.Widgets.AutoComplete;
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
using UniverseLib.UI.Models;
|
using UniverseLib.UI.Models;
|
||||||
@ -87,7 +81,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
UIFactory.SetLayoutElement(currentHooksPanel, flexibleHeight: 9999, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(currentHooksPanel, flexibleHeight: 9999, flexibleWidth: 9999);
|
||||||
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(currentHooksPanel, true, true, true, true);
|
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(currentHooksPanel, true, true, true, true);
|
||||||
|
|
||||||
var addRow = UIFactory.CreateHorizontalGroup(currentHooksPanel, "AddRow", false, true, true, true, 4,
|
GameObject addRow = UIFactory.CreateHorizontalGroup(currentHooksPanel, "AddRow", false, true, true, true, 4,
|
||||||
new Vector4(2, 2, 2, 2), new Color(0.2f, 0.2f, 0.2f));
|
new Vector4(2, 2, 2, 2), new Color(0.2f, 0.2f, 0.2f));
|
||||||
UIFactory.SetLayoutElement(addRow, minHeight: 30, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(addRow, minHeight: 30, flexibleWidth: 9999);
|
||||||
|
|
||||||
@ -95,11 +89,11 @@ namespace UnityExplorer.UI.Panels
|
|||||||
UIFactory.SetLayoutElement(classSelectorInputField.Component.gameObject, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(classSelectorInputField.Component.gameObject, flexibleWidth: 9999);
|
||||||
new TypeCompleter(typeof(object), classSelectorInputField, true, false);
|
new TypeCompleter(typeof(object), classSelectorInputField, true, false);
|
||||||
|
|
||||||
var addButton = UIFactory.CreateButton(addRow, "AddButton", "Add Hooks");
|
ButtonRef addButton = UIFactory.CreateButton(addRow, "AddButton", "Add Hooks");
|
||||||
UIFactory.SetLayoutElement(addButton.Component.gameObject, minWidth: 100, minHeight: 25);
|
UIFactory.SetLayoutElement(addButton.Component.gameObject, minWidth: 100, minHeight: 25);
|
||||||
addButton.OnClick += OnClassInputAddClicked;
|
addButton.OnClick += OnClassInputAddClicked;
|
||||||
|
|
||||||
var hooksLabel = UIFactory.CreateLabel(currentHooksPanel, "HooksLabel", "Current Hooks", TextAnchor.MiddleCenter);
|
Text hooksLabel = UIFactory.CreateLabel(currentHooksPanel, "HooksLabel", "Current Hooks", TextAnchor.MiddleCenter);
|
||||||
UIFactory.SetLayoutElement(hooksLabel.gameObject, minHeight: 30, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(hooksLabel.gameObject, minHeight: 30, flexibleWidth: 9999);
|
||||||
|
|
||||||
HooksScrollPool = UIFactory.CreateScrollPool<HookCell>(currentHooksPanel, "HooksScrollPool",
|
HooksScrollPool = UIFactory.CreateScrollPool<HookCell>(currentHooksPanel, "HooksScrollPool",
|
||||||
@ -116,10 +110,10 @@ namespace UnityExplorer.UI.Panels
|
|||||||
addHooksLabel = UIFactory.CreateLabel(addHooksPanel, "AddLabel", "NOT SET", TextAnchor.MiddleCenter);
|
addHooksLabel = UIFactory.CreateLabel(addHooksPanel, "AddLabel", "NOT SET", TextAnchor.MiddleCenter);
|
||||||
UIFactory.SetLayoutElement(addHooksLabel.gameObject, minHeight: 30, minWidth: 100, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(addHooksLabel.gameObject, minHeight: 30, minWidth: 100, flexibleWidth: 9999);
|
||||||
|
|
||||||
var buttonRow = UIFactory.CreateHorizontalGroup(addHooksPanel, "ButtonRow", false, false, true, true, 5);
|
GameObject buttonRow = UIFactory.CreateHorizontalGroup(addHooksPanel, "ButtonRow", false, false, true, true, 5);
|
||||||
UIFactory.SetLayoutElement(buttonRow, minHeight: 25, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(buttonRow, minHeight: 25, flexibleWidth: 9999);
|
||||||
|
|
||||||
var doneButton = UIFactory.CreateButton(buttonRow, "DoneButton", "Done", new Color(0.2f, 0.3f, 0.2f));
|
ButtonRef doneButton = UIFactory.CreateButton(buttonRow, "DoneButton", "Done", new Color(0.2f, 0.3f, 0.2f));
|
||||||
UIFactory.SetLayoutElement(doneButton.Component.gameObject, minHeight: 25, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(doneButton.Component.gameObject, minHeight: 25, flexibleWidth: 9999);
|
||||||
doneButton.OnClick += HookManager.Instance.DoneAddingHooks;
|
doneButton.OnClick += HookManager.Instance.DoneAddingHooks;
|
||||||
|
|
||||||
@ -140,26 +134,26 @@ namespace UnityExplorer.UI.Panels
|
|||||||
UIFactory.SetLayoutElement(editorPanel, flexibleHeight: 9999, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(editorPanel, flexibleHeight: 9999, flexibleWidth: 9999);
|
||||||
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(editorPanel, true, true, true, true);
|
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(editorPanel, true, true, true, true);
|
||||||
|
|
||||||
var editorLabel = UIFactory.CreateLabel(editorPanel,
|
Text editorLabel = UIFactory.CreateLabel(editorPanel,
|
||||||
"EditorLabel",
|
"EditorLabel",
|
||||||
"Edit Harmony patch source as desired. Accepted method names are Prefix, Postfix, Finalizer and Transpiler (can define multiple).\n\n" +
|
"Edit Harmony patch source as desired. Accepted method names are Prefix, Postfix, Finalizer and Transpiler (can define multiple).\n\n" +
|
||||||
"Hooks are temporary! Please copy the source into your IDE to avoid losing work if you wish to keep it!",
|
"Hooks are temporary! Please copy the source into your IDE to avoid losing work if you wish to keep it!",
|
||||||
TextAnchor.MiddleLeft);
|
TextAnchor.MiddleLeft);
|
||||||
UIFactory.SetLayoutElement(editorLabel.gameObject, minHeight: 25, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(editorLabel.gameObject, minHeight: 25, flexibleWidth: 9999);
|
||||||
|
|
||||||
var editorButtonRow = UIFactory.CreateHorizontalGroup(editorPanel, "ButtonRow", false, false, true, true, 5);
|
GameObject editorButtonRow = UIFactory.CreateHorizontalGroup(editorPanel, "ButtonRow", false, false, true, true, 5);
|
||||||
UIFactory.SetLayoutElement(editorButtonRow, minHeight: 25, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(editorButtonRow, minHeight: 25, flexibleWidth: 9999);
|
||||||
|
|
||||||
var editorSaveButton = UIFactory.CreateButton(editorButtonRow, "DoneButton", "Save and Return", new Color(0.2f, 0.3f, 0.2f));
|
ButtonRef editorSaveButton = UIFactory.CreateButton(editorButtonRow, "DoneButton", "Save and Return", new Color(0.2f, 0.3f, 0.2f));
|
||||||
UIFactory.SetLayoutElement(editorSaveButton.Component.gameObject, minHeight: 25, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(editorSaveButton.Component.gameObject, minHeight: 25, flexibleWidth: 9999);
|
||||||
editorSaveButton.OnClick += HookManager.Instance.EditorInputSave;
|
editorSaveButton.OnClick += HookManager.Instance.EditorInputSave;
|
||||||
|
|
||||||
var editorDoneButton = UIFactory.CreateButton(editorButtonRow, "DoneButton", "Cancel and Return", new Color(0.2f, 0.2f, 0.2f));
|
ButtonRef editorDoneButton = UIFactory.CreateButton(editorButtonRow, "DoneButton", "Cancel and Return", new Color(0.2f, 0.2f, 0.2f));
|
||||||
UIFactory.SetLayoutElement(editorDoneButton.Component.gameObject, minHeight: 25, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(editorDoneButton.Component.gameObject, minHeight: 25, flexibleWidth: 9999);
|
||||||
editorDoneButton.OnClick += HookManager.Instance.EditorInputCancel;
|
editorDoneButton.OnClick += HookManager.Instance.EditorInputCancel;
|
||||||
|
|
||||||
int fontSize = 16;
|
int fontSize = 16;
|
||||||
var inputObj = UIFactory.CreateScrollInputField(editorPanel, "EditorInput", "", out var inputScroller, fontSize);
|
GameObject inputObj = UIFactory.CreateScrollInputField(editorPanel, "EditorInput", "", out InputFieldScroller inputScroller, fontSize);
|
||||||
EditorInputScroller = inputScroller;
|
EditorInputScroller = inputScroller;
|
||||||
EditorInput.OnValueChanged += HookManager.Instance.OnEditorInputChanged;
|
EditorInput.OnValueChanged += HookManager.Instance.OnEditorInputChanged;
|
||||||
|
|
||||||
@ -171,8 +165,8 @@ namespace UnityExplorer.UI.Panels
|
|||||||
EditorInput.PlaceholderText.fontSize = fontSize;
|
EditorInput.PlaceholderText.fontSize = fontSize;
|
||||||
|
|
||||||
// Lexer highlight text overlay
|
// Lexer highlight text overlay
|
||||||
var highlightTextObj = UIFactory.CreateUIObject("HighlightText", EditorInputText.gameObject);
|
GameObject highlightTextObj = UIFactory.CreateUIObject("HighlightText", EditorInputText.gameObject);
|
||||||
var highlightTextRect = highlightTextObj.GetComponent<RectTransform>();
|
RectTransform highlightTextRect = highlightTextObj.GetComponent<RectTransform>();
|
||||||
highlightTextRect.pivot = new Vector2(0, 1);
|
highlightTextRect.pivot = new Vector2(0, 1);
|
||||||
highlightTextRect.anchorMin = Vector2.zero;
|
highlightTextRect.anchorMin = Vector2.zero;
|
||||||
highlightTextRect.anchorMax = Vector2.one;
|
highlightTextRect.anchorMax = Vector2.one;
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
using System;
|
using UnityEngine;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Config;
|
|
||||||
using UnityExplorer.Inspectors;
|
using UnityExplorer.Inspectors;
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
|
|
||||||
@ -54,11 +48,11 @@ namespace UnityExplorer.UI.Panels
|
|||||||
|
|
||||||
public override void ConstructPanelContent()
|
public override void ConstructPanelContent()
|
||||||
{
|
{
|
||||||
var closeHolder = this.TitleBar.transform.Find("CloseHolder").gameObject;
|
GameObject closeHolder = this.TitleBar.transform.Find("CloseHolder").gameObject;
|
||||||
|
|
||||||
// Inspect under mouse dropdown on title bar
|
// Inspect under mouse dropdown on title bar
|
||||||
|
|
||||||
var mouseDropdown = UIFactory.CreateDropdown(closeHolder, "MouseInspectDropdown", out MouseInspectDropdown, "Mouse Inspect", 14,
|
GameObject mouseDropdown = UIFactory.CreateDropdown(closeHolder, "MouseInspectDropdown", out MouseInspectDropdown, "Mouse Inspect", 14,
|
||||||
MouseInspector.OnDropdownSelect);
|
MouseInspector.OnDropdownSelect);
|
||||||
UIFactory.SetLayoutElement(mouseDropdown, minHeight: 25, minWidth: 140);
|
UIFactory.SetLayoutElement(mouseDropdown, minHeight: 25, minWidth: 140);
|
||||||
MouseInspectDropdown.options.Add(new Dropdown.OptionData("Mouse Inspect"));
|
MouseInspectDropdown.options.Add(new Dropdown.OptionData("Mouse Inspect"));
|
||||||
@ -68,7 +62,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
|
|
||||||
// add close all button to titlebar
|
// add close all button to titlebar
|
||||||
|
|
||||||
var closeAllBtn = UIFactory.CreateButton(closeHolder.gameObject, "CloseAllBtn", "Close All",
|
UniverseLib.UI.Models.ButtonRef closeAllBtn = UIFactory.CreateButton(closeHolder.gameObject, "CloseAllBtn", "Close All",
|
||||||
new Color(0.3f, 0.2f, 0.2f));
|
new Color(0.3f, 0.2f, 0.2f));
|
||||||
UIFactory.SetLayoutElement(closeAllBtn.Component.gameObject, minHeight: 25, minWidth: 80);
|
UIFactory.SetLayoutElement(closeAllBtn.Component.gameObject, minHeight: 25, minWidth: 80);
|
||||||
closeAllBtn.Component.transform.SetSiblingIndex(closeAllBtn.Component.transform.GetSiblingIndex() - 1);
|
closeAllBtn.Component.transform.SetSiblingIndex(closeAllBtn.Component.transform.GetSiblingIndex() - 1);
|
||||||
|
@ -3,15 +3,12 @@ using System.Collections.Generic;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Config;
|
using UnityExplorer.Config;
|
||||||
using UnityExplorer.UI.Widgets;
|
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
using UniverseLib.UI.Models;
|
using UniverseLib.UI.Models;
|
||||||
using UniverseLib.UI.Widgets;
|
|
||||||
using UniverseLib.UI.Widgets.ScrollView;
|
using UniverseLib.UI.Widgets.ScrollView;
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
|
|
||||||
@ -29,7 +26,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
public LogInfo(string message, LogType type) { this.message = message; this.type = type; }
|
public LogInfo(string message, LogType type) { this.message = message; this.type = type; }
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly List<LogInfo> Logs = new List<LogInfo>();
|
private static readonly List<LogInfo> Logs = new();
|
||||||
private static string CurrentStreamPath;
|
private static string CurrentStreamPath;
|
||||||
|
|
||||||
public override string Name => "Log";
|
public override string Name => "Log";
|
||||||
@ -67,16 +64,16 @@ namespace UnityExplorer.UI.Panels
|
|||||||
|
|
||||||
private void SetupIO()
|
private void SetupIO()
|
||||||
{
|
{
|
||||||
var fileName = $"UnityExplorer {DateTime.Now:u}.txt";
|
string fileName = $"UnityExplorer {DateTime.Now:u}.txt";
|
||||||
fileName = IOUtility.EnsureValidFilename(fileName);
|
fileName = IOUtility.EnsureValidFilename(fileName);
|
||||||
var path = Path.Combine(ExplorerCore.ExplorerFolder, "Logs");
|
string path = Path.Combine(ExplorerCore.ExplorerFolder, "Logs");
|
||||||
CurrentStreamPath = IOUtility.EnsureValidFilePath(Path.Combine(path, fileName));
|
CurrentStreamPath = IOUtility.EnsureValidFilePath(Path.Combine(path, fileName));
|
||||||
|
|
||||||
// clean old log(s)
|
// clean old log(s)
|
||||||
var files = Directory.GetFiles(path);
|
string[] files = Directory.GetFiles(path);
|
||||||
if (files.Length >= 10)
|
if (files.Length >= 10)
|
||||||
{
|
{
|
||||||
var sorted = files.ToList();
|
List<string> sorted = files.ToList();
|
||||||
// sort by 'datetime.ToString("u")' will put the oldest ones first
|
// sort by 'datetime.ToString("u")' will put the oldest ones first
|
||||||
sorted.Sort();
|
sorted.Sort();
|
||||||
for (int i = 0; i < files.Length - 9; i++)
|
for (int i = 0; i < files.Length - 9; i++)
|
||||||
@ -113,7 +110,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
|
|
||||||
// Cell pool
|
// Cell pool
|
||||||
|
|
||||||
private static readonly Dictionary<LogType, Color> logColors = new Dictionary<LogType, Color>
|
private static readonly Dictionary<LogType, Color> logColors = new()
|
||||||
{
|
{
|
||||||
{ LogType.Log, Color.white },
|
{ LogType.Log, Color.white },
|
||||||
{ LogType.Warning, Color.yellow },
|
{ LogType.Warning, Color.yellow },
|
||||||
@ -122,8 +119,8 @@ namespace UnityExplorer.UI.Panels
|
|||||||
{ LogType.Exception, Color.red },
|
{ LogType.Exception, Color.red },
|
||||||
};
|
};
|
||||||
|
|
||||||
private readonly Color logEvenColor = new Color(0.34f, 0.34f, 0.34f);
|
private readonly Color logEvenColor = new(0.34f, 0.34f, 0.34f);
|
||||||
private readonly Color logOddColor = new Color(0.28f, 0.28f, 0.28f);
|
private readonly Color logOddColor = new(0.28f, 0.28f, 0.28f);
|
||||||
|
|
||||||
public void OnCellBorrowed(ConsoleLogCell cell) { }
|
public void OnCellBorrowed(ConsoleLogCell cell) { }
|
||||||
|
|
||||||
@ -138,12 +135,12 @@ namespace UnityExplorer.UI.Panels
|
|||||||
// Logs are displayed in reverse order (newest at top)
|
// Logs are displayed in reverse order (newest at top)
|
||||||
index = Logs.Count - index - 1;
|
index = Logs.Count - index - 1;
|
||||||
|
|
||||||
var log = Logs[index];
|
LogInfo log = Logs[index];
|
||||||
cell.IndexLabel.text = $"{index}:";
|
cell.IndexLabel.text = $"{index}:";
|
||||||
cell.Input.Text = log.message;
|
cell.Input.Text = log.message;
|
||||||
cell.Input.Component.textComponent.color = logColors[log.type];
|
cell.Input.Component.textComponent.color = logColors[log.type];
|
||||||
|
|
||||||
var color = index % 2 == 0 ? logEvenColor : logOddColor;
|
Color color = index % 2 == 0 ? logEvenColor : logOddColor;
|
||||||
RuntimeHelper.SetColorBlock(cell.Input.Component, color);
|
RuntimeHelper.SetColorBlock(cell.Input.Component, color);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -167,21 +164,21 @@ namespace UnityExplorer.UI.Panels
|
|||||||
|
|
||||||
// Buttons and toggles
|
// Buttons and toggles
|
||||||
|
|
||||||
var optionsRow = UIFactory.CreateUIObject("OptionsRow", this.uiContent);
|
GameObject optionsRow = UIFactory.CreateUIObject("OptionsRow", this.uiContent);
|
||||||
UIFactory.SetLayoutElement(optionsRow, minHeight: 25, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(optionsRow, minHeight: 25, flexibleWidth: 9999);
|
||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(optionsRow, false, false, true, true, 5, 2, 2, 2, 2);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(optionsRow, false, false, true, true, 5, 2, 2, 2, 2);
|
||||||
|
|
||||||
var clearButton = UIFactory.CreateButton(optionsRow, "ClearButton", "Clear", new Color(0.2f, 0.2f, 0.2f));
|
ButtonRef clearButton = UIFactory.CreateButton(optionsRow, "ClearButton", "Clear", new Color(0.2f, 0.2f, 0.2f));
|
||||||
UIFactory.SetLayoutElement(clearButton.Component.gameObject, minHeight: 23, flexibleHeight: 0, minWidth: 60);
|
UIFactory.SetLayoutElement(clearButton.Component.gameObject, minHeight: 23, flexibleHeight: 0, minWidth: 60);
|
||||||
clearButton.OnClick += ClearLogs;
|
clearButton.OnClick += ClearLogs;
|
||||||
clearButton.Component.transform.SetSiblingIndex(1);
|
clearButton.Component.transform.SetSiblingIndex(1);
|
||||||
|
|
||||||
var fileButton = UIFactory.CreateButton(optionsRow, "FileButton", "Open Log File", new Color(0.2f, 0.2f, 0.2f));
|
ButtonRef fileButton = UIFactory.CreateButton(optionsRow, "FileButton", "Open Log File", new Color(0.2f, 0.2f, 0.2f));
|
||||||
UIFactory.SetLayoutElement(fileButton.Component.gameObject, minHeight: 23, flexibleHeight: 0, minWidth: 100);
|
UIFactory.SetLayoutElement(fileButton.Component.gameObject, minHeight: 23, flexibleHeight: 0, minWidth: 100);
|
||||||
fileButton.OnClick += OpenLogFile;
|
fileButton.OnClick += OpenLogFile;
|
||||||
fileButton.Component.transform.SetSiblingIndex(2);
|
fileButton.Component.transform.SetSiblingIndex(2);
|
||||||
|
|
||||||
var unityToggle = UIFactory.CreateToggle(optionsRow, "UnityLogToggle", out var toggle, out var toggleText);
|
GameObject unityToggle = UIFactory.CreateToggle(optionsRow, "UnityLogToggle", out Toggle toggle, out Text toggleText);
|
||||||
UIFactory.SetLayoutElement(unityToggle, minHeight: 25, minWidth: 150);
|
UIFactory.SetLayoutElement(unityToggle, minHeight: 25, minWidth: 150);
|
||||||
toggleText.text = "Log Unity Debug?";
|
toggleText.text = "Log Unity Debug?";
|
||||||
toggle.isOn = ConfigManager.Log_Unity_Debug.Value;
|
toggle.isOn = ConfigManager.Log_Unity_Debug.Value;
|
||||||
|
@ -1,13 +1,7 @@
|
|||||||
using System;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityExplorer.Inspectors.MouseInspectors;
|
using UnityExplorer.Inspectors.MouseInspectors;
|
||||||
using UnityExplorer.UI.Widgets;
|
|
||||||
using UniverseLib;
|
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
using UniverseLib.UI.Widgets;
|
|
||||||
using UniverseLib.UI.Widgets.ButtonList;
|
using UniverseLib.UI.Widgets.ButtonList;
|
||||||
using UniverseLib.UI.Widgets.ScrollView;
|
using UniverseLib.UI.Widgets.ScrollView;
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
@ -53,7 +47,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
if (index >= UiInspector.LastHitObjects.Count)
|
if (index >= UiInspector.LastHitObjects.Count)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var obj = UiInspector.LastHitObjects[index];
|
GameObject obj = UiInspector.LastHitObjects[index];
|
||||||
cell.Button.ButtonText.text = $"<color=cyan>{obj.name}</color> ({obj.transform.GetTransformPath(true)})";
|
cell.Button.ButtonText.text = $"<color=cyan>{obj.name}</color> ({obj.transform.GetTransformPath(true)})";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,19 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
|
||||||
using UnityEngine.UI;
|
|
||||||
using UnityExplorer.Config;
|
|
||||||
using UniverseLib.UI.Models;
|
|
||||||
using UnityExplorer.ObjectExplorer;
|
using UnityExplorer.ObjectExplorer;
|
||||||
using UnityExplorer.UI.Widgets;
|
|
||||||
using UniverseLib.UI;
|
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
|
using UniverseLib.UI;
|
||||||
|
using UniverseLib.UI.Models;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Panels
|
namespace UnityExplorer.UI.Panels
|
||||||
{
|
{
|
||||||
@ -31,18 +23,18 @@ namespace UnityExplorer.UI.Panels
|
|||||||
public override bool ShouldSaveActiveState => true;
|
public override bool ShouldSaveActiveState => true;
|
||||||
|
|
||||||
public int SelectedTab = 0;
|
public int SelectedTab = 0;
|
||||||
private readonly List<UIModel> tabPages = new List<UIModel>();
|
private readonly List<UIModel> tabPages = new();
|
||||||
private readonly List<ButtonRef> tabButtons = new List<ButtonRef>();
|
private readonly List<ButtonRef> tabButtons = new();
|
||||||
|
|
||||||
public void SetTab(int tabIndex)
|
public void SetTab(int tabIndex)
|
||||||
{
|
{
|
||||||
if (SelectedTab != -1)
|
if (SelectedTab != -1)
|
||||||
DisableTab(SelectedTab);
|
DisableTab(SelectedTab);
|
||||||
|
|
||||||
var content = tabPages[tabIndex];
|
UIModel content = tabPages[tabIndex];
|
||||||
content.SetActive(true);
|
content.SetActive(true);
|
||||||
|
|
||||||
var button = tabButtons[tabIndex];
|
ButtonRef button = tabButtons[tabIndex];
|
||||||
RuntimeHelper.SetColorBlock(button.Component, UniversalUI.EnabledButtonColor, UniversalUI.EnabledButtonColor * 1.2f);
|
RuntimeHelper.SetColorBlock(button.Component, UniversalUI.EnabledButtonColor, UniversalUI.EnabledButtonColor * 1.2f);
|
||||||
|
|
||||||
SelectedTab = tabIndex;
|
SelectedTab = tabIndex;
|
||||||
@ -99,7 +91,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
public override void ConstructPanelContent()
|
public override void ConstructPanelContent()
|
||||||
{
|
{
|
||||||
// Tab bar
|
// Tab bar
|
||||||
var tabGroup = UIFactory.CreateHorizontalGroup(uiContent, "TabBar", true, true, true, true, 2, new Vector4(2, 2, 2, 2));
|
GameObject tabGroup = UIFactory.CreateHorizontalGroup(uiContent, "TabBar", true, true, true, true, 2, new Vector4(2, 2, 2, 2));
|
||||||
UIFactory.SetLayoutElement(tabGroup, minHeight: 25, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(tabGroup, minHeight: 25, flexibleHeight: 0);
|
||||||
|
|
||||||
// Scene Explorer
|
// Scene Explorer
|
||||||
@ -122,7 +114,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
|
|
||||||
private void AddTabButton(GameObject tabGroup, string label)
|
private void AddTabButton(GameObject tabGroup, string label)
|
||||||
{
|
{
|
||||||
var button = UIFactory.CreateButton(tabGroup, $"Button_{label}", label);
|
ButtonRef button = UIFactory.CreateButton(tabGroup, $"Button_{label}", label);
|
||||||
|
|
||||||
int idx = tabButtons.Count;
|
int idx = tabButtons.Count;
|
||||||
//button.onClick.AddListener(() => { SetTab(idx); });
|
//button.onClick.AddListener(() => { SetTab(idx); });
|
||||||
|
@ -1,14 +1,9 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
|
||||||
using UnityExplorer.Config;
|
|
||||||
using UnityExplorer.CacheObject;
|
using UnityExplorer.CacheObject;
|
||||||
using UnityExplorer.CacheObject.Views;
|
using UnityExplorer.CacheObject.Views;
|
||||||
using UnityExplorer.UI.Widgets;
|
using UnityExplorer.Config;
|
||||||
using UniverseLib.UI.Widgets;
|
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
using UniverseLib.UI.Widgets.ScrollView;
|
using UniverseLib.UI.Widgets.ScrollView;
|
||||||
|
|
||||||
@ -26,7 +21,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
public override bool ShowByDefault => false;
|
public override bool ShowByDefault => false;
|
||||||
|
|
||||||
// Entry holders
|
// Entry holders
|
||||||
private readonly List<CacheConfigEntry> configEntries = new List<CacheConfigEntry>();
|
private readonly List<CacheConfigEntry> configEntries = new();
|
||||||
|
|
||||||
// ICacheObjectController
|
// ICacheObjectController
|
||||||
public CacheObjectBase ParentCacheObject => null;
|
public CacheObjectBase ParentCacheObject => null;
|
||||||
@ -39,10 +34,12 @@ namespace UnityExplorer.UI.Panels
|
|||||||
|
|
||||||
public OptionsPanel()
|
public OptionsPanel()
|
||||||
{
|
{
|
||||||
foreach (var entry in ConfigManager.ConfigElements)
|
foreach (KeyValuePair<string, IConfigElement> entry in ConfigManager.ConfigElements)
|
||||||
{
|
{
|
||||||
var cache = new CacheConfigEntry(entry.Value);
|
CacheConfigEntry cache = new(entry.Value)
|
||||||
cache.Owner = this;
|
{
|
||||||
|
Owner = this
|
||||||
|
};
|
||||||
configEntries.Add(cache);
|
configEntries.Add(cache);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -71,18 +68,18 @@ namespace UnityExplorer.UI.Panels
|
|||||||
{
|
{
|
||||||
// Save button
|
// Save button
|
||||||
|
|
||||||
var saveBtn = UIFactory.CreateButton(this.uiContent, "Save", "Save Options", new Color(0.2f, 0.3f, 0.2f));
|
UniverseLib.UI.Models.ButtonRef saveBtn = UIFactory.CreateButton(this.uiContent, "Save", "Save Options", new Color(0.2f, 0.3f, 0.2f));
|
||||||
UIFactory.SetLayoutElement(saveBtn.Component.gameObject, flexibleWidth: 9999, minHeight: 30, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(saveBtn.Component.gameObject, flexibleWidth: 9999, minHeight: 30, flexibleHeight: 0);
|
||||||
saveBtn.OnClick += ConfigManager.Handler.SaveConfig;
|
saveBtn.OnClick += ConfigManager.Handler.SaveConfig;
|
||||||
|
|
||||||
// Config entries
|
// Config entries
|
||||||
|
|
||||||
var scrollPool = UIFactory.CreateScrollPool<ConfigEntryCell>(this.uiContent, "ConfigEntries", out GameObject scrollObj,
|
ScrollPool<ConfigEntryCell> scrollPool = UIFactory.CreateScrollPool<ConfigEntryCell>(this.uiContent, "ConfigEntries", out GameObject scrollObj,
|
||||||
out GameObject scrollContent);
|
out GameObject scrollContent);
|
||||||
|
|
||||||
scrollPool.Initialize(this);
|
scrollPool.Initialize(this);
|
||||||
|
|
||||||
foreach (var config in configEntries)
|
foreach (CacheConfigEntry config in configEntries)
|
||||||
config.UpdateValueFromSource();
|
config.UpdateValueFromSource();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UniverseLib.Input;
|
|
||||||
using UniverseLib.UI.Models;
|
|
||||||
using UnityExplorer.UI.Widgets.AutoComplete;
|
using UnityExplorer.UI.Widgets.AutoComplete;
|
||||||
|
using UniverseLib.Input;
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
using UniverseLib;
|
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Panels
|
namespace UnityExplorer.UI.Panels
|
||||||
@ -46,7 +41,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
wasAnyDragging = false;
|
wasAnyDragging = false;
|
||||||
Resizing = false;
|
Resizing = false;
|
||||||
|
|
||||||
foreach (var instance in Instances)
|
foreach (PanelDragger instance in Instances)
|
||||||
{
|
{
|
||||||
instance.WasDragging = false;
|
instance.WasDragging = false;
|
||||||
instance.WasResizing = false;
|
instance.WasResizing = false;
|
||||||
@ -60,7 +55,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
// move AutoCompleter to bottom
|
// move AutoCompleter to bottom
|
||||||
if (AutoCompleteModal.Instance != null)
|
if (AutoCompleteModal.Instance != null)
|
||||||
{
|
{
|
||||||
var idx = Instances.IndexOf(AutoCompleteModal.Instance.Dragger);
|
int idx = Instances.IndexOf(AutoCompleteModal.Instance.Dragger);
|
||||||
Instances.RemoveAt(idx);
|
Instances.RemoveAt(idx);
|
||||||
Instances.Insert(0, AutoCompleteModal.Instance.Dragger);
|
Instances.Insert(0, AutoCompleteModal.Instance.Dragger);
|
||||||
}
|
}
|
||||||
@ -82,10 +77,10 @@ namespace UnityExplorer.UI.Panels
|
|||||||
else
|
else
|
||||||
state = MouseState.NotPressed;
|
state = MouseState.NotPressed;
|
||||||
|
|
||||||
var mousePos = DisplayManager.MousePosition;
|
Vector3 mousePos = DisplayManager.MousePosition;
|
||||||
|
|
||||||
handledInstanceThisFrame = false;
|
handledInstanceThisFrame = false;
|
||||||
foreach (var instance in Instances)
|
foreach (PanelDragger instance in Instances)
|
||||||
{
|
{
|
||||||
if (!instance.Panel.gameObject.activeSelf)
|
if (!instance.Panel.gameObject.activeSelf)
|
||||||
continue;
|
continue;
|
||||||
@ -97,7 +92,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
|
|
||||||
if (wasAnyDragging && state == MouseState.NotPressed)
|
if (wasAnyDragging && state == MouseState.NotPressed)
|
||||||
{
|
{
|
||||||
foreach (var instance in Instances)
|
foreach (PanelDragger instance in Instances)
|
||||||
instance.WasDragging = false;
|
instance.WasDragging = false;
|
||||||
wasAnyDragging = false;
|
wasAnyDragging = false;
|
||||||
}
|
}
|
||||||
@ -243,7 +238,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
|
|
||||||
public void OnDrag()
|
public void OnDrag()
|
||||||
{
|
{
|
||||||
var mousePos = DisplayManager.MousePosition;
|
Vector3 mousePos = DisplayManager.MousePosition;
|
||||||
|
|
||||||
Vector2 diff = (Vector2)mousePos - lastDragPosition;
|
Vector2 diff = (Vector2)mousePos - lastDragPosition;
|
||||||
lastDragPosition = mousePos;
|
lastDragPosition = mousePos;
|
||||||
@ -438,8 +433,8 @@ namespace UnityExplorer.UI.Panels
|
|||||||
else if (currentResizeType.HasFlag(ResizeTypes.Bottom))
|
else if (currentResizeType.HasFlag(ResizeTypes.Bottom))
|
||||||
anchorMin.y -= diffY;
|
anchorMin.y -= diffY;
|
||||||
|
|
||||||
var prevMin = Panel.anchorMin;
|
Vector2 prevMin = Panel.anchorMin;
|
||||||
var prevMax = Panel.anchorMax;
|
Vector2 prevMax = Panel.anchorMax;
|
||||||
|
|
||||||
Panel.anchorMin = new Vector2(anchorMin.x, anchorMin.y);
|
Panel.anchorMin = new Vector2(anchorMin.x, anchorMin.y);
|
||||||
Panel.anchorMax = new Vector2(anchorMax.x, anchorMax.y);
|
Panel.anchorMax = new Vector2(anchorMax.x, anchorMax.y);
|
||||||
@ -469,9 +464,9 @@ namespace UnityExplorer.UI.Panels
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var text = UIFactory.CreateLabel(UIManager.UIRoot, "ResizeCursor", "↔", TextAnchor.MiddleCenter, Color.white, true, 35);
|
Text text = UIFactory.CreateLabel(UIManager.UIRoot, "ResizeCursor", "↔", TextAnchor.MiddleCenter, Color.white, true, 35);
|
||||||
resizeCursorObj = text.gameObject;
|
resizeCursorObj = text.gameObject;
|
||||||
var outline = text.gameObject.AddComponent<Outline>();
|
Outline outline = text.gameObject.AddComponent<Outline>();
|
||||||
outline.effectColor = Color.black;
|
outline.effectColor = Color.black;
|
||||||
outline.effectDistance = new(1, 1);
|
outline.effectDistance = new(1, 1);
|
||||||
|
|
||||||
|
@ -1,17 +1,14 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Config;
|
using UnityExplorer.Config;
|
||||||
using UniverseLib.Input;
|
|
||||||
using UnityExplorer.UI.Widgets;
|
|
||||||
using UniverseLib.UI.Models;
|
|
||||||
using UniverseLib.UI;
|
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
using System.Collections;
|
using UniverseLib.Input;
|
||||||
|
using UniverseLib.UI;
|
||||||
|
using UniverseLib.UI.Models;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Panels
|
namespace UnityExplorer.UI.Panels
|
||||||
{
|
{
|
||||||
@ -117,7 +114,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
|
|
||||||
if (NavButtonWanted)
|
if (NavButtonWanted)
|
||||||
{
|
{
|
||||||
var color = active ? UniversalUI.EnabledButtonColor : UniversalUI.DisabledButtonColor;
|
Color color = active ? UniversalUI.EnabledButtonColor : UniversalUI.DisabledButtonColor;
|
||||||
RuntimeHelper.SetColorBlock(NavButton.Component, color, color * 1.2f);
|
RuntimeHelper.SetColorBlock(NavButton.Component, color, color * 1.2f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -156,11 +153,11 @@ namespace UnityExplorer.UI.Panels
|
|||||||
|
|
||||||
public static void EnsureValidPosition(RectTransform panel)
|
public static void EnsureValidPosition(RectTransform panel)
|
||||||
{
|
{
|
||||||
var pos = panel.localPosition;
|
Vector3 pos = panel.localPosition;
|
||||||
|
|
||||||
// Prevent panel going oustide screen bounds
|
// Prevent panel going oustide screen bounds
|
||||||
var halfW = DisplayManager.Width * 0.5f;
|
float halfW = DisplayManager.Width * 0.5f;
|
||||||
var halfH = DisplayManager.Height * 0.5f;
|
float halfH = DisplayManager.Height * 0.5f;
|
||||||
|
|
||||||
pos.x = Math.Max(-halfW - panel.rect.width + 50, Math.Min(pos.x, halfW - 50));
|
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));
|
pos.y = Math.Max(-halfH + 50, Math.Min(pos.y, halfH));
|
||||||
@ -211,7 +208,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
if (string.IsNullOrEmpty(data))
|
if (string.IsNullOrEmpty(data))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var split = data.Split('|');
|
string[] split = data.Split('|');
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -240,7 +237,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
// create navbar button
|
// create navbar button
|
||||||
|
|
||||||
NavButton = UIFactory.CreateButton(UIManager.NavbarTabButtonHolder, $"Button_{PanelType}", Name);
|
NavButton = UIFactory.CreateButton(UIManager.NavbarTabButtonHolder, $"Button_{PanelType}", Name);
|
||||||
var navBtn = NavButton.Component.gameObject;
|
GameObject navBtn = NavButton.Component.gameObject;
|
||||||
navBtn.AddComponent<ContentSizeFitter>().horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
|
navBtn.AddComponent<ContentSizeFitter>().horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
|
||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(navBtn, false, true, true, true, 0, 0, 0, 5, 5, TextAnchor.MiddleCenter);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(navBtn, false, true, true, true, 0, 0, 0, 5, 5, TextAnchor.MiddleCenter);
|
||||||
UIFactory.SetLayoutElement(navBtn, minWidth: 80);
|
UIFactory.SetLayoutElement(navBtn, minWidth: 80);
|
||||||
@ -248,7 +245,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
RuntimeHelper.SetColorBlock(NavButton.Component, UniversalUI.DisabledButtonColor, UniversalUI.DisabledButtonColor * 1.2f);
|
RuntimeHelper.SetColorBlock(NavButton.Component, UniversalUI.DisabledButtonColor, UniversalUI.DisabledButtonColor * 1.2f);
|
||||||
NavButton.OnClick += () => { UIManager.TogglePanel(PanelType); };
|
NavButton.OnClick += () => { UIManager.TogglePanel(PanelType); };
|
||||||
|
|
||||||
var txtObj = navBtn.transform.Find("Text").gameObject;
|
GameObject txtObj = navBtn.transform.Find("Text").gameObject;
|
||||||
txtObj.AddComponent<ContentSizeFitter>().horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
|
txtObj.AddComponent<ContentSizeFitter>().horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,15 +266,15 @@ namespace UnityExplorer.UI.Panels
|
|||||||
|
|
||||||
// Title text
|
// Title text
|
||||||
|
|
||||||
var titleTxt = UIFactory.CreateLabel(TitleBar, "TitleBar", Name, TextAnchor.MiddleLeft);
|
Text titleTxt = UIFactory.CreateLabel(TitleBar, "TitleBar", Name, TextAnchor.MiddleLeft);
|
||||||
UIFactory.SetLayoutElement(titleTxt.gameObject, minWidth: 250, minHeight: 25, flexibleHeight: 0);
|
UIFactory.SetLayoutElement(titleTxt.gameObject, minWidth: 250, minHeight: 25, flexibleHeight: 0);
|
||||||
|
|
||||||
// close button
|
// close button
|
||||||
|
|
||||||
var closeHolder = UIFactory.CreateUIObject("CloseHolder", TitleBar);
|
GameObject closeHolder = UIFactory.CreateUIObject("CloseHolder", TitleBar);
|
||||||
UIFactory.SetLayoutElement(closeHolder, minHeight: 25, flexibleHeight: 0, minWidth: 30, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(closeHolder, minHeight: 25, flexibleHeight: 0, minWidth: 30, flexibleWidth: 9999);
|
||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(closeHolder, false, false, true, true, 3, childAlignment: TextAnchor.MiddleRight);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(closeHolder, false, false, true, true, 3, childAlignment: TextAnchor.MiddleRight);
|
||||||
var closeBtn = UIFactory.CreateButton(closeHolder, "CloseButton", "—");
|
ButtonRef closeBtn = UIFactory.CreateButton(closeHolder, "CloseButton", "—");
|
||||||
UIFactory.SetLayoutElement(closeBtn.Component.gameObject, minHeight: 25, minWidth: 25, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(closeBtn.Component.gameObject, minHeight: 25, minWidth: 25, flexibleWidth: 0);
|
||||||
RuntimeHelper.SetColorBlock(closeBtn.Component, new Color(0.33f, 0.32f, 0.31f));
|
RuntimeHelper.SetColorBlock(closeBtn.Component, new Color(0.33f, 0.32f, 0.31f));
|
||||||
|
|
||||||
@ -372,7 +369,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
// outdated save data, not worth recovering just reset it.
|
// outdated save data, not worth recovering just reset it.
|
||||||
throw new Exception("invalid save data, resetting.");
|
throw new Exception("invalid save data, resetting.");
|
||||||
|
|
||||||
var split = stringAnchors.Split(',');
|
string[] split = stringAnchors.Split(',');
|
||||||
|
|
||||||
if (split.Length != 4)
|
if (split.Length != 4)
|
||||||
throw new Exception($"stringAnchors split is unexpected length: {split.Length}");
|
throw new Exception($"stringAnchors split is unexpected length: {split.Length}");
|
||||||
@ -407,7 +404,7 @@ namespace UnityExplorer.UI.Panels
|
|||||||
// outdated save data, not worth recovering just reset it.
|
// outdated save data, not worth recovering just reset it.
|
||||||
throw new Exception("invalid save data, resetting.");
|
throw new Exception("invalid save data, resetting.");
|
||||||
|
|
||||||
var split = stringPosition.Split(',');
|
string[] split = stringPosition.Split(',');
|
||||||
|
|
||||||
if (split.Length != 2)
|
if (split.Length != 2)
|
||||||
throw new Exception($"stringPosition split is unexpected length: {split.Length}");
|
throw new Exception($"stringPosition split is unexpected length: {split.Length}");
|
||||||
|
@ -10,8 +10,6 @@ using UniverseLib;
|
|||||||
using UniverseLib.Input;
|
using UniverseLib.Input;
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
using UniverseLib.UI.Models;
|
using UniverseLib.UI.Models;
|
||||||
using UniverseLib.UI.ObjectPool;
|
|
||||||
using UniverseLib.UI.Widgets;
|
|
||||||
using UniverseLib.UI.Widgets.ScrollView;
|
using UniverseLib.UI.Widgets.ScrollView;
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
|
|
||||||
@ -108,7 +106,7 @@ namespace UnityExplorer.UI
|
|||||||
UIPanels.Add(Panels.UIInspectorResults, new MouseInspectorResultsPanel());
|
UIPanels.Add(Panels.UIInspectorResults, new MouseInspectorResultsPanel());
|
||||||
UIPanels.Add(Panels.MouseInspector, new MouseInspector());
|
UIPanels.Add(Panels.MouseInspector, new MouseInspector());
|
||||||
|
|
||||||
foreach (var panel in UIPanels.Values)
|
foreach (UIPanel panel in UIPanels.Values)
|
||||||
panel.ConstructUI();
|
panel.ConstructUI();
|
||||||
|
|
||||||
// Call some initialize methods
|
// Call some initialize methods
|
||||||
@ -122,7 +120,7 @@ namespace UnityExplorer.UI
|
|||||||
ShowMenu = !ConfigManager.Hide_On_Startup.Value;
|
ShowMenu = !ConfigManager.Hide_On_Startup.Value;
|
||||||
|
|
||||||
// Failsafe fix, in some games all dropdowns displayed values are blank on startup for some reason.
|
// Failsafe fix, in some games all dropdowns displayed values are blank on startup for some reason.
|
||||||
foreach (var dropdown in UIRoot.GetComponentsInChildren<Dropdown>(true))
|
foreach (Dropdown dropdown in UIRoot.GetComponentsInChildren<Dropdown>(true))
|
||||||
dropdown.RefreshShownValue();
|
dropdown.RefreshShownValue();
|
||||||
|
|
||||||
Initializing = false;
|
Initializing = false;
|
||||||
@ -167,7 +165,7 @@ namespace UnityExplorer.UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check screen dimension change
|
// check screen dimension change
|
||||||
var display = DisplayManager.ActiveDisplay;
|
Display display = DisplayManager.ActiveDisplay;
|
||||||
if (display.renderingWidth != lastScreenWidth || display.renderingHeight != lastScreenHeight)
|
if (display.renderingWidth != lastScreenWidth || display.renderingHeight != lastScreenHeight)
|
||||||
OnScreenDimensionsChanged();
|
OnScreenDimensionsChanged();
|
||||||
}
|
}
|
||||||
@ -180,7 +178,7 @@ namespace UnityExplorer.UI
|
|||||||
|
|
||||||
public static void TogglePanel(Panels panel)
|
public static void TogglePanel(Panels panel)
|
||||||
{
|
{
|
||||||
var uiPanel = GetPanel(panel);
|
UIPanel uiPanel = GetPanel(panel);
|
||||||
SetPanelActive(panel, !uiPanel.Enabled);
|
SetPanelActive(panel, !uiPanel.Enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,11 +225,11 @@ namespace UnityExplorer.UI
|
|||||||
|
|
||||||
private static void OnScreenDimensionsChanged()
|
private static void OnScreenDimensionsChanged()
|
||||||
{
|
{
|
||||||
var display = DisplayManager.ActiveDisplay;
|
Display display = DisplayManager.ActiveDisplay;
|
||||||
lastScreenWidth = display.renderingWidth;
|
lastScreenWidth = display.renderingWidth;
|
||||||
lastScreenHeight = display.renderingHeight;
|
lastScreenHeight = display.renderingHeight;
|
||||||
|
|
||||||
foreach (var panel in UIPanels)
|
foreach (KeyValuePair<Panels, UIPanel> panel in UIPanels)
|
||||||
{
|
{
|
||||||
panel.Value.EnsureValidSize();
|
panel.Value.EnsureValidSize();
|
||||||
UIPanel.EnsureValidPosition(panel.Value.Rect);
|
UIPanel.EnsureValidPosition(panel.Value.Rect);
|
||||||
@ -292,7 +290,7 @@ namespace UnityExplorer.UI
|
|||||||
PanelHolder = new GameObject("PanelHolder");
|
PanelHolder = new GameObject("PanelHolder");
|
||||||
PanelHolder.transform.SetParent(UIRoot.transform, false);
|
PanelHolder.transform.SetParent(UIRoot.transform, false);
|
||||||
PanelHolder.layer = 5;
|
PanelHolder.layer = 5;
|
||||||
var rect = PanelHolder.AddComponent<RectTransform>();
|
RectTransform rect = PanelHolder.AddComponent<RectTransform>();
|
||||||
rect.sizeDelta = Vector2.zero;
|
rect.sizeDelta = Vector2.zero;
|
||||||
rect.anchoredPosition = Vector2.zero;
|
rect.anchoredPosition = Vector2.zero;
|
||||||
rect.pivot = new Vector2(0.5f, 0.5f);
|
rect.pivot = new Vector2(0.5f, 0.5f);
|
||||||
@ -303,7 +301,7 @@ namespace UnityExplorer.UI
|
|||||||
|
|
||||||
private static void CreateTopNavBar()
|
private static void CreateTopNavBar()
|
||||||
{
|
{
|
||||||
var navbarPanel = UIFactory.CreateUIObject("MainNavbar", UIRoot);
|
GameObject navbarPanel = UIFactory.CreateUIObject("MainNavbar", UIRoot);
|
||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(navbarPanel, false, false, true, true, 5, 4, 4, 4, 4, TextAnchor.MiddleCenter);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(navbarPanel, false, false, true, true, 5, 4, 4, 4, 4, TextAnchor.MiddleCenter);
|
||||||
navbarPanel.AddComponent<Image>().color = new Color(0.1f, 0.1f, 0.1f);
|
navbarPanel.AddComponent<Image>().color = new Color(0.1f, 0.1f, 0.1f);
|
||||||
NavBarRect = navbarPanel.GetComponent<RectTransform>();
|
NavBarRect = navbarPanel.GetComponent<RectTransform>();
|
||||||
@ -320,7 +318,7 @@ namespace UnityExplorer.UI
|
|||||||
// UnityExplorer title
|
// UnityExplorer title
|
||||||
|
|
||||||
string titleTxt = $"{ExplorerCore.NAME} <i><color=grey>{ExplorerCore.VERSION}</color></i>";
|
string titleTxt = $"{ExplorerCore.NAME} <i><color=grey>{ExplorerCore.VERSION}</color></i>";
|
||||||
var title = UIFactory.CreateLabel(navbarPanel, "Title", titleTxt, TextAnchor.MiddleLeft, default, true, 17);
|
Text title = UIFactory.CreateLabel(navbarPanel, "Title", titleTxt, TextAnchor.MiddleLeft, default, true, 17);
|
||||||
UIFactory.SetLayoutElement(title.gameObject, minWidth: 170, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(title.gameObject, minWidth: 170, flexibleWidth: 0);
|
||||||
|
|
||||||
// panel tabs
|
// panel tabs
|
||||||
@ -331,7 +329,7 @@ namespace UnityExplorer.UI
|
|||||||
|
|
||||||
// Time controls
|
// Time controls
|
||||||
|
|
||||||
var timeLabel = UIFactory.CreateLabel(navbarPanel, "TimeLabel", "Time:", TextAnchor.MiddleRight, Color.grey);
|
Text timeLabel = UIFactory.CreateLabel(navbarPanel, "TimeLabel", "Time:", TextAnchor.MiddleRight, Color.grey);
|
||||||
UIFactory.SetLayoutElement(timeLabel.gameObject, minHeight: 25, minWidth: 50);
|
UIFactory.SetLayoutElement(timeLabel.gameObject, minHeight: 25, minWidth: 50);
|
||||||
|
|
||||||
timeInput = UIFactory.CreateInputField(navbarPanel, "TimeInput", "timeScale");
|
timeInput = UIFactory.CreateInputField(navbarPanel, "TimeInput", "timeScale");
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Specialized;
|
using System.Collections.Specialized;
|
||||||
using UnityExplorer.CacheObject.IValues;
|
using UnityExplorer.CacheObject.IValues;
|
||||||
using UniverseLib;
|
|
||||||
using UniverseLib.UI;
|
|
||||||
using UniverseLib.UI.Models;
|
using UniverseLib.UI.Models;
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
|
|
||||||
@ -30,8 +28,8 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
|
|||||||
public InputFieldRef InputField { get; }
|
public InputFieldRef InputField { get; }
|
||||||
public bool AnchorToCaretPosition => false;
|
public bool AnchorToCaretPosition => false;
|
||||||
|
|
||||||
private readonly List<Suggestion> suggestions = new List<Suggestion>();
|
private readonly List<Suggestion> suggestions = new();
|
||||||
private readonly HashSet<string> suggestedValues = new HashSet<string>();
|
private readonly HashSet<string> suggestedValues = new();
|
||||||
|
|
||||||
private OrderedDictionary enumValues;
|
private OrderedDictionary enumValues;
|
||||||
|
|
||||||
@ -139,13 +137,13 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
|
|||||||
|
|
||||||
for (int i = 0; i < this.enumValues.Count; i++)
|
for (int i = 0; i < this.enumValues.Count; i++)
|
||||||
{
|
{
|
||||||
var enumValue = (CachedEnumValue)enumValues[i];
|
CachedEnumValue enumValue = (CachedEnumValue)enumValues[i];
|
||||||
if (enumValue.Name.ContainsIgnoreCase(value))
|
if (enumValue.Name.ContainsIgnoreCase(value))
|
||||||
AddSuggestion(enumValue.Name);
|
AddSuggestion(enumValue.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static readonly Dictionary<string, string> sharedValueToLabel = new Dictionary<string, string>(4096);
|
internal static readonly Dictionary<string, string> sharedValueToLabel = new(4096);
|
||||||
|
|
||||||
void AddSuggestion(string value)
|
void AddSuggestion(string value)
|
||||||
{
|
{
|
||||||
|
@ -1,11 +1,4 @@
|
|||||||
using System;
|
using UniverseLib.UI.Models;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
|
||||||
using UniverseLib.UI;
|
|
||||||
using UniverseLib.UI.Models;
|
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Widgets.AutoComplete
|
namespace UnityExplorer.UI.Widgets.AutoComplete
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,4 @@
|
|||||||
using System;
|
namespace UnityExplorer.UI.Widgets.AutoComplete
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Widgets.AutoComplete
|
|
||||||
{
|
{
|
||||||
public struct Suggestion
|
public struct Suggestion
|
||||||
{
|
{
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
using HarmonyLib;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
using UniverseLib.UI;
|
|
||||||
using UniverseLib.UI.Models;
|
using UniverseLib.UI.Models;
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
|
|
||||||
@ -67,10 +65,10 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
allowedTypes = new();
|
allowedTypes = new();
|
||||||
foreach (var entry in ReflectionUtility.AllTypes)
|
foreach (KeyValuePair<string, Type> entry in ReflectionUtility.AllTypes)
|
||||||
{
|
{
|
||||||
// skip <PrivateImplementationDetails> and <AnonymousClass> classes
|
// skip <PrivateImplementationDetails> and <AnonymousClass> classes
|
||||||
var type = entry.Value;
|
Type type = entry.Value;
|
||||||
if (type.FullName.Contains("PrivateImplementationDetails")
|
if (type.FullName.Contains("PrivateImplementationDetails")
|
||||||
|| type.FullName.Contains("DisplayClass")
|
|| type.FullName.Contains("DisplayClass")
|
||||||
|| type.FullName.Contains('<'))
|
|| type.FullName.Contains('<'))
|
||||||
@ -126,7 +124,7 @@ namespace UnityExplorer.UI.Widgets.AutoComplete
|
|||||||
if (ReflectionUtility.GetTypeByName(value) is Type t && allowedTypes.Contains(t))
|
if (ReflectionUtility.GetTypeByName(value) is Type t && allowedTypes.Contains(t))
|
||||||
AddSuggestion(t);
|
AddSuggestion(t);
|
||||||
|
|
||||||
foreach (var entry in allowedTypes)
|
foreach (Type entry in allowedTypes)
|
||||||
{
|
{
|
||||||
if (entry.FullName.ContainsIgnoreCase(value))
|
if (entry.FullName.ContainsIgnoreCase(value))
|
||||||
AddSuggestion(entry);
|
AddSuggestion(entry);
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
using System;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.UI.Widgets.AutoComplete;
|
using UnityExplorer.UI.Widgets.AutoComplete;
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
@ -41,8 +37,10 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
inputField.Component.lineType = InputField.LineType.MultiLineNewline;
|
inputField.Component.lineType = InputField.LineType.MultiLineNewline;
|
||||||
inputField.UIRoot.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;
|
inputField.UIRoot.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;
|
||||||
|
|
||||||
typeCompleter = new TypeCompleter(typeof(object), this.inputField);
|
typeCompleter = new TypeCompleter(typeof(object), this.inputField)
|
||||||
typeCompleter.Enabled = false;
|
{
|
||||||
|
Enabled = false
|
||||||
|
};
|
||||||
|
|
||||||
CreateSpecialContent();
|
CreateSpecialContent();
|
||||||
|
|
||||||
|
@ -1,16 +1,11 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.UI;
|
|
||||||
using UniverseLib.UI.Models;
|
|
||||||
using UnityExplorer.UI.Widgets.AutoComplete;
|
|
||||||
using UniverseLib.UI;
|
|
||||||
using UniverseLib;
|
|
||||||
using UnityExplorer.CacheObject;
|
using UnityExplorer.CacheObject;
|
||||||
|
using UniverseLib.UI;
|
||||||
|
using UniverseLib.UI.Models;
|
||||||
using UniverseLib.UI.ObjectPool;
|
using UniverseLib.UI.ObjectPool;
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
|
|
||||||
@ -48,14 +43,14 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
|
|
||||||
public void OnReturnToPool()
|
public void OnReturnToPool()
|
||||||
{
|
{
|
||||||
foreach (var widget in paramHandlers)
|
foreach (ParameterHandler widget in paramHandlers)
|
||||||
{
|
{
|
||||||
widget.OnReturned();
|
widget.OnReturned();
|
||||||
Pool<ParameterHandler>.Return(widget);
|
Pool<ParameterHandler>.Return(widget);
|
||||||
}
|
}
|
||||||
paramHandlers = null;
|
paramHandlers = null;
|
||||||
|
|
||||||
foreach (var widget in genericHandlers)
|
foreach (GenericArgumentHandler widget in genericHandlers)
|
||||||
{
|
{
|
||||||
widget.OnReturned();
|
widget.OnReturned();
|
||||||
Pool<GenericArgumentHandler>.Return(widget);
|
Pool<GenericArgumentHandler>.Return(widget);
|
||||||
@ -111,9 +106,9 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < genericArguments.Length; i++)
|
for (int i = 0; i < genericArguments.Length; i++)
|
||||||
{
|
{
|
||||||
var type = genericArguments[i];
|
Type type = genericArguments[i];
|
||||||
|
|
||||||
var holder = genericHandlers[i] = Pool<GenericArgumentHandler>.Borrow();
|
GenericArgumentHandler holder = genericHandlers[i] = Pool<GenericArgumentHandler>.Borrow();
|
||||||
holder.UIRoot.transform.SetParent(this.genericArgumentsHolder.transform, false);
|
holder.UIRoot.transform.SetParent(this.genericArgumentsHolder.transform, false);
|
||||||
holder.OnBorrowed(this, type);
|
holder.OnBorrowed(this, type);
|
||||||
}
|
}
|
||||||
@ -123,9 +118,9 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < parameters.Length; i++)
|
for (int i = 0; i < parameters.Length; i++)
|
||||||
{
|
{
|
||||||
var param = parameters[i];
|
ParameterInfo param = parameters[i];
|
||||||
|
|
||||||
var holder = paramHandlers[i] = Pool<ParameterHandler>.Borrow();
|
ParameterHandler holder = paramHandlers[i] = Pool<ParameterHandler>.Borrow();
|
||||||
holder.UIRoot.transform.SetParent(this.parametersHolder.transform, false);
|
holder.UIRoot.transform.SetParent(this.parametersHolder.transform, false);
|
||||||
holder.OnBorrowed(this, param);
|
holder.OnBorrowed(this, param);
|
||||||
}
|
}
|
||||||
@ -142,7 +137,7 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
// generic args
|
// generic args
|
||||||
this.genericArgumentsHolder = UIFactory.CreateUIObject("GenericHolder", UIRoot);
|
this.genericArgumentsHolder = UIFactory.CreateUIObject("GenericHolder", UIRoot);
|
||||||
UIFactory.SetLayoutElement(genericArgumentsHolder, flexibleWidth: 1000);
|
UIFactory.SetLayoutElement(genericArgumentsHolder, flexibleWidth: 1000);
|
||||||
var genericsTitle = UIFactory.CreateLabel(genericArgumentsHolder, "GenericsTitle", "Generic Arguments", TextAnchor.MiddleLeft);
|
Text genericsTitle = UIFactory.CreateLabel(genericArgumentsHolder, "GenericsTitle", "Generic Arguments", TextAnchor.MiddleLeft);
|
||||||
UIFactory.SetLayoutElement(genericsTitle.gameObject, minHeight: 25, flexibleWidth: 1000);
|
UIFactory.SetLayoutElement(genericsTitle.gameObject, minHeight: 25, flexibleWidth: 1000);
|
||||||
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(genericArgumentsHolder, false, false, true, true, 3);
|
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(genericArgumentsHolder, false, false, true, true, 3);
|
||||||
UIFactory.SetLayoutElement(genericArgumentsHolder, minHeight: 25, flexibleHeight: 750, minWidth: 50, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(genericArgumentsHolder, minHeight: 25, flexibleHeight: 750, minWidth: 50, flexibleWidth: 9999);
|
||||||
@ -151,14 +146,14 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
// args
|
// args
|
||||||
this.parametersHolder = UIFactory.CreateUIObject("ArgHolder", UIRoot);
|
this.parametersHolder = UIFactory.CreateUIObject("ArgHolder", UIRoot);
|
||||||
UIFactory.SetLayoutElement(parametersHolder, flexibleWidth: 1000);
|
UIFactory.SetLayoutElement(parametersHolder, flexibleWidth: 1000);
|
||||||
var argsTitle = UIFactory.CreateLabel(parametersHolder, "ArgsTitle", "Arguments", TextAnchor.MiddleLeft);
|
Text argsTitle = UIFactory.CreateLabel(parametersHolder, "ArgsTitle", "Arguments", TextAnchor.MiddleLeft);
|
||||||
UIFactory.SetLayoutElement(argsTitle.gameObject, minHeight: 25, flexibleWidth: 1000);
|
UIFactory.SetLayoutElement(argsTitle.gameObject, minHeight: 25, flexibleWidth: 1000);
|
||||||
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(parametersHolder, false, false, true, true, 3);
|
UIFactory.SetLayoutGroup<VerticalLayoutGroup>(parametersHolder, false, false, true, true, 3);
|
||||||
UIFactory.SetLayoutElement(parametersHolder, minHeight: 25, flexibleHeight: 750, minWidth: 50, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(parametersHolder, minHeight: 25, flexibleHeight: 750, minWidth: 50, flexibleWidth: 9999);
|
||||||
//argHolder.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;
|
//argHolder.AddComponent<ContentSizeFitter>().verticalFit = ContentSizeFitter.FitMode.PreferredSize;
|
||||||
|
|
||||||
// evaluate button
|
// evaluate button
|
||||||
var evalButton = UIFactory.CreateButton(UIRoot, "EvaluateButton", "Evaluate", new Color(0.2f, 0.2f, 0.2f));
|
ButtonRef evalButton = UIFactory.CreateButton(UIRoot, "EvaluateButton", "Evaluate", new Color(0.2f, 0.2f, 0.2f));
|
||||||
UIFactory.SetLayoutElement(evalButton.Component.gameObject, minHeight: 25, minWidth: 150, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(evalButton.Component.gameObject, minHeight: 25, minWidth: 150, flexibleWidth: 0);
|
||||||
evalButton.OnClick += () =>
|
evalButton.OnClick += () =>
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
@ -20,10 +18,10 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
typeCompleter.BaseType = genericType;
|
typeCompleter.BaseType = genericType;
|
||||||
typeCompleter.CacheTypes();
|
typeCompleter.CacheTypes();
|
||||||
|
|
||||||
var constraints = genericType.GetGenericParameterConstraints();
|
Type[] constraints = genericType.GetGenericParameterConstraints();
|
||||||
typeCompleter.GenericConstraints = constraints;
|
typeCompleter.GenericConstraints = constraints;
|
||||||
|
|
||||||
var sb = new StringBuilder($"<color={SignatureHighlighter.CONST}>{genericType.Name}</color>");
|
StringBuilder sb = new($"<color={SignatureHighlighter.CONST}>{genericType.Name}</color>");
|
||||||
|
|
||||||
for (int j = 0; j < constraints.Length; j++)
|
for (int j = 0; j < constraints.Length; j++)
|
||||||
{
|
{
|
||||||
|
@ -1,11 +1,8 @@
|
|||||||
using HarmonyLib;
|
using HarmonyLib;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.Specialized;
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.CacheObject.IValues;
|
|
||||||
using UnityExplorer.UI.Panels;
|
using UnityExplorer.UI.Panels;
|
||||||
using UnityExplorer.UI.Widgets.AutoComplete;
|
using UnityExplorer.UI.Widgets.AutoComplete;
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
@ -105,7 +102,7 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
if (usingBasicLabel)
|
if (usingBasicLabel)
|
||||||
return basicValue;
|
return basicValue;
|
||||||
|
|
||||||
var input = this.inputField.Text;
|
string input = this.inputField.Text;
|
||||||
|
|
||||||
if (typeof(Type).IsAssignableFrom(paramType))
|
if (typeof(Type).IsAssignableFrom(paramType))
|
||||||
return ReflectionUtility.GetTypeByName(input);
|
return ReflectionUtility.GetTypeByName(input);
|
||||||
|
@ -1,8 +1,4 @@
|
|||||||
using System;
|
using UnityEngine;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Widgets
|
namespace UnityExplorer.UI.Widgets
|
||||||
{
|
{
|
||||||
|
@ -1,17 +1,9 @@
|
|||||||
using HarmonyLib;
|
using System;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Inspectors;
|
|
||||||
using UnityExplorer.UI.Widgets;
|
|
||||||
using UniverseLib;
|
using UniverseLib;
|
||||||
using UniverseLib.UI;
|
using UniverseLib.UI;
|
||||||
using UniverseLib.UI.Models;
|
using UniverseLib.UI.Models;
|
||||||
using UniverseLib.UI.Widgets;
|
|
||||||
using UniverseLib.UI.Widgets.ScrollView;
|
using UniverseLib.UI.Widgets.ScrollView;
|
||||||
using UniverseLib.Utility;
|
using UniverseLib.Utility;
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
public void JumpAndExpandToTransform(Transform transform)
|
public void JumpAndExpandToTransform(Transform transform)
|
||||||
{
|
{
|
||||||
// make sure all parents of the object are expanded
|
// make sure all parents of the object are expanded
|
||||||
var parent = transform.parent;
|
Transform parent = transform.parent;
|
||||||
while (parent)
|
while (parent)
|
||||||
{
|
{
|
||||||
int pid = parent.GetInstanceID();
|
int pid = parent.GetInstanceID();
|
||||||
@ -136,7 +136,7 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
int idx;
|
int idx;
|
||||||
for (idx = 0; idx < cachedTransforms.Count; idx++)
|
for (idx = 0; idx < cachedTransforms.Count; idx++)
|
||||||
{
|
{
|
||||||
var cache = (CachedTransform)cachedTransforms[idx];
|
CachedTransform cache = (CachedTransform)cachedTransforms[idx];
|
||||||
if (cache.InstanceID == transformID)
|
if (cache.InstanceID == transformID)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -151,7 +151,7 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
|
|
||||||
private IEnumerator HighlightCellCoroutine(TransformCell cell)
|
private IEnumerator HighlightCellCoroutine(TransformCell cell)
|
||||||
{
|
{
|
||||||
var button = cell.NameButton.Component;
|
UnityEngine.UI.Button button = cell.NameButton.Component;
|
||||||
button.StartColorTween(new Color(0.2f, 0.3f, 0.2f), false);
|
button.StartColorTween(new Color(0.2f, 0.3f, 0.2f), false);
|
||||||
|
|
||||||
float start = Time.realtimeSinceStartup;
|
float start = Time.realtimeSinceStartup;
|
||||||
@ -191,7 +191,7 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
bool filtering = Filtering;
|
bool filtering = Filtering;
|
||||||
|
|
||||||
IEnumerable<GameObject> rootObjects = GetRootEntriesMethod();
|
IEnumerable<GameObject> rootObjects = GetRootEntriesMethod();
|
||||||
foreach (var gameObj in rootObjects)
|
foreach (GameObject gameObj in rootObjects)
|
||||||
{
|
{
|
||||||
if (!gameObj)
|
if (!gameObj)
|
||||||
continue;
|
continue;
|
||||||
@ -214,7 +214,7 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
traversedThisFrame.Start();
|
traversedThisFrame.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
var cached = (CachedTransform)cachedTransforms[i];
|
CachedTransform cached = (CachedTransform)cachedTransforms[i];
|
||||||
if (!visited.Contains(cached.InstanceID))
|
if (!visited.Contains(cached.InstanceID))
|
||||||
{
|
{
|
||||||
cachedTransforms.RemoveAt(i);
|
cachedTransforms.RemoveAt(i);
|
||||||
@ -293,7 +293,7 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < transform.childCount; i++)
|
for (int i = 0; i < transform.childCount; i++)
|
||||||
{
|
{
|
||||||
var enumerator = Traverse(transform.GetChild(i), cached, depth + 1, oneShot, filtering);
|
IEnumerator enumerator = Traverse(transform.GetChild(i), cached, depth + 1, oneShot, filtering);
|
||||||
while (enumerator.MoveNext())
|
while (enumerator.MoveNext())
|
||||||
{
|
{
|
||||||
if (!oneShot)
|
if (!oneShot)
|
||||||
@ -350,7 +350,7 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
|
|
||||||
public void OnCellExpandToggled(CachedTransform cache)
|
public void OnCellExpandToggled(CachedTransform cache)
|
||||||
{
|
{
|
||||||
var instanceID = cache.InstanceID;
|
int instanceID = cache.InstanceID;
|
||||||
if (expandedInstanceIDs.Contains(instanceID))
|
if (expandedInstanceIDs.Contains(instanceID))
|
||||||
expandedInstanceIDs.Remove(instanceID);
|
expandedInstanceIDs.Remove(instanceID);
|
||||||
else
|
else
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
@ -273,7 +271,7 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region SavWav
|
#region SavWav
|
||||||
|
|
||||||
// Copyright (c) 2012 Calvin Rien
|
// Copyright (c) 2012 Calvin Rien
|
||||||
// http://the.darktable.com
|
// http://the.darktable.com
|
||||||
@ -404,6 +402,6 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
stream.Seek(0, SeekOrigin.Begin);
|
stream.Seek(0, SeekOrigin.Begin);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,9 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Config;
|
using UnityExplorer.Config;
|
||||||
@ -224,14 +221,14 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
// Actual texture viewer
|
// Actual texture viewer
|
||||||
|
|
||||||
GameObject imageViewport = UIFactory.CreateVerticalGroup(textureViewerRoot, "ImageViewport", false, false, true, true,
|
GameObject imageViewport = UIFactory.CreateVerticalGroup(textureViewerRoot, "ImageViewport", false, false, true, true,
|
||||||
bgColor: new(1,1,1,0), childAlignment: TextAnchor.MiddleCenter);
|
bgColor: new(1, 1, 1, 0), childAlignment: TextAnchor.MiddleCenter);
|
||||||
UIFactory.SetLayoutElement(imageViewport, flexibleWidth: 9999, flexibleHeight: 9999);
|
UIFactory.SetLayoutElement(imageViewport, flexibleWidth: 9999, flexibleHeight: 9999);
|
||||||
|
|
||||||
GameObject imageHolder = UIFactory.CreateUIObject("ImageHolder", imageViewport);
|
GameObject imageHolder = UIFactory.CreateUIObject("ImageHolder", imageViewport);
|
||||||
imageLayout = UIFactory.SetLayoutElement(imageHolder, 1, 1, 0, 0);
|
imageLayout = UIFactory.SetLayoutElement(imageHolder, 1, 1, 0, 0);
|
||||||
|
|
||||||
var actualImageObj = UIFactory.CreateUIObject("ActualImage", imageHolder);
|
GameObject actualImageObj = UIFactory.CreateUIObject("ActualImage", imageHolder);
|
||||||
var actualRect = actualImageObj.GetComponent<RectTransform>();
|
RectTransform actualRect = actualImageObj.GetComponent<RectTransform>();
|
||||||
actualRect.anchorMin = new(0, 0);
|
actualRect.anchorMin = new(0, 0);
|
||||||
actualRect.anchorMax = new(1, 1);
|
actualRect.anchorMax = new(1, 1);
|
||||||
image = actualImageObj.AddComponent<Image>();
|
image = actualImageObj.AddComponent<Image>();
|
||||||
|
@ -105,7 +105,7 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(UIRoot, false, false, true, true, 5);
|
UIFactory.SetLayoutGroup<HorizontalLayoutGroup>(UIRoot, false, false, true, true, 5);
|
||||||
UIFactory.SetLayoutElement(UIRoot, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
|
UIFactory.SetLayoutElement(UIRoot, minHeight: 25, flexibleHeight: 0, flexibleWidth: 9999);
|
||||||
|
|
||||||
var nameLabel = UIFactory.CreateLabel(UIRoot, "NameLabel", "Name:", TextAnchor.MiddleLeft, Color.grey);
|
Text nameLabel = UIFactory.CreateLabel(UIRoot, "NameLabel", "Name:", TextAnchor.MiddleLeft, Color.grey);
|
||||||
UIFactory.SetLayoutElement(nameLabel.gameObject, minHeight: 25, minWidth: 45, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(nameLabel.gameObject, minHeight: 25, minWidth: 45, flexibleWidth: 0);
|
||||||
|
|
||||||
nameInput = UIFactory.CreateInputField(UIRoot, "NameInput", "untitled");
|
nameInput = UIFactory.CreateInputField(UIRoot, "NameInput", "untitled");
|
||||||
@ -116,7 +116,7 @@ namespace UnityExplorer.UI.Widgets
|
|||||||
UIFactory.SetLayoutElement(gameObjectButton.Component.gameObject, minHeight: 25, minWidth: 160);
|
UIFactory.SetLayoutElement(gameObjectButton.Component.gameObject, minHeight: 25, minWidth: 160);
|
||||||
gameObjectButton.OnClick += OnGameObjectButtonClicked;
|
gameObjectButton.OnClick += OnGameObjectButtonClicked;
|
||||||
|
|
||||||
var instanceLabel = UIFactory.CreateLabel(UIRoot, "InstanceLabel", "Instance ID:", TextAnchor.MiddleRight, Color.grey);
|
Text instanceLabel = UIFactory.CreateLabel(UIRoot, "InstanceLabel", "Instance ID:", TextAnchor.MiddleRight, Color.grey);
|
||||||
UIFactory.SetLayoutElement(instanceLabel.gameObject, minHeight: 25, minWidth: 100, flexibleWidth: 0);
|
UIFactory.SetLayoutElement(instanceLabel.gameObject, minHeight: 25, minWidth: 100, flexibleWidth: 0);
|
||||||
|
|
||||||
instanceIdInput = UIFactory.CreateInputField(UIRoot, "InstanceIDInput", "ERROR");
|
instanceIdInput = UIFactory.CreateInputField(UIRoot, "InstanceIDInput", "ERROR");
|
||||||
|
Reference in New Issue
Block a user