summaryrefslogtreecommitdiff
path: root/Assets/Plugins/Sirenix/Odin Inspector/Scripts/Editor/VectorIntPropertyResolvers.cs
diff options
context:
space:
mode:
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