mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-16 14:17:51 +08:00
Removed TextMeshPro dependency, using only vanilla UI now. Also fixes for games which dont ship with Default UI Shader.
This commit is contained in:
parent
6766a8cf4c
commit
f87b06989d
Binary file not shown.
Before Width: | Height: | Size: 1.9 KiB |
BIN
resources/explorerui.bundle
Normal file
BIN
resources/explorerui.bundle
Normal file
Binary file not shown.
Binary file not shown.
@ -128,48 +128,53 @@ namespace UnityExplorer.Console
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static void UpdatePosition()
|
private static void UpdatePosition()
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
var editor = ConsolePage.Instance.m_codeEditor;
|
var editor = ConsolePage.Instance.m_codeEditor;
|
||||||
|
|
||||||
if (editor.InputField.text.Length < 1)
|
var textGen = editor.inputText.cachedTextGenerator;
|
||||||
{
|
|
||||||
return;
|
//if (textGen.characters.Count < 1)
|
||||||
}
|
// return;
|
||||||
|
|
||||||
int caretPos = editor.InputField.caretPosition;
|
int caretPos = editor.InputField.caretPosition;
|
||||||
while (caretPos >= editor.inputText.textInfo.characterInfo.Length)
|
|
||||||
{
|
|
||||||
caretPos--;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (caretPos == m_lastCaretPos)
|
if (caretPos >= 1)
|
||||||
{
|
caretPos--;
|
||||||
|
|
||||||
|
if (caretPos < 0 || caretPos == m_lastCaretPos)
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
m_lastCaretPos = caretPos;
|
m_lastCaretPos = caretPos;
|
||||||
|
|
||||||
if (caretPos >= 0 && caretPos < editor.inputText.textInfo.characterInfo.Length)
|
var pos = textGen.characters[caretPos].cursorPos;
|
||||||
{
|
|
||||||
var pos = editor.inputText.textInfo.characterInfo[caretPos].bottomLeft;
|
|
||||||
|
|
||||||
pos = editor.InputField.transform.TransformPoint(pos);
|
// todo this calculation isnt the right one to use. It's wrong if we hide the Debug Console.
|
||||||
|
|
||||||
// fix position when scrolled down
|
var posOffset = MainMenu.Instance.MainPanel.transform.position;
|
||||||
var scrollSize = editor.InputField.verticalScrollbar.size;
|
|
||||||
var scrollValue = editor.InputField.verticalScrollbar.value;
|
|
||||||
|
|
||||||
scrollSize += (1 - scrollSize) * (1 - scrollValue);
|
pos = (Vector2)posOffset + pos + new Vector2(25, 35);
|
||||||
|
|
||||||
if (!Mathf.Approximately(scrollSize, 1))
|
//// fix position when scrolled down
|
||||||
{
|
//var scrollSize = editor.InputField.verticalScrollbar.size;
|
||||||
var height = editor.InputField.textViewport.rect.height;
|
//var scrollValue = editor.InputField.verticalScrollbar.value;
|
||||||
|
|
||||||
pos.y += (1 / scrollSize * height) - height;
|
//scrollSize += (1 - scrollSize) * (1 - scrollValue);
|
||||||
}
|
|
||||||
|
//if (!Mathf.Approximately(scrollSize, 1))
|
||||||
|
//{
|
||||||
|
// var height = editor.InputField.textViewport.rect.height;
|
||||||
|
|
||||||
|
// pos.y += (1 / scrollSize * height) - height;
|
||||||
|
//}
|
||||||
|
|
||||||
m_mainObj.transform.position = new Vector3(pos.x, pos.y - 3, 0);
|
m_mainObj.transform.position = new Vector3(pos.x, pos.y - 3, 0);
|
||||||
}
|
}
|
||||||
|
catch //(Exception e)
|
||||||
|
{
|
||||||
|
//ExplorerCore.Log(e.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly char[] splitChars = new[] { '{', '}', ',', ';', '<', '>', '(', ')', '[', ']', '=', '|', '&', '?' };
|
private static readonly char[] splitChars = new[] { '{', '}', ',', ';', '<', '>', '(', ')', '[', ']', '=', '|', '&', '?' };
|
||||||
@ -307,7 +312,7 @@ namespace UnityExplorer.Console
|
|||||||
|
|
||||||
var hiddenChild = UIFactory.CreateUIObject("HiddenText", buttonObj);
|
var hiddenChild = UIFactory.CreateUIObject("HiddenText", buttonObj);
|
||||||
hiddenChild.SetActive(false);
|
hiddenChild.SetActive(false);
|
||||||
var hiddenText = hiddenChild.AddComponent<Text>();
|
var hiddenText = hiddenChild.AddGraphic<Text>();
|
||||||
m_hiddenSuggestionTexts.Add(hiddenText);
|
m_hiddenSuggestionTexts.Add(hiddenText);
|
||||||
|
|
||||||
#if CPP
|
#if CPP
|
||||||
|
@ -3,7 +3,6 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using UnityExplorer.Input;
|
using UnityExplorer.Input;
|
||||||
using UnityExplorer.Console.Lexer;
|
using UnityExplorer.Console.Lexer;
|
||||||
using TMPro;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
@ -23,29 +22,20 @@ namespace UnityExplorer.Console
|
|||||||
{
|
{
|
||||||
private readonly InputLexer inputLexer = new InputLexer();
|
private readonly InputLexer inputLexer = new InputLexer();
|
||||||
|
|
||||||
public TMP_InputField InputField { get; internal set; }
|
public InputField InputField { get; internal set; }
|
||||||
|
|
||||||
public TextMeshProUGUI inputText;
|
public Text inputText;
|
||||||
private TextMeshProUGUI inputHighlightText;
|
private Text inputHighlightText;
|
||||||
private TextMeshProUGUI lineText;
|
|
||||||
private Image background;
|
private Image background;
|
||||||
private Image lineNumberBackground;
|
|
||||||
private Image scrollbar;
|
private Image scrollbar;
|
||||||
|
|
||||||
//private readonly RectTransform inputTextTransform;
|
|
||||||
//private readonly RectTransform lineHighlightTransform;
|
|
||||||
//private bool lineHighlightLocked;
|
|
||||||
//private Image lineHighlight;
|
|
||||||
|
|
||||||
public int LineCount { get; private set; }
|
public int LineCount { get; private set; }
|
||||||
public int CurrentLine { get; private set; }
|
public int CurrentLine { get; private set; }
|
||||||
public int CurrentColumn { get; private set; }
|
|
||||||
public int CurrentIndent { get; private set; }
|
public int CurrentIndent { get; private set; }
|
||||||
|
|
||||||
private static readonly StringBuilder highlightedBuilder = new StringBuilder(4096);
|
private static readonly StringBuilder highlightedBuilder = new StringBuilder(4096);
|
||||||
private static readonly StringBuilder lineBuilder = new StringBuilder();
|
|
||||||
|
|
||||||
private static readonly KeyCode[] lineChangeKeys =
|
private static readonly KeyCode[] onFocusKeys =
|
||||||
{
|
{
|
||||||
KeyCode.Return, KeyCode.Backspace, KeyCode.UpArrow,
|
KeyCode.Return, KeyCode.Backspace, KeyCode.UpArrow,
|
||||||
KeyCode.DownArrow, KeyCode.LeftArrow, KeyCode.RightArrow
|
KeyCode.DownArrow, KeyCode.LeftArrow, KeyCode.RightArrow
|
||||||
@ -69,7 +59,7 @@ namespace UnityExplorer.Console
|
|||||||
inputHighlightText.text = string.Empty;
|
inputHighlightText.text = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
inputText.ForceMeshUpdate(false);
|
//inputText.ForceMeshUpdate(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,14 +88,6 @@ The following helper methods are available:
|
|||||||
{
|
{
|
||||||
ConstructUI();
|
ConstructUI();
|
||||||
|
|
||||||
if (!AllReferencesAssigned())
|
|
||||||
{
|
|
||||||
throw new Exception("References are missing!");
|
|
||||||
}
|
|
||||||
|
|
||||||
//inputTextTransform = inputText.GetComponent<RectTransform>();
|
|
||||||
//lineHighlightTransform = lineHighlight.GetComponent<RectTransform>();
|
|
||||||
|
|
||||||
ApplyTheme();
|
ApplyTheme();
|
||||||
inputLexer.UseMatchers(CSharpLexer.DelimiterSymbols, CSharpLexer.Matchers);
|
inputLexer.UseMatchers(CSharpLexer.DelimiterSymbols, CSharpLexer.Matchers);
|
||||||
|
|
||||||
@ -113,7 +95,7 @@ The following helper methods are available:
|
|||||||
#if CPP
|
#if CPP
|
||||||
InputField.onValueChanged.AddListener(new Action<string>((string s) => { OnInputChanged(); }));
|
InputField.onValueChanged.AddListener(new Action<string>((string s) => { OnInputChanged(); }));
|
||||||
#else
|
#else
|
||||||
this.InputField.onValueChanged.AddListener((string s) => { OnInputChanged(); });
|
this.InputField.onValueChanged.AddListener((string s) => { OnInputChanged(s); });
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,12 +107,12 @@ The following helper methods are available:
|
|||||||
AutoIndentCaret();
|
AutoIndentCaret();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EventSystem.current?.currentSelectedGameObject?.name == "InputField (TMP)")
|
if (EventSystem.current?.currentSelectedGameObject?.name == "InputField")
|
||||||
{
|
{
|
||||||
bool focusKeyPressed = false;
|
bool focusKeyPressed = false;
|
||||||
|
|
||||||
// Check for any focus key pressed
|
// Check for any focus key pressed
|
||||||
foreach (KeyCode key in lineChangeKeys)
|
foreach (KeyCode key in onFocusKeys)
|
||||||
{
|
{
|
||||||
if (InputManager.GetKeyDown(key))
|
if (InputManager.GetKeyDown(key))
|
||||||
{
|
{
|
||||||
@ -139,20 +121,18 @@ The following helper methods are available:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update line highlight
|
|
||||||
if (focusKeyPressed || InputManager.GetMouseButton(0))
|
if (focusKeyPressed || InputManager.GetMouseButton(0))
|
||||||
{
|
{
|
||||||
//UpdateHighlight();
|
|
||||||
ConsolePage.Instance.OnInputChanged();
|
ConsolePage.Instance.OnInputChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnInputChanged(bool forceUpdate = false)
|
public void OnInputChanged(string newInput, bool forceUpdate = false)
|
||||||
{
|
{
|
||||||
string newText = InputField.text;
|
string newText = newInput;
|
||||||
|
|
||||||
UpdateIndent();
|
UpdateIndent(newInput);
|
||||||
|
|
||||||
if (!forceUpdate && string.IsNullOrEmpty(newText))
|
if (!forceUpdate && string.IsNullOrEmpty(newText))
|
||||||
{
|
{
|
||||||
@ -163,152 +143,39 @@ The following helper methods are available:
|
|||||||
inputHighlightText.text = SyntaxHighlightContent(newText);
|
inputHighlightText.text = SyntaxHighlightContent(newText);
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateLineNumbers();
|
|
||||||
//UpdateHighlight();
|
|
||||||
|
|
||||||
ConsolePage.Instance.OnInputChanged();
|
ConsolePage.Instance.OnInputChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
//public void SetLineHighlight(int lineNumber, bool lockLineHighlight)
|
private void UpdateIndent(string newText)
|
||||||
//{
|
|
||||||
// if (lineNumber < 1 || lineNumber > LineCount)
|
|
||||||
// {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// lineHighlightTransform.anchoredPosition = new Vector2(5,
|
|
||||||
// (inputText.textInfo.lineInfo[inputText.textInfo.characterInfo[0].lineNumber].lineHeight *
|
|
||||||
// //-(lineNumber - 1)) - 4f +
|
|
||||||
// -(lineNumber - 1)) +
|
|
||||||
// inputTextTransform.anchoredPosition.y);
|
|
||||||
|
|
||||||
// lineHighlightLocked = lockLineHighlight;
|
|
||||||
//}
|
|
||||||
|
|
||||||
private void UpdateLineNumbers()
|
|
||||||
{
|
|
||||||
int currentLineCount = inputText.textInfo.lineCount;
|
|
||||||
|
|
||||||
int currentLineNumber = 1;
|
|
||||||
|
|
||||||
if (currentLineCount != LineCount)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
lineBuilder.Length = 0;
|
|
||||||
|
|
||||||
for (int i = 1; i < currentLineCount + 2; i++)
|
|
||||||
{
|
|
||||||
if (i - 1 > 0 && i - 1 < currentLineCount - 1)
|
|
||||||
{
|
|
||||||
int characterStart = inputText.textInfo.lineInfo[i - 1].firstCharacterIndex;
|
|
||||||
int characterCount = inputText.textInfo.lineInfo[i - 1].characterCount;
|
|
||||||
|
|
||||||
if (characterStart >= 0 && characterStart < inputText.text.Length &&
|
|
||||||
characterCount != 0 && !inputText.text.Substring(characterStart, characterCount).Contains("\n"))
|
|
||||||
{
|
|
||||||
lineBuilder.Append("\n");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lineBuilder.Append(currentLineNumber);
|
|
||||||
lineBuilder.Append('\n');
|
|
||||||
|
|
||||||
currentLineNumber++;
|
|
||||||
|
|
||||||
if (i - 1 == 0 && i - 1 < currentLineCount - 1)
|
|
||||||
{
|
|
||||||
int characterStart = inputText.textInfo.lineInfo[i - 1].firstCharacterIndex;
|
|
||||||
int characterCount = inputText.textInfo.lineInfo[i - 1].characterCount;
|
|
||||||
|
|
||||||
if (characterStart >= 0 && characterStart < inputText.text.Length &&
|
|
||||||
characterCount != 0 && !inputText.text.Substring(characterStart, characterCount).Contains("\n"))
|
|
||||||
{
|
|
||||||
lineBuilder.Append("\n");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lineText.text = lineBuilder.ToString();
|
|
||||||
LineCount = currentLineCount;
|
|
||||||
}
|
|
||||||
catch { }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void UpdateIndent()
|
|
||||||
{
|
{
|
||||||
int caret = InputField.caretPosition;
|
int caret = InputField.caretPosition;
|
||||||
|
|
||||||
if (caret < 0 || caret >= inputText.textInfo.characterInfo.Length)
|
int len = newText.Length;
|
||||||
{
|
if (caret < 0 || caret >= len)
|
||||||
while (caret >= 0 && caret >= inputText.textInfo.characterInfo.Length)
|
|
||||||
{
|
{
|
||||||
|
while (caret >= 0 && caret >= len)
|
||||||
caret--;
|
caret--;
|
||||||
}
|
|
||||||
|
|
||||||
if (caret < 0 || caret >= inputText.textInfo.characterInfo.Length)
|
if (caret < 0)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
CurrentLine = inputText.textInfo.characterInfo[caret].lineNumber;
|
|
||||||
|
|
||||||
int charCount = 0;
|
|
||||||
for (int i = 0; i < CurrentLine; i++)
|
|
||||||
{
|
|
||||||
charCount += inputText.textInfo.lineInfo[i].characterCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
CurrentColumn = caret - charCount;
|
|
||||||
CurrentIndent = 0;
|
CurrentIndent = 0;
|
||||||
|
|
||||||
for (int i = 0; i < caret && i < InputField.text.Length; i++)
|
for (int i = 0; i < caret && i < newText.Length; i++)
|
||||||
{
|
{
|
||||||
char character = InputField.text[i];
|
char character = newText[i];
|
||||||
|
|
||||||
if (character == CSharpLexer.indentIncreaseCharacter)
|
if (character == CSharpLexer.indentIncreaseCharacter)
|
||||||
{
|
|
||||||
CurrentIndent++;
|
CurrentIndent++;
|
||||||
}
|
|
||||||
|
|
||||||
if (character == CSharpLexer.indentDecreaseCharacter)
|
if (character == CSharpLexer.indentDecreaseCharacter)
|
||||||
{
|
|
||||||
CurrentIndent--;
|
CurrentIndent--;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (CurrentIndent < 0)
|
if (CurrentIndent < 0)
|
||||||
{
|
|
||||||
CurrentIndent = 0;
|
CurrentIndent = 0;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
//private void UpdateHighlight()
|
|
||||||
//{
|
|
||||||
// if (lineHighlightLocked)
|
|
||||||
// {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// int caret = InputField.caretPosition - 1;
|
|
||||||
|
|
||||||
// float lineHeight = inputText.textInfo.lineInfo[inputText.textInfo.characterInfo[0].lineNumber].lineHeight;
|
|
||||||
// int lineNumber = inputText.textInfo.characterInfo[caret].lineNumber;
|
|
||||||
// float offset = lineNumber + inputTextTransform.anchoredPosition.y;
|
|
||||||
|
|
||||||
// lineHighlightTransform.anchoredPosition = new Vector2(5, -(offset * lineHeight));
|
|
||||||
// }
|
|
||||||
// catch //(Exception e)
|
|
||||||
// {
|
|
||||||
// //ExplorerCore.LogWarning("Exception on Update Line Highlight: " + e);
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
private const string CLOSE_COLOR_TAG = "</color>";
|
private const string CLOSE_COLOR_TAG = "</color>";
|
||||||
|
|
||||||
@ -325,7 +192,7 @@ The following helper methods are available:
|
|||||||
highlightedBuilder.Append(inputText[i]);
|
highlightedBuilder.Append(inputText[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
highlightedBuilder.Append(match.htmlColor);
|
highlightedBuilder.Append($"{match.htmlColor}");
|
||||||
|
|
||||||
for (int i = match.startIndex; i < match.endIndex; i++)
|
for (int i = match.startIndex; i < match.endIndex; i++)
|
||||||
{
|
{
|
||||||
@ -388,20 +255,21 @@ The following helper methods are available:
|
|||||||
// insert the actual auto indent now
|
// insert the actual auto indent now
|
||||||
InputField.text = InputField.text.Insert(caretPos, indent);
|
InputField.text = InputField.text.Insert(caretPos, indent);
|
||||||
|
|
||||||
InputField.stringPosition = caretPos + indent.Length;
|
//InputField.stringPosition = caretPos + indent.Length;
|
||||||
|
InputField.caretPosition = caretPos + indent.Length;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update line column and indent positions
|
// Update line column and indent positions
|
||||||
UpdateIndent();
|
UpdateIndent(InputField.text);
|
||||||
|
|
||||||
inputText.text = InputField.text;
|
inputText.text = InputField.text;
|
||||||
inputText.SetText(InputField.text, true);
|
//inputText.SetText(InputField.text, true);
|
||||||
inputText.Rebuild(CanvasUpdate.Prelayout);
|
inputText.Rebuild(CanvasUpdate.Prelayout);
|
||||||
InputField.ForceLabelUpdate();
|
InputField.ForceLabelUpdate();
|
||||||
InputField.Rebuild(CanvasUpdate.Prelayout);
|
InputField.Rebuild(CanvasUpdate.Prelayout);
|
||||||
|
|
||||||
OnInputChanged(true);
|
OnInputChanged(inputText.text, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetAutoIndentTab(int amount)
|
private string GetAutoIndentTab(int amount)
|
||||||
@ -418,12 +286,7 @@ The following helper methods are available:
|
|||||||
|
|
||||||
// ============== Theme ============== //
|
// ============== Theme ============== //
|
||||||
|
|
||||||
private static Color caretColor = new Color32(255, 255, 255, 255);
|
|
||||||
private static Color textColor = new Color32(255, 255, 255, 255);
|
|
||||||
private static Color backgroundColor = new Color32(37, 37, 37, 255);
|
private static Color backgroundColor = new Color32(37, 37, 37, 255);
|
||||||
//private static Color lineHighlightColor = new Color32(50, 50, 50, 255);
|
|
||||||
private static Color lineNumberBackgroundColor = new Color32(25, 25, 25, 255);
|
|
||||||
private static Color lineNumberTextColor = new Color32(180, 180, 180, 255);
|
|
||||||
private static Color scrollbarColor = new Color32(45, 50, 50, 255);
|
private static Color scrollbarColor = new Color32(45, 50, 50, 255);
|
||||||
|
|
||||||
private void ApplyTheme()
|
private void ApplyTheme()
|
||||||
@ -434,34 +297,13 @@ The following helper methods are available:
|
|||||||
highlightTextRect.offsetMin = Vector2.zero;
|
highlightTextRect.offsetMin = Vector2.zero;
|
||||||
highlightTextRect.offsetMax = Vector2.zero;
|
highlightTextRect.offsetMax = Vector2.zero;
|
||||||
|
|
||||||
InputField.caretColor = caretColor;
|
InputField.caretColor = Color.white;
|
||||||
inputText.color = textColor;
|
inputText.color = new Color(1, 1, 1, 0.51f);
|
||||||
inputHighlightText.color = textColor;
|
inputHighlightText.color = Color.white;
|
||||||
background.color = backgroundColor;
|
background.color = backgroundColor;
|
||||||
//lineHighlight.color = lineHighlightColor;
|
|
||||||
lineNumberBackground.color = lineNumberBackgroundColor;
|
|
||||||
lineText.color = lineNumberTextColor;
|
|
||||||
scrollbar.color = scrollbarColor;
|
scrollbar.color = scrollbarColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool AllReferencesAssigned()
|
|
||||||
{
|
|
||||||
if (!InputField ||
|
|
||||||
!inputText ||
|
|
||||||
!inputHighlightText ||
|
|
||||||
!lineText ||
|
|
||||||
!background ||
|
|
||||||
//!lineHighlight ||
|
|
||||||
!lineNumberBackground ||
|
|
||||||
!scrollbar)
|
|
||||||
{
|
|
||||||
// One or more references are not assigned
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ========== UI CONSTRUCTION =========== //
|
// ========== UI CONSTRUCTION =========== //
|
||||||
|
|
||||||
public void ConstructUI()
|
public void ConstructUI()
|
||||||
@ -589,81 +431,38 @@ The following helper methods are available:
|
|||||||
mainBgRect.offsetMin = Vector2.zero;
|
mainBgRect.offsetMin = Vector2.zero;
|
||||||
mainBgRect.offsetMax = Vector2.zero;
|
mainBgRect.offsetMax = Vector2.zero;
|
||||||
|
|
||||||
var mainBgImage = mainBg.AddComponent<Image>();
|
var mainBgImage = mainBg.AddGraphic<Image>();
|
||||||
|
|
||||||
//var lineHighlight = UIFactory.CreateUIObject("LineHighlight", consoleBase);
|
var inputObj = UIFactory.CreateInputField(consoleBase, 14, 0);
|
||||||
|
|
||||||
//var lineHighlightRect = lineHighlight.GetComponent<RectTransform>();
|
var inputField = inputObj.GetComponent<InputField>();
|
||||||
//lineHighlightRect.pivot = new Vector2(0.5f, 1);
|
//inputField.richText = false;
|
||||||
//lineHighlightRect.anchorMin = new Vector2(0, 1);
|
//inputField.restoreOriginalTextOnEscape = false;
|
||||||
//lineHighlightRect.anchorMax = new Vector2(1, 1);
|
|
||||||
//lineHighlightRect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 21);
|
|
||||||
|
|
||||||
//var lineHighlightImage = lineHighlight.GetComponent<Image>();
|
|
||||||
//if (!lineHighlightImage)
|
|
||||||
//{
|
|
||||||
// lineHighlightImage = lineHighlight.AddComponent<Image>();
|
|
||||||
//}
|
|
||||||
|
|
||||||
var linesBg = UIFactory.CreateUIObject("LinesBackground", consoleBase);
|
|
||||||
var linesBgRect = linesBg.GetComponent<RectTransform>();
|
|
||||||
linesBgRect.anchorMin = Vector2.zero;
|
|
||||||
linesBgRect.anchorMax = new Vector2(0, 1);
|
|
||||||
linesBgRect.offsetMin = new Vector2(-17.5f, 0);
|
|
||||||
linesBgRect.offsetMax = new Vector2(17.5f, 0);
|
|
||||||
linesBgRect.sizeDelta = new Vector2(65, 0);
|
|
||||||
|
|
||||||
var linesBgImage = linesBg.AddComponent<Image>();
|
|
||||||
|
|
||||||
var inputObj = UIFactory.CreateTMPInput(consoleBase);
|
|
||||||
|
|
||||||
var inputField = inputObj.GetComponent<TMP_InputField>();
|
|
||||||
inputField.richText = false;
|
|
||||||
inputField.restoreOriginalTextOnEscape = false;
|
|
||||||
|
|
||||||
var inputRect = inputObj.GetComponent<RectTransform>();
|
var inputRect = inputObj.GetComponent<RectTransform>();
|
||||||
inputRect.pivot = new Vector2(0.5f, 0.5f);
|
inputRect.pivot = new Vector2(0, 1);
|
||||||
inputRect.anchorMin = Vector2.zero;
|
inputRect.anchorMin = Vector2.zero;
|
||||||
inputRect.anchorMax = new Vector2(0.92f, 1);
|
inputRect.anchorMax = Vector2.one;
|
||||||
inputRect.offsetMin = new Vector2(20, 0);
|
inputRect.offsetMin = new Vector2(20, 0);
|
||||||
inputRect.offsetMax = new Vector2(14, 0);
|
inputRect.offsetMax = new Vector2(14, 0);
|
||||||
inputRect.anchoredPosition = new Vector2(40, 0);
|
|
||||||
|
|
||||||
var textAreaObj = inputObj.transform.Find("TextArea");
|
var mainTextObj = inputField.textComponent.gameObject;
|
||||||
var textAreaRect = textAreaObj.GetComponent<RectTransform>();
|
|
||||||
textAreaRect.pivot = new Vector2(0.5f, 0.5f);
|
|
||||||
textAreaRect.anchorMin = Vector2.zero;
|
|
||||||
textAreaRect.anchorMax = Vector2.one;
|
|
||||||
|
|
||||||
var mainTextObj = textAreaObj.transform.Find("Text");
|
var mainTextInput = mainTextObj.GetComponent<Text>();
|
||||||
var mainTextRect = mainTextObj.GetComponent<RectTransform>();
|
|
||||||
mainTextRect.pivot = new Vector2(0.5f, 0.5f);
|
|
||||||
mainTextRect.anchorMin = Vector2.zero;
|
|
||||||
mainTextRect.anchorMax = Vector2.one;
|
|
||||||
mainTextRect.offsetMin = Vector2.zero;
|
|
||||||
mainTextRect.offsetMax = Vector2.zero;
|
|
||||||
|
|
||||||
var mainTextInput = mainTextObj.GetComponent<TextMeshProUGUI>();
|
var placeHolderText = inputField.placeholder.GetComponent<Text>();
|
||||||
//mainTextInput.fontSize = 18;
|
placeHolderText.text = STARTUP_TEXT;
|
||||||
|
|
||||||
var placeHolderText = textAreaObj.transform.Find("Placeholder").GetComponent<TextMeshProUGUI>();
|
|
||||||
placeHolderText.text = CodeEditor.STARTUP_TEXT;
|
|
||||||
|
|
||||||
var linesTextObj = UIFactory.CreateUIObject("LinesText", mainTextObj.gameObject);
|
|
||||||
var linesTextRect = linesTextObj.GetComponent<RectTransform>();
|
|
||||||
|
|
||||||
var linesTextInput = linesTextObj.AddComponent<TextMeshProUGUI>();
|
|
||||||
linesTextInput.fontSize = 18;
|
|
||||||
|
|
||||||
var highlightTextObj = UIFactory.CreateUIObject("HighlightText", mainTextObj.gameObject);
|
var highlightTextObj = UIFactory.CreateUIObject("HighlightText", mainTextObj.gameObject);
|
||||||
var highlightTextRect = highlightTextObj.GetComponent<RectTransform>();
|
var highlightTextRect = highlightTextObj.GetComponent<RectTransform>();
|
||||||
|
highlightTextRect.pivot = new Vector2(0, 1);
|
||||||
highlightTextRect.anchorMin = Vector2.zero;
|
highlightTextRect.anchorMin = Vector2.zero;
|
||||||
highlightTextRect.anchorMax = Vector2.one;
|
highlightTextRect.anchorMax = Vector2.one;
|
||||||
highlightTextRect.offsetMin = Vector2.zero;
|
highlightTextRect.offsetMin = new Vector2(20, 0);
|
||||||
highlightTextRect.offsetMax = Vector2.zero;
|
highlightTextRect.offsetMax = new Vector2(14, 0);
|
||||||
|
|
||||||
var highlightTextInput = highlightTextObj.AddComponent<TextMeshProUGUI>();
|
var highlightTextInput = highlightTextObj.AddGraphic<Text>();
|
||||||
//highlightTextInput.fontSize = 18;
|
highlightTextInput.supportRichText = true;
|
||||||
|
|
||||||
var scroll = UIFactory.CreateScrollbar(consoleBase);
|
var scroll = UIFactory.CreateScrollbar(consoleBase);
|
||||||
|
|
||||||
@ -681,19 +480,7 @@ The following helper methods are available:
|
|||||||
|
|
||||||
var scrollImage = scroll.GetComponent<Image>();
|
var scrollImage = scroll.GetComponent<Image>();
|
||||||
|
|
||||||
var tmpInput = inputObj.GetComponent<TMP_InputField>();
|
inputField.GetComponentInChildren<RectMask2D>().enabled = false;
|
||||||
tmpInput.scrollSensitivity = 15;
|
|
||||||
tmpInput.verticalScrollbar = scroller;
|
|
||||||
|
|
||||||
// set lines text anchors here after UI is fleshed out
|
|
||||||
linesTextRect.pivot = Vector2.zero;
|
|
||||||
linesTextRect.anchorMin = new Vector2(0, 0);
|
|
||||||
linesTextRect.anchorMax = new Vector2(1, 1);
|
|
||||||
linesTextRect.offsetMin = Vector2.zero;
|
|
||||||
linesTextRect.offsetMax = Vector2.zero;
|
|
||||||
linesTextRect.anchoredPosition = new Vector2(-40, 0);
|
|
||||||
|
|
||||||
tmpInput.GetComponentInChildren<RectMask2D>().enabled = false;
|
|
||||||
inputObj.GetComponent<Image>().enabled = false;
|
inputObj.GetComponent<Image>().enabled = false;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@ -723,66 +510,18 @@ The following helper methods are available:
|
|||||||
#endif
|
#endif
|
||||||
void CompileCallback()
|
void CompileCallback()
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(tmpInput.text))
|
if (!string.IsNullOrEmpty(inputField.text))
|
||||||
{
|
{
|
||||||
ConsolePage.Instance.Evaluate(tmpInput.text.Trim());
|
ConsolePage.Instance.Evaluate(inputField.text.Trim());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region FONT
|
mainTextInput.supportRichText = false;
|
||||||
|
|
||||||
TMP_FontAsset fontToUse = UIManager.ConsoleFont;
|
mainTextInput.font = UIManager.ConsoleFont;
|
||||||
if (fontToUse == null)
|
highlightTextInput.font = UIManager.ConsoleFont;
|
||||||
{
|
|
||||||
#if CPP
|
|
||||||
UnityEngine.Object[] fonts = ResourcesUnstrip.FindObjectsOfTypeAll(Il2CppType.Of<TMP_FontAsset>());
|
|
||||||
foreach (UnityEngine.Object font in fonts)
|
|
||||||
{
|
|
||||||
TMP_FontAsset fontCast = font.Il2CppCast(typeof(TMP_FontAsset)) as TMP_FontAsset;
|
|
||||||
|
|
||||||
if (fontCast.name.Contains("LiberationSans"))
|
|
||||||
{
|
|
||||||
fontToUse = fontCast;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
var fonts = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
|
|
||||||
foreach (var font in fonts)
|
|
||||||
{
|
|
||||||
if (font.name.Contains("LiberationSans"))
|
|
||||||
{
|
|
||||||
fontToUse = font;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fontToUse != null)
|
|
||||||
{
|
|
||||||
UnityEngine.TextCore.FaceInfo faceInfo = fontToUse.faceInfo;
|
|
||||||
fontToUse.tabSize = 10;
|
|
||||||
faceInfo.tabWidth = 10;
|
|
||||||
#if CPP
|
|
||||||
fontToUse.faceInfo = faceInfo;
|
|
||||||
#else
|
|
||||||
typeof(TMP_FontAsset)
|
|
||||||
.GetField("m_FaceInfo", BindingFlags.NonPublic | BindingFlags.Instance)
|
|
||||||
.SetValue(fontToUse, faceInfo);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
tmpInput.fontAsset = fontToUse;
|
|
||||||
|
|
||||||
mainTextInput.font = fontToUse;
|
|
||||||
mainTextInput.fontSize = 18;
|
|
||||||
|
|
||||||
highlightTextInput.font = fontToUse;
|
|
||||||
highlightTextInput.fontSize = 18;
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
// assign references
|
// assign references
|
||||||
|
|
||||||
@ -790,10 +529,7 @@ The following helper methods are available:
|
|||||||
|
|
||||||
this.inputText = mainTextInput;
|
this.inputText = mainTextInput;
|
||||||
this.inputHighlightText = highlightTextInput;
|
this.inputHighlightText = highlightTextInput;
|
||||||
this.lineText = linesTextInput;
|
|
||||||
this.background = mainBgImage;
|
this.background = mainBgImage;
|
||||||
//this.lineHighlight = lineHighlightImage;
|
|
||||||
this.lineNumberBackground = linesBgImage;
|
|
||||||
this.scrollbar = scrollImage;
|
this.scrollbar = scrollImage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ namespace UnityExplorer.Console.Lexer
|
|||||||
{
|
{
|
||||||
public abstract Color HighlightColor { get; }
|
public abstract Color HighlightColor { get; }
|
||||||
|
|
||||||
public string HexColor => htmlColor ?? (htmlColor = "<#" + HighlightColor.ToHex() + ">");
|
public string HexColor => htmlColor ?? (htmlColor = "<color=#" + HighlightColor.ToHex() + ">");
|
||||||
private string htmlColor = null;
|
private string htmlColor = null;
|
||||||
|
|
||||||
public virtual IEnumerable<char> StartChars { get { yield break; } }
|
public virtual IEnumerable<char> StartChars { get { yield break; } }
|
||||||
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using UnityExplorer.Helpers;
|
using UnityExplorer.Helpers;
|
||||||
using UnityExplorer.UI;
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.Unstrip;
|
using UnityExplorer.Unstrip;
|
||||||
using TMPro;
|
//using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Inspectors.GameObjects;
|
using UnityExplorer.Inspectors.GameObjects;
|
||||||
@ -36,10 +36,10 @@ namespace UnityExplorer.Inspectors
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static string m_lastName;
|
private static string m_lastName;
|
||||||
public static TMP_InputField m_nameInput;
|
public static InputField m_nameInput;
|
||||||
|
|
||||||
private static string m_lastPath;
|
private static string m_lastPath;
|
||||||
public static TMP_InputField m_pathInput;
|
public static InputField m_pathInput;
|
||||||
private static RectTransform m_pathInputRect;
|
private static RectTransform m_pathInputRect;
|
||||||
private static GameObject m_pathGroupObj;
|
private static GameObject m_pathGroupObj;
|
||||||
private static Text m_hiddenPathText;
|
private static Text m_hiddenPathText;
|
||||||
@ -271,7 +271,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
m_hiddenPathText = pathHiddenTextObj.GetComponent<Text>();
|
m_hiddenPathText = pathHiddenTextObj.GetComponent<Text>();
|
||||||
m_hiddenPathText.color = Color.clear;
|
m_hiddenPathText.color = Color.clear;
|
||||||
m_hiddenPathText.fontSize = 14;
|
m_hiddenPathText.fontSize = 14;
|
||||||
m_hiddenPathText.lineSpacing = 1.5f;
|
//m_hiddenPathText.lineSpacing = 1.5f;
|
||||||
m_hiddenPathText.raycastTarget = false;
|
m_hiddenPathText.raycastTarget = false;
|
||||||
var hiddenFitter = pathHiddenTextObj.AddComponent<ContentSizeFitter>();
|
var hiddenFitter = pathHiddenTextObj.AddComponent<ContentSizeFitter>();
|
||||||
hiddenFitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
|
hiddenFitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
|
||||||
@ -286,10 +286,10 @@ namespace UnityExplorer.Inspectors
|
|||||||
hiddenGroup.childForceExpandHeight = true;
|
hiddenGroup.childForceExpandHeight = true;
|
||||||
hiddenGroup.childControlHeight = true;
|
hiddenGroup.childControlHeight = true;
|
||||||
|
|
||||||
var pathInputObj = UIFactory.CreateTMPInput(pathHiddenTextObj, 14, 0, (int)TextAlignmentOptions.MidlineLeft);
|
var pathInputObj = UIFactory.CreateInputField(pathHiddenTextObj);
|
||||||
var pathInputRect = pathInputObj.GetComponent<RectTransform>();
|
var pathInputRect = pathInputObj.GetComponent<RectTransform>();
|
||||||
pathInputRect.sizeDelta = new Vector2(pathInputRect.sizeDelta.x, 25);
|
pathInputRect.sizeDelta = new Vector2(pathInputRect.sizeDelta.x, 25);
|
||||||
m_pathInput = pathInputObj.GetComponent<TMP_InputField>();
|
m_pathInput = pathInputObj.GetComponent<InputField>();
|
||||||
m_pathInput.text = TargetGO.transform.GetTransformPath();
|
m_pathInput.text = TargetGO.transform.GetTransformPath();
|
||||||
m_pathInput.readOnly = true;
|
m_pathInput.readOnly = true;
|
||||||
var pathInputLayout = pathInputObj.AddComponent<LayoutElement>();
|
var pathInputLayout = pathInputObj.AddComponent<LayoutElement>();
|
||||||
@ -301,7 +301,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
textRect.offsetMin = new Vector2(3, 3);
|
textRect.offsetMin = new Vector2(3, 3);
|
||||||
textRect.offsetMax = new Vector2(3, 3);
|
textRect.offsetMax = new Vector2(3, 3);
|
||||||
m_pathInput.textComponent.color = new Color(0.75f, 0.75f, 0.75f);
|
m_pathInput.textComponent.color = new Color(0.75f, 0.75f, 0.75f);
|
||||||
m_pathInput.textComponent.lineSpacing = 1.5f;
|
//m_pathInput.textComponent.lineSpacing = 1.5f;
|
||||||
|
|
||||||
m_pathInputRect = m_pathInput.GetComponent<RectTransform>();
|
m_pathInputRect = m_pathInput.GetComponent<RectTransform>();
|
||||||
m_hiddenPathRect = m_hiddenPathText.GetComponent<RectTransform>();
|
m_hiddenPathRect = m_hiddenPathText.GetComponent<RectTransform>();
|
||||||
@ -321,8 +321,8 @@ namespace UnityExplorer.Inspectors
|
|||||||
nameLayout.minHeight = 25;
|
nameLayout.minHeight = 25;
|
||||||
nameLayout.flexibleHeight = 0;
|
nameLayout.flexibleHeight = 0;
|
||||||
|
|
||||||
var nameTextObj = UIFactory.CreateTMPLabel(nameRowObj, TextAlignmentOptions.Midline);
|
var nameTextObj = UIFactory.CreateLabel(nameRowObj, TextAnchor.MiddleCenter);
|
||||||
var nameTextText = nameTextObj.GetComponent<TextMeshProUGUI>();
|
var nameTextText = nameTextObj.GetComponent<Text>();
|
||||||
nameTextText.text = "Name:";
|
nameTextText.text = "Name:";
|
||||||
nameTextText.fontSize = 14;
|
nameTextText.fontSize = 14;
|
||||||
nameTextText.color = Color.grey;
|
nameTextText.color = Color.grey;
|
||||||
@ -332,12 +332,12 @@ namespace UnityExplorer.Inspectors
|
|||||||
nameTextLayout.minWidth = 55;
|
nameTextLayout.minWidth = 55;
|
||||||
nameTextLayout.flexibleWidth = 0;
|
nameTextLayout.flexibleWidth = 0;
|
||||||
|
|
||||||
var nameInputObj = UIFactory.CreateTMPInput(nameRowObj, 14, 0, (int)TextAlignmentOptions.MidlineLeft);
|
var nameInputObj = UIFactory.CreateInputField(nameRowObj);
|
||||||
var nameInputRect = nameInputObj.GetComponent<RectTransform>();
|
var nameInputRect = nameInputObj.GetComponent<RectTransform>();
|
||||||
nameInputRect.sizeDelta = new Vector2(nameInputRect.sizeDelta.x, 25);
|
nameInputRect.sizeDelta = new Vector2(nameInputRect.sizeDelta.x, 25);
|
||||||
m_nameInput = nameInputObj.GetComponent<TMP_InputField>();
|
m_nameInput = nameInputObj.GetComponent<InputField>();
|
||||||
m_nameInput.text = TargetGO.name;
|
m_nameInput.text = TargetGO.name;
|
||||||
m_nameInput.lineType = TMP_InputField.LineType.SingleLine;
|
m_nameInput.lineType = InputField.LineType.SingleLine;
|
||||||
|
|
||||||
var applyNameBtnObj = UIFactory.CreateButton(nameRowObj);
|
var applyNameBtnObj = UIFactory.CreateButton(nameRowObj);
|
||||||
var applyNameBtn = applyNameBtnObj.GetComponent<Button>();
|
var applyNameBtn = applyNameBtnObj.GetComponent<Button>();
|
||||||
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||||||
using UnityExplorer.Helpers;
|
using UnityExplorer.Helpers;
|
||||||
using UnityExplorer.UI;
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Shared;
|
using UnityExplorer.UI.Shared;
|
||||||
using TMPro;
|
//using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Input;
|
using UnityExplorer.Input;
|
||||||
|
@ -5,7 +5,7 @@ using UnityExplorer.Helpers;
|
|||||||
using UnityExplorer.UI;
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Shared;
|
using UnityExplorer.UI.Shared;
|
||||||
using UnityExplorer.Unstrip;
|
using UnityExplorer.Unstrip;
|
||||||
using TMPro;
|
//using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Input;
|
using UnityExplorer.Input;
|
||||||
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using UnityExplorer.Helpers;
|
using UnityExplorer.Helpers;
|
||||||
using UnityExplorer.UI;
|
using UnityExplorer.UI;
|
||||||
using TMPro;
|
//using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Input;
|
using UnityExplorer.Input;
|
||||||
@ -20,7 +20,7 @@ namespace UnityExplorer.Inspectors.GameObjects
|
|||||||
Instance = this;
|
Instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TMP_InputField s_setParentInput;
|
private static InputField s_setParentInput;
|
||||||
|
|
||||||
private static ControlEditor s_positionControl;
|
private static ControlEditor s_positionControl;
|
||||||
private static ControlEditor s_localPosControl;
|
private static ControlEditor s_localPosControl;
|
||||||
@ -31,9 +31,9 @@ namespace UnityExplorer.Inspectors.GameObjects
|
|||||||
|
|
||||||
internal struct ControlEditor
|
internal struct ControlEditor
|
||||||
{
|
{
|
||||||
public TMP_InputField fullValue;
|
public InputField fullValue;
|
||||||
public Slider[] sliders;
|
public Slider[] sliders;
|
||||||
public TMP_InputField[] inputs;
|
public InputField[] inputs;
|
||||||
public Text[] values;
|
public Text[] values;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ namespace UnityExplorer.Inspectors.GameObjects
|
|||||||
|
|
||||||
// get relevant input for controltype + value
|
// get relevant input for controltype + value
|
||||||
|
|
||||||
TMP_InputField[] inputs = null;
|
InputField[] inputs = null;
|
||||||
switch (controlType)
|
switch (controlType)
|
||||||
{
|
{
|
||||||
case ControlType.position:
|
case ControlType.position:
|
||||||
@ -197,7 +197,7 @@ namespace UnityExplorer.Inspectors.GameObjects
|
|||||||
case ControlType.localScale:
|
case ControlType.localScale:
|
||||||
inputs = s_scaleControl.inputs; break;
|
inputs = s_scaleControl.inputs; break;
|
||||||
}
|
}
|
||||||
TMP_InputField input = inputs[(int)vectorValue];
|
InputField input = inputs[(int)vectorValue];
|
||||||
|
|
||||||
float val = float.Parse(input.text);
|
float val = float.Parse(input.text);
|
||||||
|
|
||||||
@ -357,9 +357,9 @@ namespace UnityExplorer.Inspectors.GameObjects
|
|||||||
setParentLabelLayout.minHeight = 25;
|
setParentLabelLayout.minHeight = 25;
|
||||||
setParentLabelLayout.flexibleWidth = 0;
|
setParentLabelLayout.flexibleWidth = 0;
|
||||||
|
|
||||||
var setParentInputObj = UIFactory.CreateTMPInput(setParentGroupObj, 14, 0, (int)TextAlignmentOptions.MidlineLeft);
|
var setParentInputObj = UIFactory.CreateInputField(setParentGroupObj);
|
||||||
s_setParentInput = setParentInputObj.GetComponent<TMP_InputField>();
|
s_setParentInput = setParentInputObj.GetComponent<InputField>();
|
||||||
var placeholderInput = setParentInputObj.transform.Find("TextArea/Placeholder").GetComponent<TextMeshProUGUI>();
|
var placeholderInput = s_setParentInput.placeholder.GetComponent<Text>();
|
||||||
placeholderInput.text = "Enter a GameObject name or path...";
|
placeholderInput.text = "Enter a GameObject name or path...";
|
||||||
var setParentInputLayout = setParentInputObj.AddComponent<LayoutElement>();
|
var setParentInputLayout = setParentInputObj.AddComponent<LayoutElement>();
|
||||||
setParentInputLayout.minHeight = 25;
|
setParentInputLayout.minHeight = 25;
|
||||||
@ -421,11 +421,11 @@ namespace UnityExplorer.Inspectors.GameObjects
|
|||||||
|
|
||||||
// readonly value input
|
// readonly value input
|
||||||
|
|
||||||
var valueInputObj = UIFactory.CreateTMPInput(topBarObj, 14, 0, (int)TextAlignmentOptions.MidlineLeft);
|
var valueInputObj = UIFactory.CreateInputField(topBarObj);
|
||||||
var valueInput = valueInputObj.GetComponent<TMP_InputField>();
|
var valueInput = valueInputObj.GetComponent<InputField>();
|
||||||
valueInput.readOnly = true;
|
valueInput.readOnly = true;
|
||||||
valueInput.richText = true;
|
//valueInput.richText = true;
|
||||||
valueInput.isRichTextEditingAllowed = true;
|
//valueInput.isRichTextEditingAllowed = true;
|
||||||
var valueInputLayout = valueInputObj.AddComponent<LayoutElement>();
|
var valueInputLayout = valueInputObj.AddComponent<LayoutElement>();
|
||||||
valueInputLayout.minHeight = 25;
|
valueInputLayout.minHeight = 25;
|
||||||
valueInputLayout.flexibleHeight = 0;
|
valueInputLayout.flexibleHeight = 0;
|
||||||
@ -435,7 +435,7 @@ namespace UnityExplorer.Inspectors.GameObjects
|
|||||||
editor.fullValue = valueInput;
|
editor.fullValue = valueInput;
|
||||||
|
|
||||||
editor.sliders = new Slider[3];
|
editor.sliders = new Slider[3];
|
||||||
editor.inputs = new TMP_InputField[3];
|
editor.inputs = new InputField[3];
|
||||||
editor.values = new Text[3];
|
editor.values = new Text[3];
|
||||||
|
|
||||||
var xRow = ConstructEditorRow(parent, editor, type, VectorValue.x);
|
var xRow = ConstructEditorRow(parent, editor, type, VectorValue.x);
|
||||||
@ -540,9 +540,9 @@ namespace UnityExplorer.Inspectors.GameObjects
|
|||||||
inputHolderGroup.childForceExpandWidth = false;
|
inputHolderGroup.childForceExpandWidth = false;
|
||||||
inputHolderGroup.childControlWidth = true;
|
inputHolderGroup.childControlWidth = true;
|
||||||
|
|
||||||
var inputObj = UIFactory.CreateTMPInput(inputHolder, 14, 0, (int)TextAlignmentOptions.MidlineLeft);
|
var inputObj = UIFactory.CreateInputField(inputHolder);
|
||||||
var input = inputObj.GetComponent<TMP_InputField>();
|
var input = inputObj.GetComponent<InputField>();
|
||||||
input.characterValidation = TMP_InputField.CharacterValidation.Decimal;
|
input.characterValidation = InputField.CharacterValidation.Decimal;
|
||||||
|
|
||||||
var inputLayout = inputObj.AddComponent<LayoutElement>();
|
var inputLayout = inputObj.AddComponent<LayoutElement>();
|
||||||
inputLayout.minHeight = 25;
|
inputLayout.minHeight = 25;
|
||||||
|
@ -7,7 +7,7 @@ using UnityExplorer.UI.PageModel;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using TMPro;
|
//using TMPro;
|
||||||
using UnityExplorer.Inspectors.Reflection;
|
using UnityExplorer.Inspectors.Reflection;
|
||||||
|
|
||||||
namespace UnityExplorer.Inspectors
|
namespace UnityExplorer.Inspectors
|
||||||
@ -277,9 +277,9 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
// time scale input
|
// time scale input
|
||||||
|
|
||||||
var timeInputObj = UIFactory.CreateTMPInput(timeGroupObj, 14, 0, (int)TextAlignmentOptions.MidlineLeft);
|
var timeInputObj = UIFactory.CreateInputField(timeGroupObj);
|
||||||
var timeInput = timeInputObj.GetComponent<TMP_InputField>();
|
var timeInput = timeInputObj.GetComponent<InputField>();
|
||||||
timeInput.characterValidation = TMP_InputField.CharacterValidation.Decimal;
|
timeInput.characterValidation = InputField.CharacterValidation.Decimal;
|
||||||
var timeInputLayout = timeInputObj.AddComponent<LayoutElement>();
|
var timeInputLayout = timeInputObj.AddComponent<LayoutElement>();
|
||||||
timeInputLayout.minWidth = 90;
|
timeInputLayout.minWidth = 90;
|
||||||
timeInputLayout.flexibleWidth = 0;
|
timeInputLayout.flexibleWidth = 0;
|
||||||
|
@ -54,12 +54,22 @@ namespace UnityExplorer.Inspectors.Reflection
|
|||||||
{
|
{
|
||||||
var pType = param.ParameterType;
|
var pType = param.ParameterType;
|
||||||
|
|
||||||
if (pType.IsByRef && pType.HasElementType)
|
if (pType.IsByRef && !pType.IsPrimitive && pType != typeof(string))
|
||||||
|
{
|
||||||
|
if (pType.IsArray || pType.Name.Contains("Array"))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
pType = pType.GetElementType();
|
pType = pType.GetElementType();
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (pType.IsPrimitive || pType == typeof(string))
|
if (pType != null && (pType.IsPrimitive || pType == typeof(string)))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,7 @@ namespace UnityExplorer.Inspectors.Reflection
|
|||||||
}
|
}
|
||||||
else if (MemInfo is PropertyInfo pi)
|
else if (MemInfo is PropertyInfo pi)
|
||||||
{
|
{
|
||||||
if (pi.GetAccessors()[0].IsStatic)
|
if (pi.GetAccessors(true)[0].IsStatic)
|
||||||
{
|
{
|
||||||
isStatic = true;
|
isStatic = true;
|
||||||
memberColor = SyntaxColors.Prop_Static;
|
memberColor = SyntaxColors.Prop_Static;
|
||||||
|
@ -9,7 +9,7 @@ using UnityExplorer.UI.Shared;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using UnityExplorer.UI;
|
using UnityExplorer.UI;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using TMPro;
|
//using TMPro;
|
||||||
|
|
||||||
namespace UnityExplorer.Inspectors
|
namespace UnityExplorer.Inspectors
|
||||||
{
|
{
|
||||||
@ -23,9 +23,9 @@ namespace UnityExplorer.Inspectors
|
|||||||
// all cached members of the target
|
// all cached members of the target
|
||||||
internal CacheMember[] m_allMembers;
|
internal CacheMember[] m_allMembers;
|
||||||
// filtered members based on current filters
|
// filtered members based on current filters
|
||||||
internal CacheMember[] m_membersFiltered;
|
//internal CacheMember[] m_membersFiltered;
|
||||||
// actual shortlist of displayed members
|
// actual shortlist of displayed members
|
||||||
internal CacheMember[] m_membersShortlist;
|
//internal CacheMember[] m_membersShortlist;
|
||||||
|
|
||||||
// UI members
|
// UI members
|
||||||
|
|
||||||
@ -36,16 +36,20 @@ namespace UnityExplorer.Inspectors
|
|||||||
set => m_content = value;
|
set => m_content = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal PageHandler m_pageHandler;
|
//internal PageHandler m_pageHandler;
|
||||||
|
|
||||||
// Blacklists
|
// Blacklists
|
||||||
private static readonly HashSet<string> s_typeAndMemberBlacklist = new HashSet<string>
|
private static readonly HashSet<string> s_typeAndMemberBlacklist = new HashSet<string>
|
||||||
{
|
{
|
||||||
|
// these cause a crash
|
||||||
"Type.DeclaringMethod",
|
"Type.DeclaringMethod",
|
||||||
"Rigidbody2D.Cast",
|
"Rigidbody2D.Cast",
|
||||||
|
"Collider2D.Cast",
|
||||||
|
"Collider2D.Raycast",
|
||||||
};
|
};
|
||||||
private static readonly HashSet<string> s_methodStartsWithBlacklist = new HashSet<string>
|
private static readonly HashSet<string> s_methodStartsWithBlacklist = new HashSet<string>
|
||||||
{
|
{
|
||||||
|
// these are redundant
|
||||||
"get_",
|
"get_",
|
||||||
"set_",
|
"set_",
|
||||||
};
|
};
|
||||||
@ -136,16 +140,24 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
// check blacklisted members
|
// check blacklisted members
|
||||||
var sig = $"{member.DeclaringType.Name}.{member.Name}";
|
var sig = $"{member.DeclaringType.Name}.{member.Name}";
|
||||||
if (s_typeAndMemberBlacklist.Any(it => it == sig))
|
|
||||||
|
if (s_typeAndMemberBlacklist.Any(it => sig.Contains(it)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (s_methodStartsWithBlacklist.Any(it => member.Name.StartsWith(it)))
|
if (s_methodStartsWithBlacklist.Any(it => member.Name.StartsWith(it)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (mi != null)
|
if (mi != null)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
AppendParams(mi.GetParameters());
|
AppendParams(mi.GetParameters());
|
||||||
}
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
ExplorerCore.Log(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (pi != null)
|
else if (pi != null)
|
||||||
{
|
{
|
||||||
AppendParams(pi.GetIndexParameters());
|
AppendParams(pi.GetIndexParameters());
|
||||||
@ -194,7 +206,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
m_allMembers = list.ToArray();
|
m_allMembers = list.ToArray();
|
||||||
|
|
||||||
ExplorerCore.Log("Cached " + m_allMembers.Length + " members");
|
// ExplorerCore.Log("Cached " + m_allMembers.Length + " members");
|
||||||
}
|
}
|
||||||
|
|
||||||
#region UI CONSTRUCTION
|
#region UI CONSTRUCTION
|
||||||
@ -243,8 +255,8 @@ namespace UnityExplorer.Inspectors
|
|||||||
typeLabelTextLayout.flexibleWidth = 0;
|
typeLabelTextLayout.flexibleWidth = 0;
|
||||||
typeLabelTextLayout.minHeight = 25;
|
typeLabelTextLayout.minHeight = 25;
|
||||||
|
|
||||||
var typeLabelInputObj = UIFactory.CreateTMPInput(typeRowObj, 14, 0, (int)TextAlignmentOptions.MidlineLeft);
|
var typeLabelInputObj = UIFactory.CreateInputField(typeRowObj);
|
||||||
var typeLabelInput = typeLabelInputObj.GetComponent<TMP_InputField>();
|
var typeLabelInput = typeLabelInputObj.GetComponent<InputField>();
|
||||||
typeLabelInput.readOnly = true;
|
typeLabelInput.readOnly = true;
|
||||||
var typeLabelLayout = typeLabelInputObj.AddComponent<LayoutElement>();
|
var typeLabelLayout = typeLabelInputObj.AddComponent<LayoutElement>();
|
||||||
typeLabelLayout.minWidth = 150;
|
typeLabelLayout.minWidth = 150;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using UnityExplorer.Unstrip;
|
using UnityExplorer.Unstrip;
|
||||||
using TMPro;
|
//using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Config;
|
using UnityExplorer.Config;
|
||||||
@ -19,7 +19,7 @@ namespace UnityExplorer.UI.PageModel
|
|||||||
|
|
||||||
internal static readonly List<string> s_preInitMessages = new List<string>();
|
internal static readonly List<string> s_preInitMessages = new List<string>();
|
||||||
|
|
||||||
private TMP_InputField m_textInput;
|
private InputField m_textInput;
|
||||||
|
|
||||||
public DebugConsole(GameObject parent)
|
public DebugConsole(GameObject parent)
|
||||||
{
|
{
|
||||||
@ -98,7 +98,7 @@ namespace UnityExplorer.UI.PageModel
|
|||||||
logAreaLayout.preferredHeight = 190;
|
logAreaLayout.preferredHeight = 190;
|
||||||
logAreaLayout.flexibleHeight = 0;
|
logAreaLayout.flexibleHeight = 0;
|
||||||
|
|
||||||
var inputObj = UIFactory.CreateTMPInput(logAreaObj);
|
var inputObj = UIFactory.CreateInputField(logAreaObj, 14, 0, 1);
|
||||||
|
|
||||||
var mainInputGroup = inputObj.GetComponent<VerticalLayoutGroup>();
|
var mainInputGroup = inputObj.GetComponent<VerticalLayoutGroup>();
|
||||||
mainInputGroup.padding.left = 8;
|
mainInputGroup.padding.left = 8;
|
||||||
@ -125,23 +125,24 @@ namespace UnityExplorer.UI.PageModel
|
|||||||
scrollColors.normalColor = new Color(0.5f, 0.5f, 0.5f, 1.0f);
|
scrollColors.normalColor = new Color(0.5f, 0.5f, 0.5f, 1.0f);
|
||||||
scroller.colors = scrollColors;
|
scroller.colors = scrollColors;
|
||||||
|
|
||||||
var tmpInput = inputObj.GetComponent<TMP_InputField>();
|
var tmpInput = inputObj.GetComponent<InputField>();
|
||||||
tmpInput.scrollSensitivity = 15;
|
//tmpInput.scrollSensitivity = 15;
|
||||||
tmpInput.verticalScrollbar = scroller;
|
//tmpInput.verticalScrollbar = scroller;
|
||||||
|
tmpInput.readOnly = true;
|
||||||
|
|
||||||
if (UIManager.ConsoleFont != null)
|
if (UIManager.ConsoleFont != null)
|
||||||
{
|
{
|
||||||
tmpInput.textComponent.font = UIManager.ConsoleFont;
|
tmpInput.textComponent.font = UIManager.ConsoleFont;
|
||||||
#if MONO
|
#if MONO
|
||||||
(tmpInput.placeholder as TextMeshProUGUI).font = UIManager.ConsoleFont;
|
(tmpInput.placeholder as Text).font = UIManager.ConsoleFont;
|
||||||
#else
|
#else
|
||||||
tmpInput.placeholder.TryCast<TextMeshProUGUI>().font = UIManager.ConsoleFont;
|
tmpInput.placeholder.TryCast<Text>().font = UIManager.ConsoleFont;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
tmpInput.readOnly = true;
|
tmpInput.readOnly = true;
|
||||||
|
|
||||||
m_textInput = inputObj.GetComponent<TMP_InputField>();
|
m_textInput = inputObj.GetComponent<InputField>();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using TMPro;
|
//using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Config;
|
using UnityExplorer.Config;
|
||||||
@ -14,10 +14,10 @@ namespace UnityExplorer.UI.PageModel
|
|||||||
{
|
{
|
||||||
public override string Name => "Options";
|
public override string Name => "Options";
|
||||||
|
|
||||||
private TMP_InputField m_keycodeInput;
|
private InputField m_keycodeInput;
|
||||||
private Toggle m_unlockMouseToggle;
|
private Toggle m_unlockMouseToggle;
|
||||||
private TMP_InputField m_pageLimitInput;
|
private InputField m_pageLimitInput;
|
||||||
private TMP_InputField m_defaultOutputInput;
|
private InputField m_defaultOutputInput;
|
||||||
|
|
||||||
public override void Init()
|
public override void Init()
|
||||||
{
|
{
|
||||||
@ -138,12 +138,12 @@ namespace UnityExplorer.UI.PageModel
|
|||||||
labelLayout.minWidth = 150;
|
labelLayout.minWidth = 150;
|
||||||
labelLayout.minHeight = 25;
|
labelLayout.minHeight = 25;
|
||||||
|
|
||||||
var keycodeInputObj = UIFactory.CreateTMPInput(rowObj, 14, 0, (int)TextAlignmentOptions.MidlineLeft);
|
var keycodeInputObj = UIFactory.CreateInputField(rowObj);
|
||||||
|
|
||||||
m_keycodeInput = keycodeInputObj.GetComponent<TMP_InputField>();
|
m_keycodeInput = keycodeInputObj.GetComponent<InputField>();
|
||||||
m_keycodeInput.text = ModConfig.Instance.Main_Menu_Toggle.ToString();
|
m_keycodeInput.text = ModConfig.Instance.Main_Menu_Toggle.ToString();
|
||||||
|
|
||||||
m_keycodeInput.placeholder.gameObject.GetComponent<TextMeshProUGUI>().text = "KeyCode, eg. F7";
|
m_keycodeInput.placeholder.gameObject.GetComponent<Text>().text = "KeyCode, eg. F7";
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void ConstructMouseUnlockOpt(GameObject parent)
|
internal void ConstructMouseUnlockOpt(GameObject parent)
|
||||||
@ -197,12 +197,12 @@ namespace UnityExplorer.UI.PageModel
|
|||||||
labelLayout.minWidth = 150;
|
labelLayout.minWidth = 150;
|
||||||
labelLayout.minHeight = 25;
|
labelLayout.minHeight = 25;
|
||||||
|
|
||||||
var inputObj = UIFactory.CreateTMPInput(rowObj, 14, 0, (int)TextAlignmentOptions.MidlineLeft);
|
var inputObj = UIFactory.CreateInputField(rowObj);
|
||||||
|
|
||||||
m_pageLimitInput = inputObj.GetComponent<TMP_InputField>();
|
m_pageLimitInput = inputObj.GetComponent<InputField>();
|
||||||
m_pageLimitInput.text = ModConfig.Instance.Default_Page_Limit.ToString();
|
m_pageLimitInput.text = ModConfig.Instance.Default_Page_Limit.ToString();
|
||||||
|
|
||||||
m_pageLimitInput.placeholder.gameObject.GetComponent<TextMeshProUGUI>().text = "Integer, eg. 20";
|
m_pageLimitInput.placeholder.gameObject.GetComponent<Text>().text = "Integer, eg. 20";
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void ConstructOutputPathOpt(GameObject parent)
|
internal void ConstructOutputPathOpt(GameObject parent)
|
||||||
@ -228,12 +228,12 @@ namespace UnityExplorer.UI.PageModel
|
|||||||
labelLayout.minWidth = 150;
|
labelLayout.minWidth = 150;
|
||||||
labelLayout.minHeight = 25;
|
labelLayout.minHeight = 25;
|
||||||
|
|
||||||
var inputObj = UIFactory.CreateTMPInput(rowObj, 14, 0, (int)TextAlignmentOptions.MidlineLeft);
|
var inputObj = UIFactory.CreateInputField(rowObj);
|
||||||
|
|
||||||
m_defaultOutputInput = inputObj.GetComponent<TMP_InputField>();
|
m_defaultOutputInput = inputObj.GetComponent<InputField>();
|
||||||
m_defaultOutputInput.text = ModConfig.Instance.Default_Output_Path.ToString();
|
m_defaultOutputInput.text = ModConfig.Instance.Default_Output_Path.ToString();
|
||||||
|
|
||||||
m_defaultOutputInput.placeholder.gameObject.GetComponent<TextMeshProUGUI>().text = @"Directory, eg. Mods\UnityExplorer";
|
m_defaultOutputInput.placeholder.gameObject.GetComponent<Text>().text = @"Directory, eg. Mods\UnityExplorer";
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using TMPro;
|
//using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
@ -51,9 +51,9 @@ namespace UnityExplorer.UI.PageModel
|
|||||||
private Text m_resultCountText;
|
private Text m_resultCountText;
|
||||||
|
|
||||||
internal SearchContext m_context;
|
internal SearchContext m_context;
|
||||||
private TMP_InputField m_customTypeInput;
|
private InputField m_customTypeInput;
|
||||||
|
|
||||||
private TMP_InputField m_nameInput;
|
private InputField m_nameInput;
|
||||||
|
|
||||||
private Button m_selectedContextButton;
|
private Button m_selectedContextButton;
|
||||||
private readonly Dictionary<SearchContext, Button> m_contextButtons = new Dictionary<SearchContext, Button>();
|
private readonly Dictionary<SearchContext, Button> m_contextButtons = new Dictionary<SearchContext, Button>();
|
||||||
@ -94,11 +94,15 @@ namespace UnityExplorer.UI.PageModel
|
|||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
{
|
{
|
||||||
// todo update scene filter options
|
|
||||||
if (HaveScenesChanged())
|
if (HaveScenesChanged())
|
||||||
{
|
{
|
||||||
RefreshSceneDropdown();
|
RefreshSceneDropdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_customTypeInput.isFocused && m_context != SearchContext.Custom)
|
||||||
|
{
|
||||||
|
OnContextButtonClicked(SearchContext.Custom);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Updating result list content
|
// Updating result list content
|
||||||
@ -480,20 +484,20 @@ namespace UnityExplorer.UI.PageModel
|
|||||||
|
|
||||||
// custom type input
|
// custom type input
|
||||||
|
|
||||||
var customTypeObj = UIFactory.CreateTMPInput(contextRowObj, 13, 0, (int)TextAlignmentOptions.MidlineLeft);
|
var customTypeObj = UIFactory.CreateInputField(contextRowObj);
|
||||||
var customTypeLayout = customTypeObj.AddComponent<LayoutElement>();
|
var customTypeLayout = customTypeObj.AddComponent<LayoutElement>();
|
||||||
customTypeLayout.minWidth = 250;
|
customTypeLayout.minWidth = 250;
|
||||||
customTypeLayout.flexibleWidth = 2000;
|
customTypeLayout.flexibleWidth = 2000;
|
||||||
customTypeLayout.minHeight = 25;
|
customTypeLayout.minHeight = 25;
|
||||||
customTypeLayout.flexibleHeight = 0;
|
customTypeLayout.flexibleHeight = 0;
|
||||||
m_customTypeInput = customTypeObj.GetComponent<TMP_InputField>();
|
m_customTypeInput = customTypeObj.GetComponent<InputField>();
|
||||||
m_customTypeInput.placeholder.gameObject.GetComponent<TextMeshProUGUI>().text = "eg. UnityEngine.Texture2D, etc...";
|
m_customTypeInput.placeholder.gameObject.GetComponent<Text>().text = "eg. UnityEngine.Texture2D, etc...";
|
||||||
m_customTypeInput.onFocusSelectAll = true;
|
//m_customTypeInput.onFocusSelectAll = true;
|
||||||
#if MONO
|
//#if MONO
|
||||||
m_customTypeInput.onSelect.AddListener((string val) => { OnContextButtonClicked(SearchContext.Custom); });
|
// m_customTypeInput.onSelect.AddListener((string val) => { OnContextButtonClicked(SearchContext.Custom); });
|
||||||
#else
|
//#else
|
||||||
m_customTypeInput.onSelect.AddListener(new Action<string>((string val) => { OnContextButtonClicked(SearchContext.Custom); }));
|
// m_customTypeInput.onSelect.AddListener(new Action<string>((string val) => { OnContextButtonClicked(SearchContext.Custom); }));
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
// search input
|
// search input
|
||||||
|
|
||||||
@ -515,8 +519,8 @@ namespace UnityExplorer.UI.PageModel
|
|||||||
nameLabelLayout.minWidth = 125;
|
nameLabelLayout.minWidth = 125;
|
||||||
nameLabelLayout.minHeight = 25;
|
nameLabelLayout.minHeight = 25;
|
||||||
|
|
||||||
var nameInputObj = UIFactory.CreateTMPInput(nameRowObj, 14, 0, (int)TextAlignmentOptions.MidlineLeft);
|
var nameInputObj = UIFactory.CreateInputField(nameRowObj);
|
||||||
m_nameInput = nameInputObj.GetComponent<TMP_InputField>();
|
m_nameInput = nameInputObj.GetComponent<InputField>();
|
||||||
//m_nameInput.placeholder.gameObject.GetComponent<TextMeshProUGUI>().text = "";
|
//m_nameInput.placeholder.gameObject.GetComponent<TextMeshProUGUI>().text = "";
|
||||||
var nameInputLayout = nameInputObj.AddComponent<LayoutElement>();
|
var nameInputLayout = nameInputObj.AddComponent<LayoutElement>();
|
||||||
nameInputLayout.minWidth = 150;
|
nameInputLayout.minWidth = 150;
|
||||||
|
@ -336,20 +336,22 @@ namespace UnityExplorer.UI
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string path = ExplorerCore.EXPLORER_FOLDER + @"\cursor.png";
|
//string path = ExplorerCore.EXPLORER_FOLDER + @"\cursor.png";
|
||||||
byte[] data = File.ReadAllBytes(path);
|
//byte[] data = File.ReadAllBytes(path);
|
||||||
|
|
||||||
Texture2D tex = new Texture2D(32, 32);
|
//Texture2D tex = new Texture2D(32, 32);
|
||||||
tex.LoadImage(data, false);
|
//tex.LoadImage(data, false);
|
||||||
UnityEngine.Object.DontDestroyOnLoad(tex);
|
//UnityEngine.Object.DontDestroyOnLoad(tex);
|
||||||
|
|
||||||
Sprite sprite = UIManager.CreateSprite(tex, new Rect(0, 0, 32, 32));
|
//Sprite sprite = UIManager.CreateSprite(tex, new Rect(0, 0, 32, 32));
|
||||||
UnityEngine.Object.DontDestroyOnLoad(sprite);
|
//UnityEngine.Object.DontDestroyOnLoad(sprite);
|
||||||
|
|
||||||
|
var sprite = UIManager.ResizeCursor;
|
||||||
|
|
||||||
m_resizeCursorImage = new GameObject("ResizeCursorImage");
|
m_resizeCursorImage = new GameObject("ResizeCursorImage");
|
||||||
m_resizeCursorImage.transform.SetParent(UIManager.CanvasRoot.transform);
|
m_resizeCursorImage.transform.SetParent(UIManager.CanvasRoot.transform);
|
||||||
|
|
||||||
Image image = m_resizeCursorImage.AddComponent<Image>();
|
Image image = m_resizeCursorImage.AddGraphic<Image>();
|
||||||
image.sprite = sprite;
|
image.sprite = sprite;
|
||||||
RectTransform rect = image.transform.GetComponent<RectTransform>();
|
RectTransform rect = image.transform.GetComponent<RectTransform>();
|
||||||
rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 32);
|
rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 32);
|
||||||
|
@ -35,6 +35,17 @@ public class SliderScrollbar
|
|||||||
this.m_slider.Set(1f, false);
|
this.m_slider.Set(1f, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal bool CheckDestroyed()
|
||||||
|
{
|
||||||
|
if (!m_slider || !m_scrollbar)
|
||||||
|
{
|
||||||
|
Instances.Remove(this);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
internal void Update()
|
internal void Update()
|
||||||
{
|
{
|
||||||
this.RefreshVisibility();
|
this.RefreshVisibility();
|
||||||
@ -42,11 +53,8 @@ public class SliderScrollbar
|
|||||||
|
|
||||||
internal void RefreshVisibility()
|
internal void RefreshVisibility()
|
||||||
{
|
{
|
||||||
if (!m_slider || !m_scrollbar)
|
if (!m_slider.gameObject.activeInHierarchy)
|
||||||
{
|
|
||||||
Instances.Remove(this);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
bool shouldShow = !Mathf.Approximately(this.m_scrollbar.size, 1);
|
bool shouldShow = !Mathf.Approximately(this.m_scrollbar.size, 1);
|
||||||
var obj = this.m_slider.handleRect.gameObject;
|
var obj = this.m_slider.handleRect.gameObject;
|
||||||
@ -85,7 +93,7 @@ public class SliderScrollbar
|
|||||||
GameObject handleSlideAreaObj = UIFactory.CreateUIObject("Handle Slide Area", sliderObj);
|
GameObject handleSlideAreaObj = UIFactory.CreateUIObject("Handle Slide Area", sliderObj);
|
||||||
GameObject handleObj = UIFactory.CreateUIObject("Handle", handleSlideAreaObj);
|
GameObject handleObj = UIFactory.CreateUIObject("Handle", handleSlideAreaObj);
|
||||||
|
|
||||||
Image bgImage = bgObj.AddComponent<Image>();
|
Image bgImage = bgObj.AddGraphic<Image>();
|
||||||
bgImage.type = Image.Type.Sliced;
|
bgImage.type = Image.Type.Sliced;
|
||||||
bgImage.color = new Color(0.05f, 0.05f, 0.05f, 1.0f);
|
bgImage.color = new Color(0.05f, 0.05f, 0.05f, 1.0f);
|
||||||
|
|
||||||
@ -101,7 +109,7 @@ public class SliderScrollbar
|
|||||||
fillAreaRect.anchoredPosition = new Vector2(-5f, 0f);
|
fillAreaRect.anchoredPosition = new Vector2(-5f, 0f);
|
||||||
fillAreaRect.sizeDelta = new Vector2(-20f, 0f);
|
fillAreaRect.sizeDelta = new Vector2(-20f, 0f);
|
||||||
|
|
||||||
Image fillImage = fillObj.AddComponent<Image>();
|
Image fillImage = fillObj.AddGraphic<Image>();
|
||||||
fillImage.type = Image.Type.Sliced;
|
fillImage.type = Image.Type.Sliced;
|
||||||
fillImage.color = Color.clear;
|
fillImage.color = Color.clear;
|
||||||
|
|
||||||
@ -114,7 +122,7 @@ public class SliderScrollbar
|
|||||||
handleSlideRect.offsetMax = new Vector2(-15f, 0f);
|
handleSlideRect.offsetMax = new Vector2(-15f, 0f);
|
||||||
handleSlideRect.sizeDelta = new Vector2(-30f, -30f);
|
handleSlideRect.sizeDelta = new Vector2(-30f, -30f);
|
||||||
|
|
||||||
Image handleImage = handleObj.AddComponent<Image>();
|
Image handleImage = handleObj.AddGraphic<Image>();
|
||||||
handleImage.color = new Color(0.5f, 0.5f, 0.5f, 1.0f);
|
handleImage.color = new Color(0.5f, 0.5f, 0.5f, 1.0f);
|
||||||
|
|
||||||
var handleRect = handleObj.GetComponent<RectTransform>();
|
var handleRect = handleObj.GetComponent<RectTransform>();
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using TMPro;
|
//using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ namespace UnityExplorer.UI
|
|||||||
internal static Vector2 thickSize = new Vector2(160f, 30f);
|
internal static Vector2 thickSize = new Vector2(160f, 30f);
|
||||||
internal static Vector2 thinSize = new Vector2(160f, 20f);
|
internal static Vector2 thinSize = new Vector2(160f, 20f);
|
||||||
internal static Color defaultTextColor = new Color(0.95f, 0.95f, 0.95f, 1f);
|
internal static Color defaultTextColor = new Color(0.95f, 0.95f, 0.95f, 1f);
|
||||||
internal static Font m_defaultFont;
|
internal static Font s_defaultFont;
|
||||||
|
|
||||||
public static GameObject CreateUIObject(string name, GameObject parent, Vector2 size = default)
|
public static GameObject CreateUIObject(string name, GameObject parent, Vector2 size = default)
|
||||||
{
|
{
|
||||||
@ -47,16 +47,22 @@ namespace UnityExplorer.UI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static T AddGraphic<T>(this GameObject obj) where T : Graphic
|
||||||
|
{
|
||||||
|
var ret = obj.AddComponent<T>();
|
||||||
|
ret.material = UIManager.UIMaterial;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
private static void SetDefaultTextValues(Text lbl)
|
private static void SetDefaultTextValues(Text lbl)
|
||||||
{
|
{
|
||||||
lbl.color = defaultTextColor;
|
lbl.color = defaultTextColor;
|
||||||
|
|
||||||
if (!m_defaultFont)
|
if (!s_defaultFont)
|
||||||
{
|
s_defaultFont = Resources.GetBuiltinResource<Font>("Arial.ttf");
|
||||||
m_defaultFont = Resources.GetBuiltinResource<Font>("Arial.ttf");
|
|
||||||
}
|
|
||||||
|
|
||||||
lbl.font = m_defaultFont;
|
if (s_defaultFont)
|
||||||
|
lbl.font = s_defaultFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SetDefaultColorTransitionValues(Selectable selectable)
|
public static void SetDefaultColorTransitionValues(Selectable selectable)
|
||||||
@ -99,7 +105,7 @@ namespace UnityExplorer.UI
|
|||||||
rect.anchoredPosition = Vector2.zero;
|
rect.anchoredPosition = Vector2.zero;
|
||||||
rect.sizeDelta = Vector2.zero;
|
rect.sizeDelta = Vector2.zero;
|
||||||
|
|
||||||
Image image = panelObj.AddComponent<Image>();
|
Image image = panelObj.AddGraphic<Image>();
|
||||||
image.type = Image.Type.Filled;
|
image.type = Image.Type.Filled;
|
||||||
image.color = new Color(0.05f, 0.05f, 0.05f);
|
image.color = new Color(0.05f, 0.05f, 0.05f);
|
||||||
|
|
||||||
@ -116,7 +122,7 @@ namespace UnityExplorer.UI
|
|||||||
content = new GameObject("Content");
|
content = new GameObject("Content");
|
||||||
content.transform.parent = panelObj.transform;
|
content.transform.parent = panelObj.transform;
|
||||||
|
|
||||||
Image image2 = content.AddComponent<Image>();
|
Image image2 = content.AddGraphic<Image>();
|
||||||
image2.type = Image.Type.Filled;
|
image2.type = Image.Type.Filled;
|
||||||
image2.color = new Color(0.1f, 0.1f, 0.1f);
|
image2.color = new Color(0.1f, 0.1f, 0.1f);
|
||||||
|
|
||||||
@ -143,7 +149,7 @@ namespace UnityExplorer.UI
|
|||||||
gridGroup.cellSize = cellSize;
|
gridGroup.cellSize = cellSize;
|
||||||
gridGroup.spacing = spacing;
|
gridGroup.spacing = spacing;
|
||||||
|
|
||||||
Image image = groupObj.AddComponent<Image>();
|
Image image = groupObj.AddGraphic<Image>();
|
||||||
if (color != default)
|
if (color != default)
|
||||||
{
|
{
|
||||||
image.color = color;
|
image.color = color;
|
||||||
@ -164,7 +170,7 @@ namespace UnityExplorer.UI
|
|||||||
horiGroup.childAlignment = TextAnchor.UpperLeft;
|
horiGroup.childAlignment = TextAnchor.UpperLeft;
|
||||||
horiGroup.childControlWidth = false;
|
horiGroup.childControlWidth = false;
|
||||||
|
|
||||||
Image image = groupObj.AddComponent<Image>();
|
Image image = groupObj.AddGraphic<Image>();
|
||||||
if (color != default)
|
if (color != default)
|
||||||
{
|
{
|
||||||
image.color = color;
|
image.color = color;
|
||||||
@ -185,7 +191,7 @@ namespace UnityExplorer.UI
|
|||||||
horiGroup.childAlignment = TextAnchor.UpperLeft;
|
horiGroup.childAlignment = TextAnchor.UpperLeft;
|
||||||
horiGroup.childControlWidth = false;
|
horiGroup.childControlWidth = false;
|
||||||
|
|
||||||
Image image = groupObj.AddComponent<Image>();
|
Image image = groupObj.AddGraphic<Image>();
|
||||||
if (color != default)
|
if (color != default)
|
||||||
{
|
{
|
||||||
image.color = color;
|
image.color = color;
|
||||||
@ -198,23 +204,23 @@ namespace UnityExplorer.UI
|
|||||||
return groupObj;
|
return groupObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GameObject CreateTMPLabel(GameObject parent, TextAlignmentOptions alignment)
|
//public static GameObject CreateTMPLabel(GameObject parent, TextAlignmentOptions alignment)
|
||||||
{
|
//{
|
||||||
GameObject labelObj = CreateUIObject("Label", parent, thinSize);
|
// GameObject labelObj = CreateUIObject("Label", parent, thinSize);
|
||||||
|
|
||||||
TextMeshProUGUI text = labelObj.AddComponent<TextMeshProUGUI>();
|
// TextMeshProUGUI text = labelObj.AddGraphic<TextMeshProUGUI>();
|
||||||
|
|
||||||
text.alignment = alignment;
|
// text.alignment = alignment;
|
||||||
text.richText = true;
|
// text.richText = true;
|
||||||
|
|
||||||
return labelObj;
|
// return labelObj;
|
||||||
}
|
//}
|
||||||
|
|
||||||
public static GameObject CreateLabel(GameObject parent, TextAnchor alignment)
|
public static GameObject CreateLabel(GameObject parent, TextAnchor alignment)
|
||||||
{
|
{
|
||||||
GameObject labelObj = CreateUIObject("Label", parent, thinSize);
|
GameObject labelObj = CreateUIObject("Label", parent, thinSize);
|
||||||
|
|
||||||
Text text = labelObj.AddComponent<Text>();
|
Text text = labelObj.AddGraphic<Text>();
|
||||||
SetDefaultTextValues(text);
|
SetDefaultTextValues(text);
|
||||||
text.alignment = alignment;
|
text.alignment = alignment;
|
||||||
text.supportRichText = true;
|
text.supportRichText = true;
|
||||||
@ -230,7 +236,7 @@ namespace UnityExplorer.UI
|
|||||||
textObj.AddComponent<RectTransform>();
|
textObj.AddComponent<RectTransform>();
|
||||||
SetParentAndAlign(textObj, buttonObj);
|
SetParentAndAlign(textObj, buttonObj);
|
||||||
|
|
||||||
Image image = buttonObj.AddComponent<Image>();
|
Image image = buttonObj.AddGraphic<Image>();
|
||||||
image.type = Image.Type.Sliced;
|
image.type = Image.Type.Sliced;
|
||||||
image.color = new Color(1, 1, 1, 0.75f);
|
image.color = new Color(1, 1, 1, 0.75f);
|
||||||
|
|
||||||
@ -244,7 +250,7 @@ namespace UnityExplorer.UI
|
|||||||
btn.colors = colors;
|
btn.colors = colors;
|
||||||
}
|
}
|
||||||
|
|
||||||
Text text = textObj.AddComponent<Text>();
|
Text text = textObj.AddGraphic<Text>();
|
||||||
text.text = "Button";
|
text.text = "Button";
|
||||||
SetDefaultTextValues(text);
|
SetDefaultTextValues(text);
|
||||||
text.alignment = TextAnchor.MiddleCenter;
|
text.alignment = TextAnchor.MiddleCenter;
|
||||||
@ -267,7 +273,7 @@ namespace UnityExplorer.UI
|
|||||||
GameObject handleSlideAreaObj = CreateUIObject("Handle Slide Area", sliderObj);
|
GameObject handleSlideAreaObj = CreateUIObject("Handle Slide Area", sliderObj);
|
||||||
GameObject handleObj = CreateUIObject("Handle", handleSlideAreaObj);
|
GameObject handleObj = CreateUIObject("Handle", handleSlideAreaObj);
|
||||||
|
|
||||||
Image bgImage = bgObj.AddComponent<Image>();
|
Image bgImage = bgObj.AddGraphic<Image>();
|
||||||
bgImage.type = Image.Type.Sliced;
|
bgImage.type = Image.Type.Sliced;
|
||||||
bgImage.color = new Color(0.15f, 0.15f, 0.15f, 1.0f);
|
bgImage.color = new Color(0.15f, 0.15f, 0.15f, 1.0f);
|
||||||
|
|
||||||
@ -282,7 +288,7 @@ namespace UnityExplorer.UI
|
|||||||
fillAreaRect.anchoredPosition = new Vector2(-5f, 0f);
|
fillAreaRect.anchoredPosition = new Vector2(-5f, 0f);
|
||||||
fillAreaRect.sizeDelta = new Vector2(-20f, 0f);
|
fillAreaRect.sizeDelta = new Vector2(-20f, 0f);
|
||||||
|
|
||||||
Image fillImage = fillObj.AddComponent<Image>();
|
Image fillImage = fillObj.AddGraphic<Image>();
|
||||||
fillImage.type = Image.Type.Sliced;
|
fillImage.type = Image.Type.Sliced;
|
||||||
fillImage.color = new Color(0.3f, 0.3f, 0.3f, 1.0f);
|
fillImage.color = new Color(0.3f, 0.3f, 0.3f, 1.0f);
|
||||||
|
|
||||||
@ -293,7 +299,7 @@ namespace UnityExplorer.UI
|
|||||||
handleSlideRect.anchorMin = new Vector2(0f, 0f);
|
handleSlideRect.anchorMin = new Vector2(0f, 0f);
|
||||||
handleSlideRect.anchorMax = new Vector2(1f, 1f);
|
handleSlideRect.anchorMax = new Vector2(1f, 1f);
|
||||||
|
|
||||||
Image handleImage = handleObj.AddComponent<Image>();
|
Image handleImage = handleObj.AddGraphic<Image>();
|
||||||
handleImage.color = new Color(0.5f, 0.5f, 0.5f, 1.0f);
|
handleImage.color = new Color(0.5f, 0.5f, 0.5f, 1.0f);
|
||||||
|
|
||||||
handleObj.GetComponent<RectTransform>().sizeDelta = new Vector2(20f, 0f);
|
handleObj.GetComponent<RectTransform>().sizeDelta = new Vector2(20f, 0f);
|
||||||
@ -315,11 +321,11 @@ namespace UnityExplorer.UI
|
|||||||
GameObject slideAreaObj = CreateUIObject("Sliding Area", scrollObj);
|
GameObject slideAreaObj = CreateUIObject("Sliding Area", scrollObj);
|
||||||
GameObject handleObj = CreateUIObject("Handle", slideAreaObj);
|
GameObject handleObj = CreateUIObject("Handle", slideAreaObj);
|
||||||
|
|
||||||
Image scrollImage = scrollObj.AddComponent<Image>();
|
Image scrollImage = scrollObj.AddGraphic<Image>();
|
||||||
scrollImage.type = Image.Type.Sliced;
|
scrollImage.type = Image.Type.Sliced;
|
||||||
scrollImage.color = new Color(0.1f, 0.1f, 0.1f);
|
scrollImage.color = new Color(0.1f, 0.1f, 0.1f);
|
||||||
|
|
||||||
Image handleImage = handleObj.AddComponent<Image>();
|
Image handleImage = handleObj.AddGraphic<Image>();
|
||||||
handleImage.type = Image.Type.Sliced;
|
handleImage.type = Image.Type.Sliced;
|
||||||
handleImage.color = new Color(0.4f, 0.4f, 0.4f);
|
handleImage.color = new Color(0.4f, 0.4f, 0.4f);
|
||||||
|
|
||||||
@ -364,14 +370,14 @@ namespace UnityExplorer.UI
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Image bgImage = bgObj.AddComponent<Image>();
|
Image bgImage = bgObj.AddGraphic<Image>();
|
||||||
bgImage.type = Image.Type.Sliced;
|
bgImage.type = Image.Type.Sliced;
|
||||||
bgImage.color = new Color(0.1f, 0.1f, 0.1f, 1.0f);
|
bgImage.color = new Color(0.1f, 0.1f, 0.1f, 1.0f);
|
||||||
|
|
||||||
Image checkImage = checkObj.AddComponent<Image>();
|
Image checkImage = checkObj.AddGraphic<Image>();
|
||||||
checkImage.color = new Color(90f / 255f, 115f / 255f, 90f / 255f, 1.0f);
|
checkImage.color = new Color(90f / 255f, 115f / 255f, 90f / 255f, 1.0f);
|
||||||
|
|
||||||
text = labelObj.AddComponent<Text>();
|
text = labelObj.AddGraphic<Text>();
|
||||||
text.text = "Toggle";
|
text.text = "Toggle";
|
||||||
SetDefaultTextValues(text);
|
SetDefaultTextValues(text);
|
||||||
|
|
||||||
@ -399,24 +405,21 @@ namespace UnityExplorer.UI
|
|||||||
return toggleObj;
|
return toggleObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GameObject CreateTMPInput(GameObject parent, int fontSize = 16, int overflowMode = 0, int alignment = 257)
|
public static GameObject CreateInputField(GameObject parent, int fontSize = 14, int alignment = 3, int wrap = 0)
|
||||||
{
|
{
|
||||||
GameObject mainObj = CreateUIObject("InputField (TMP)", parent);
|
GameObject mainObj = CreateUIObject("InputField", parent);
|
||||||
|
|
||||||
Image mainImage = mainObj.AddComponent<Image>();
|
Image mainImage = mainObj.AddGraphic<Image>();
|
||||||
mainImage.type = Image.Type.Sliced;
|
mainImage.type = Image.Type.Sliced;
|
||||||
mainImage.color = new Color(38f / 255f, 38f / 255f, 38f / 255f, 1.0f);
|
mainImage.color = new Color(38f / 255f, 38f / 255f, 38f / 255f, 1.0f);
|
||||||
|
|
||||||
TMP_InputField mainInput = mainObj.AddComponent<TMP_InputField>();
|
InputField mainInput = mainObj.AddComponent<InputField>();
|
||||||
Navigation nav = mainInput.navigation;
|
Navigation nav = mainInput.navigation;
|
||||||
nav.mode = Navigation.Mode.None;
|
nav.mode = Navigation.Mode.None;
|
||||||
mainInput.navigation = nav;
|
mainInput.navigation = nav;
|
||||||
mainInput.richText = true;
|
mainInput.lineType = InputField.LineType.MultiLineNewline;
|
||||||
mainInput.isRichTextEditingAllowed = true;
|
|
||||||
mainInput.lineType = TMP_InputField.LineType.MultiLineNewline;
|
|
||||||
mainInput.interactable = true;
|
mainInput.interactable = true;
|
||||||
mainInput.transition = Selectable.Transition.ColorTint;
|
mainInput.transition = Selectable.Transition.ColorTint;
|
||||||
mainInput.onFocusSelectAll = false;
|
|
||||||
|
|
||||||
ColorBlock mainColors = mainInput.colors;
|
ColorBlock mainColors = mainInput.colors;
|
||||||
mainColors.normalColor = new Color(1, 1, 1, 1);
|
mainColors.normalColor = new Color(1, 1, 1, 1);
|
||||||
@ -435,21 +438,21 @@ namespace UnityExplorer.UI
|
|||||||
textArea.AddComponent<RectMask2D>();
|
textArea.AddComponent<RectMask2D>();
|
||||||
|
|
||||||
RectTransform textAreaRect = textArea.GetComponent<RectTransform>();
|
RectTransform textAreaRect = textArea.GetComponent<RectTransform>();
|
||||||
textAreaRect.anchorMin = new Vector2(0, 0);
|
textAreaRect.anchorMin = Vector2.zero;
|
||||||
textAreaRect.anchorMax = new Vector2(1, 1);
|
textAreaRect.anchorMax = Vector2.one;
|
||||||
textAreaRect.offsetMin = new Vector2(10, 7);
|
textAreaRect.offsetMin = Vector2.zero;
|
||||||
textAreaRect.offsetMax = new Vector2(10, 6);
|
textAreaRect.offsetMax = Vector2.zero;
|
||||||
|
|
||||||
mainInput.textViewport = textArea.GetComponent<RectTransform>();
|
// mainInput.textViewport = textArea.GetComponent<RectTransform>();
|
||||||
|
|
||||||
GameObject placeHolderObj = CreateUIObject("Placeholder", textArea);
|
GameObject placeHolderObj = CreateUIObject("Placeholder", textArea);
|
||||||
TextMeshProUGUI placeholderText = placeHolderObj.AddComponent<TextMeshProUGUI>();
|
Text placeholderText = placeHolderObj.AddGraphic<Text>();
|
||||||
placeholderText.fontSize = fontSize;
|
SetDefaultTextValues(placeholderText);
|
||||||
placeholderText.fontSizeMax = fontSize;
|
|
||||||
placeholderText.text = "...";
|
placeholderText.text = "...";
|
||||||
placeholderText.color = new Color(0.5f, 0.5f, 0.5f, 1.0f);
|
placeholderText.color = new Color(0.5f, 0.5f, 0.5f, 1.0f);
|
||||||
placeholderText.overflowMode = (TextOverflowModes)overflowMode;
|
placeholderText.horizontalOverflow = (HorizontalWrapMode)wrap;
|
||||||
placeholderText.alignment = (TextAlignmentOptions)alignment;
|
placeholderText.alignment = (TextAnchor)alignment;
|
||||||
|
placeholderText.fontSize = fontSize;
|
||||||
|
|
||||||
RectTransform placeHolderRect = placeHolderObj.GetComponent<RectTransform>();
|
RectTransform placeHolderRect = placeHolderObj.GetComponent<RectTransform>();
|
||||||
placeHolderRect.anchorMin = Vector2.zero;
|
placeHolderRect.anchorMin = Vector2.zero;
|
||||||
@ -464,13 +467,13 @@ namespace UnityExplorer.UI
|
|||||||
mainInput.placeholder = placeholderText;
|
mainInput.placeholder = placeholderText;
|
||||||
|
|
||||||
GameObject inputTextObj = CreateUIObject("Text", textArea);
|
GameObject inputTextObj = CreateUIObject("Text", textArea);
|
||||||
TextMeshProUGUI inputText = inputTextObj.AddComponent<TextMeshProUGUI>();
|
Text inputText = inputTextObj.AddGraphic<Text>();
|
||||||
inputText.fontSize = fontSize;
|
SetDefaultTextValues(inputText);
|
||||||
inputText.fontSizeMax = fontSize;
|
|
||||||
inputText.text = "";
|
inputText.text = "";
|
||||||
inputText.color = new Color(1f, 1f, 1f, 1f);
|
inputText.color = new Color(1f, 1f, 1f, 1f);
|
||||||
inputText.overflowMode = (TextOverflowModes)overflowMode;
|
inputText.horizontalOverflow = (HorizontalWrapMode)wrap;
|
||||||
inputText.alignment = (TextAlignmentOptions)alignment;
|
inputText.alignment = (TextAnchor)alignment;
|
||||||
|
inputText.fontSize = fontSize;
|
||||||
|
|
||||||
RectTransform inputTextRect = inputTextObj.GetComponent<RectTransform>();
|
RectTransform inputTextRect = inputTextObj.GetComponent<RectTransform>();
|
||||||
inputTextRect.anchorMin = Vector2.zero;
|
inputTextRect.anchorMin = Vector2.zero;
|
||||||
@ -487,51 +490,6 @@ namespace UnityExplorer.UI
|
|||||||
return mainObj;
|
return mainObj;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static GameObject CreateInputField(GameObject parent)
|
|
||||||
{
|
|
||||||
GameObject inputObj = CreateUIObject("InputField", parent, thickSize);
|
|
||||||
|
|
||||||
GameObject placeholderObj = CreateUIObject("Placeholder", inputObj);
|
|
||||||
GameObject textObj = CreateUIObject("Text", inputObj);
|
|
||||||
|
|
||||||
Image inputImage = inputObj.AddComponent<Image>();
|
|
||||||
inputImage.type = Image.Type.Sliced;
|
|
||||||
inputImage.color = new Color(0.1f, 0.1f, 0.1f, 1.0f);
|
|
||||||
|
|
||||||
InputField inputField = inputObj.AddComponent<InputField>();
|
|
||||||
SetDefaultColorTransitionValues(inputField);
|
|
||||||
|
|
||||||
Text text = textObj.AddComponent<Text>();
|
|
||||||
text.text = "";
|
|
||||||
text.supportRichText = false;
|
|
||||||
SetDefaultTextValues(text);
|
|
||||||
|
|
||||||
Text placeholderText = placeholderObj.AddComponent<Text>();
|
|
||||||
placeholderText.text = "Enter text...";
|
|
||||||
placeholderText.fontStyle = FontStyle.Italic;
|
|
||||||
Color color = text.color;
|
|
||||||
color.a *= 0.5f;
|
|
||||||
placeholderText.color = color;
|
|
||||||
|
|
||||||
RectTransform textRect = textObj.GetComponent<RectTransform>();
|
|
||||||
textRect.anchorMin = Vector2.zero;
|
|
||||||
textRect.anchorMax = Vector2.one;
|
|
||||||
textRect.sizeDelta = Vector2.zero;
|
|
||||||
textRect.offsetMin = new Vector2(10f, 6f);
|
|
||||||
textRect.offsetMax = new Vector2(-10f, -7f);
|
|
||||||
|
|
||||||
RectTransform placeholderRect = placeholderObj.GetComponent<RectTransform>();
|
|
||||||
placeholderRect.anchorMin = Vector2.zero;
|
|
||||||
placeholderRect.anchorMax = Vector2.one;
|
|
||||||
placeholderRect.sizeDelta = Vector2.zero;
|
|
||||||
placeholderRect.offsetMin = new Vector2(10f, 6f);
|
|
||||||
placeholderRect.offsetMax = new Vector2(-10f, -7f);
|
|
||||||
inputField.textComponent = text;
|
|
||||||
inputField.placeholder = placeholderText;
|
|
||||||
|
|
||||||
return inputObj;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static GameObject CreateDropdown(GameObject parent, out Dropdown dropdown)
|
public static GameObject CreateDropdown(GameObject parent, out Dropdown dropdown)
|
||||||
{
|
{
|
||||||
GameObject dropdownObj = CreateUIObject("Dropdown", parent, thickSize);
|
GameObject dropdownObj = CreateUIObject("Dropdown", parent, thickSize);
|
||||||
@ -557,11 +515,11 @@ namespace UnityExplorer.UI
|
|||||||
scrollRectTransform.pivot = Vector2.one;
|
scrollRectTransform.pivot = Vector2.one;
|
||||||
scrollRectTransform.sizeDelta = new Vector2(scrollRectTransform.sizeDelta.x, 0f);
|
scrollRectTransform.sizeDelta = new Vector2(scrollRectTransform.sizeDelta.x, 0f);
|
||||||
|
|
||||||
Text itemLabelText = itemLabelObj.AddComponent<Text>();
|
Text itemLabelText = itemLabelObj.AddGraphic<Text>();
|
||||||
SetDefaultTextValues(itemLabelText);
|
SetDefaultTextValues(itemLabelText);
|
||||||
itemLabelText.alignment = TextAnchor.MiddleLeft;
|
itemLabelText.alignment = TextAnchor.MiddleLeft;
|
||||||
|
|
||||||
var arrowText = arrowObj.AddComponent<Text>();
|
var arrowText = arrowObj.AddGraphic<Text>();
|
||||||
SetDefaultTextValues(arrowText);
|
SetDefaultTextValues(arrowText);
|
||||||
arrowText.text = "▼";
|
arrowText.text = "▼";
|
||||||
var arrowRect = arrowObj.GetComponent<RectTransform>();
|
var arrowRect = arrowObj.GetComponent<RectTransform>();
|
||||||
@ -570,7 +528,7 @@ namespace UnityExplorer.UI
|
|||||||
arrowRect.sizeDelta = new Vector2(20f, 20f);
|
arrowRect.sizeDelta = new Vector2(20f, 20f);
|
||||||
arrowRect.anchoredPosition = new Vector2(-15f, 0f);
|
arrowRect.anchoredPosition = new Vector2(-15f, 0f);
|
||||||
|
|
||||||
Image itemBgImage = itemBgObj.AddComponent<Image>();
|
Image itemBgImage = itemBgObj.AddGraphic<Image>();
|
||||||
itemBgImage.color = new Color(0.25f, 0.45f, 0.25f, 1.0f);
|
itemBgImage.color = new Color(0.25f, 0.45f, 0.25f, 1.0f);
|
||||||
|
|
||||||
Toggle itemToggle = itemObj.AddComponent<Toggle>();
|
Toggle itemToggle = itemObj.AddComponent<Toggle>();
|
||||||
@ -586,7 +544,7 @@ namespace UnityExplorer.UI
|
|||||||
#else
|
#else
|
||||||
itemToggle.onValueChanged.AddListener((bool val) => { itemToggle.OnDeselect(null); });
|
itemToggle.onValueChanged.AddListener((bool val) => { itemToggle.OnDeselect(null); });
|
||||||
#endif
|
#endif
|
||||||
Image templateImage = templateObj.AddComponent<Image>();
|
Image templateImage = templateObj.AddGraphic<Image>();
|
||||||
templateImage.type = Image.Type.Sliced;
|
templateImage.type = Image.Type.Sliced;
|
||||||
templateImage.color = new Color(0.15f, 0.15f, 0.15f, 1.0f);
|
templateImage.color = new Color(0.15f, 0.15f, 0.15f, 1.0f);
|
||||||
|
|
||||||
@ -602,14 +560,14 @@ namespace UnityExplorer.UI
|
|||||||
|
|
||||||
viewportObj.AddComponent<Mask>().showMaskGraphic = false;
|
viewportObj.AddComponent<Mask>().showMaskGraphic = false;
|
||||||
|
|
||||||
Image viewportImage = viewportObj.AddComponent<Image>();
|
Image viewportImage = viewportObj.AddGraphic<Image>();
|
||||||
viewportImage.type = Image.Type.Sliced;
|
viewportImage.type = Image.Type.Sliced;
|
||||||
|
|
||||||
Text labelText = labelObj.AddComponent<Text>();
|
Text labelText = labelObj.AddGraphic<Text>();
|
||||||
SetDefaultTextValues(labelText);
|
SetDefaultTextValues(labelText);
|
||||||
labelText.alignment = TextAnchor.MiddleLeft;
|
labelText.alignment = TextAnchor.MiddleLeft;
|
||||||
|
|
||||||
Image dropdownImage = dropdownObj.AddComponent<Image>();
|
Image dropdownImage = dropdownObj.AddGraphic<Image>();
|
||||||
dropdownImage.color = new Color(0.2f, 0.2f, 0.2f, 1);
|
dropdownImage.color = new Color(0.2f, 0.2f, 0.2f, 1);
|
||||||
dropdownImage.type = Image.Type.Sliced;
|
dropdownImage.type = Image.Type.Sliced;
|
||||||
|
|
||||||
@ -678,7 +636,7 @@ namespace UnityExplorer.UI
|
|||||||
mainLayout.flexibleWidth = 5000;
|
mainLayout.flexibleWidth = 5000;
|
||||||
mainLayout.flexibleHeight = 5000;
|
mainLayout.flexibleHeight = 5000;
|
||||||
|
|
||||||
Image mainImage = mainObj.AddComponent<Image>();
|
Image mainImage = mainObj.AddGraphic<Image>();
|
||||||
mainImage.type = Image.Type.Filled;
|
mainImage.type = Image.Type.Filled;
|
||||||
mainImage.color = (color == default) ? new Color(0.3f, 0.3f, 0.3f, 1f) : color;
|
mainImage.color = (color == default) ? new Color(0.3f, 0.3f, 0.3f, 1f) : color;
|
||||||
|
|
||||||
@ -691,7 +649,7 @@ namespace UnityExplorer.UI
|
|||||||
viewportRect.sizeDelta = new Vector2(-15.0f, 0.0f);
|
viewportRect.sizeDelta = new Vector2(-15.0f, 0.0f);
|
||||||
viewportRect.offsetMax = new Vector2(-20.0f, 0.0f);
|
viewportRect.offsetMax = new Vector2(-20.0f, 0.0f);
|
||||||
|
|
||||||
viewportObj.AddComponent<Image>().color = Color.white;
|
viewportObj.AddGraphic<Image>().color = Color.white;
|
||||||
viewportObj.AddComponent<Mask>().showMaskGraphic = false;
|
viewportObj.AddComponent<Mask>().showMaskGraphic = false;
|
||||||
|
|
||||||
content = CreateUIObject("Content", viewportObj);
|
content = CreateUIObject("Content", viewportObj);
|
||||||
|
@ -4,7 +4,7 @@ using UnityEngine.UI;
|
|||||||
using UnityExplorer.Inspectors;
|
using UnityExplorer.Inspectors;
|
||||||
using UnityExplorer.UI.PageModel;
|
using UnityExplorer.UI.PageModel;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using TMPro;
|
//using TMPro;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using UnityExplorer.Helpers;
|
using UnityExplorer.Helpers;
|
||||||
#if CPP
|
#if CPP
|
||||||
@ -19,36 +19,29 @@ namespace UnityExplorer.UI
|
|||||||
public static EventSystem EventSys { get; private set; }
|
public static EventSystem EventSys { get; private set; }
|
||||||
public static StandaloneInputModule InputModule { get; private set; }
|
public static StandaloneInputModule InputModule { get; private set; }
|
||||||
|
|
||||||
public static TMP_FontAsset ConsoleFont { get; private set; }
|
internal static Material UIMaterial { get; private set; }
|
||||||
|
internal static Sprite ResizeCursor { get; private set; }
|
||||||
|
internal static Font ConsoleFont { get; private set; }
|
||||||
|
internal static Font DefaultFont { get; private set; }
|
||||||
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
var bundlePath = ExplorerCore.EXPLORER_FOLDER + @"\tmp.bundle";
|
var bundlePath = ExplorerCore.EXPLORER_FOLDER + @"\explorerui.bundle";
|
||||||
if (File.Exists(bundlePath))
|
if (File.Exists(bundlePath))
|
||||||
{
|
{
|
||||||
var bundle = AssetBundle.LoadFromFile(bundlePath);
|
var bundle = AssetBundle.LoadFromFile(bundlePath);
|
||||||
|
|
||||||
bundle.LoadAllAssets();
|
UIMaterial = bundle.LoadAsset<Material>("UIMaterial");
|
||||||
ExplorerCore.Log("Loaded TMP bundle");
|
ResizeCursor = bundle.LoadAsset<Sprite>("cursor");
|
||||||
|
|
||||||
if (TMP_Settings.instance == null)
|
ConsoleFont = bundle.LoadAsset<Font>("CONSOLA");
|
||||||
{
|
DefaultFont = bundle.LoadAsset<Font>("CONSOLA");
|
||||||
var settings = bundle.LoadAsset<TMP_Settings>("TMP Settings");
|
|
||||||
|
|
||||||
#if MONO
|
ExplorerCore.Log("Loaded UI bundle");
|
||||||
typeof(TMP_Settings)
|
|
||||||
.GetField("s_Instance", ReflectionHelpers.CommonFlags)
|
|
||||||
.SetValue(null, settings);
|
|
||||||
#else
|
|
||||||
TMP_Settings.s_Instance = settings;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
ConsoleFont = bundle.LoadAsset<TMP_FontAsset>("CONSOLA SDF");
|
|
||||||
}
|
|
||||||
else if (TMP_Settings.instance == null)
|
|
||||||
{
|
{
|
||||||
ExplorerCore.LogWarning(@"This game does not seem to have the TMP Resources package, and the TMP AssetBundle was not found at 'Mods\UnityExplorer\tmp.bundle\'!");
|
ExplorerCore.LogWarning("Could not find the ExplorerUI Bundle! It should exist at '" + bundlePath + "'");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -107,14 +100,16 @@ namespace UnityExplorer.UI
|
|||||||
PanelDragger.Instance.Update();
|
PanelDragger.Instance.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var slider in SliderScrollbar.Instances)
|
for (int i = 0; i < SliderScrollbar.Instances.Count; i++)
|
||||||
{
|
|
||||||
if (slider.m_slider.gameObject.activeInHierarchy)
|
|
||||||
{
|
{
|
||||||
|
var slider = SliderScrollbar.Instances[i];
|
||||||
|
|
||||||
|
if (slider.CheckDestroyed())
|
||||||
|
i--;
|
||||||
|
else
|
||||||
slider.Update();
|
slider.Update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static GameObject CreateRootCanvas()
|
private static GameObject CreateRootCanvas()
|
||||||
{
|
{
|
||||||
|
@ -108,10 +108,14 @@
|
|||||||
<HintPath>$(MLMonoGameFolder)\MelonLoader\MelonLoader.ModHandler.dll</HintPath>
|
<HintPath>$(MLMonoGameFolder)\MelonLoader\MelonLoader.ModHandler.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Unity.TextMeshPro">
|
<!-- <Reference Include="Unity.TextMeshPro">
|
||||||
<HintPath>$(MLMonoManagedFolder)\Unity.TextMeshPro.dll</HintPath>
|
<HintPath>$(MLMonoManagedFolder)\Unity.TextMeshPro.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.TextCoreModule">
|
||||||
|
<HintPath>$(MLMonoManagedFolder)\UnityEngine.TextCoreModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference> -->
|
||||||
<Reference Include="UnityEngine">
|
<Reference Include="UnityEngine">
|
||||||
<HintPath>$(MLMonoManagedFolder)\UnityEngine.dll</HintPath>
|
<HintPath>$(MLMonoManagedFolder)\UnityEngine.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
@ -124,10 +128,6 @@
|
|||||||
<HintPath>$(MLMonoManagedFolder)\UnityEngine.PhysicsModule.dll</HintPath>
|
<HintPath>$(MLMonoManagedFolder)\UnityEngine.PhysicsModule.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="UnityEngine.TextCoreModule">
|
|
||||||
<HintPath>$(MLMonoManagedFolder)\UnityEngine.TextCoreModule.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.TextRenderingModule">
|
<Reference Include="UnityEngine.TextRenderingModule">
|
||||||
<HintPath>$(MLMonoManagedFolder)\UnityEngine.TextRenderingModule.dll</HintPath>
|
<HintPath>$(MLMonoManagedFolder)\UnityEngine.TextRenderingModule.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
@ -159,10 +159,14 @@
|
|||||||
<HintPath>$(BIEMonoGameFolder)\BepInEx\core\0Harmony.dll</HintPath>
|
<HintPath>$(BIEMonoGameFolder)\BepInEx\core\0Harmony.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Unity.TextMeshPro">
|
<!-- <Reference Include="Unity.TextMeshPro">
|
||||||
<HintPath>$(BIEMonoManagedFolder)\Unity.TextMeshPro.dll</HintPath>
|
<HintPath>$(BIEMonoManagedFolder)\Unity.TextMeshPro.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.TextCoreModule">
|
||||||
|
<HintPath>$(BIEMonoManagedFolder)\UnityEngine.TextCoreModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference> -->
|
||||||
<Reference Include="UnityEngine.AssetBundleModule">
|
<Reference Include="UnityEngine.AssetBundleModule">
|
||||||
<HintPath>$(BIEMonoManagedFolder)\UnityEngine.AssetBundleModule.dll</HintPath>
|
<HintPath>$(BIEMonoManagedFolder)\UnityEngine.AssetBundleModule.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
@ -179,10 +183,6 @@
|
|||||||
<HintPath>$(BIEMonoManagedFolder)\UnityEngine.PhysicsModule.dll</HintPath>
|
<HintPath>$(BIEMonoManagedFolder)\UnityEngine.PhysicsModule.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="UnityEngine.TextCoreModule">
|
|
||||||
<HintPath>$(BIEMonoManagedFolder)\UnityEngine.TextCoreModule.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.TextRenderingModule">
|
<Reference Include="UnityEngine.TextRenderingModule">
|
||||||
<HintPath>$(BIEMonoManagedFolder)\UnityEngine.TextRenderingModule.dll</HintPath>
|
<HintPath>$(BIEMonoManagedFolder)\UnityEngine.TextRenderingModule.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
@ -222,10 +222,14 @@
|
|||||||
<HintPath>$(MLCppGameFolder)\MelonLoader\Managed\Il2CppSystem.Core.dll</HintPath>
|
<HintPath>$(MLCppGameFolder)\MelonLoader\Managed\Il2CppSystem.Core.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Unity.TextMeshPro">
|
<!-- <Reference Include="Unity.TextMeshPro">
|
||||||
<HintPath>$(MLCppGameFolder)\MelonLoader\Managed\Unity.TextMeshPro.dll</HintPath>
|
<HintPath>$(MLCppGameFolder)\MelonLoader\Managed\Unity.TextMeshPro.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.TextCoreModule">
|
||||||
|
<HintPath>$(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.TextCoreModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference> -->
|
||||||
<Reference Include="UnityEngine">
|
<Reference Include="UnityEngine">
|
||||||
<HintPath>$(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.dll</HintPath>
|
<HintPath>$(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
@ -238,10 +242,6 @@
|
|||||||
<HintPath>$(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.PhysicsModule.dll</HintPath>
|
<HintPath>$(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.PhysicsModule.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="UnityEngine.TextCoreModule">
|
|
||||||
<HintPath>$(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.TextCoreModule.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.TextRenderingModule">
|
<Reference Include="UnityEngine.TextRenderingModule">
|
||||||
<HintPath>$(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
|
<HintPath>$(MLCppGameFolder)\MelonLoader\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
@ -285,10 +285,14 @@
|
|||||||
<HintPath>$(BIECppGameFolder)\BepInEx\unhollowed\Il2CppSystem.Core.dll</HintPath>
|
<HintPath>$(BIECppGameFolder)\BepInEx\unhollowed\Il2CppSystem.Core.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Unity.TextMeshPro">
|
<!-- <Reference Include="Unity.TextMeshPro">
|
||||||
<HintPath>$(BIECppGameFolder)\BepInEx\unhollowed\Unity.TextMeshPro.dll</HintPath>
|
<HintPath>$(BIECppGameFolder)\BepInEx\unhollowed\Unity.TextMeshPro.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="UnityEngine.TextCoreModule">
|
||||||
|
<HintPath>$(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.TextCoreModule.dll</HintPath>
|
||||||
|
<Private>False</Private>
|
||||||
|
</Reference> -->
|
||||||
<Reference Include="UnityEngine">
|
<Reference Include="UnityEngine">
|
||||||
<HintPath>$(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.dll</HintPath>
|
<HintPath>$(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
@ -301,10 +305,6 @@
|
|||||||
<HintPath>$(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.PhysicsModule.dll</HintPath>
|
<HintPath>$(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.PhysicsModule.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="UnityEngine.TextCoreModule">
|
|
||||||
<HintPath>$(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.TextCoreModule.dll</HintPath>
|
|
||||||
<Private>False</Private>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="UnityEngine.TextRenderingModule">
|
<Reference Include="UnityEngine.TextRenderingModule">
|
||||||
<HintPath>$(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.TextRenderingModule.dll</HintPath>
|
<HintPath>$(BIECppGameFolder)\BepInEx\unhollowed\UnityEngine.TextRenderingModule.dll</HintPath>
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
@ -338,9 +338,9 @@
|
|||||||
<Compile Include="ExplorerMelonMod.cs" />
|
<Compile Include="ExplorerMelonMod.cs" />
|
||||||
<Compile Include="Helpers\ReflectionHelpers.cs" />
|
<Compile Include="Helpers\ReflectionHelpers.cs" />
|
||||||
<Compile Include="Helpers\UnityHelpers.cs" />
|
<Compile Include="Helpers\UnityHelpers.cs" />
|
||||||
<Compile Include="Inspectors\GameObject\ChildList.cs" />
|
<Compile Include="Inspectors\GameObjects\ChildList.cs" />
|
||||||
<Compile Include="Inspectors\GameObject\ComponentList.cs" />
|
<Compile Include="Inspectors\GameObjects\ComponentList.cs" />
|
||||||
<Compile Include="Inspectors\GameObject\GameObjectControls.cs" />
|
<Compile Include="Inspectors\GameObjects\GameObjectControls.cs" />
|
||||||
<Compile Include="UI\ForceUnlockCursor.cs" />
|
<Compile Include="UI\ForceUnlockCursor.cs" />
|
||||||
<Compile Include="Input\IHandleInput.cs" />
|
<Compile Include="Input\IHandleInput.cs" />
|
||||||
<Compile Include="Tests\Tests.cs" />
|
<Compile Include="Tests\Tests.cs" />
|
||||||
|
@ -39,6 +39,10 @@ namespace UnityExplorer.Unstrip
|
|||||||
{
|
{
|
||||||
var iCall = ICallHelper.GetICall<d_LoadAssetWithSubAssets_Internal>("UnityEngine.AssetBundle::LoadAssetWithSubAssets_Internal");
|
var iCall = ICallHelper.GetICall<d_LoadAssetWithSubAssets_Internal>("UnityEngine.AssetBundle::LoadAssetWithSubAssets_Internal");
|
||||||
var ptr = iCall.Invoke(m_bundlePtr, IL2CPP.ManagedStringToIl2Cpp(""), Il2CppType.Of<UnityEngine.Object>().Pointer);
|
var ptr = iCall.Invoke(m_bundlePtr, IL2CPP.ManagedStringToIl2Cpp(""), Il2CppType.Of<UnityEngine.Object>().Pointer);
|
||||||
|
|
||||||
|
if (ptr == IntPtr.Zero)
|
||||||
|
return new UnityEngine.Object[0];
|
||||||
|
|
||||||
return new Il2CppReferenceArray<UnityEngine.Object>(ptr);
|
return new Il2CppReferenceArray<UnityEngine.Object>(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -50,6 +54,10 @@ namespace UnityExplorer.Unstrip
|
|||||||
{
|
{
|
||||||
var iCall = ICallHelper.GetICall<d_LoadAsset_Internal>("UnityEngine.AssetBundle::LoadAsset_Internal");
|
var iCall = ICallHelper.GetICall<d_LoadAsset_Internal>("UnityEngine.AssetBundle::LoadAsset_Internal");
|
||||||
var ptr = iCall.Invoke(m_bundlePtr, IL2CPP.ManagedStringToIl2Cpp(name), Il2CppType.Of<T>().Pointer);
|
var ptr = iCall.Invoke(m_bundlePtr, IL2CPP.ManagedStringToIl2Cpp(name), Il2CppType.Of<T>().Pointer);
|
||||||
|
|
||||||
|
if (ptr == IntPtr.Zero)
|
||||||
|
return null;
|
||||||
|
|
||||||
return new UnityEngine.Object(ptr).TryCast<T>();
|
return new UnityEngine.Object(ptr).TryCast<T>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user