add AddListener helper for IL2CPP, cleanup some unity extensions

This commit is contained in:
sinaioutlander
2020-11-13 23:14:57 +11:00
parent eedb7dd76f
commit eb693eceb5
23 changed files with 136 additions and 282 deletions

View File

@ -319,12 +319,8 @@ namespace UnityExplorer.Inspectors.Reflection
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
evalButton.onClick.AddListener(OnMainEvaluateButton);
void OnMainEvaluateButton()
{
if (HasParameters)

View File

@ -48,7 +48,7 @@ namespace UnityExplorer.Inspectors.Reflection
GetLabelForValue();
m_text.text = RichTextValue;
bool shouldShowInspect = !InspectorBase.IsNullOrDestroyed(this.Value, true);
bool shouldShowInspect = !Value.IsNullOrDestroyed(true);
if (m_inspectButton.activeSelf != shouldShowInspect)
m_inspectButton.SetActive(shouldShowInspect);
}
@ -164,14 +164,11 @@ namespace UnityExplorer.Inspectors.Reflection
var inspectText = m_inspectButton.GetComponentInChildren<Text>();
inspectText.text = "Inspect";
var inspectBtn = m_inspectButton.GetComponent<Button>();
#if CPP
inspectBtn.onClick.AddListener(new Action(OnInspectClicked));
#else
inspectBtn.onClick.AddListener(OnInspectClicked);
#endif
void OnInspectClicked()
{
if (!InspectorBase.IsNullOrDestroyed(this.Value))
if (!Value.IsNullOrDestroyed())
InspectorManager.Instance.Inspect(this.Value);
}

View File

@ -472,7 +472,7 @@ namespace UnityExplorer.Inspectors
nameInputLayout.minWidth = 100;
nameInputLayout.minHeight = 25;
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;
// membertype filter