diff --git a/Alchemy/Assets/Alchemy/Editor/Internal/GUIHelper.cs b/Alchemy/Assets/Alchemy/Editor/Internal/GUIHelper.cs index d8d30ad..fec097a 100644 --- a/Alchemy/Assets/Alchemy/Editor/Internal/GUIHelper.cs +++ b/Alchemy/Assets/Alchemy/Editor/Internal/GUIHelper.cs @@ -88,7 +88,7 @@ namespace Alchemy.Editor if (events.OnItemsChosen == null) return; ReflectionHelper.Invoke(target, events.OnItemsChosen, new object[] { items }); }; -#elif UNITY_2022_1_OR_NEWER +#else listView.onItemsChosen += items => { if (events.OnItemsChosen == null) return; @@ -113,8 +113,8 @@ namespace Alchemy.Editor if (events.OnSelectedIndicesChanged== null) return; ReflectionHelper.Invoke(target, events.OnSelectedIndicesChanged, new object[] { indices }); }; -#elif UNITY_2022_1_OR_NEWER - listView.onSelectionChanged += items => +#else + listView.onSelectionChange += items => { if (events.OnSelectionChanged == null) return; ReflectionHelper.Invoke(target, events.OnSelectionChanged, new object[] { items }); diff --git a/Alchemy/Assets/Alchemy/Runtime/Inspector/InspectorAttributes.cs b/Alchemy/Assets/Alchemy/Runtime/Inspector/InspectorAttributes.cs index fffed14..2538932 100644 --- a/Alchemy/Assets/Alchemy/Runtime/Inspector/InspectorAttributes.cs +++ b/Alchemy/Assets/Alchemy/Runtime/Inspector/InspectorAttributes.cs @@ -225,13 +225,13 @@ namespace Alchemy.Inspector public string OnItemIndexChanged { get; set; } public string OnItemsAdded { get; set; } public string OnItemsRemoved { get; set; } -#if UNITY_2022_1_OR_NEWER + public string OnItemsChosen { get; set; } -#endif + public string OnItemsSourceChanged { get; set; } -#if UNITY_2022_1_OR_NEWER + public string OnSelectionChanged { get; set; } public string OnSelectedIndicesChanged { get; set; } -#endif + } } \ No newline at end of file diff --git a/Alchemy/Assets/Tests/OnListViewChangedTest.cs b/Alchemy/Assets/Tests/OnListViewChangedTest.cs index 19e6e1a..8c6e26f 100644 --- a/Alchemy/Assets/Tests/OnListViewChangedTest.cs +++ b/Alchemy/Assets/Tests/OnListViewChangedTest.cs @@ -8,10 +8,7 @@ public class OnListViewChangedTest : MonoBehaviour OnItemChanged = nameof(OnItemChanged), OnItemsAdded = nameof(OnItemsAdded), OnItemsRemoved = nameof(OnItemsRemoved), -#if UNITY_2022_1_OR_NEWER OnSelectedIndicesChanged = nameof(OnSelectedIndicesChanged), -#endif - OnItemIndexChanged = nameof(OnItemIndexChanged)) ] public int[] array; @@ -30,12 +27,12 @@ public class OnListViewChangedTest : MonoBehaviour { Debug.Log($"Removed: [{string.Join(',', indices)}]"); } -#if UNITY_2022_1_OR_NEWER + void OnSelectedIndicesChanged(IEnumerable indices) { Debug.Log($"Selected: [{string.Join(',', indices)}]"); } -#endif + void OnItemIndexChanged(int before, int after) { Debug.Log($"Index Changed: [{before} -> {after}]");