public override void OnGUI() { if (memberValue == null) { memberValue = string.Empty; } if (_values == null) { UpdateValues(); if (attribute.Filter) { _filter = new TextFilter(_values, id, false, prefs, SetValue); } } string newValue = null; string currentValue = memberValue; using (gui.Horizontal()) { if (attribute.TextField) { #if PROFILE Profiler.BeginSample("PopupDrawer TextFieldDrop"); #endif newValue = gui.TextFieldDropDown(displayText, memberValue, _values); if (currentValue != newValue) { _changed = true; } #if PROFILE Profiler.EndSample(); #endif } else { #if PROFILE Profiler.BeginSample("PopupDrawer TextFieldDrop"); #endif if (!_currentIndex.HasValue) { if (attribute.TakeLastPathItem) { _currentIndex = _values.IndexOf(x => GetActualValue(x) == currentValue); } else { _currentIndex = _values.IndexOf(currentValue); } } if (_currentIndex == -1) { _currentIndex = 0; if (_values.Length > 0) { SetValue(_values[0]); } } gui.BeginCheck(); int selection = gui.Popup(displayText, _currentIndex.Value, _values); if (gui.HasChanged() && _values.Length > 0) { _currentIndex = selection; _changed = true; newValue = _values[selection]; } #if PROFILE Profiler.EndSample(); #endif } if (attribute.Filter) { _filter.OnGUI(gui, 45f); } if (_changed) { _changed = false; SetValue(newValue); } if (_showUpdateButton && gui.MiniButton("U", "Update popup values", MiniButtonStyle.Right)) { UpdateValues(); } } }
public override void OnRightGUI() { filter.OnGUI(gui); }