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