public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { position = EditorGUI.PrefixLabel(position, label); var attrib = this.fieldInfo.GetCustomAttributes(typeof(SPTime.Config), false).FirstOrDefault() as SPTime.Config; var availNames = (attrib != null) ? attrib.AvailableCustomTimeNames : null; SPTimePropertyDrawer.DrawTimeSupplier(position, property, position.width, availNames); }
protected virtual void DrawTimePeriodSansLabel(Rect position, SerializedProperty property) { var secondsProp = property.FindPropertyRelative(PROP_SECONDS); var w = position.width / 3f; var attrib = this.fieldInfo.GetCustomAttributes(typeof(SPTime.Config), false).FirstOrDefault() as SPTime.Config; var availNames = (attrib != null) ? attrib.AvailableCustomTimeNames : null; if (w > 75f) { position = _timeDrawer.DrawDuration(position, secondsProp, Mathf.Min(w, 150f)); position = _timeDrawer.DrawUnits(position, secondsProp, 75f); position = SPTimePropertyDrawer.DrawTimeSupplier(position, property, position.width, availNames); //we mirror the SPTime prop drawer, we can do this because the property names are identical } else { position = _timeDrawer.DrawDuration(position, secondsProp, w); position = _timeDrawer.DrawUnits(position, secondsProp, w); position = SPTimePropertyDrawer.DrawTimeSupplier(position, property, position.width, availNames); //we mirror the SPTime prop drawer, we can do this because the property names are identical } }