summaryrefslogtreecommitdiff
path: root/VRCSDK3Worlds/Assets/Udon/UdonNetworkTypes.cs
blob: 9ed82631fd3e0c8222ef959960cbe3717f8e845b (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
using UnityEngine;
using System;
using System.Collections.Generic;

namespace VRC.Udon
{
    public static class UdonNetworkTypes
    {
        public static bool CanSync(Type type) => _syncTypes.Contains(type);
        public static bool CanSyncLinear(Type type) => _linearTypes.Contains(type);
        public static bool CanSyncSmooth(Type type) => _smoothTypes.Contains(type);

        private static readonly HashSet<Type> _syncTypes = new HashSet<Type>{
            typeof(bool),
            typeof(char),
            typeof(byte),
            typeof(uint),
            typeof(int),
            typeof(long),
            typeof(sbyte),
            typeof(ulong),
            typeof(float),
            typeof(double),
            typeof(short),
            typeof(ushort),
            typeof(string),
            typeof(bool[]),
            typeof(char[]),
            typeof(byte[]),
            typeof(uint[]),
            typeof(int[]),
            typeof(long[]),
            typeof(sbyte[]),
            typeof(ulong[]),
            typeof(float[]),
            typeof(double[]),
            typeof(short[]),
            typeof(ushort[]),
            typeof(string[]),
            typeof(Color),
            typeof(Color32),
            typeof(Vector2),
            typeof(Vector3),
            typeof(Vector4),
            typeof(Quaternion),
            typeof(Vector2[]),
            typeof(Vector3[]),
            typeof(Vector4[]),
            typeof(Quaternion[]),
            typeof(Color[]),
            typeof(Color32[]),
            typeof(SDKBase.VRCUrl),
            typeof(SDKBase.VRCUrl[]),
        };

        private static readonly HashSet<Type> _linearTypes = new HashSet<Type>{
            typeof(byte),
            typeof(sbyte),
            typeof(short),
            typeof(ushort),
            typeof(uint),
            typeof(int),
            typeof(ulong),
            typeof(long),
            typeof(float),
            typeof(double),
            typeof(Vector2),
            typeof(Vector3),
            typeof(Quaternion),
            typeof(Color),
            typeof(Color32),
        };

        private static readonly HashSet<Type> _smoothTypes = new HashSet<Type> {
            typeof(byte),
            typeof(sbyte),
            typeof(short),
            typeof(ushort),
            typeof(uint),
            typeof(int),
            typeof(ulong),
            typeof(long),
            typeof(float),
            typeof(double),
            typeof(Vector2),
            typeof(Vector3),
            typeof(Quaternion),
        };
    }
}