Fix vertices overflow on debug console, move UISyntaxHighlight

This commit is contained in:
sinaioutlander 2020-11-13 23:37:04 +11:00
parent eb693eceb5
commit 7a4c7eb498
3 changed files with 13 additions and 6 deletions

View File

@ -29,6 +29,7 @@ namespace UnityExplorer.UI.Modules
internal static readonly List<string> s_preInitMessages = new List<string>();
private InputField m_textInput;
internal const int MAX_TEXT_LEN = 10000;
public DebugConsole(GameObject parent)
{
@ -102,7 +103,15 @@ namespace UnityExplorer.UI.Modules
message = $"<color=#{hexColor}>{message}</color>";
if (Instance?.m_textInput)
Instance.m_textInput.text = $"{message}\n{Instance.m_textInput.text}";
{
var input = Instance.m_textInput;
var wanted = $"{message}\n{input.text}";
if (wanted.Length > MAX_TEXT_LEN)
wanted = wanted.Substring(0, MAX_TEXT_LEN);
input.text = wanted;
}
else
s_preInitMessages.Add(message);
}

View File

@ -4,7 +4,7 @@ using System.Reflection;
using UnityEngine;
using UnityExplorer.Unstrip;
namespace UnityExplorer.UI.Shared
namespace UnityExplorer.UI
{
public class UISyntaxHighlight
{
@ -47,9 +47,7 @@ namespace UnityExplorer.UI.Shared
{
string ret = "";
if (type.IsGenericParameter
|| type.GetGenericArguments().Any(it => it.IsGenericParameter)
|| (type.HasElementType && type.GetElementType().IsGenericParameter))
if (type.IsGenericParameter || (type.HasElementType && type.GetElementType().IsGenericParameter))
{
ret = $"<color={Enum}>{type.Name}</color>";
}

View File

@ -379,7 +379,7 @@
<Compile Include="UI\Shared\InputFieldScroller.cs" />
<Compile Include="UI\Shared\SliderScrollbar.cs" />
<Compile Include="UI\Shared\PageHandler.cs" />
<Compile Include="UI\Shared\UISyntaxHighlight.cs" />
<Compile Include="UI\UISyntaxHighlight.cs" />
<Compile Include="UI\UIManager.cs" />
<Compile Include="Unstrip\AssetBundleUnstrip.cs" />
<Compile Include="Unstrip\ColorUtilityUnstrip.cs" />