コード例 #1
0
        void OnGUI()
        {
            Event evt      = Event.current;
            bool  hitEnter = evt.type == EventType.KeyDown && (evt.keyCode == KeyCode.Return || evt.keyCode == KeyCode.KeypadEnter);

            GUI.SetNextControlName(kIpTextFieldId);

            EditorGUILayout.BeginVertical();
            {
                GUILayout.Space(5);
                m_IpString = EditorGUILayout.TextField(m_IpString);

                if (!m_DidFocus)
                {
                    m_DidFocus = true;
                    EditorGUI.FocusTextInControl(kIpTextFieldId);
                }

                GUI.enabled = !string.IsNullOrEmpty(m_IpString);
                if (GUILayout.Button("Connect") || hitEnter)
                {
                    Close();
                    EditorPrefs.SetString(kAndroidLogcatLastIp, m_IpString);
                    AndroidLogcatUtilities.ConnectDevice(m_Adb, m_IpString);
                    GUIUtility.ExitGUI();
                }
            }
            EditorGUILayout.EndVertical();
        }