public static ObjectPropertyDrawer GetObjectPropertyDrawer(Type objType) { if (ObjectPropertyDrawers.drawers == null) { ObjectPropertyDrawers.Rebuild(); } ObjectPropertyDrawer result; ObjectPropertyDrawers.drawers.TryGetValue(objType, ref result); return(result); }
public static SkillObject FsmObjectField(GUIContent label, Skill fsm, SkillObject fsmObject, Type objectTypeConstraint, object[] attributes) { if (label == null) { label = GUIContent.none; } if (fsmObject == null) { SkillObject fsmObject2 = new SkillObject(); fsmObject2.set_ObjectType(objectTypeConstraint); fsmObject = fsmObject2; } EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]); if (!objectTypeConstraint.IsAssignableFrom(fsmObject.get_ObjectType())) { fsmObject.set_ObjectType(objectTypeConstraint); } if (fsmObject.get_UseVariable()) { fsmObject = VariableEditor.DoFsmObjectPopup(label, fsm, fsmObject, objectTypeConstraint); } else { ObjectPropertyDrawer objectPropertyDrawer = ObjectPropertyDrawers.GetObjectPropertyDrawer(fsmObject.get_ObjectType()); if (objectPropertyDrawer != null) { fsmObject.set_Value(objectPropertyDrawer.OnGUI(label, fsmObject.get_Value(), !SkillEditor.SelectedFsmIsPersistent(), attributes)); } else { fsmObject.set_Value(EditorGUILayout.ObjectField(label, fsmObject.get_Value(), fsmObject.get_ObjectType(), !SkillEditor.SelectedFsmIsPersistent(), new GUILayoutOption[0])); } } fsmObject = (SkillObject)VariableEditor.VariableToggle(fsmObject, label.get_text()); VariableEditor.EndVariableEditor(fsmObject); return(fsmObject); }