mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-16 06:08:16 +08:00
add AddListener helper for IL2CPP, cleanup some unity extensions
This commit is contained in:
parent
eedb7dd76f
commit
eb693eceb5
@ -4,6 +4,7 @@ using System.Linq;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.EventSystems;
|
using UnityEngine.EventSystems;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using UnityExplorer.Helpers;
|
||||||
using UnityExplorer.UI;
|
using UnityExplorer.UI;
|
||||||
using UnityExplorer.UI.Modules;
|
using UnityExplorer.UI.Modules;
|
||||||
|
|
||||||
@ -292,12 +293,7 @@ namespace UnityExplorer.Console
|
|||||||
hiddenChild.SetActive(false);
|
hiddenChild.SetActive(false);
|
||||||
var hiddenText = hiddenChild.AddComponent<Text>();
|
var hiddenText = hiddenChild.AddComponent<Text>();
|
||||||
m_hiddenSuggestionTexts.Add(hiddenText);
|
m_hiddenSuggestionTexts.Add(hiddenText);
|
||||||
|
|
||||||
#if CPP
|
|
||||||
btn.onClick.AddListener(new Action(UseAutocompleteButton));
|
|
||||||
#else
|
|
||||||
btn.onClick.AddListener(UseAutocompleteButton);
|
btn.onClick.AddListener(UseAutocompleteButton);
|
||||||
#endif
|
|
||||||
|
|
||||||
void UseAutocompleteButton()
|
void UseAutocompleteButton()
|
||||||
{
|
{
|
||||||
|
@ -11,6 +11,7 @@ using UnityExplorer.UI.Modules;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using UnityExplorer.UI.Shared;
|
using UnityExplorer.UI.Shared;
|
||||||
|
using UnityExplorer.Helpers;
|
||||||
|
|
||||||
namespace UnityExplorer.Console
|
namespace UnityExplorer.Console
|
||||||
{
|
{
|
||||||
@ -72,11 +73,7 @@ The following helper methods are available:
|
|||||||
|
|
||||||
ConstructUI();
|
ConstructUI();
|
||||||
|
|
||||||
#if CPP
|
InputField.onValueChanged.AddListener((string s) => { OnInputChanged(s); });
|
||||||
InputField.onValueChanged.AddListener(new Action<string>((string s) => { OnInputChanged(s); }));
|
|
||||||
#else
|
|
||||||
this.InputField.onValueChanged.AddListener((string s) => { OnInputChanged(s); });
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update()
|
public void Update()
|
||||||
@ -354,11 +351,7 @@ The following helper methods are available:
|
|||||||
// Enable Ctrl+R toggle
|
// Enable Ctrl+R toggle
|
||||||
|
|
||||||
var ctrlRToggleObj = UIFactory.CreateToggle(topBarObj, out Toggle ctrlRToggle, out Text ctrlRToggleText);
|
var ctrlRToggleObj = UIFactory.CreateToggle(topBarObj, out Toggle ctrlRToggle, out Text ctrlRToggleText);
|
||||||
#if CPP
|
|
||||||
ctrlRToggle.onValueChanged.AddListener(new Action<bool>(CtrlRToggleCallback));
|
|
||||||
#else
|
|
||||||
ctrlRToggle.onValueChanged.AddListener(CtrlRToggleCallback);
|
ctrlRToggle.onValueChanged.AddListener(CtrlRToggleCallback);
|
||||||
#endif
|
|
||||||
void CtrlRToggleCallback(bool val)
|
void CtrlRToggleCallback(bool val)
|
||||||
{
|
{
|
||||||
EnableCtrlRShortcut = val;
|
EnableCtrlRShortcut = val;
|
||||||
@ -374,11 +367,7 @@ The following helper methods are available:
|
|||||||
// Enable Suggestions toggle
|
// Enable Suggestions toggle
|
||||||
|
|
||||||
var suggestToggleObj = UIFactory.CreateToggle(topBarObj, out Toggle suggestToggle, out Text suggestToggleText);
|
var suggestToggleObj = UIFactory.CreateToggle(topBarObj, out Toggle suggestToggle, out Text suggestToggleText);
|
||||||
#if CPP
|
|
||||||
suggestToggle.onValueChanged.AddListener(new Action<bool>(SuggestToggleCallback));
|
|
||||||
#else
|
|
||||||
suggestToggle.onValueChanged.AddListener(SuggestToggleCallback);
|
suggestToggle.onValueChanged.AddListener(SuggestToggleCallback);
|
||||||
#endif
|
|
||||||
void SuggestToggleCallback(bool val)
|
void SuggestToggleCallback(bool val)
|
||||||
{
|
{
|
||||||
EnableAutocompletes = val;
|
EnableAutocompletes = val;
|
||||||
@ -395,11 +384,7 @@ The following helper methods are available:
|
|||||||
// Enable Auto-indent toggle
|
// Enable Auto-indent toggle
|
||||||
|
|
||||||
var autoIndentToggleObj = UIFactory.CreateToggle(topBarObj, out Toggle autoIndentToggle, out Text autoIndentToggleText);
|
var autoIndentToggleObj = UIFactory.CreateToggle(topBarObj, out Toggle autoIndentToggle, out Text autoIndentToggleText);
|
||||||
#if CPP
|
|
||||||
autoIndentToggle.onValueChanged.AddListener(new Action<bool>(OnIndentChanged));
|
|
||||||
#else
|
|
||||||
autoIndentToggle.onValueChanged.AddListener(OnIndentChanged);
|
autoIndentToggle.onValueChanged.AddListener(OnIndentChanged);
|
||||||
#endif
|
|
||||||
void OnIndentChanged(bool val) => EnableAutoIndent = val;
|
void OnIndentChanged(bool val) => EnableAutoIndent = val;
|
||||||
|
|
||||||
autoIndentToggleText.text = "Auto-indent";
|
autoIndentToggleText.text = "Auto-indent";
|
||||||
@ -461,11 +446,7 @@ The following helper methods are available:
|
|||||||
btnText.color = Color.white;
|
btnText.color = Color.white;
|
||||||
|
|
||||||
// Set compile button callback now that we have the Input Field reference
|
// Set compile button callback now that we have the Input Field reference
|
||||||
#if CPP
|
|
||||||
compileButton.onClick.AddListener(new Action(CompileCallback));
|
|
||||||
#else
|
|
||||||
compileButton.onClick.AddListener(CompileCallback);
|
compileButton.onClick.AddListener(CompileCallback);
|
||||||
#endif
|
|
||||||
void CompileCallback()
|
void CompileCallback()
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(inputField.text))
|
if (!string.IsNullOrEmpty(inputField.text))
|
||||||
|
33
src/Helpers/EventHelper.cs
Normal file
33
src/Helpers/EventHelper.cs
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#if CPP
|
||||||
|
using System;
|
||||||
|
using UnityEngine.Events;
|
||||||
|
|
||||||
|
namespace UnityExplorer.Helpers
|
||||||
|
{
|
||||||
|
// Possibly temporary, just so Il2Cpp can do the same style "AddListener" as Mono.
|
||||||
|
// Just saves me having a preprocessor directive for every single AddListener.
|
||||||
|
|
||||||
|
public static class EventHelper
|
||||||
|
{
|
||||||
|
public static void AddListener(this UnityEvent action, Action listener)
|
||||||
|
{
|
||||||
|
action.AddListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AddListener<T>(this UnityEvent<T> action, Action<T> listener)
|
||||||
|
{
|
||||||
|
action.AddListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AddListener<T0, T1>(this UnityEvent<T0, T1> action, Action<T0, T1> listener)
|
||||||
|
{
|
||||||
|
action.AddListener(listener);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void AddListener<T0, T1, T2>(this UnityEvent<T0, T1, T2> action, Action<T0, T1, T2> listener)
|
||||||
|
{
|
||||||
|
action.AddListener(listener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
@ -18,12 +18,27 @@ namespace UnityExplorer.Helpers
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ActiveSceneName
|
public static bool IsNullOrDestroyed(this object obj, bool suppressWarning = false)
|
||||||
{
|
{
|
||||||
get
|
var unityObj = obj as Object;
|
||||||
|
if (obj == null)
|
||||||
{
|
{
|
||||||
return UnityEngine.SceneManagement.SceneManager.GetActiveScene().name;
|
if (!suppressWarning)
|
||||||
|
ExplorerCore.LogWarning("The target instance is null!");
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (obj is Object)
|
||||||
|
{
|
||||||
|
if (!unityObj)
|
||||||
|
{
|
||||||
|
if (!suppressWarning)
|
||||||
|
ExplorerCore.LogWarning("The target UnityEngine.Object was destroyed!");
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ToStringLong(this Vector3 vec)
|
public static string ToStringLong(this Vector3 vec)
|
||||||
|
@ -177,11 +177,7 @@ namespace UnityExplorer.Inspectors.GameObjects
|
|||||||
mainColors.normalColor = new Color(0.07f, 0.07f, 0.07f);
|
mainColors.normalColor = new Color(0.07f, 0.07f, 0.07f);
|
||||||
mainColors.highlightedColor = new Color(0.2f, 0.2f, 0.2f, 1);
|
mainColors.highlightedColor = new Color(0.2f, 0.2f, 0.2f, 1);
|
||||||
mainBtn.colors = mainColors;
|
mainBtn.colors = mainColors;
|
||||||
#if CPP
|
|
||||||
mainBtn.onClick.AddListener(new Action(() => { OnChildListObjectClicked(thisIndex); }));
|
|
||||||
#else
|
|
||||||
mainBtn.onClick.AddListener(() => { OnChildListObjectClicked(thisIndex); });
|
mainBtn.onClick.AddListener(() => { OnChildListObjectClicked(thisIndex); });
|
||||||
#endif
|
|
||||||
|
|
||||||
Text mainText = mainButtonObj.GetComponentInChildren<Text>();
|
Text mainText = mainButtonObj.GetComponentInChildren<Text>();
|
||||||
mainText.alignment = TextAnchor.MiddleLeft;
|
mainText.alignment = TextAnchor.MiddleLeft;
|
||||||
|
@ -194,11 +194,7 @@ namespace UnityExplorer.Inspectors.GameObjects
|
|||||||
var checkImg = toggleObj.transform.Find("Background/Checkmark").GetComponent<Image>();
|
var checkImg = toggleObj.transform.Find("Background/Checkmark").GetComponent<Image>();
|
||||||
checkImg.color = UISyntaxHighlight.Class_Instance.ToColor();
|
checkImg.color = UISyntaxHighlight.Class_Instance.ToColor();
|
||||||
checkImg.color *= 0.66f;
|
checkImg.color *= 0.66f;
|
||||||
#if CPP
|
|
||||||
toggle.onValueChanged.AddListener(new Action<bool>((bool val) => { OnCompToggleClicked(thisIndex, val); }));
|
|
||||||
#else
|
|
||||||
toggle.onValueChanged.AddListener((bool val) => { OnCompToggleClicked(thisIndex, val); });
|
toggle.onValueChanged.AddListener((bool val) => { OnCompToggleClicked(thisIndex, val); });
|
||||||
#endif
|
|
||||||
toggleText.text = "";
|
toggleText.text = "";
|
||||||
s_compToggles.Add(toggle);
|
s_compToggles.Add(toggle);
|
||||||
|
|
||||||
@ -215,11 +211,7 @@ namespace UnityExplorer.Inspectors.GameObjects
|
|||||||
mainColors.normalColor = new Color(0.07f, 0.07f, 0.07f);
|
mainColors.normalColor = new Color(0.07f, 0.07f, 0.07f);
|
||||||
mainColors.highlightedColor = new Color(0.2f, 0.2f, 0.2f, 1);
|
mainColors.highlightedColor = new Color(0.2f, 0.2f, 0.2f, 1);
|
||||||
mainBtn.colors = mainColors;
|
mainBtn.colors = mainColors;
|
||||||
#if CPP
|
|
||||||
mainBtn.onClick.AddListener(new Action(() => { OnCompListObjectClicked(thisIndex); }));
|
|
||||||
#else
|
|
||||||
mainBtn.onClick.AddListener(() => { OnCompListObjectClicked(thisIndex); });
|
mainBtn.onClick.AddListener(() => { OnCompListObjectClicked(thisIndex); });
|
||||||
#endif
|
|
||||||
|
|
||||||
// Component button text
|
// Component button text
|
||||||
|
|
||||||
|
@ -299,11 +299,7 @@ namespace UnityExplorer.Inspectors.GameObjects
|
|||||||
contentGroup.childControlWidth = true;
|
contentGroup.childControlWidth = true;
|
||||||
|
|
||||||
// ~~ add hide button callback now that we have scroll reference ~~
|
// ~~ add hide button callback now that we have scroll reference ~~
|
||||||
#if CPP
|
|
||||||
hideButton.onClick.AddListener(new Action(OnHideClicked));
|
|
||||||
#else
|
|
||||||
hideButton.onClick.AddListener(OnHideClicked);
|
hideButton.onClick.AddListener(OnHideClicked);
|
||||||
#endif
|
|
||||||
void OnHideClicked()
|
void OnHideClicked()
|
||||||
{
|
{
|
||||||
if (hideText.text == "Show")
|
if (hideText.text == "Show")
|
||||||
@ -368,11 +364,7 @@ namespace UnityExplorer.Inspectors.GameObjects
|
|||||||
|
|
||||||
var applyButtonObj = UIFactory.CreateButton(setParentGroupObj);
|
var applyButtonObj = UIFactory.CreateButton(setParentGroupObj);
|
||||||
var applyButton = applyButtonObj.GetComponent<Button>();
|
var applyButton = applyButtonObj.GetComponent<Button>();
|
||||||
#if CPP
|
|
||||||
applyButton.onClick.AddListener(new Action(OnSetParentClicked));
|
|
||||||
#else
|
|
||||||
applyButton.onClick.AddListener(OnSetParentClicked);
|
applyButton.onClick.AddListener(OnSetParentClicked);
|
||||||
#endif
|
|
||||||
var applyText = applyButtonObj.GetComponentInChildren<Text>();
|
var applyText = applyButtonObj.GetComponentInChildren<Text>();
|
||||||
applyText.text = "Apply";
|
applyText.text = "Apply";
|
||||||
var applyLayout = applyButtonObj.AddComponent<LayoutElement>();
|
var applyLayout = applyButtonObj.AddComponent<LayoutElement>();
|
||||||
@ -446,11 +438,7 @@ namespace UnityExplorer.Inspectors.GameObjects
|
|||||||
zRow.SetActive(false);
|
zRow.SetActive(false);
|
||||||
|
|
||||||
// add expand callback now that we have group reference
|
// add expand callback now that we have group reference
|
||||||
#if CPP
|
|
||||||
expandButton.onClick.AddListener(new Action(ToggleExpand));
|
|
||||||
#else
|
|
||||||
expandButton.onClick.AddListener(ToggleExpand);
|
expandButton.onClick.AddListener(ToggleExpand);
|
||||||
#endif
|
|
||||||
void ToggleExpand()
|
void ToggleExpand()
|
||||||
{
|
{
|
||||||
if (xRow.activeSelf)
|
if (xRow.activeSelf)
|
||||||
@ -524,11 +512,7 @@ namespace UnityExplorer.Inspectors.GameObjects
|
|||||||
slider.minValue = -2;
|
slider.minValue = -2;
|
||||||
slider.maxValue = 2;
|
slider.maxValue = 2;
|
||||||
slider.value = 0;
|
slider.value = 0;
|
||||||
#if CPP
|
|
||||||
slider.onValueChanged.AddListener(new Action<float>((float val) => { OnSliderControlChanged(val, slider, type, vectorValue); }));
|
|
||||||
#else
|
|
||||||
slider.onValueChanged.AddListener((float val) => { OnSliderControlChanged(val, slider, type, vectorValue); });
|
slider.onValueChanged.AddListener((float val) => { OnSliderControlChanged(val, slider, type, vectorValue); });
|
||||||
#endif
|
|
||||||
editor.sliders[(int)vectorValue] = slider;
|
editor.sliders[(int)vectorValue] = slider;
|
||||||
|
|
||||||
// input field
|
// input field
|
||||||
@ -563,11 +547,7 @@ namespace UnityExplorer.Inspectors.GameObjects
|
|||||||
applyLayout.minWidth = 60;
|
applyLayout.minWidth = 60;
|
||||||
applyLayout.minHeight = 25;
|
applyLayout.minHeight = 25;
|
||||||
|
|
||||||
#if MONO
|
|
||||||
applyBtn.onClick.AddListener(() => { OnVectorControlInputApplied(type, vectorValue); });
|
applyBtn.onClick.AddListener(() => { OnVectorControlInputApplied(type, vectorValue); });
|
||||||
#else
|
|
||||||
applyBtn.onClick.AddListener(new Action(() => { OnVectorControlInputApplied(type, vectorValue); }));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return rowObject;
|
return rowObject;
|
||||||
}
|
}
|
||||||
@ -584,11 +564,9 @@ namespace UnityExplorer.Inspectors.GameObjects
|
|||||||
|
|
||||||
var instantiateBtnObj = UIFactory.CreateButton(bottomRow, new Color(0.2f, 0.2f, 0.2f));
|
var instantiateBtnObj = UIFactory.CreateButton(bottomRow, new Color(0.2f, 0.2f, 0.2f));
|
||||||
var instantiateBtn = instantiateBtnObj.GetComponent<Button>();
|
var instantiateBtn = instantiateBtnObj.GetComponent<Button>();
|
||||||
#if MONO
|
|
||||||
instantiateBtn.onClick.AddListener(InstantiateBtn);
|
instantiateBtn.onClick.AddListener(InstantiateBtn);
|
||||||
#else
|
|
||||||
instantiateBtn.onClick.AddListener(new Action(InstantiateBtn));
|
|
||||||
#endif
|
|
||||||
var instantiateText = instantiateBtnObj.GetComponentInChildren<Text>();
|
var instantiateText = instantiateBtnObj.GetComponentInChildren<Text>();
|
||||||
instantiateText.text = "Instantiate";
|
instantiateText.text = "Instantiate";
|
||||||
instantiateText.fontSize = 14;
|
instantiateText.fontSize = 14;
|
||||||
@ -607,11 +585,9 @@ namespace UnityExplorer.Inspectors.GameObjects
|
|||||||
|
|
||||||
var dontDestroyBtnObj = UIFactory.CreateButton(bottomRow, new Color(0.2f, 0.2f, 0.2f));
|
var dontDestroyBtnObj = UIFactory.CreateButton(bottomRow, new Color(0.2f, 0.2f, 0.2f));
|
||||||
var dontDestroyBtn = dontDestroyBtnObj.GetComponent<Button>();
|
var dontDestroyBtn = dontDestroyBtnObj.GetComponent<Button>();
|
||||||
#if MONO
|
|
||||||
dontDestroyBtn.onClick.AddListener(DontDestroyOnLoadBtn);
|
dontDestroyBtn.onClick.AddListener(DontDestroyOnLoadBtn);
|
||||||
#else
|
|
||||||
dontDestroyBtn.onClick.AddListener(new Action(DontDestroyOnLoadBtn));
|
|
||||||
#endif
|
|
||||||
var dontDestroyText = dontDestroyBtnObj.GetComponentInChildren<Text>();
|
var dontDestroyText = dontDestroyBtnObj.GetComponentInChildren<Text>();
|
||||||
dontDestroyText.text = "Set DontDestroyOnLoad";
|
dontDestroyText.text = "Set DontDestroyOnLoad";
|
||||||
dontDestroyText.fontSize = 14;
|
dontDestroyText.fontSize = 14;
|
||||||
@ -629,11 +605,9 @@ namespace UnityExplorer.Inspectors.GameObjects
|
|||||||
|
|
||||||
var destroyBtnObj = UIFactory.CreateButton(bottomRow, new Color(0.2f, 0.2f, 0.2f));
|
var destroyBtnObj = UIFactory.CreateButton(bottomRow, new Color(0.2f, 0.2f, 0.2f));
|
||||||
var destroyBtn = destroyBtnObj.GetComponent<Button>();
|
var destroyBtn = destroyBtnObj.GetComponent<Button>();
|
||||||
#if MONO
|
|
||||||
destroyBtn.onClick.AddListener(DestroyBtn);
|
destroyBtn.onClick.AddListener(DestroyBtn);
|
||||||
#else
|
|
||||||
destroyBtn.onClick.AddListener(new Action(DestroyBtn));
|
|
||||||
#endif
|
|
||||||
var destroyText = destroyBtnObj.GetComponentInChildren<Text>();
|
var destroyText = destroyBtnObj.GetComponentInChildren<Text>();
|
||||||
destroyText.text = "Destroy";
|
destroyText.text = "Destroy";
|
||||||
destroyText.fontSize = 14;
|
destroyText.fontSize = 14;
|
||||||
|
@ -251,11 +251,9 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
var backButtonObj = UIFactory.CreateButton(m_pathGroupObj);
|
var backButtonObj = UIFactory.CreateButton(m_pathGroupObj);
|
||||||
var backButton = backButtonObj.GetComponent<Button>();
|
var backButton = backButtonObj.GetComponent<Button>();
|
||||||
#if CPP
|
|
||||||
backButton.onClick.AddListener(new Action(OnBackButtonClicked));
|
|
||||||
#else
|
|
||||||
backButton.onClick.AddListener(OnBackButtonClicked);
|
backButton.onClick.AddListener(OnBackButtonClicked);
|
||||||
#endif
|
|
||||||
var backColors = backButton.colors;
|
var backColors = backButton.colors;
|
||||||
backColors.normalColor = new Color(0.15f, 0.15f, 0.15f);
|
backColors.normalColor = new Color(0.15f, 0.15f, 0.15f);
|
||||||
backButton.colors = backColors;
|
backButton.colors = backColors;
|
||||||
@ -341,11 +339,9 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
var applyNameBtnObj = UIFactory.CreateButton(nameRowObj);
|
var applyNameBtnObj = UIFactory.CreateButton(nameRowObj);
|
||||||
var applyNameBtn = applyNameBtnObj.GetComponent<Button>();
|
var applyNameBtn = applyNameBtnObj.GetComponent<Button>();
|
||||||
#if CPP
|
|
||||||
applyNameBtn.onClick.AddListener(new Action(OnApplyNameClicked));
|
|
||||||
#else
|
|
||||||
applyNameBtn.onClick.AddListener(OnApplyNameClicked);
|
applyNameBtn.onClick.AddListener(OnApplyNameClicked);
|
||||||
#endif
|
|
||||||
var applyNameText = applyNameBtnObj.GetComponentInChildren<Text>();
|
var applyNameText = applyNameBtnObj.GetComponentInChildren<Text>();
|
||||||
applyNameText.text = "Apply";
|
applyNameText.text = "Apply";
|
||||||
applyNameText.fontSize = 14;
|
applyNameText.fontSize = 14;
|
||||||
@ -372,11 +368,8 @@ namespace UnityExplorer.Inspectors
|
|||||||
toggleLayout.flexibleWidth = 0;
|
toggleLayout.flexibleWidth = 0;
|
||||||
m_enabledText.text = "Enabled";
|
m_enabledText.text = "Enabled";
|
||||||
m_enabledText.color = Color.green;
|
m_enabledText.color = Color.green;
|
||||||
#if CPP
|
|
||||||
m_enabledToggle.onValueChanged.AddListener(new Action<bool>(OnEnableToggled));
|
|
||||||
#else
|
|
||||||
m_enabledToggle.onValueChanged.AddListener(OnEnableToggled);
|
m_enabledToggle.onValueChanged.AddListener(OnEnableToggled);
|
||||||
#endif
|
|
||||||
|
|
||||||
// layer and scene row
|
// layer and scene row
|
||||||
|
|
||||||
@ -408,11 +401,8 @@ namespace UnityExplorer.Inspectors
|
|||||||
layerDropdownLayout.minWidth = 120;
|
layerDropdownLayout.minWidth = 120;
|
||||||
layerDropdownLayout.flexibleWidth = 2000;
|
layerDropdownLayout.flexibleWidth = 2000;
|
||||||
layerDropdownLayout.minHeight = 25;
|
layerDropdownLayout.minHeight = 25;
|
||||||
#if CPP
|
|
||||||
m_layerDropdown.onValueChanged.AddListener(new Action<int>(OnLayerSelected));
|
|
||||||
#else
|
|
||||||
m_layerDropdown.onValueChanged.AddListener(OnLayerSelected);
|
m_layerDropdown.onValueChanged.AddListener(OnLayerSelected);
|
||||||
#endif
|
|
||||||
|
|
||||||
var scenelabelObj = UIFactory.CreateLabel(sceneLayerRow, TextAnchor.MiddleCenter);
|
var scenelabelObj = UIFactory.CreateLabel(sceneLayerRow, TextAnchor.MiddleCenter);
|
||||||
var sceneLabel = scenelabelObj.GetComponent<Text>();
|
var sceneLabel = scenelabelObj.GetComponent<Text>();
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using UnityExplorer.Helpers;
|
||||||
using UnityExplorer.UI;
|
using UnityExplorer.UI;
|
||||||
|
|
||||||
namespace UnityExplorer.Inspectors
|
namespace UnityExplorer.Inspectors
|
||||||
@ -22,7 +23,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
{
|
{
|
||||||
Target = target;
|
Target = target;
|
||||||
|
|
||||||
if (IsNullOrDestroyed(Target))
|
if (Target.IsNullOrDestroyed())
|
||||||
{
|
{
|
||||||
Destroy();
|
Destroy();
|
||||||
return;
|
return;
|
||||||
@ -45,7 +46,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
public virtual void Update()
|
public virtual void Update()
|
||||||
{
|
{
|
||||||
if (IsNullOrDestroyed(Target))
|
if (Target.IsNullOrDestroyed())
|
||||||
{
|
{
|
||||||
Destroy();
|
Destroy();
|
||||||
return;
|
return;
|
||||||
@ -84,28 +85,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool IsNullOrDestroyed(object obj, bool suppressWarning = false)
|
|
||||||
{
|
|
||||||
var unityObj = obj as UnityEngine.Object;
|
|
||||||
if (obj == null)
|
|
||||||
{
|
|
||||||
if (!suppressWarning)
|
|
||||||
ExplorerCore.LogWarning("The target instance is null!");
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (obj is UnityEngine.Object)
|
|
||||||
{
|
|
||||||
if (!unityObj)
|
|
||||||
{
|
|
||||||
if (!suppressWarning)
|
|
||||||
ExplorerCore.LogWarning("The target UnityEngine.Object was destroyed!");
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#region UI CONSTRUCTION
|
#region UI CONSTRUCTION
|
||||||
|
|
||||||
@ -133,11 +113,9 @@ namespace UnityExplorer.Inspectors
|
|||||||
tabText.alignment = TextAnchor.MiddleLeft;
|
tabText.alignment = TextAnchor.MiddleLeft;
|
||||||
|
|
||||||
tabButton = targetButtonObj.GetComponent<Button>();
|
tabButton = targetButtonObj.GetComponent<Button>();
|
||||||
#if CPP
|
|
||||||
tabButton.onClick.AddListener(new Action(() => { InspectorManager.Instance.SetInspectorTab(this); }));
|
|
||||||
#else
|
|
||||||
tabButton.onClick.AddListener(() => { InspectorManager.Instance.SetInspectorTab(this); });
|
tabButton.onClick.AddListener(() => { InspectorManager.Instance.SetInspectorTab(this); });
|
||||||
#endif
|
|
||||||
var closeBtnObj = UIFactory.CreateButton(tabGroupObj);
|
var closeBtnObj = UIFactory.CreateButton(tabGroupObj);
|
||||||
var closeBtnLayout = closeBtnObj.AddComponent<LayoutElement>();
|
var closeBtnLayout = closeBtnObj.AddComponent<LayoutElement>();
|
||||||
closeBtnLayout.minWidth = 20;
|
closeBtnLayout.minWidth = 20;
|
||||||
@ -147,11 +125,8 @@ namespace UnityExplorer.Inspectors
|
|||||||
closeBtnText.color = new Color(1, 0, 0, 1);
|
closeBtnText.color = new Color(1, 0, 0, 1);
|
||||||
|
|
||||||
var closeBtn = closeBtnObj.GetComponent<Button>();
|
var closeBtn = closeBtnObj.GetComponent<Button>();
|
||||||
#if CPP
|
|
||||||
closeBtn.onClick.AddListener(new Action(() => { Destroy(); }));
|
closeBtn.onClick.AddListener(Destroy);
|
||||||
#else
|
|
||||||
closeBtn.onClick.AddListener(() => { Destroy(); });
|
|
||||||
#endif
|
|
||||||
|
|
||||||
var closeColors = closeBtn.colors;
|
var closeColors = closeBtn.colors;
|
||||||
closeColors.normalColor = new Color(0.2f, 0.2f, 0.2f, 1);
|
closeColors.normalColor = new Color(0.2f, 0.2f, 0.2f, 1);
|
||||||
|
@ -45,7 +45,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
#endif
|
#endif
|
||||||
UnityEngine.Object unityObj = obj as UnityEngine.Object;
|
UnityEngine.Object unityObj = obj as UnityEngine.Object;
|
||||||
|
|
||||||
if (InspectorBase.IsNullOrDestroyed(obj))
|
if (obj.IsNullOrDestroyed())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -289,11 +289,9 @@ namespace UnityExplorer.Inspectors
|
|||||||
|
|
||||||
// var applyBtnObj = UIFactory.CreateButton(timeGroupObj);
|
// var applyBtnObj = UIFactory.CreateButton(timeGroupObj);
|
||||||
// var applyBtn = applyBtnObj.GetComponent<Button>();
|
// var applyBtn = applyBtnObj.GetComponent<Button>();
|
||||||
//#if MONO
|
|
||||||
// applyBtn.onClick.AddListener(SetTimeScale);
|
// applyBtn.onClick.AddListener(SetTimeScale);
|
||||||
//#else
|
|
||||||
// applyBtn.onClick.AddListener(new Action(SetTimeScale));
|
|
||||||
//#endif
|
|
||||||
// var applyText = applyBtnObj.GetComponentInChildren<Text>();
|
// var applyText = applyBtnObj.GetComponentInChildren<Text>();
|
||||||
// applyText.text = "Apply";
|
// applyText.text = "Apply";
|
||||||
// applyText.fontSize = 14;
|
// applyText.fontSize = 14;
|
||||||
@ -323,11 +321,8 @@ namespace UnityExplorer.Inspectors
|
|||||||
var inspectText = inspectObj.GetComponentInChildren<Text>();
|
var inspectText = inspectObj.GetComponentInChildren<Text>();
|
||||||
inspectText.text = "Mouse Inspect";
|
inspectText.text = "Mouse Inspect";
|
||||||
inspectText.fontSize = 13;
|
inspectText.fontSize = 13;
|
||||||
#if MONO
|
|
||||||
inspectBtn.onClick.AddListener(OnInspectMouseClicked);
|
inspectBtn.onClick.AddListener(OnInspectMouseClicked);
|
||||||
#else
|
|
||||||
inspectBtn.onClick.AddListener(new Action(OnInspectMouseClicked));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void OnInspectMouseClicked()
|
void OnInspectMouseClicked()
|
||||||
{
|
{
|
||||||
|
@ -319,12 +319,8 @@ namespace UnityExplorer.Inspectors.Reflection
|
|||||||
var colors = evalButton.colors;
|
var colors = evalButton.colors;
|
||||||
colors.highlightedColor = new Color(0.4f, 0.7f, 0.4f);
|
colors.highlightedColor = new Color(0.4f, 0.7f, 0.4f);
|
||||||
evalButton.colors = colors;
|
evalButton.colors = colors;
|
||||||
#if CPP
|
|
||||||
evalButton.onClick.AddListener(new Action(OnMainEvaluateButton));
|
|
||||||
#else
|
|
||||||
evalButton.onClick.AddListener(OnMainEvaluateButton);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
evalButton.onClick.AddListener(OnMainEvaluateButton);
|
||||||
void OnMainEvaluateButton()
|
void OnMainEvaluateButton()
|
||||||
{
|
{
|
||||||
if (HasParameters)
|
if (HasParameters)
|
||||||
|
@ -48,7 +48,7 @@ namespace UnityExplorer.Inspectors.Reflection
|
|||||||
GetLabelForValue();
|
GetLabelForValue();
|
||||||
m_text.text = RichTextValue;
|
m_text.text = RichTextValue;
|
||||||
|
|
||||||
bool shouldShowInspect = !InspectorBase.IsNullOrDestroyed(this.Value, true);
|
bool shouldShowInspect = !Value.IsNullOrDestroyed(true);
|
||||||
if (m_inspectButton.activeSelf != shouldShowInspect)
|
if (m_inspectButton.activeSelf != shouldShowInspect)
|
||||||
m_inspectButton.SetActive(shouldShowInspect);
|
m_inspectButton.SetActive(shouldShowInspect);
|
||||||
}
|
}
|
||||||
@ -164,14 +164,11 @@ namespace UnityExplorer.Inspectors.Reflection
|
|||||||
var inspectText = m_inspectButton.GetComponentInChildren<Text>();
|
var inspectText = m_inspectButton.GetComponentInChildren<Text>();
|
||||||
inspectText.text = "Inspect";
|
inspectText.text = "Inspect";
|
||||||
var inspectBtn = m_inspectButton.GetComponent<Button>();
|
var inspectBtn = m_inspectButton.GetComponent<Button>();
|
||||||
#if CPP
|
|
||||||
inspectBtn.onClick.AddListener(new Action(OnInspectClicked));
|
|
||||||
#else
|
|
||||||
inspectBtn.onClick.AddListener(OnInspectClicked);
|
inspectBtn.onClick.AddListener(OnInspectClicked);
|
||||||
#endif
|
|
||||||
void OnInspectClicked()
|
void OnInspectClicked()
|
||||||
{
|
{
|
||||||
if (!InspectorBase.IsNullOrDestroyed(this.Value))
|
if (!Value.IsNullOrDestroyed())
|
||||||
InspectorManager.Instance.Inspect(this.Value);
|
InspectorManager.Instance.Inspect(this.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -472,7 +472,7 @@ namespace UnityExplorer.Inspectors
|
|||||||
nameInputLayout.minWidth = 100;
|
nameInputLayout.minWidth = 100;
|
||||||
nameInputLayout.minHeight = 25;
|
nameInputLayout.minHeight = 25;
|
||||||
var nameInput = nameInputObj.GetComponent<InputField>();
|
var nameInput = nameInputObj.GetComponent<InputField>();
|
||||||
nameInput.onValueChanged.AddListener(new Action<string>((string val) => { FilterMembers(val); }));
|
nameInput.onValueChanged.AddListener((string val) => { FilterMembers(val); });
|
||||||
m_nameFilterText = nameInput.textComponent;
|
m_nameFilterText = nameInput.textComponent;
|
||||||
|
|
||||||
// membertype filter
|
// membertype filter
|
||||||
|
@ -8,6 +8,7 @@ using UnityEngine;
|
|||||||
using UnityEngine.SceneManagement;
|
using UnityEngine.SceneManagement;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Unstrip;
|
using UnityExplorer.Unstrip;
|
||||||
|
using UnityExplorer.Helpers;
|
||||||
|
|
||||||
namespace UnityExplorer.Inspectors
|
namespace UnityExplorer.Inspectors
|
||||||
{
|
{
|
||||||
@ -319,12 +320,8 @@ namespace UnityExplorer.Inspectors
|
|||||||
dropdownLayout.flexibleWidth = 2;
|
dropdownLayout.flexibleWidth = 2;
|
||||||
|
|
||||||
m_sceneDropdownText = m_sceneDropdown.transform.Find("Label").GetComponent<Text>();
|
m_sceneDropdownText = m_sceneDropdown.transform.Find("Label").GetComponent<Text>();
|
||||||
|
|
||||||
#if CPP
|
|
||||||
m_sceneDropdown.onValueChanged.AddListener(new Action<int>((int val) => { SetSceneFromDropdown(val); }));
|
|
||||||
#else
|
|
||||||
m_sceneDropdown.onValueChanged.AddListener((int val) => { SetSceneFromDropdown(val); });
|
m_sceneDropdown.onValueChanged.AddListener((int val) => { SetSceneFromDropdown(val); });
|
||||||
#endif
|
|
||||||
void SetSceneFromDropdown(int val)
|
void SetSceneFromDropdown(int val)
|
||||||
{
|
{
|
||||||
string scene = m_sceneDropdown.options[val].text;
|
string scene = m_sceneDropdown.options[val].text;
|
||||||
@ -353,11 +350,8 @@ namespace UnityExplorer.Inspectors
|
|||||||
var colors = backButton.colors;
|
var colors = backButton.colors;
|
||||||
colors.normalColor = new Color(0.12f, 0.12f, 0.12f);
|
colors.normalColor = new Color(0.12f, 0.12f, 0.12f);
|
||||||
backButton.colors = colors;
|
backButton.colors = colors;
|
||||||
#if CPP
|
|
||||||
backButton.onClick.AddListener(new Action(() => { SetSceneObjectParent(); }));
|
|
||||||
#else
|
|
||||||
backButton.onClick.AddListener(() => { SetSceneObjectParent(); });
|
backButton.onClick.AddListener(() => { SetSceneObjectParent(); });
|
||||||
#endif
|
|
||||||
|
|
||||||
void SetSceneObjectParent()
|
void SetSceneObjectParent()
|
||||||
{
|
{
|
||||||
@ -403,12 +397,9 @@ namespace UnityExplorer.Inspectors
|
|||||||
inspectButtonLayout.minWidth = 65;
|
inspectButtonLayout.minWidth = 65;
|
||||||
inspectButtonLayout.flexibleWidth = 0;
|
inspectButtonLayout.flexibleWidth = 0;
|
||||||
Button inspectButton = m_mainInspectBtn.GetComponent<Button>();
|
Button inspectButton = m_mainInspectBtn.GetComponent<Button>();
|
||||||
#if CPP
|
|
||||||
inspectButton.onClick.AddListener(new Action(() => { InspectorManager.Instance.Inspect(m_selectedSceneObject); }));
|
|
||||||
|
|
||||||
#else
|
|
||||||
inspectButton.onClick.AddListener(() => { InspectorManager.Instance.Inspect(m_selectedSceneObject); });
|
inspectButton.onClick.AddListener(() => { InspectorManager.Instance.Inspect(m_selectedSceneObject); });
|
||||||
#endif
|
|
||||||
GameObject scrollObj = UIFactory.CreateScrollView(leftPane, out m_sceneListContent, out SliderScrollbar scroller, new Color(0.1f, 0.1f, 0.1f));
|
GameObject scrollObj = UIFactory.CreateScrollView(leftPane, out m_sceneListContent, out SliderScrollbar scroller, new Color(0.1f, 0.1f, 0.1f));
|
||||||
|
|
||||||
m_sceneListPageHandler = new PageHandler(scroller);
|
m_sceneListPageHandler = new PageHandler(scroller);
|
||||||
@ -429,11 +420,8 @@ namespace UnityExplorer.Inspectors
|
|||||||
var hideLayout = hideButtonObj.AddComponent<LayoutElement>();
|
var hideLayout = hideButtonObj.AddComponent<LayoutElement>();
|
||||||
hideLayout.minWidth = 20;
|
hideLayout.minWidth = 20;
|
||||||
hideLayout.minHeight = 20;
|
hideLayout.minHeight = 20;
|
||||||
#if MONO
|
|
||||||
hideBtn.onClick.AddListener(OnHide);
|
hideBtn.onClick.AddListener(OnHide);
|
||||||
#else
|
|
||||||
hideBtn.onClick.AddListener(new Action(OnHide));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void OnHide()
|
void OnHide()
|
||||||
{
|
{
|
||||||
@ -493,11 +481,8 @@ namespace UnityExplorer.Inspectors
|
|||||||
mainColors.normalColor = new Color(0.1f, 0.1f, 0.1f);
|
mainColors.normalColor = new Color(0.1f, 0.1f, 0.1f);
|
||||||
mainColors.highlightedColor = new Color(0.2f, 0.2f, 0.2f, 1);
|
mainColors.highlightedColor = new Color(0.2f, 0.2f, 0.2f, 1);
|
||||||
mainBtn.colors = mainColors;
|
mainBtn.colors = mainColors;
|
||||||
#if CPP
|
|
||||||
mainBtn.onClick.AddListener(new Action(() => { SceneListObjectClicked(thisIndex); }));
|
|
||||||
#else
|
|
||||||
mainBtn.onClick.AddListener(() => { SceneListObjectClicked(thisIndex); });
|
mainBtn.onClick.AddListener(() => { SceneListObjectClicked(thisIndex); });
|
||||||
#endif
|
|
||||||
|
|
||||||
Text mainText = mainButtonObj.GetComponentInChildren<Text>();
|
Text mainText = mainButtonObj.GetComponentInChildren<Text>();
|
||||||
mainText.alignment = TextAnchor.MiddleLeft;
|
mainText.alignment = TextAnchor.MiddleLeft;
|
||||||
@ -519,11 +504,8 @@ namespace UnityExplorer.Inspectors
|
|||||||
inspectColors.normalColor = new Color(0.15f, 0.15f, 0.15f);
|
inspectColors.normalColor = new Color(0.15f, 0.15f, 0.15f);
|
||||||
mainColors.highlightedColor = new Color(0.2f, 0.2f, 0.2f, 0.5f);
|
mainColors.highlightedColor = new Color(0.2f, 0.2f, 0.2f, 0.5f);
|
||||||
inspectBtn.colors = inspectColors;
|
inspectBtn.colors = inspectColors;
|
||||||
#if CPP
|
|
||||||
inspectBtn.onClick.AddListener(new Action(() => { InspectorManager.Instance.Inspect(m_sceneShortList[thisIndex]); }));
|
|
||||||
#else
|
|
||||||
inspectBtn.onClick.AddListener(() => { InspectorManager.Instance.Inspect(m_sceneShortList[thisIndex]); });
|
inspectBtn.onClick.AddListener(() => { InspectorManager.Instance.Inspect(m_sceneShortList[thisIndex]); });
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -5,6 +5,7 @@ using UnityEngine;
|
|||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.UI.Modules;
|
using UnityExplorer.UI.Modules;
|
||||||
using UnityExplorer.Config;
|
using UnityExplorer.Config;
|
||||||
|
using UnityExplorer.Helpers;
|
||||||
|
|
||||||
namespace UnityExplorer.UI
|
namespace UnityExplorer.UI
|
||||||
{
|
{
|
||||||
@ -210,11 +211,7 @@ namespace UnityExplorer.UI
|
|||||||
GameObject hideBtnObj = UIFactory.CreateButton(titleBar);
|
GameObject hideBtnObj = UIFactory.CreateButton(titleBar);
|
||||||
|
|
||||||
Button hideBtn = hideBtnObj.GetComponent<Button>();
|
Button hideBtn = hideBtnObj.GetComponent<Button>();
|
||||||
#if CPP
|
|
||||||
hideBtn.onClick.AddListener(new Action(() => { ExplorerCore.ShowMenu = false; }));
|
|
||||||
#else
|
|
||||||
hideBtn.onClick.AddListener(() => { ExplorerCore.ShowMenu = false; });
|
hideBtn.onClick.AddListener(() => { ExplorerCore.ShowMenu = false; });
|
||||||
#endif
|
|
||||||
ColorBlock colorBlock = hideBtn.colors;
|
ColorBlock colorBlock = hideBtn.colors;
|
||||||
colorBlock.normalColor = new Color(65f / 255f, 23f / 255f, 23f / 255f);
|
colorBlock.normalColor = new Color(65f / 255f, 23f / 255f, 23f / 255f);
|
||||||
colorBlock.pressedColor = new Color(35f / 255f, 10f / 255f, 10f / 255f);
|
colorBlock.pressedColor = new Color(35f / 255f, 10f / 255f, 10f / 255f);
|
||||||
@ -266,11 +263,7 @@ namespace UnityExplorer.UI
|
|||||||
|
|
||||||
page.RefNavbarButton = btn;
|
page.RefNavbarButton = btn;
|
||||||
|
|
||||||
#if CPP
|
|
||||||
btn.onClick.AddListener(new Action(() => { SetPage(page); }));
|
|
||||||
#else
|
|
||||||
btn.onClick.AddListener(() => { SetPage(page); });
|
btn.onClick.AddListener(() => { SetPage(page); });
|
||||||
#endif
|
|
||||||
|
|
||||||
Text text = btnObj.GetComponentInChildren<Text>();
|
Text text = btnObj.GetComponentInChildren<Text>();
|
||||||
text.text = page.Name;
|
text.text = page.Name;
|
||||||
|
@ -8,6 +8,7 @@ using UnityExplorer.Config;
|
|||||||
using UnityExplorer.UI.Shared;
|
using UnityExplorer.UI.Shared;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using UnityExplorer.Helpers;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Modules
|
namespace UnityExplorer.UI.Modules
|
||||||
{
|
{
|
||||||
@ -184,11 +185,8 @@ namespace UnityExplorer.UI.Modules
|
|||||||
hideBtnText.text = "Hide";
|
hideBtnText.text = "Hide";
|
||||||
|
|
||||||
var hideButton = hideButtonObj.GetComponent<Button>();
|
var hideButton = hideButtonObj.GetComponent<Button>();
|
||||||
#if CPP
|
|
||||||
hideButton.onClick.AddListener(new Action(HideCallback));
|
|
||||||
#else
|
|
||||||
hideButton.onClick.AddListener(HideCallback);
|
hideButton.onClick.AddListener(HideCallback);
|
||||||
#endif
|
|
||||||
void HideCallback()
|
void HideCallback()
|
||||||
{
|
{
|
||||||
if (logAreaObj.activeSelf)
|
if (logAreaObj.activeSelf)
|
||||||
@ -221,12 +219,8 @@ namespace UnityExplorer.UI.Modules
|
|||||||
clearBtnText.text = "Clear";
|
clearBtnText.text = "Clear";
|
||||||
|
|
||||||
var clearButton = clearButtonObj.GetComponent<Button>();
|
var clearButton = clearButtonObj.GetComponent<Button>();
|
||||||
#if CPP
|
|
||||||
clearButton.onClick.AddListener(new Action(ClearCallback));
|
|
||||||
#else
|
|
||||||
clearButton.onClick.AddListener(ClearCallback);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
clearButton.onClick.AddListener(ClearCallback);
|
||||||
void ClearCallback()
|
void ClearCallback()
|
||||||
{
|
{
|
||||||
m_textInput.text = "";
|
m_textInput.text = "";
|
||||||
@ -244,11 +238,9 @@ namespace UnityExplorer.UI.Modules
|
|||||||
// Unity log toggle
|
// Unity log toggle
|
||||||
|
|
||||||
var unityToggleObj = UIFactory.CreateToggle(bottomBarObj, out Toggle unityToggle, out Text unityToggleText);
|
var unityToggleObj = UIFactory.CreateToggle(bottomBarObj, out Toggle unityToggle, out Text unityToggleText);
|
||||||
#if CPP
|
|
||||||
unityToggle.onValueChanged.AddListener(new Action<bool>(ToggleLogUnity));
|
|
||||||
#else
|
|
||||||
unityToggle.onValueChanged.AddListener(ToggleLogUnity);
|
unityToggle.onValueChanged.AddListener(ToggleLogUnity);
|
||||||
#endif
|
|
||||||
unityToggle.isOn = LogUnity;
|
unityToggle.isOn = LogUnity;
|
||||||
unityToggleText.text = "Print Unity Debug?";
|
unityToggleText.text = "Print Unity Debug?";
|
||||||
unityToggleText.alignment = TextAnchor.MiddleLeft;
|
unityToggleText.alignment = TextAnchor.MiddleLeft;
|
||||||
@ -269,33 +261,31 @@ namespace UnityExplorer.UI.Modules
|
|||||||
pos.y = -8;
|
pos.y = -8;
|
||||||
unityToggleRect.localPosition = pos;
|
unityToggleRect.localPosition = pos;
|
||||||
|
|
||||||
// // Save to disk button
|
// // Save to disk button
|
||||||
|
|
||||||
// var saveToDiskObj = UIFactory.CreateToggle(bottomBarObj, out Toggle diskToggle, out Text diskToggleText);
|
// 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)
|
// diskToggle.onValueChanged.AddListener(ToggleDisk);
|
||||||
// {
|
|
||||||
// SaveToDisk = val;
|
|
||||||
// ModConfig.Instance.Save_Logs_To_Disk = val;
|
|
||||||
// ModConfig.SaveSettings();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// var diskToggleLayout = saveToDiskObj.AddComponent<LayoutElement>();
|
// diskToggle.isOn = SaveToDisk;
|
||||||
// diskToggleLayout.minWidth = 340;
|
// diskToggleText.text = "Save logs to 'Mods\\UnityExplorer\\Logs'?";
|
||||||
// diskToggleLayout.flexibleWidth = 0;
|
// diskToggleText.alignment = TextAnchor.MiddleLeft;
|
||||||
|
|
||||||
// var saveToDiskRect = saveToDiskObj.transform.Find("Background").GetComponent<RectTransform>();
|
// void ToggleDisk(bool val)
|
||||||
// pos = unityToggleRect.localPosition;
|
// {
|
||||||
// pos.y = -8;
|
// SaveToDisk = val;
|
||||||
// saveToDiskRect.localPosition = pos;
|
// 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
|
#endregion
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ using System.Linq;
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
using UnityExplorer.Config;
|
using UnityExplorer.Config;
|
||||||
|
using UnityExplorer.Helpers;
|
||||||
using UnityExplorer.UI.Shared;
|
using UnityExplorer.UI.Shared;
|
||||||
using UnityExplorer.Unstrip;
|
using UnityExplorer.Unstrip;
|
||||||
|
|
||||||
@ -108,11 +109,8 @@ namespace UnityExplorer.UI.Modules
|
|||||||
var applyColors = applyBtn.colors;
|
var applyColors = applyBtn.colors;
|
||||||
applyColors.normalColor = new Color(0.3f, 0.7f, 0.3f);
|
applyColors.normalColor = new Color(0.3f, 0.7f, 0.3f);
|
||||||
applyBtn.colors = applyColors;
|
applyBtn.colors = applyColors;
|
||||||
#if MONO
|
|
||||||
applyBtn.onClick.AddListener(OnApply);
|
applyBtn.onClick.AddListener(OnApply);
|
||||||
#else
|
|
||||||
applyBtn.onClick.AddListener(new Action(OnApply));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void ConstructKeycodeOpt(GameObject parent)
|
internal void ConstructKeycodeOpt(GameObject parent)
|
||||||
|
@ -492,12 +492,6 @@ namespace UnityExplorer.UI.Modules
|
|||||||
customTypeLayout.flexibleHeight = 0;
|
customTypeLayout.flexibleHeight = 0;
|
||||||
m_customTypeInput = customTypeObj.GetComponent<InputField>();
|
m_customTypeInput = customTypeObj.GetComponent<InputField>();
|
||||||
m_customTypeInput.placeholder.gameObject.GetComponent<Text>().text = "eg. UnityEngine.Texture2D, etc...";
|
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
|
// search input
|
||||||
|
|
||||||
@ -558,11 +552,7 @@ namespace UnityExplorer.UI.Modules
|
|||||||
sceneDropLayout.minWidth = 220;
|
sceneDropLayout.minWidth = 220;
|
||||||
sceneDropLayout.minHeight = 25;
|
sceneDropLayout.minHeight = 25;
|
||||||
|
|
||||||
#if MONO
|
|
||||||
m_sceneDropdown.onValueChanged.AddListener(OnSceneDropdownChanged);
|
m_sceneDropdown.onValueChanged.AddListener(OnSceneDropdownChanged);
|
||||||
#else
|
|
||||||
m_sceneDropdown.onValueChanged.AddListener(new Action<int>(OnSceneDropdownChanged));
|
|
||||||
#endif
|
|
||||||
void OnSceneDropdownChanged(int value)
|
void OnSceneDropdownChanged(int value)
|
||||||
{
|
{
|
||||||
if (value < 4)
|
if (value < 4)
|
||||||
@ -598,11 +588,7 @@ namespace UnityExplorer.UI.Modules
|
|||||||
childDrop.options.Add(new Dropdown.OptionData { text = "Root Objects Only" });
|
childDrop.options.Add(new Dropdown.OptionData { text = "Root Objects Only" });
|
||||||
childDrop.options.Add(new Dropdown.OptionData { text = "Children Only" });
|
childDrop.options.Add(new Dropdown.OptionData { text = "Children Only" });
|
||||||
|
|
||||||
#if MONO
|
|
||||||
childDrop.onValueChanged.AddListener(OnChildDropdownChanged);
|
childDrop.onValueChanged.AddListener(OnChildDropdownChanged);
|
||||||
#else
|
|
||||||
childDrop.onValueChanged.AddListener(new Action<int>(OnChildDropdownChanged));
|
|
||||||
#endif
|
|
||||||
void OnChildDropdownChanged(int value)
|
void OnChildDropdownChanged(int value)
|
||||||
{
|
{
|
||||||
m_childFilter = (ChildFilter)value;
|
m_childFilter = (ChildFilter)value;
|
||||||
@ -617,11 +603,8 @@ namespace UnityExplorer.UI.Modules
|
|||||||
searchBtnLayout.minHeight = 30;
|
searchBtnLayout.minHeight = 30;
|
||||||
searchBtnLayout.flexibleHeight = 0;
|
searchBtnLayout.flexibleHeight = 0;
|
||||||
var searchBtn = searchBtnObj.GetComponent<Button>();
|
var searchBtn = searchBtnObj.GetComponent<Button>();
|
||||||
#if MONO
|
|
||||||
searchBtn.onClick.AddListener(OnUnitySearchClicked);
|
searchBtn.onClick.AddListener(OnUnitySearchClicked);
|
||||||
#else
|
|
||||||
searchBtn.onClick.AddListener(new Action(OnUnitySearchClicked));
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void AddContextButton(GameObject parent, string label, SearchContext context, float width = 110)
|
internal void AddContextButton(GameObject parent, string label, SearchContext context, float width = 110)
|
||||||
@ -632,11 +615,7 @@ namespace UnityExplorer.UI.Modules
|
|||||||
|
|
||||||
m_contextButtons.Add(context, btn);
|
m_contextButtons.Add(context, btn);
|
||||||
|
|
||||||
#if MONO
|
|
||||||
btn.onClick.AddListener(() => { OnContextButtonClicked(context); });
|
btn.onClick.AddListener(() => { OnContextButtonClicked(context); });
|
||||||
#else
|
|
||||||
btn.onClick.AddListener(new Action(() => { OnContextButtonClicked(context); }));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
var btnLayout = btnObj.AddComponent<LayoutElement>();
|
var btnLayout = btnObj.AddComponent<LayoutElement>();
|
||||||
btnLayout.minHeight = 25;
|
btnLayout.minHeight = 25;
|
||||||
@ -719,11 +698,8 @@ namespace UnityExplorer.UI.Modules
|
|||||||
mainColors.normalColor = new Color(0.1f, 0.1f, 0.1f);
|
mainColors.normalColor = new Color(0.1f, 0.1f, 0.1f);
|
||||||
mainColors.highlightedColor = new Color(0.2f, 0.2f, 0.2f, 1);
|
mainColors.highlightedColor = new Color(0.2f, 0.2f, 0.2f, 1);
|
||||||
mainBtn.colors = mainColors;
|
mainBtn.colors = mainColors;
|
||||||
#if CPP
|
|
||||||
mainBtn.onClick.AddListener(new Action(() => { OnResultClicked(thisIndex); }));
|
|
||||||
#else
|
|
||||||
mainBtn.onClick.AddListener(() => { OnResultClicked(thisIndex); });
|
mainBtn.onClick.AddListener(() => { OnResultClicked(thisIndex); });
|
||||||
#endif
|
|
||||||
|
|
||||||
Text mainText = mainButtonObj.GetComponentInChildren<Text>();
|
Text mainText = mainButtonObj.GetComponentInChildren<Text>();
|
||||||
mainText.alignment = TextAnchor.MiddleLeft;
|
mainText.alignment = TextAnchor.MiddleLeft;
|
||||||
|
@ -33,11 +33,7 @@ namespace UnityExplorer.UI.Shared
|
|||||||
this.sliderScroller = sliderScroller;
|
this.sliderScroller = sliderScroller;
|
||||||
this.inputField = inputField;
|
this.inputField = inputField;
|
||||||
|
|
||||||
#if MONO
|
|
||||||
inputField.onValueChanged.AddListener(OnTextChanged);
|
inputField.onValueChanged.AddListener(OnTextChanged);
|
||||||
#else
|
|
||||||
inputField.onValueChanged.AddListener(new Action<string>(OnTextChanged));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
inputRect = inputField.GetComponent<RectTransform>();
|
inputRect = inputField.GetComponent<RectTransform>();
|
||||||
layoutElement = inputField.gameObject.AddComponent<LayoutElement>();
|
layoutElement = inputField.gameObject.AddComponent<LayoutElement>();
|
||||||
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||||||
using UnityExplorer.Config;
|
using UnityExplorer.Config;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using UnityExplorer.Helpers;
|
||||||
|
|
||||||
namespace UnityExplorer.UI.Shared
|
namespace UnityExplorer.UI.Shared
|
||||||
{
|
{
|
||||||
@ -184,11 +185,9 @@ namespace UnityExplorer.UI.Shared
|
|||||||
|
|
||||||
GameObject leftBtnObj = UIFactory.CreateButton(m_pageUIHolder, new Color(0.15f, 0.15f, 0.15f));
|
GameObject leftBtnObj = UIFactory.CreateButton(m_pageUIHolder, new Color(0.15f, 0.15f, 0.15f));
|
||||||
Button leftBtn = leftBtnObj.GetComponent<Button>();
|
Button leftBtn = leftBtnObj.GetComponent<Button>();
|
||||||
#if CPP
|
|
||||||
leftBtn.onClick.AddListener(new Action(() => { TurnPage(Turn.Left); }));
|
|
||||||
#else
|
|
||||||
leftBtn.onClick.AddListener(() => { TurnPage(Turn.Left); });
|
leftBtn.onClick.AddListener(() => { TurnPage(Turn.Left); });
|
||||||
#endif
|
|
||||||
Text leftBtnText = leftBtnObj.GetComponentInChildren<Text>();
|
Text leftBtnText = leftBtnObj.GetComponentInChildren<Text>();
|
||||||
leftBtnText.text = "◄";
|
leftBtnText.text = "◄";
|
||||||
LayoutElement leftBtnLayout = leftBtnObj.AddComponent<LayoutElement>();
|
LayoutElement leftBtnLayout = leftBtnObj.AddComponent<LayoutElement>();
|
||||||
@ -206,11 +205,9 @@ namespace UnityExplorer.UI.Shared
|
|||||||
|
|
||||||
GameObject rightBtnObj = UIFactory.CreateButton(m_pageUIHolder, new Color(0.15f, 0.15f, 0.15f));
|
GameObject rightBtnObj = UIFactory.CreateButton(m_pageUIHolder, new Color(0.15f, 0.15f, 0.15f));
|
||||||
Button rightBtn = rightBtnObj.GetComponent<Button>();
|
Button rightBtn = rightBtnObj.GetComponent<Button>();
|
||||||
#if CPP
|
|
||||||
rightBtn.onClick.AddListener(new Action(() => { TurnPage(Turn.Right); }));
|
|
||||||
#else
|
|
||||||
rightBtn.onClick.AddListener(() => { TurnPage(Turn.Right); });
|
rightBtn.onClick.AddListener(() => { TurnPage(Turn.Right); });
|
||||||
#endif
|
|
||||||
Text rightBtnText = rightBtnObj.GetComponentInChildren<Text>();
|
Text rightBtnText = rightBtnObj.GetComponentInChildren<Text>();
|
||||||
rightBtnText.text = "►";
|
rightBtnText.text = "►";
|
||||||
LayoutElement rightBtnLayout = rightBtnObj.AddComponent<LayoutElement>();
|
LayoutElement rightBtnLayout = rightBtnObj.AddComponent<LayoutElement>();
|
||||||
|
@ -25,15 +25,10 @@ public class SliderScrollbar
|
|||||||
this.m_slider = slider;
|
this.m_slider = slider;
|
||||||
this.m_scrollRect = scrollbar.transform.parent.GetComponent<RectTransform>();
|
this.m_scrollRect = scrollbar.transform.parent.GetComponent<RectTransform>();
|
||||||
|
|
||||||
#if MONO
|
this.m_scrollbar.onValueChanged.AddListener(this.OnScrollbarValueChanged);
|
||||||
this.m_scrollbar.onValueChanged.AddListener(this.OnScrollbarValueChanged);
|
this.m_slider.onValueChanged.AddListener(this.OnSliderValueChanged);
|
||||||
this.m_slider.onValueChanged.AddListener(this.OnSliderValueChanged);
|
|
||||||
#else
|
|
||||||
this.m_scrollbar.onValueChanged.AddListener(new Action<float>(this.OnScrollbarValueChanged));
|
|
||||||
this.m_slider.onValueChanged.AddListener(new Action<float>(this.OnSliderValueChanged));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
this.RefreshVisibility();
|
this.RefreshVisibility();
|
||||||
this.m_slider.Set(1f, false);
|
this.m_slider.Set(1f, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
//using TMPro;
|
//using TMPro;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.UI;
|
using UnityEngine.UI;
|
||||||
|
using UnityExplorer.Helpers;
|
||||||
using UnityExplorer.UI.Shared;
|
using UnityExplorer.UI.Shared;
|
||||||
|
|
||||||
namespace UnityExplorer.UI
|
namespace UnityExplorer.UI
|
||||||
@ -71,11 +72,7 @@ namespace UnityExplorer.UI
|
|||||||
// this is because i'm not setting any ColorBlock.selectedColor, because it is commonly stripped.
|
// this is because i'm not setting any ColorBlock.selectedColor, because it is commonly stripped.
|
||||||
if (selectable is Button button)
|
if (selectable is Button button)
|
||||||
{
|
{
|
||||||
#if CPP
|
button.onClick.AddListener(Deselect);
|
||||||
button.onClick.AddListener(new Action(Deselect));
|
|
||||||
#else
|
|
||||||
button.onClick.AddListener(Deselect);
|
|
||||||
#endif
|
|
||||||
void Deselect()
|
void Deselect()
|
||||||
{
|
{
|
||||||
button.OnDeselect(null);
|
button.OnDeselect(null);
|
||||||
@ -347,19 +344,12 @@ namespace UnityExplorer.UI
|
|||||||
toggle = toggleObj.AddComponent<Toggle>();
|
toggle = toggleObj.AddComponent<Toggle>();
|
||||||
toggle.isOn = true;
|
toggle.isOn = true;
|
||||||
Toggle toggleComp = toggle;
|
Toggle toggleComp = toggle;
|
||||||
#if CPP
|
|
||||||
toggle.onValueChanged.AddListener(new Action<bool>((bool val) =>
|
toggle.onValueChanged.AddListener(Deselect);
|
||||||
|
void Deselect(bool _)
|
||||||
{
|
{
|
||||||
toggleComp.OnDeselect(null);
|
toggleComp.OnDeselect(null);
|
||||||
}));
|
|
||||||
#else
|
|
||||||
toggle.onValueChanged.AddListener(Deselect);
|
|
||||||
|
|
||||||
void Deselect(bool _)
|
|
||||||
{
|
|
||||||
toggleComp.OnDeselect(null);
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
Image bgImage = bgObj.AddComponent<Image>();
|
Image bgImage = bgObj.AddComponent<Image>();
|
||||||
bgImage.type = Image.Type.Sliced;
|
bgImage.type = Image.Type.Sliced;
|
||||||
@ -549,11 +539,7 @@ namespace UnityExplorer.UI
|
|||||||
colors.highlightedColor = new Color(0.25f, 0.45f, 0.25f, 1.0f);
|
colors.highlightedColor = new Color(0.25f, 0.45f, 0.25f, 1.0f);
|
||||||
itemToggle.colors = colors;
|
itemToggle.colors = colors;
|
||||||
|
|
||||||
#if CPP
|
itemToggle.onValueChanged.AddListener((bool val) => { itemToggle.OnDeselect(null); });
|
||||||
itemToggle.onValueChanged.AddListener(new Action<bool>((bool val) => { itemToggle.OnDeselect(null); }));
|
|
||||||
#else
|
|
||||||
itemToggle.onValueChanged.AddListener((bool val) => { itemToggle.OnDeselect(null); });
|
|
||||||
#endif
|
|
||||||
Image templateImage = templateObj.AddComponent<Image>();
|
Image templateImage = templateObj.AddComponent<Image>();
|
||||||
templateImage.type = Image.Type.Sliced;
|
templateImage.type = Image.Type.Sliced;
|
||||||
templateImage.color = new Color(0.15f, 0.15f, 0.15f, 1.0f);
|
templateImage.color = new Color(0.15f, 0.15f, 0.15f, 1.0f);
|
||||||
|
@ -323,6 +323,7 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Helpers\EventHelper.cs" />
|
||||||
<Compile Include="Inspectors\MouseInspector.cs" />
|
<Compile Include="Inspectors\MouseInspector.cs" />
|
||||||
<Compile Include="Inspectors\Reflection\CacheObject\CacheEnumerated.cs" />
|
<Compile Include="Inspectors\Reflection\CacheObject\CacheEnumerated.cs" />
|
||||||
<Compile Include="Inspectors\Reflection\CacheObject\CacheFactory.cs" />
|
<Compile Include="Inspectors\Reflection\CacheObject\CacheFactory.cs" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user