weixudong
2020-11-19 8b57dd2c92449dd326fff48f9d9e14415f9d0ccc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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