Exemplo n.º 1
0
        private void HandleField(SerializedProperty fieldProperty, Type targetType)
        {
            FieldInfo field = targetType.GetField(fieldProperty.name);

            if (field == null)
            {
                return;
            }
            if (field.FieldType == typeof(Environment))
            {
                if (EditorApplication.isPlaying)
                {
                    GUI.enabled = false;
                }
                EditorGUILayout.PropertyField(fieldProperty, true);
                Environment env = (Environment)field.GetValue(serializedObject.targetObject);

                string mappingConfigName = env == Environment.Cave ? "CaveInputBinding" : "PCInputBinding";
                var    mappingProperty   = serializedObject.FindProperty(mappingConfigName);
                InspectorUtils.DrawField(targetType.GetField(mappingConfigName), mappingProperty, serializedObject.targetObject);
                GUI.enabled = true;
            }
            else if (!typeof(InputBinding).IsAssignableFrom(field.FieldType))
            {
                EditorGUILayout.PropertyField(fieldProperty, true);
            }
        }
Exemplo n.º 2
0
 public void DrawInInspector(SerializedProperty property)
 {
     InspectorUtils.DrawObject(property, () => {
         EditorGUILayout.PropertyField(property.FindPropertyRelative("ReverseAxisDirection"), false);
         InspectorUtils.DrawField(GetType().GetField("PositiveButton"), property.FindPropertyRelative("PositiveButton"), this);
         InspectorUtils.DrawField(GetType().GetField("NegativeButton"), property.FindPropertyRelative("NegativeButton"), this);
     });
 }
Exemplo n.º 3
0
 public void DrawInInspector(SerializedProperty property)
 {
     InspectorUtils.DrawObject(property, () => {
         foreach (var field in GetType().GetFields())
         {
             var fieldProperty = property.FindPropertyRelative(field.Name);
             InspectorUtils.DrawField(field, fieldProperty, this);
         }
     });
 }
Exemplo n.º 4
0
 public void DrawInInspector(SerializedProperty property)
 {
     InspectorUtils.DrawObject(property, () => {
         EditorGUILayout.PropertyField(property.FindPropertyRelative("IsButtonActivated"), false);
         if (typeof(CursorInput).IsAssignableFrom(GetType()))
         {
             EditorGUILayout.PropertyField(property.FindPropertyRelative("MainAxisOnly"), false);
         }
         if (typeof(FlystickInput).IsAssignableFrom(GetType()))
         {
             EditorGUILayout.PropertyField(property.FindPropertyRelative("Instance"), false);
         }
         if (IsButtonActivated && typeof(PointerInput).IsAssignableFrom(GetType()))
         {
             EditorGUILayout.PropertyField(property.FindPropertyRelative("ActivationType"), false);
         }
         if (IsButtonActivated)
         {
             var buttonProperty = property.FindPropertyRelative("Button");
             InspectorUtils.DrawField(GetType().GetField("Button"), buttonProperty, this);
         }
     });
 }
Exemplo n.º 5
0
        private void DrawField(string name, Type targetType)
        {
            var mappingProperty = serializedObject.FindProperty(name);

            InspectorUtils.DrawField(targetType.GetField(name), mappingProperty, serializedObject.targetObject);
        }