summaryrefslogtreecommitdiff
path: root/Assets/Plugins/Sirenix/Odin Inspector/Scripts/Editor/VectorIntPropertyResolvers.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2020-10-15 19:05:22 +0800
committerchai <chaifix@163.com>2020-10-15 19:05:22 +0800
commitf049177e20a276049c61edbad631c1b2bbdd5706 (patch)
tree7d1a1cd9b690a5d9a8b9a65554a191d6ec769601 /Assets/Plugins/Sirenix/Odin Inspector/Scripts/Editor/VectorIntPropertyResolvers.cs
parent6990a0d1fbdcbbf404f40713363ac1a148c8840a (diff)
-advanced inspector
+odin
Diffstat (limited to 'Assets/Plugins/Sirenix/Odin Inspector/Scripts/Editor/VectorIntPropertyResolvers.cs')
-rw-r--r--Assets/Plugins/Sirenix/Odin Inspector/Scripts/Editor/VectorIntPropertyResolvers.cs54
1 files changed, 54 insertions, 0 deletions
diff --git a/Assets/Plugins/Sirenix/Odin Inspector/Scripts/Editor/VectorIntPropertyResolvers.cs b/Assets/Plugins/Sirenix/Odin Inspector/Scripts/Editor/VectorIntPropertyResolvers.cs
new file mode 100644
index 00000000..2e7df3e0
--- /dev/null
+++ b/Assets/Plugins/Sirenix/Odin Inspector/Scripts/Editor/VectorIntPropertyResolvers.cs
@@ -0,0 +1,54 @@
+//-----------------------------------------------------------------------
+// <copyright file="VectorIntPropertyResolvers.cs" company="Sirenix IVS">
+// Copyright (c) Sirenix IVS. All rights reserved.
+// </copyright>
+//-----------------------------------------------------------------------
+
+#if UNITY_EDITOR && UNITY_2017_2_OR_NEWER
+
+namespace Sirenix.OdinInspector.Editor.Drawers
+{
+ using UnityEngine;
+
+ public sealed class Vector2IntResolver : BaseMemberPropertyResolver<Vector2Int>
+ {
+ protected override InspectorPropertyInfo[] GetPropertyInfos()
+ {
+ return new InspectorPropertyInfo[]
+ {
+ InspectorPropertyInfo.CreateValue("x", 0, this.Property.ValueEntry.SerializationBackend,
+ new GetterSetter<Vector2Int, int>(
+ getter: (ref Vector2Int vec) => vec.x,
+ setter: (ref Vector2Int vec, int value) => vec.x = value)),
+ InspectorPropertyInfo.CreateValue("y", 0, this.Property.ValueEntry.SerializationBackend,
+ new GetterSetter<Vector2Int, int>(
+ getter: (ref Vector2Int vec) => vec.y,
+ setter: (ref Vector2Int vec, int value) => vec.y = value)),
+ };
+ }
+ }
+
+ public sealed class Vector3IntResolver : BaseMemberPropertyResolver<Vector3Int>
+ {
+ protected override InspectorPropertyInfo[] GetPropertyInfos()
+ {
+ return new InspectorPropertyInfo[]
+ {
+ InspectorPropertyInfo.CreateValue("x", 0, this.Property.ValueEntry.SerializationBackend,
+ new GetterSetter<Vector3Int, int>(
+ getter: (ref Vector3Int vec) => vec.x,
+ setter: (ref Vector3Int vec, int value) => vec.x = value)),
+ InspectorPropertyInfo.CreateValue("y", 0, this.Property.ValueEntry.SerializationBackend,
+ new GetterSetter<Vector3Int, int>(
+ getter: (ref Vector3Int vec) => vec.y,
+ setter: (ref Vector3Int vec, int value) => vec.y = value)),
+ InspectorPropertyInfo.CreateValue("z", 0, this.Property.ValueEntry.SerializationBackend,
+ new GetterSetter<Vector3Int, int>(
+ getter: (ref Vector3Int vec) => vec.z,
+ setter: (ref Vector3Int vec, int value) => vec.z = value)),
+ };
+ }
+ }
+}
+
+#endif // UNITY_EDITOR && UNITY_2017_2_OR_NEWER \ No newline at end of file