public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { if (IsConditionMet(property)) { //条件满足,开始绘制 if (property.type.EndsWith("Event")) { UEDrawer.OnGUI(position, property, string.IsNullOrEmpty(condSAtt.Label) ? label : new GUIContent(condSAtt.Label)); } else { LabelDrawer.DrawLabel(position, property, condSAtt.Label); } } else if (condSAtt.AlwaysShow && Event.current.type == EventType.Repaint) { var tc = GUI.color; GUI.color = Color.gray; if (property.type.EndsWith("Event")) { UEDrawer.OnGUI(position, property, string.IsNullOrEmpty(condSAtt.Label) ? label : new GUIContent(condSAtt.Label)); } else { LabelDrawer.DrawLabel(position, property, condSAtt.Label); } GUI.color = tc; } }
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { if (!initialized) { if (property.type.EndsWith("Event")) { drawerOverride = new UnityEditorInternal.UnityEventDrawer(); } if (property.type.EndsWith("Map")) { drawerOverride = System.Reflection.Assembly.GetExecutingAssembly().CreateInstance(property.type + "Drawer") as PropertyDrawer; } initialized = true; } if (IsConditionMet(property)) { // 条件满足,开始绘制 LabelDrawer.DrawLabel(position, property, Attr.Label, Attr.Const, drawerOverride); } else if (Attr.AlwaysShow && Event.current.type == EventType.Repaint) { var tc = GUI.color; GUI.color = Color.gray; LabelDrawer.DrawLabel(position, property, Attr.Label, Attr.Const, drawerOverride); GUI.color = tc; } }