Esempio n. 1
0
        // On gui
        protected override void OnGUI()
        {
            base.OnGUI();
            EditorGUILayout.BeginHorizontal();
            WitEditorUI.LayoutStatusLabel(_status);
            GUILayout.BeginVertical(GUILayout.Width(24));
            GUILayout.Space(4);
            GUILayout.BeginHorizontal();
            GUILayout.Space(4);
            var rect = GUILayoutUtility.GetLastRect();

            if (null == _hamburgerButton)
            {
                // GUI.skin must be called from OnGUI
                _hamburgerButton = new GUIStyle(GUI.skin.GetStyle("PaneOptions"));
                _hamburgerButton.imagePosition = ImagePosition.ImageOnly;
            }

            var value = EditorGUILayout.Popup(-1, new string[] { "Save", "Copy to Clipboard" }, _hamburgerButton, GUILayout.Width(24));

            if (-1 != value)
            {
                if (value == 0)
                {
                    var path = EditorUtility.SaveFilePanel("Save Response Json", Application.dataPath,
                                                           "result", "json");
                    if (!string.IsNullOrEmpty(path))
                    {
                        File.WriteAllText(path, _response.ToString());
                    }
                }
                else
                {
                    EditorGUIUtility.systemCopyBuffer = _response.ToString();
                }
            }

            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();
        }