Inheritance: EditorWindow
コード例 #1
0
        public override void OnInspectorGUI()
        {
            controller = (AirConsole)target;

            // show logo & version
            EditorGUILayout.BeginHorizontal(styleBlack, GUILayout.Height(30));
            GUILayout.Label(logo, GUILayout.Width(128), GUILayout.Height(30));
            GUILayout.FlexibleSpace();
            GUILayout.Label("v" + Settings.VERSION, styleBlack);
            EditorGUILayout.EndHorizontal();

            // show default inspector property editor withouth script reference
            serializedObject.Update();
            DrawPropertiesExcluding(serializedObject, new string[] { "m_Script" });
            serializedObject.ApplyModifiedProperties();

            //translation bool
            bool oldTranslationValue = translationValue;

            translationValue = EditorGUILayout.Toggle("Translation", translationValue);
            if (oldTranslationValue != translationValue)
            {
                string path = Application.dataPath + Settings.WEBTEMPLATE_PATH + "/translation.js";

                if (translationValue)
                {
                    System.IO.File.WriteAllText(path, TRANSLATION_ACTIVE);
                }
                else
                {
                    System.IO.File.WriteAllText(path, TRANSLATION_INACTIVE);
                }
            }

            EditorGUILayout.BeginHorizontal(styleBlack);
            // check if a port was exported
            if (System.IO.File.Exists(EditorPrefs.GetString("airconsolePortPath") + "/screen.html"))
            {
                if (GUILayout.Button("Open Exported Port", GUILayout.MaxWidth(130)))
                {
                    Extentions.OpenBrowser(controller, EditorPrefs.GetString("airconsolePortPath"));
                }
            }

            GUILayout.FlexibleSpace();

            if (GUILayout.Button("Settings"))
            {
                SettingWindow window = (SettingWindow)EditorWindow.GetWindow(typeof(SettingWindow));
                window.Show();
            }

            EditorGUILayout.EndHorizontal();
        }
コード例 #2
0
        public override void OnInspectorGUI()
        {
            controller = (AirConsole)target;

            // show logo & version
            EditorGUILayout.BeginHorizontal(styleBlack, GUILayout.Height(30));
            GUILayout.Label(logo, GUILayout.Width(128), GUILayout.Height(30));
            GUILayout.FlexibleSpace();
            GUILayout.Label("v" + Settings.VERSION, styleBlack);
            EditorGUILayout.EndHorizontal();

            // Show default inspector property editor withouth script referenz
            serializedObject.Update();
            DrawPropertiesExcluding(serializedObject, new string[] { "m_Script" });
            serializedObject.ApplyModifiedProperties();

            EditorGUILayout.BeginHorizontal(styleBlack);
            // check if a port was exported
            if (System.IO.File.Exists(EditorPrefs.GetString("airconsolePortPath") + "/screen.html"))
            {
                if (GUILayout.Button("Open Exported Port", GUILayout.MaxWidth(130)))
                {
                    Extentions.OpenBrowser(controller, EditorPrefs.GetString("airconsolePortPath"));
                }
            }

            GUILayout.FlexibleSpace();

            if (GUILayout.Button("Settings"))
            {
                SettingWindow window = (SettingWindow)EditorWindow.GetWindow(typeof(SettingWindow));
                window.Show();
            }

            EditorGUILayout.EndHorizontal();
        }