Fix: #if 2022.2 to 2022.1

This commit is contained in:
Akeit0 2024-03-01 14:27:22 +09:00
parent a2e588ef38
commit a509a7ba83
3 changed files with 16 additions and 4 deletions

View File

@ -103,7 +103,7 @@ namespace Alchemy.Editor.Elements
else if (type == typeof(uint))
{
#if UNITY_2022_2_OR_NEWER
#if UNITY_2022_1_OR_NEWER
AddField(new UnsignedIntegerField(label), (uint)obj);
#else
var value = (uint)obj;
@ -126,7 +126,7 @@ namespace Alchemy.Editor.Elements
}
else if (type == typeof(ulong))
{
#if UNITY_2022_2_OR_NEWER
#if UNITY_2022_1_OR_NEWER
AddField(new UnsignedLongField(label), (ulong)obj);
#else
var value = (ulong)obj;

View File

@ -82,7 +82,7 @@ namespace Alchemy.Editor
if (events.OnItemsRemoved == null) return;
ReflectionHelper.Invoke(target, events.OnItemsRemoved, new object[] { indices });
};
#if UNITY_2022_2_OR_NEWER
#if UNITY_2022_1_OR_NEWER
listView.itemsChosen += items =>
{
if (events.OnItemsChosen == null) return;
@ -101,7 +101,7 @@ namespace Alchemy.Editor
if (events.OnItemIndexChanged == null) return;
ReflectionHelper.Invoke(target, events.OnItemIndexChanged, new object[] { before, after });
};
#if UNITY_2022_2_OR_NEWER
#if UNITY_2022_1_OR_NEWER
listView.selectionChanged += items =>
{
if (events.OnSelectionChanged == null) return;

View File

@ -8,6 +8,8 @@ public class OnListViewChangedTest : MonoBehaviour
OnItemChanged = nameof(OnItemChanged),
OnItemsAdded = nameof(OnItemsAdded),
OnItemsRemoved = nameof(OnItemsRemoved),
OnItemsChosen = nameof(OnItemChosen),
OnSelectionChanged = nameof(OnSelectionChanged),
OnSelectedIndicesChanged = nameof(OnSelectedIndicesChanged),
OnItemIndexChanged = nameof(OnItemIndexChanged))
]
@ -28,6 +30,16 @@ public class OnListViewChangedTest : MonoBehaviour
Debug.Log($"Removed: [{string.Join(',', indices)}]");
}
void OnItemChosen(IEnumerable<object> items)
{
Debug.Log($"Chosen: [{string.Join(',', items)}]");
}
void OnSelectionChanged(IEnumerable<object> items)
{
Debug.Log($"Selection Changed: [{string.Join(',', items)}]");
}
void OnSelectedIndicesChanged(IEnumerable<int> indices)
{
Debug.Log($"Selected: [{string.Join(',', indices)}]");