private WrapMode WrapModeIconPopup(Keyframe key, WrapMode oldWrap, float hOffset) { float width = (float)CurveEditorWindow.s_WrapModeMenuIcon.image.width; Vector3 viewTransformPoint = this.m_CurveEditor.DrawingToViewTransformPoint(new Vector3(key.time, key.value)); Rect position = new Rect(viewTransformPoint.x + width * hOffset, viewTransformPoint.y, width, width); WrapModeFixedCurve wrapModeFixedCurve = (WrapModeFixedCurve)oldWrap; Enum[] array1 = Enum.GetValues(typeof(WrapModeFixedCurve)).Cast <Enum>().ToArray <Enum>(); string[] array2 = ((IEnumerable <string>)Enum.GetNames(typeof(WrapModeFixedCurve))).Select <string, string>((Func <string, string>)(x => ObjectNames.NicifyVariableName(x))).ToArray <string>(); int selected = Array.IndexOf <Enum>(array1, (Enum)wrapModeFixedCurve); int controlId = GUIUtility.GetControlID("WrapModeIconPopup".GetHashCode(), EditorGUIUtility.native, position); int selectedValueForControl = EditorGUI.PopupCallbackInfo.GetSelectedValueForControl(controlId, selected); GUIContent[] options = EditorGUIUtility.TempContent(array2); Event current = Event.current; EventType type = current.type; switch (type) { case EventType.KeyDown: if (current.MainActionKeyForControl(controlId)) { if (Application.platform == RuntimePlatform.OSXEditor) { position.y = (float)((double)position.y - (double)(selectedValueForControl * 16) - 19.0); } EditorGUI.PopupCallbackInfo.instance = new EditorGUI.PopupCallbackInfo(controlId); EditorUtility.DisplayCustomMenu(position, options, selectedValueForControl, new EditorUtility.SelectMenuItemFunction(EditorGUI.PopupCallbackInfo.instance.SetEnumValueDelegate), (object)null); current.Use(); break; } break; case EventType.Repaint: GUIStyle.none.Draw(position, CurveEditorWindow.s_WrapModeMenuIcon, controlId, false); break; default: if (type == EventType.MouseDown && current.button == 0 && position.Contains(current.mousePosition)) { if (Application.platform == RuntimePlatform.OSXEditor) { position.y = (float)((double)position.y - (double)(selectedValueForControl * 16) - 19.0); } EditorGUI.PopupCallbackInfo.instance = new EditorGUI.PopupCallbackInfo(controlId); EditorUtility.DisplayCustomMenu(position, options, selectedValueForControl, new EditorUtility.SelectMenuItemFunction(EditorGUI.PopupCallbackInfo.instance.SetEnumValueDelegate), (object)null); GUIUtility.keyboardControl = controlId; current.Use(); break; } break; } return((WrapMode)array1[selectedValueForControl]); }
private WrapMode WrapModeIconPopup(Keyframe key, WrapMode oldWrap, float hOffset) { float width = s_WrapModeMenuIcon.image.width; Vector3 lhs = new Vector3(key.time, key.value); lhs = this.m_CurveEditor.DrawingToViewTransformPoint(lhs); Rect position = new Rect(lhs.x + (width * hOffset), lhs.y, width, width); WrapModeFixedCurve curve = (WrapModeFixedCurve)oldWrap; Enum[] array = Enum.GetValues(typeof(WrapModeFixedCurve)).Cast <Enum>().ToArray <Enum>(); if (< > f__am$cache9 == null) {