Пример #1
0
        private static LayerMask DrawLayerMask(GUIContent guiContent, LayerMask layerMask)
        {
            if (FieldInspector.layerNames == null)
            {
                FieldInspector.InitLayers();
            }
            int num = 0;

            for (int i = 0; i < FieldInspector.layerNames.Length; i++)
            {
                if ((layerMask.value & FieldInspector.maskValues[i]) == FieldInspector.maskValues[i])
                {
                    num |= 1 << i;
                }
            }
            int num2 = EditorGUILayout.MaskField(guiContent, num, FieldInspector.layerNames, new GUILayoutOption[0]);

            if (num2 != num)
            {
                num = 0;
                for (int j = 0; j < FieldInspector.layerNames.Length; j++)
                {
                    if ((num2 & 1 << j) != 0)
                    {
                        num |= FieldInspector.maskValues[j];
                    }
                }
                layerMask.value = num;
            }
            return(layerMask);
        }
Пример #2
0
 public static void Init()
 {
     FieldInspector.InitLayers();
 }