summaryrefslogtreecommitdiff
path: root/VRCSDK3Avatars/Assets/Resources/GestureManager/Scripts/Editor/Modules/ModuleHelper.cs
blob: 5513fb8cb10301c62ffba98047a06dc4aa976c11 (plain)
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
using GestureManager.Scripts.Extra;
using GmgAvatarDescriptor =
#if VRC_SDK_VRCSDK2 || VRC_SDK_VRCSDK3
    VRC.SDKBase.VRC_AvatarDescriptor;
#else
    UnityEngine.Component;
#endif
using UnityEngine;

namespace GestureManager.Scripts.Editor.Modules
{
    public static class ModuleHelper
    {
        public static ModuleBase GetModuleFor(GestureManager manager, GameObject gameObject) => GetModuleFor(manager, gameObject.GetComponent<GmgAvatarDescriptor>());

        public static ModuleBase GetModuleFor(GestureManager manager, GmgAvatarDescriptor descriptorComponent)
        {
            switch (descriptorComponent)
            {
#if VRC_SDK_VRCSDK2
                case VRCSDK2.VRC_AvatarDescriptor descriptorV2:
                    return new Vrc2.ModuleVrc2(manager, descriptorV2);
#endif
#if VRC_SDK_VRCSDK3
                case VRC.SDK3.Avatars.Components.VRCAvatarDescriptor descriptorV3:
                    return new Vrc3.ModuleVrc3(manager, descriptorV3);
#endif
                default: return null;
            }
        }
    }
}