mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-01-06 01:23:31 +08:00
DebugConsole save log on quit, some work on CacheObjects, fix missing-material issue on games without default UI Shader
This commit is contained in:
parent
668c8f7c3f
commit
dc449d4a1e
@ -20,6 +20,7 @@ namespace UnityExplorer.Config
|
|||||||
public int Default_Page_Limit = 25;
|
public int Default_Page_Limit = 25;
|
||||||
public string Default_Output_Path = ExplorerCore.EXPLORER_FOLDER;
|
public string Default_Output_Path = ExplorerCore.EXPLORER_FOLDER;
|
||||||
public bool Log_Unity_Debug = false;
|
public bool Log_Unity_Debug = false;
|
||||||
|
public bool Save_Logs_To_Disk = true;
|
||||||
|
|
||||||
public static event Action OnConfigChanged;
|
public static event Action OnConfigChanged;
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ using HarmonyLib;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using UnityExplorer.UI.Modules;
|
||||||
#if CPP
|
#if CPP
|
||||||
using UnhollowerRuntimeLib;
|
using UnhollowerRuntimeLib;
|
||||||
using BepInEx.IL2CPP;
|
using BepInEx.IL2CPP;
|
||||||
@ -46,6 +47,10 @@ namespace UnityExplorer
|
|||||||
ExplorerCore.Update();
|
ExplorerCore.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal void OnApplicationQuit()
|
||||||
|
{
|
||||||
|
DebugConsole.OnQuit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -108,7 +113,11 @@ namespace UnityExplorer
|
|||||||
lastSceneName = scene.name;
|
lastSceneName = scene.name;
|
||||||
DoSceneChange(scene, scene);
|
DoSceneChange(scene, scene);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal void OnApplicationQuit()
|
||||||
|
{
|
||||||
|
DebugConsole.OnQuit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ namespace UnityExplorer
|
|||||||
}
|
}
|
||||||
public static bool m_showMenu;
|
public static bool m_showMenu;
|
||||||
|
|
||||||
private static bool m_doneUIInit;
|
private static bool s_doneUIInit;
|
||||||
private static float m_timeSinceStartup;
|
private static float m_timeSinceStartup;
|
||||||
|
|
||||||
public ExplorerCore()
|
public ExplorerCore()
|
||||||
@ -92,25 +92,20 @@ namespace UnityExplorer
|
|||||||
|
|
||||||
public static void Update()
|
public static void Update()
|
||||||
{
|
{
|
||||||
if (!m_doneUIInit)
|
if (!s_doneUIInit)
|
||||||
CheckUIInit();
|
CheckUIInit();
|
||||||
|
|
||||||
if (MouseInspector.Enabled)
|
if (MouseInspector.Enabled)
|
||||||
{
|
|
||||||
MouseInspector.UpdateInspect();
|
MouseInspector.UpdateInspect();
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (InputManager.GetKeyDown(ModConfig.Instance.Main_Menu_Toggle))
|
if (InputManager.GetKeyDown(ModConfig.Instance.Main_Menu_Toggle))
|
||||||
ShowMenu = !ShowMenu;
|
ShowMenu = !ShowMenu;
|
||||||
|
|
||||||
if (ShowMenu)
|
if (ShowMenu && s_doneUIInit)
|
||||||
{
|
|
||||||
//ForceUnlockCursor.Update();
|
|
||||||
UIManager.Update();
|
UIManager.Update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private static void CheckUIInit()
|
private static void CheckUIInit()
|
||||||
{
|
{
|
||||||
@ -118,7 +113,7 @@ namespace UnityExplorer
|
|||||||
|
|
||||||
if (m_timeSinceStartup > 0.1f)
|
if (m_timeSinceStartup > 0.1f)
|
||||||
{
|
{
|
||||||
m_doneUIInit = true;
|
s_doneUIInit = true;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
UIManager.Init();
|
UIManager.Init();
|
||||||
@ -203,5 +198,16 @@ namespace UnityExplorer
|
|||||||
ExplorerBepInPlugin.Logging?.LogError(message?.ToString());
|
ExplorerBepInPlugin.Logging?.LogError(message?.ToString());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static string RemoveInvalidFilenameChars(string s)
|
||||||
|
{
|
||||||
|
var invalid = System.IO.Path.GetInvalidFileNameChars();
|
||||||
|
foreach (var c in invalid)
|
||||||
|
{
|
||||||
|
s = s.Replace(c.ToString(), "");
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#if ML
|
#if ML
|
||||||
using MelonLoader;
|
using MelonLoader;
|
||||||
|
using UnityExplorer.UI.Modules;
|
||||||
|
|
||||||
namespace UnityExplorer
|
namespace UnityExplorer
|
||||||
{
|
{
|
||||||
@ -24,6 +25,11 @@ namespace UnityExplorer
|
|||||||
ExplorerCore.Update();
|
ExplorerCore.Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void OnApplicationQuit()
|
||||||
|
{
|
||||||
|
DebugConsole.OnQuit();
|
||||||
|
}
|
||||||
|
|
||||||
//public override void OnGUI()
|
//public override void OnGUI()
|
||||||
//{
|
//{
|
||||||
// ExplorerCore.OnGUI();
|
// ExplorerCore.OnGUI();
|
||||||
|
@ -167,7 +167,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
titleLayout.minHeight = 30;
|
titleLayout.minHeight = 30;
|
||||||
titleLayout.flexibleHeight = 0;
|
titleLayout.flexibleHeight = 0;
|
||||||
titleLayout.minWidth = 90;
|
titleLayout.minWidth = 90;
|
||||||
titleLayout.flexibleWidth = 0;
|
titleLayout.flexibleWidth = 20000;
|
||||||
|
|
||||||
ConstructToolbar(topRowObj);
|
ConstructToolbar(topRowObj);
|
||||||
|
|
||||||
@ -222,84 +222,84 @@ namespace UnityExplorer.Inspectors
|
|||||||
invisGroup.padding.right = 2;
|
invisGroup.padding.right = 2;
|
||||||
invisGroup.spacing = 10;
|
invisGroup.spacing = 10;
|
||||||
|
|
||||||
// time scale group
|
// // time scale group
|
||||||
|
|
||||||
var timeGroupObj = UIFactory.CreateHorizontalGroup(invisObj, new Color(1, 1, 1, 0));
|
// var timeGroupObj = UIFactory.CreateHorizontalGroup(invisObj, new Color(1, 1, 1, 0));
|
||||||
var timeGroup = timeGroupObj.GetComponent<HorizontalLayoutGroup>();
|
// var timeGroup = timeGroupObj.GetComponent<HorizontalLayoutGroup>();
|
||||||
timeGroup.childForceExpandWidth = false;
|
// timeGroup.childForceExpandWidth = false;
|
||||||
timeGroup.childControlWidth = true;
|
// timeGroup.childControlWidth = true;
|
||||||
timeGroup.childForceExpandHeight = false;
|
// timeGroup.childForceExpandHeight = false;
|
||||||
timeGroup.childControlHeight = true;
|
// timeGroup.childControlHeight = true;
|
||||||
timeGroup.padding.top = 2;
|
// timeGroup.padding.top = 2;
|
||||||
timeGroup.padding.left = 5;
|
// timeGroup.padding.left = 5;
|
||||||
timeGroup.padding.right = 2;
|
// timeGroup.padding.right = 2;
|
||||||
timeGroup.padding.bottom = 2;
|
// timeGroup.padding.bottom = 2;
|
||||||
timeGroup.spacing = 5;
|
// timeGroup.spacing = 5;
|
||||||
timeGroup.childAlignment = TextAnchor.MiddleCenter;
|
// timeGroup.childAlignment = TextAnchor.MiddleCenter;
|
||||||
var timeGroupLayout = timeGroupObj.AddComponent<LayoutElement>();
|
// var timeGroupLayout = timeGroupObj.AddComponent<LayoutElement>();
|
||||||
timeGroupLayout.minWidth = 100;
|
// timeGroupLayout.minWidth = 100;
|
||||||
timeGroupLayout.flexibleWidth = 300;
|
// timeGroupLayout.flexibleWidth = 300;
|
||||||
timeGroupLayout.minHeight = 25;
|
// timeGroupLayout.minHeight = 25;
|
||||||
timeGroupLayout.flexibleHeight = 0;
|
// timeGroupLayout.flexibleHeight = 0;
|
||||||
|
|
||||||
// time scale title
|
// // time scale title
|
||||||
|
|
||||||
var timeTitleObj = UIFactory.CreateLabel(timeGroupObj, TextAnchor.MiddleLeft);
|
// var timeTitleObj = UIFactory.CreateLabel(timeGroupObj, TextAnchor.MiddleLeft);
|
||||||
var timeTitle = timeTitleObj.GetComponent<Text>();
|
// var timeTitle = timeTitleObj.GetComponent<Text>();
|
||||||
timeTitle.text = "Time Scale:";
|
// timeTitle.text = "Time Scale:";
|
||||||
timeTitle.color = new Color(21f / 255f, 192f / 255f, 235f / 255f);
|
// timeTitle.color = new Color(21f / 255f, 192f / 255f, 235f / 255f);
|
||||||
var titleLayout = timeTitleObj.AddComponent<LayoutElement>();
|
// var titleLayout = timeTitleObj.AddComponent<LayoutElement>();
|
||||||
titleLayout.minHeight = 25;
|
// titleLayout.minHeight = 25;
|
||||||
titleLayout.minWidth = 80;
|
// titleLayout.minWidth = 80;
|
||||||
titleLayout.flexibleHeight = 0;
|
// titleLayout.flexibleHeight = 0;
|
||||||
timeTitle.horizontalOverflow = HorizontalWrapMode.Overflow;
|
// timeTitle.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||||||
|
|
||||||
// actual active time label
|
// // actual active time label
|
||||||
|
|
||||||
var timeLabelObj = UIFactory.CreateLabel(timeGroupObj, TextAnchor.MiddleLeft);
|
// var timeLabelObj = UIFactory.CreateLabel(timeGroupObj, TextAnchor.MiddleLeft);
|
||||||
var timeLabelLayout = timeLabelObj.AddComponent<LayoutElement>();
|
// var timeLabelLayout = timeLabelObj.AddComponent<LayoutElement>();
|
||||||
timeLabelLayout.minWidth = 40;
|
// timeLabelLayout.minWidth = 40;
|
||||||
timeLabelLayout.minHeight = 25;
|
// timeLabelLayout.minHeight = 25;
|
||||||
timeLabelLayout.flexibleHeight = 0;
|
// timeLabelLayout.flexibleHeight = 0;
|
||||||
|
|
||||||
// todo make static and update
|
// // todo make static and update
|
||||||
var s_timeText = timeLabelObj.GetComponent<Text>();
|
// var s_timeText = timeLabelObj.GetComponent<Text>();
|
||||||
s_timeText.text = Time.timeScale.ToString("F1");
|
// s_timeText.text = Time.timeScale.ToString("F1");
|
||||||
|
|
||||||
// time scale input
|
// // time scale input
|
||||||
|
|
||||||
var timeInputObj = UIFactory.CreateInputField(timeGroupObj);
|
// var timeInputObj = UIFactory.CreateInputField(timeGroupObj);
|
||||||
var timeInput = timeInputObj.GetComponent<InputField>();
|
// var timeInput = timeInputObj.GetComponent<InputField>();
|
||||||
timeInput.characterValidation = 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;
|
||||||
timeInputLayout.minHeight = 25;
|
// timeInputLayout.minHeight = 25;
|
||||||
timeInputLayout.flexibleHeight = 0;
|
// timeInputLayout.flexibleHeight = 0;
|
||||||
|
|
||||||
// time scale apply button
|
// // time scale apply button
|
||||||
|
|
||||||
var applyBtnObj = UIFactory.CreateButton(timeGroupObj);
|
// var applyBtnObj = UIFactory.CreateButton(timeGroupObj);
|
||||||
var applyBtn = applyBtnObj.GetComponent<Button>();
|
// var applyBtn = applyBtnObj.GetComponent<Button>();
|
||||||
#if MONO
|
//#if MONO
|
||||||
applyBtn.onClick.AddListener(SetTimeScale);
|
// applyBtn.onClick.AddListener(SetTimeScale);
|
||||||
#else
|
//#else
|
||||||
applyBtn.onClick.AddListener(new Action(SetTimeScale));
|
// applyBtn.onClick.AddListener(new Action(SetTimeScale));
|
||||||
#endif
|
//#endif
|
||||||
var applyText = applyBtnObj.GetComponentInChildren<Text>();
|
// var applyText = applyBtnObj.GetComponentInChildren<Text>();
|
||||||
applyText.text = "Apply";
|
// applyText.text = "Apply";
|
||||||
applyText.fontSize = 14;
|
// applyText.fontSize = 14;
|
||||||
var applyLayout = applyBtnObj.AddComponent<LayoutElement>();
|
// var applyLayout = applyBtnObj.AddComponent<LayoutElement>();
|
||||||
applyLayout.minWidth = 50;
|
// applyLayout.minWidth = 50;
|
||||||
applyLayout.minHeight = 25;
|
// applyLayout.minHeight = 25;
|
||||||
applyLayout.flexibleHeight = 0;
|
// applyLayout.flexibleHeight = 0;
|
||||||
|
|
||||||
void SetTimeScale()
|
// void SetTimeScale()
|
||||||
{
|
// {
|
||||||
var scale = float.Parse(timeInput.text);
|
// var scale = float.Parse(timeInput.text);
|
||||||
Time.timeScale = scale;
|
// Time.timeScale = scale;
|
||||||
s_timeText.text = Time.timeScale.ToString("F1");
|
// s_timeText.text = Time.timeScale.ToString("F1");
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
// inspect under mouse button
|
// inspect under mouse button
|
||||||
|
@ -21,8 +21,11 @@ namespace UnityExplorer.Inspectors.Reflection
|
|||||||
|
|
||||||
public virtual bool IsStatic { get; private set; }
|
public virtual bool IsStatic { get; private set; }
|
||||||
|
|
||||||
public override bool HasParameters => m_arguments != null && m_arguments.Length > 0;
|
|
||||||
public override bool IsMember => true;
|
public override bool IsMember => true;
|
||||||
|
|
||||||
|
public override bool HasParameters => ParamCount > 0;
|
||||||
|
public virtual int ParamCount => m_arguments.Length;
|
||||||
|
|
||||||
public override bool HasEvaluated => m_evaluated;
|
public override bool HasEvaluated => m_evaluated;
|
||||||
|
|
||||||
public string RichTextName => m_richTextName ?? GetRichTextName();
|
public string RichTextName => m_richTextName ?? GetRichTextName();
|
||||||
@ -47,12 +50,8 @@ namespace UnityExplorer.Inspectors.Reflection
|
|||||||
|
|
||||||
public override void UpdateValue()
|
public override void UpdateValue()
|
||||||
{
|
{
|
||||||
if (HasParameters && !m_isEvaluating)
|
if (!HasParameters || m_isEvaluating)
|
||||||
{
|
{
|
||||||
// need to enter args first
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
#if CPP
|
#if CPP
|
||||||
@ -60,7 +59,6 @@ namespace UnityExplorer.Inspectors.Reflection
|
|||||||
throw new Exception("Type not supported with Reflection");
|
throw new Exception("Type not supported with Reflection");
|
||||||
#endif
|
#endif
|
||||||
UpdateReflection();
|
UpdateReflection();
|
||||||
|
|
||||||
#if CPP
|
#if CPP
|
||||||
if (IValue.Value != null)
|
if (IValue.Value != null)
|
||||||
IValue.Value = IValue.Value.Il2CppCast(ReflectionHelpers.GetActualType(IValue.Value));
|
IValue.Value = IValue.Value.Il2CppCast(ReflectionHelpers.GetActualType(IValue.Value));
|
||||||
@ -70,6 +68,7 @@ namespace UnityExplorer.Inspectors.Reflection
|
|||||||
{
|
{
|
||||||
ReflectionException = ReflectionHelpers.ExceptionToString(e, true);
|
ReflectionException = ReflectionHelpers.ExceptionToString(e, true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
base.UpdateValue();
|
base.UpdateValue();
|
||||||
}
|
}
|
||||||
@ -227,7 +226,7 @@ namespace UnityExplorer.Inspectors.Reflection
|
|||||||
internal RectTransform m_topRowRect;
|
internal RectTransform m_topRowRect;
|
||||||
internal LayoutElement m_leftLayout;
|
internal LayoutElement m_leftLayout;
|
||||||
internal LayoutElement m_rightLayout;
|
internal LayoutElement m_rightLayout;
|
||||||
//internal GameObject m_subGroup;
|
internal GameObject m_subContent;
|
||||||
|
|
||||||
internal override void ConstructUI()
|
internal override void ConstructUI()
|
||||||
{
|
{
|
||||||
@ -272,7 +271,7 @@ namespace UnityExplorer.Inspectors.Reflection
|
|||||||
leftRect.offsetMax = Vector2.zero;
|
leftRect.offsetMax = Vector2.zero;
|
||||||
leftRect.sizeDelta = Vector2.zero;
|
leftRect.sizeDelta = Vector2.zero;
|
||||||
m_leftLayout = labelObj.AddComponent<LayoutElement>();
|
m_leftLayout = labelObj.AddComponent<LayoutElement>();
|
||||||
m_leftLayout.preferredWidth = 225;
|
m_leftLayout.preferredWidth = 125;
|
||||||
m_leftLayout.minHeight = 25;
|
m_leftLayout.minHeight = 25;
|
||||||
m_leftLayout.flexibleHeight = 100;
|
m_leftLayout.flexibleHeight = 100;
|
||||||
var labelFitter = labelObj.AddComponent<ContentSizeFitter>();
|
var labelFitter = labelObj.AddComponent<ContentSizeFitter>();
|
||||||
@ -284,50 +283,78 @@ namespace UnityExplorer.Inspectors.Reflection
|
|||||||
|
|
||||||
// right group
|
// right group
|
||||||
|
|
||||||
m_rightGroup = UIFactory.CreateHorizontalGroup(topGroupObj, new Color(1, 1, 1, 0));
|
m_rightGroup = UIFactory.CreateVerticalGroup(topGroupObj, new Color(1, 1, 1, 0));
|
||||||
m_rightLayout = m_rightGroup.AddComponent<LayoutElement>();
|
m_rightLayout = m_rightGroup.AddComponent<LayoutElement>();
|
||||||
m_rightLayout.minHeight = 25;
|
m_rightLayout.minHeight = 25;
|
||||||
m_rightLayout.flexibleHeight = 480;
|
m_rightLayout.flexibleHeight = 480;
|
||||||
m_rightLayout.minWidth = 300;
|
m_rightLayout.minWidth = 125;
|
||||||
m_rightLayout.flexibleWidth = 5000;
|
m_rightLayout.flexibleWidth = 5000;
|
||||||
var rightGroup = m_rightGroup.GetComponent<HorizontalLayoutGroup>();
|
var rightGroup = m_rightGroup.GetComponent<VerticalLayoutGroup>();
|
||||||
rightGroup.childForceExpandHeight = false;
|
rightGroup.childForceExpandHeight = true;
|
||||||
rightGroup.childForceExpandWidth = true;
|
rightGroup.childForceExpandWidth = false;
|
||||||
rightGroup.childControlHeight = true;
|
rightGroup.childControlHeight = true;
|
||||||
rightGroup.childControlWidth = true;
|
rightGroup.childControlWidth = true;
|
||||||
rightGroup.spacing = 4;
|
rightGroup.spacing = 4;
|
||||||
|
|
||||||
// todo check for HasParameters, etc
|
// evaluate button
|
||||||
|
if (this is CacheMethod || HasParameters)
|
||||||
if (!HasParameters && IsMember)
|
|
||||||
{
|
{
|
||||||
//var refreshBtnObj = UIFactory.CreateButton(topRowObj, new Color(0.3f, 0.3f, 0.3f));
|
var color = HasParameters ? new Color(0.4f, 0.4f, 0.4f) : new Color(0.3f, 0.6f, 0.3f);
|
||||||
//var btnLayout = refreshBtnObj.AddComponent<LayoutElement>();
|
|
||||||
//btnLayout.minWidth = 30;
|
var evalButtonObj = UIFactory.CreateButton(m_rightGroup, color);
|
||||||
//btnLayout.minHeight = 20;
|
var evalLayout = evalButtonObj.AddComponent<LayoutElement>();
|
||||||
//btnLayout.flexibleWidth = 0;
|
evalLayout.minWidth = 100;
|
||||||
//var refreshTxt = refreshBtnObj.GetComponentInChildren<Text>();
|
evalLayout.minHeight = 22;
|
||||||
//refreshTxt.text = "⟳";
|
evalLayout.flexibleWidth = 0;
|
||||||
//refreshTxt.fontSize = 16;
|
var evalText = evalButtonObj.GetComponentInChildren<Text>();
|
||||||
//var refreshBtn = refreshBtnObj.GetComponent<Button>();
|
evalText.text = HasParameters
|
||||||
//refreshBtn.onClick.AddListener(() => { ExplorerCore.Log("todo Update!"); });
|
? $"Evaluate ({ParamCount})"
|
||||||
|
: "Evaluate";
|
||||||
|
|
||||||
|
var evalButton = evalButtonObj.GetComponent<Button>();
|
||||||
|
var colors = evalButton.colors;
|
||||||
|
colors.highlightedColor = new Color(0.4f, 0.7f, 0.4f);
|
||||||
|
evalButton.colors = colors;
|
||||||
|
#if CPP
|
||||||
|
evalButton.onClick.AddListener(new Action(OnMainEvaluateButton));
|
||||||
|
#else
|
||||||
|
evalButton.onClick.AddListener(OnMainEvaluateButton);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void OnMainEvaluateButton()
|
||||||
|
{
|
||||||
|
if (HasParameters)
|
||||||
|
{
|
||||||
|
// todo show parameter input
|
||||||
|
ExplorerCore.Log("TODO params");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// method with no parameters
|
||||||
|
(this as CacheMethod).Evaluate();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IValue.ConstructUI(m_rightGroup);
|
// subcontent
|
||||||
|
|
||||||
// todo subcontent
|
// todo check if IValue actually has subcontent
|
||||||
|
|
||||||
//m_subContent = UIFactory.CreateHorizontalGroup(m_parentContent, new Color(1, 1, 1, 0));
|
m_subContent = UIFactory.CreateHorizontalGroup(m_parentContent, new Color(1, 1, 1, 0));
|
||||||
//var subGroup = m_subContent.GetComponent<HorizontalLayoutGroup>();
|
var subGroup = m_subContent.GetComponent<HorizontalLayoutGroup>();
|
||||||
//subGroup.childForceExpandWidth = true;
|
subGroup.childForceExpandWidth = true;
|
||||||
//subGroup.childControlWidth = true;
|
subGroup.childControlWidth = true;
|
||||||
//var subLayout = m_subContent.AddComponent<LayoutElement>();
|
var subLayout = m_subContent.AddComponent<LayoutElement>();
|
||||||
//subLayout.minHeight = 25;
|
subLayout.minHeight = 50;
|
||||||
//subLayout.flexibleHeight = 500;
|
subLayout.flexibleHeight = 500;
|
||||||
//subLayout.minWidth = 125;
|
subLayout.minWidth = 125;
|
||||||
//subLayout.flexibleWidth = 9000;
|
subLayout.flexibleWidth = 9000;
|
||||||
|
|
||||||
//m_subContent.SetActive(false);
|
m_subContent.SetActive(false);
|
||||||
|
|
||||||
|
// Construct InteractiveValue UI
|
||||||
|
|
||||||
|
IValue.ConstructUI(m_rightGroup, m_subContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -10,12 +10,14 @@ namespace UnityExplorer.Inspectors.Reflection
|
|||||||
{
|
{
|
||||||
public class CacheMethod : CacheMember
|
public class CacheMethod : CacheMember
|
||||||
{
|
{
|
||||||
private CacheObjectBase m_cachedReturnValue;
|
//private CacheObjectBase m_cachedReturnValue;
|
||||||
|
|
||||||
public override bool HasParameters => base.HasParameters || GenericArgs.Length > 0;
|
public override bool HasParameters => base.HasParameters || GenericArgs.Length > 0;
|
||||||
|
|
||||||
public override bool IsStatic => (MemInfo as MethodInfo).IsStatic;
|
public override bool IsStatic => (MemInfo as MethodInfo).IsStatic;
|
||||||
|
|
||||||
|
public override int ParamCount => base.ParamCount + m_genericArgInput.Length;
|
||||||
|
|
||||||
public Type[] GenericArgs { get; private set; }
|
public Type[] GenericArgs { get; private set; }
|
||||||
public Type[][] GenericConstraints { get; private set; }
|
public Type[][] GenericConstraints { get; private set; }
|
||||||
|
|
||||||
@ -38,7 +40,7 @@ namespace UnityExplorer.Inspectors.Reflection
|
|||||||
|
|
||||||
public override void UpdateValue()
|
public override void UpdateValue()
|
||||||
{
|
{
|
||||||
// CacheMethod cannot UpdateValue directly. Need to Evaluate.
|
base.UpdateValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void UpdateReflection()
|
public override void UpdateReflection()
|
||||||
@ -74,17 +76,20 @@ namespace UnityExplorer.Inspectors.Reflection
|
|||||||
ReflectionException = ReflectionHelpers.ExceptionToString(e);
|
ReflectionException = ReflectionHelpers.ExceptionToString(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ret != null)
|
IValue.Value = ret;
|
||||||
{
|
IValue.UpdateValue();
|
||||||
//m_cachedReturnValue = CacheFactory.GetTypeAndCacheObject(ret);
|
|
||||||
|
|
||||||
//m_cachedReturnValue = CacheFactory.GetCacheObject(ret);
|
//if (ret != null)
|
||||||
m_cachedReturnValue.UpdateValue();
|
//{
|
||||||
}
|
// //m_cachedReturnValue = CacheFactory.GetTypeAndCacheObject(ret);
|
||||||
else
|
// //m_cachedReturnValue = CacheFactory.GetCacheObject(ret);
|
||||||
{
|
// // m_cachedReturnValue.UpdateValue();
|
||||||
m_cachedReturnValue = null;
|
|
||||||
}
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// m_cachedReturnValue = null;
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
private MethodInfo MakeGenericMethodFromInput()
|
private MethodInfo MakeGenericMethodFromInput()
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
using UnityExplorer.Helpers;
|
using UnityExplorer.Helpers;
|
||||||
|
|
||||||
namespace UnityExplorer.Inspectors.Reflection
|
namespace UnityExplorer.Inspectors.Reflection
|
||||||
@ -9,17 +10,16 @@ namespace UnityExplorer.Inspectors.Reflection
|
|||||||
|
|
||||||
public InstanceInspector(object target) : base(target)
|
public InstanceInspector(object target) : base(target)
|
||||||
{
|
{
|
||||||
|
// needed?
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update()
|
public void ConstructInstanceHelpers(GameObject parent)
|
||||||
{
|
{
|
||||||
base.Update();
|
// todo
|
||||||
|
|
||||||
if (m_pendingDestroy || InspectorManager.Instance.m_activeInspector != this)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ConstructInstanceFilters(GameObject parent)
|
||||||
|
{
|
||||||
// todo
|
// todo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,9 @@ namespace UnityExplorer.Inspectors.Reflection
|
|||||||
public object Value { get; set; }
|
public object Value { get; set; }
|
||||||
public Type ValueType;
|
public Type ValueType;
|
||||||
|
|
||||||
|
// might not need
|
||||||
|
public virtual bool HasSubContent => false;
|
||||||
|
|
||||||
public string RichTextValue => m_richValue ?? GetRichTextValue();
|
public string RichTextValue => m_richValue ?? GetRichTextValue();
|
||||||
internal string m_richValue;
|
internal string m_richValue;
|
||||||
internal string m_richValueType;
|
internal string m_richValueType;
|
||||||
@ -69,7 +72,6 @@ namespace UnityExplorer.Inspectors.Reflection
|
|||||||
return m_toStringMethod;
|
return m_toStringMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public string GetRichTextValue()
|
public string GetRichTextValue()
|
||||||
{
|
{
|
||||||
if (Value != null)
|
if (Value != null)
|
||||||
@ -77,14 +79,15 @@ namespace UnityExplorer.Inspectors.Reflection
|
|||||||
|
|
||||||
m_richValueType = UISyntaxHighlight.GetHighlight(ValueType, true);
|
m_richValueType = UISyntaxHighlight.GetHighlight(ValueType, true);
|
||||||
|
|
||||||
|
if (OwnerCacheObject is CacheMember cm && !cm.HasEvaluated)
|
||||||
|
return $"<i><color=grey>Not yet evaluated</color> ({m_richValueType})</i>";
|
||||||
|
|
||||||
if (Value == null) return $"<color=grey>null</color> ({m_richValueType})";
|
if (Value == null) return $"<color=grey>null</color> ({m_richValueType})";
|
||||||
|
|
||||||
string label;
|
string label;
|
||||||
|
|
||||||
if (ValueType == typeof(TextAsset))
|
if (ValueType == typeof(TextAsset) && Value is TextAsset textAsset)
|
||||||
{
|
{
|
||||||
var textAsset = Value as TextAsset;
|
|
||||||
|
|
||||||
label = textAsset.text;
|
label = textAsset.text;
|
||||||
|
|
||||||
if (label.Length > 10)
|
if (label.Length > 10)
|
||||||
@ -128,8 +131,9 @@ namespace UnityExplorer.Inspectors.Reflection
|
|||||||
|
|
||||||
internal GameObject m_UIContent;
|
internal GameObject m_UIContent;
|
||||||
internal Text m_text;
|
internal Text m_text;
|
||||||
|
internal GameObject m_subContentParent;
|
||||||
|
|
||||||
public void ConstructUI(GameObject parent)
|
public virtual void ConstructUI(GameObject parent, GameObject subGroup)
|
||||||
{
|
{
|
||||||
m_UIContent = UIFactory.CreateLabel(parent, TextAnchor.MiddleLeft);
|
m_UIContent = UIFactory.CreateLabel(parent, TextAnchor.MiddleLeft);
|
||||||
var mainLayout = m_UIContent.AddComponent<LayoutElement>();
|
var mainLayout = m_UIContent.AddComponent<LayoutElement>();
|
||||||
@ -138,8 +142,7 @@ namespace UnityExplorer.Inspectors.Reflection
|
|||||||
mainLayout.minHeight = 25;
|
mainLayout.minHeight = 25;
|
||||||
m_text = m_UIContent.GetComponent<Text>();
|
m_text = m_UIContent.GetComponent<Text>();
|
||||||
|
|
||||||
GetRichTextValue();
|
m_subContentParent = subGroup;
|
||||||
m_text.text = $"<i><color=grey>Not yet evaluated</color> ({m_richValueType})</i>";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -8,19 +8,7 @@ namespace UnityExplorer.Inspectors.Reflection
|
|||||||
|
|
||||||
public StaticInspector(Type type) : base(type)
|
public StaticInspector(Type type) : base(type)
|
||||||
{
|
{
|
||||||
// TODO
|
// needed?
|
||||||
}
|
|
||||||
|
|
||||||
public override void Update()
|
|
||||||
{
|
|
||||||
base.Update();
|
|
||||||
|
|
||||||
if (m_pendingDestroy || InspectorManager.Instance.m_activeInspector != this)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// todo
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,7 +158,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
RefreshDisplay();
|
RefreshDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RefreshDisplay(bool fast = false)
|
public void RefreshDisplay()
|
||||||
{
|
{
|
||||||
// temp because not doing filtering yet
|
// temp because not doing filtering yet
|
||||||
m_membersFiltered = m_allMembers;
|
m_membersFiltered = m_allMembers;
|
||||||
@ -166,8 +166,6 @@ namespace UnityExplorer.Inspectors
|
|||||||
var members = m_membersFiltered;
|
var members = m_membersFiltered;
|
||||||
m_pageHandler.ListCount = members.Length;
|
m_pageHandler.ListCount = members.Length;
|
||||||
|
|
||||||
if (!fast)
|
|
||||||
{
|
|
||||||
// disable current members
|
// disable current members
|
||||||
for (int i = 0; i < m_displayedMembers.Length; i++)
|
for (int i = 0; i < m_displayedMembers.Length; i++)
|
||||||
{
|
{
|
||||||
@ -177,7 +175,6 @@ namespace UnityExplorer.Inspectors
|
|||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (members.Length < 1)
|
if (members.Length < 1)
|
||||||
return;
|
return;
|
||||||
@ -188,7 +185,6 @@ namespace UnityExplorer.Inspectors
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
CacheMember member = members[itemIndex];
|
CacheMember member = members[itemIndex];
|
||||||
|
|
||||||
m_displayedMembers[itemIndex - m_pageHandler.StartIndex] = member;
|
m_displayedMembers[itemIndex - m_pageHandler.StartIndex] = member;
|
||||||
member.Enable();
|
member.Enable();
|
||||||
}
|
}
|
||||||
@ -211,7 +207,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
labelWidth = width;
|
labelWidth = width;
|
||||||
}
|
}
|
||||||
|
|
||||||
float valueWidth = m_scrollContentRect.rect.width - labelWidth - 10;
|
float valueWidth = m_scrollContentRect.rect.width - labelWidth - 20;
|
||||||
|
|
||||||
foreach (var cache in m_displayedMembers)
|
foreach (var cache in m_displayedMembers)
|
||||||
{
|
{
|
||||||
@ -382,6 +378,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
var typeLabel = UIFactory.CreateLabel(typeRowObj, TextAnchor.MiddleLeft);
|
var typeLabel = UIFactory.CreateLabel(typeRowObj, TextAnchor.MiddleLeft);
|
||||||
var typeLabelText = typeLabel.GetComponent<Text>();
|
var typeLabelText = typeLabel.GetComponent<Text>();
|
||||||
typeLabelText.text = "Type:";
|
typeLabelText.text = "Type:";
|
||||||
|
typeLabelText.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||||||
var typeLabelTextLayout = typeLabel.AddComponent<LayoutElement>();
|
var typeLabelTextLayout = typeLabel.AddComponent<LayoutElement>();
|
||||||
typeLabelTextLayout.minWidth = 60;
|
typeLabelTextLayout.minWidth = 60;
|
||||||
typeLabelTextLayout.flexibleWidth = 0;
|
typeLabelTextLayout.flexibleWidth = 0;
|
||||||
@ -395,15 +392,40 @@ namespace UnityExplorer.Inspectors
|
|||||||
typeLabelLayout.flexibleWidth = 5000;
|
typeLabelLayout.flexibleWidth = 5000;
|
||||||
|
|
||||||
typeLabelInput.text = UISyntaxHighlight.GetHighlight(m_targetType, true);
|
typeLabelInput.text = UISyntaxHighlight.GetHighlight(m_targetType, true);
|
||||||
|
|
||||||
|
// Helper tools
|
||||||
|
|
||||||
|
if (this is InstanceInspector ii)
|
||||||
|
{
|
||||||
|
ii.ConstructInstanceHelpers(Content);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void ConstructFilterArea()
|
internal void ConstructFilterArea()
|
||||||
{
|
{
|
||||||
|
var filterAreaObj = UIFactory.CreateVerticalGroup(Content, new Color(0.1f, 0.1f, 0.1f));
|
||||||
|
var filterLayout = filterAreaObj.AddComponent<LayoutElement>();
|
||||||
|
filterLayout.minHeight = 25;
|
||||||
|
var filterGroup = filterAreaObj.GetComponent<VerticalLayoutGroup>();
|
||||||
|
filterGroup.childForceExpandWidth = true;
|
||||||
|
filterGroup.childForceExpandHeight = false;
|
||||||
|
filterGroup.childControlWidth = true;
|
||||||
|
filterGroup.childControlHeight = true;
|
||||||
|
|
||||||
|
// name filter
|
||||||
|
|
||||||
|
|
||||||
// todo instance inspector has extra filters
|
|
||||||
|
|
||||||
// todo instance inspector "helper tools"
|
// membertype filter
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// Instance filters
|
||||||
|
|
||||||
|
if (this is InstanceInspector ii)
|
||||||
|
{
|
||||||
|
ii.ConstructInstanceFilters(filterAreaObj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void ConstructMemberList()
|
internal void ConstructMemberList()
|
||||||
|
@ -34,7 +34,7 @@ namespace UnityExplorer.Tests
|
|||||||
}
|
}
|
||||||
private static bool m_setOnlyProperty;
|
private static bool m_setOnlyProperty;
|
||||||
|
|
||||||
public Texture2D TestTexture = UIManager.MakeSolidTexture(Color.white, 200, 200);
|
public Texture2D TestTexture;
|
||||||
public static Sprite TestSprite;
|
public static Sprite TestSprite;
|
||||||
|
|
||||||
public static int StaticProperty => 5;
|
public static int StaticProperty => 5;
|
||||||
@ -48,12 +48,13 @@ namespace UnityExplorer.Tests
|
|||||||
public TestClass()
|
public TestClass()
|
||||||
{
|
{
|
||||||
#if CPP
|
#if CPP
|
||||||
|
TestTexture = UIManager.MakeSolidTexture(Color.white, 200, 200);
|
||||||
TestTexture.name = "TestTexture";
|
TestTexture.name = "TestTexture";
|
||||||
|
|
||||||
//var r = new Rect(0, 0, TestTexture.width, TestTexture.height);
|
var r = new Rect(0, 0, TestTexture.width, TestTexture.height);
|
||||||
//var v2 = Vector2.zero;
|
var v2 = Vector2.zero;
|
||||||
//var v4 = Vector4.zero;
|
var v4 = Vector4.zero;
|
||||||
//TestSprite = Sprite.CreateSprite_Injected(TestTexture, ref r, ref v2, 100f, 0u, SpriteMeshType.Tight, ref v4, false);
|
TestSprite = Sprite.CreateSprite_Injected(TestTexture, ref r, ref v2, 100f, 0u, SpriteMeshType.Tight, ref v4, false);
|
||||||
|
|
||||||
GameObject.DontDestroyOnLoad(TestTexture);
|
GameObject.DontDestroyOnLoad(TestTexture);
|
||||||
GameObject.DontDestroyOnLoad(TestSprite);
|
GameObject.DontDestroyOnLoad(TestSprite);
|
||||||
|
@ -6,6 +6,8 @@ using UnityEngine;
|
|||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Config;
|
using UnityExplorer.Config;
|
||||||
using UnityExplorer.UI.Shared;
|
using UnityExplorer.UI.Shared;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Modules
|
namespace UnityExplorer.UI.Modules
|
||||||
{
|
{
|
||||||
@ -14,10 +16,14 @@ namespace UnityExplorer.UI.Modules
|
|||||||
public static DebugConsole Instance { get; private set; }
|
public static DebugConsole Instance { get; private set; }
|
||||||
|
|
||||||
public static bool LogUnity { get; set; } = ModConfig.Instance.Log_Unity_Debug;
|
public static bool LogUnity { get; set; } = ModConfig.Instance.Log_Unity_Debug;
|
||||||
|
public static bool SaveToDisk { get; set; } = ModConfig.Instance.Save_Logs_To_Disk;
|
||||||
|
|
||||||
|
internal static bool m_savedToDiskChecked;
|
||||||
|
|
||||||
public static readonly List<string> AllMessages = new List<string>();
|
public static readonly List<string> AllMessages = new List<string>();
|
||||||
public static readonly List<Text> MessageHolders = new List<Text>();
|
public static readonly List<Text> MessageHolders = new List<Text>();
|
||||||
|
|
||||||
|
// logs that occured before the actual UI was ready.
|
||||||
internal static readonly List<string> s_preInitMessages = new List<string>();
|
internal static readonly List<string> s_preInitMessages = new List<string>();
|
||||||
|
|
||||||
private InputField m_textInput;
|
private InputField m_textInput;
|
||||||
@ -26,9 +32,6 @@ namespace UnityExplorer.UI.Modules
|
|||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
|
|
||||||
//AllMessages = new List<string>();
|
|
||||||
//MessageHolders = new List<Text>();
|
|
||||||
|
|
||||||
ConstructUI(parent);
|
ConstructUI(parent);
|
||||||
|
|
||||||
string preAppend = "";
|
string preAppend = "";
|
||||||
@ -42,6 +45,37 @@ namespace UnityExplorer.UI.Modules
|
|||||||
m_textInput.text = preAppend;
|
m_textInput.text = preAppend;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void OnQuit()
|
||||||
|
{
|
||||||
|
if (m_savedToDiskChecked)
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_savedToDiskChecked = true;
|
||||||
|
|
||||||
|
if (!SaveToDisk)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var path = ExplorerCore.EXPLORER_FOLDER + @"\Logs";
|
||||||
|
|
||||||
|
if (!Directory.Exists(path))
|
||||||
|
Directory.CreateDirectory(path);
|
||||||
|
|
||||||
|
// delete oldest log
|
||||||
|
var files = Directory.GetFiles(path);
|
||||||
|
if (files.Length >= 10)
|
||||||
|
{
|
||||||
|
var sorted = files.ToList();
|
||||||
|
// sort by datetime.ToString will put the oldest one first
|
||||||
|
sorted.Sort();
|
||||||
|
File.Delete(sorted[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
var fileName = "UnityExplorer " + DateTime.Now.ToString("u") + ".txt";
|
||||||
|
fileName = ExplorerCore.RemoveInvalidFilenameChars(fileName);
|
||||||
|
|
||||||
|
File.WriteAllText(path + @"\" + fileName, Instance.m_textInput.text);
|
||||||
|
}
|
||||||
|
|
||||||
public static void Log(string message)
|
public static void Log(string message)
|
||||||
{
|
{
|
||||||
Log(message, null);
|
Log(message, null);
|
||||||
@ -99,43 +133,6 @@ namespace UnityExplorer.UI.Modules
|
|||||||
logAreaLayout.preferredHeight = 190;
|
logAreaLayout.preferredHeight = 190;
|
||||||
logAreaLayout.flexibleHeight = 0;
|
logAreaLayout.flexibleHeight = 0;
|
||||||
|
|
||||||
//var inputObj = UIFactory.CreateInputField(logAreaObj, 14, 0, 1);
|
|
||||||
|
|
||||||
//var mainInputGroup = inputObj.GetComponent<VerticalLayoutGroup>();
|
|
||||||
//mainInputGroup.padding.left = 8;
|
|
||||||
//mainInputGroup.padding.right = 8;
|
|
||||||
//mainInputGroup.padding.top = 5;
|
|
||||||
//mainInputGroup.padding.bottom = 5;
|
|
||||||
|
|
||||||
//var inputLayout = inputObj.AddComponent<LayoutElement>();
|
|
||||||
//inputLayout.preferredWidth = 500;
|
|
||||||
//inputLayout.flexibleWidth = 9999;
|
|
||||||
|
|
||||||
//var inputImage = inputObj.GetComponent<Image>();
|
|
||||||
//inputImage.color = new Color(0.05f, 0.05f, 0.05f, 1.0f);
|
|
||||||
|
|
||||||
//var scroll = UIFactory.CreateScrollbar(logAreaObj);
|
|
||||||
|
|
||||||
//var scrollLayout = scroll.AddComponent<LayoutElement>();
|
|
||||||
//scrollLayout.preferredWidth = 25;
|
|
||||||
//scrollLayout.flexibleWidth = 0;
|
|
||||||
|
|
||||||
//var scroller = scroll.GetComponent<Scrollbar>();
|
|
||||||
//scroller.direction = Scrollbar.Direction.TopToBottom;
|
|
||||||
//var scrollColors = scroller.colors;
|
|
||||||
//scrollColors.normalColor = new Color(0.5f, 0.5f, 0.5f, 1.0f);
|
|
||||||
//scroller.colors = scrollColors;
|
|
||||||
|
|
||||||
//var tmpInput = inputObj.GetComponent<InputField>();
|
|
||||||
//tmpInput.readOnly = true;
|
|
||||||
|
|
||||||
//if (UIManager.ConsoleFont)
|
|
||||||
//{
|
|
||||||
// tmpInput.textComponent.font = UIManager.ConsoleFont;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//tmpInput.readOnly = true;
|
|
||||||
|
|
||||||
var inputScrollerObj = UIFactory.CreateSrollInputField(logAreaObj, out InputFieldScroller inputScroll, 14, new Color(0.05f, 0.05f, 0.05f));
|
var inputScrollerObj = UIFactory.CreateSrollInputField(logAreaObj, out InputFieldScroller inputScroll, 14, new Color(0.05f, 0.05f, 0.05f));
|
||||||
|
|
||||||
inputScroll.inputField.textComponent.font = UIManager.ConsoleFont;
|
inputScroll.inputField.textComponent.font = UIManager.ConsoleFont;
|
||||||
@ -260,7 +257,7 @@ namespace UnityExplorer.UI.Modules
|
|||||||
}
|
}
|
||||||
|
|
||||||
var unityToggleLayout = unityToggleObj.AddComponent<LayoutElement>();
|
var unityToggleLayout = unityToggleObj.AddComponent<LayoutElement>();
|
||||||
unityToggleLayout.minWidth = 200;
|
unityToggleLayout.minWidth = 170;
|
||||||
unityToggleLayout.flexibleWidth = 0;
|
unityToggleLayout.flexibleWidth = 0;
|
||||||
|
|
||||||
var unityToggleRect = unityToggleObj.transform.Find("Background").GetComponent<RectTransform>();
|
var unityToggleRect = unityToggleObj.transform.Find("Background").GetComponent<RectTransform>();
|
||||||
@ -268,7 +265,35 @@ namespace UnityExplorer.UI.Modules
|
|||||||
pos.y = -8;
|
pos.y = -8;
|
||||||
unityToggleRect.localPosition = pos;
|
unityToggleRect.localPosition = pos;
|
||||||
|
|
||||||
#endregion
|
// // Save to disk button
|
||||||
|
|
||||||
|
// var saveToDiskObj = UIFactory.CreateToggle(bottomBarObj, out Toggle diskToggle, out Text diskToggleText);
|
||||||
|
//#if CPP
|
||||||
|
// diskToggle.onValueChanged.AddListener(new Action<bool>(ToggleDisk));
|
||||||
|
//#else
|
||||||
|
// diskToggle.onValueChanged.AddListener(ToggleDisk);
|
||||||
|
//#endif
|
||||||
|
// diskToggle.isOn = SaveToDisk;
|
||||||
|
// diskToggleText.text = "Save logs to 'Mods\\UnityExplorer\\Logs'?";
|
||||||
|
// diskToggleText.alignment = TextAnchor.MiddleLeft;
|
||||||
|
|
||||||
|
// void ToggleDisk(bool val)
|
||||||
|
// {
|
||||||
|
// SaveToDisk = val;
|
||||||
|
// ModConfig.Instance.Save_Logs_To_Disk = val;
|
||||||
|
// ModConfig.SaveSettings();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// var diskToggleLayout = saveToDiskObj.AddComponent<LayoutElement>();
|
||||||
|
// diskToggleLayout.minWidth = 340;
|
||||||
|
// diskToggleLayout.flexibleWidth = 0;
|
||||||
|
|
||||||
|
// var saveToDiskRect = saveToDiskObj.transform.Find("Background").GetComponent<RectTransform>();
|
||||||
|
// pos = unityToggleRect.localPosition;
|
||||||
|
// pos.y = -8;
|
||||||
|
// saveToDiskRect.localPosition = pos;
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,9 +131,9 @@ namespace UnityExplorer.UI
|
|||||||
|
|
||||||
#region RESIZE
|
#region RESIZE
|
||||||
|
|
||||||
private const int RESIZE_THICKNESS = 10;
|
private const int RESIZE_THICKNESS = 15;
|
||||||
|
|
||||||
private readonly Vector2 minResize = new Vector2(733, 542);
|
private readonly Vector2 minResize = new Vector2(630, 540);
|
||||||
|
|
||||||
private bool WasResizing { get; set; }
|
private bool WasResizing { get; set; }
|
||||||
private ResizeTypes m_currentResizeType = ResizeTypes.NONE;
|
private ResizeTypes m_currentResizeType = ResizeTypes.NONE;
|
||||||
@ -339,16 +339,6 @@ namespace UnityExplorer.UI
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//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);
|
|
||||||
|
|
||||||
//Sprite sprite = UIManager.CreateSprite(tex, new Rect(0, 0, 32, 32));
|
|
||||||
//UnityEngine.Object.DontDestroyOnLoad(sprite);
|
|
||||||
|
|
||||||
var sprite = UIManager.ResizeCursor;
|
var sprite = UIManager.ResizeCursor;
|
||||||
|
|
||||||
m_resizeCursorImage = new GameObject("ResizeCursorImage");
|
m_resizeCursorImage = new GameObject("ResizeCursorImage");
|
||||||
@ -356,6 +346,7 @@ namespace UnityExplorer.UI
|
|||||||
|
|
||||||
Image image = m_resizeCursorImage.AddComponent<Image>();
|
Image image = m_resizeCursorImage.AddComponent<Image>();
|
||||||
image.sprite = sprite;
|
image.sprite = sprite;
|
||||||
|
image.material = Graphic.defaultGraphicMaterial;
|
||||||
RectTransform rect = image.transform.GetComponent<RectTransform>();
|
RectTransform rect = image.transform.GetComponent<RectTransform>();
|
||||||
rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 32);
|
rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 32);
|
||||||
rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 32);
|
rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, 32);
|
||||||
|
@ -559,7 +559,7 @@ namespace UnityExplorer.UI
|
|||||||
templateImage.color = new Color(0.15f, 0.15f, 0.15f, 1.0f);
|
templateImage.color = new Color(0.15f, 0.15f, 0.15f, 1.0f);
|
||||||
|
|
||||||
ScrollRect scrollRect = templateObj.AddComponent<ScrollRect>();
|
ScrollRect scrollRect = templateObj.AddComponent<ScrollRect>();
|
||||||
scrollRect.scrollSensitivity = 25;
|
scrollRect.scrollSensitivity = 35;
|
||||||
scrollRect.content = contentObj.GetComponent<RectTransform>();
|
scrollRect.content = contentObj.GetComponent<RectTransform>();
|
||||||
scrollRect.viewport = viewportObj.GetComponent<RectTransform>();
|
scrollRect.viewport = viewportObj.GetComponent<RectTransform>();
|
||||||
scrollRect.horizontal = false;
|
scrollRect.horizontal = false;
|
||||||
@ -715,7 +715,7 @@ namespace UnityExplorer.UI
|
|||||||
scrollRect.vertical = true;
|
scrollRect.vertical = true;
|
||||||
scrollRect.verticalScrollbar = hiddenScroll;
|
scrollRect.verticalScrollbar = hiddenScroll;
|
||||||
scrollRect.movementType = ScrollRect.MovementType.Clamped;
|
scrollRect.movementType = ScrollRect.MovementType.Clamped;
|
||||||
scrollRect.scrollSensitivity = 25;
|
scrollRect.scrollSensitivity = 35;
|
||||||
scrollRect.horizontalScrollbarVisibility = ScrollRect.ScrollbarVisibility.AutoHideAndExpandViewport;
|
scrollRect.horizontalScrollbarVisibility = ScrollRect.ScrollbarVisibility.AutoHideAndExpandViewport;
|
||||||
scrollRect.verticalScrollbarVisibility = ScrollRect.ScrollbarVisibility.Permanent;
|
scrollRect.verticalScrollbarVisibility = ScrollRect.ScrollbarVisibility.Permanent;
|
||||||
|
|
||||||
|
@ -32,7 +32,11 @@ namespace UnityExplorer.UI
|
|||||||
var bundle = AssetBundle.LoadFromFile(bundlePath);
|
var bundle = AssetBundle.LoadFromFile(bundlePath);
|
||||||
|
|
||||||
// Fix for games which don't ship with 'UI/Default' shader.
|
// Fix for games which don't ship with 'UI/Default' shader.
|
||||||
|
if (Graphic.defaultGraphicMaterial.shader?.name != "UI/Default")
|
||||||
|
{
|
||||||
|
ExplorerCore.Log("This game does not ship with the 'UI/Default' shader, using manual Default Shader...");
|
||||||
Graphic.defaultGraphicMaterial.shader = bundle.LoadAsset<Shader>("DefaultUI");
|
Graphic.defaultGraphicMaterial.shader = bundle.LoadAsset<Shader>("DefaultUI");
|
||||||
|
}
|
||||||
|
|
||||||
ResizeCursor = bundle.LoadAsset<Sprite>("cursor");
|
ResizeCursor = bundle.LoadAsset<Sprite>("cursor");
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_ML_Cpp|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_ML_Cpp|AnyCPU' ">
|
||||||
<!-- <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> -->
|
<!-- <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> -->
|
||||||
<OutputPath>..\Release\Explorer.MelonLoader.Il2Cpp\</OutputPath>
|
<OutputPath>..\Release\UnityExplorer.MelonLoader.Il2Cpp\</OutputPath>
|
||||||
<DefineConstants>CPP,ML</DefineConstants>
|
<DefineConstants>CPP,ML</DefineConstants>
|
||||||
<IsCpp>true</IsCpp>
|
<IsCpp>true</IsCpp>
|
||||||
<IsMelonLoader>true</IsMelonLoader>
|
<IsMelonLoader>true</IsMelonLoader>
|
||||||
@ -50,7 +50,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_ML_Mono|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_ML_Mono|AnyCPU' ">
|
||||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||||
<OutputPath>..\Release\Explorer.MelonLoader.Mono\</OutputPath>
|
<OutputPath>..\Release\UnityExplorer.MelonLoader.Mono\</OutputPath>
|
||||||
<DefineConstants>MONO,ML</DefineConstants>
|
<DefineConstants>MONO,ML</DefineConstants>
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
<Prefer32Bit>false</Prefer32Bit>
|
||||||
<IsCpp>false</IsCpp>
|
<IsCpp>false</IsCpp>
|
||||||
@ -59,7 +59,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_BIE_Cpp|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_BIE_Cpp|AnyCPU' ">
|
||||||
<!-- <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> -->
|
<!-- <TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion> -->
|
||||||
<OutputPath>..\Release\Explorer.BepInEx.Il2Cpp\</OutputPath>
|
<OutputPath>..\Release\UnityExplorer.BepInEx.Il2Cpp\</OutputPath>
|
||||||
<DefineConstants>CPP,BIE</DefineConstants>
|
<DefineConstants>CPP,BIE</DefineConstants>
|
||||||
<IsCpp>true</IsCpp>
|
<IsCpp>true</IsCpp>
|
||||||
<IsMelonLoader>false</IsMelonLoader>
|
<IsMelonLoader>false</IsMelonLoader>
|
||||||
@ -67,7 +67,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_BIE_Mono|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release_BIE_Mono|AnyCPU' ">
|
||||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||||
<OutputPath>..\Release\Explorer.BepInEx.Mono\</OutputPath>
|
<OutputPath>..\Release\UnityExplorer.BepInEx.Mono\</OutputPath>
|
||||||
<DefineConstants>MONO,BIE</DefineConstants>
|
<DefineConstants>MONO,BIE</DefineConstants>
|
||||||
<IsCpp>false</IsCpp>
|
<IsCpp>false</IsCpp>
|
||||||
<IsMelonLoader>false</IsMelonLoader>
|
<IsMelonLoader>false</IsMelonLoader>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user