コード例 #1
0
        void OnGUI()
        {
            // 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();

            GUILayout.Label("AirConsole Settings", EditorStyles.boldLabel);

            Settings.webSocketPort = EditorGUILayout.IntField("Websocket Port", Settings.webSocketPort, GUILayout.MaxWidth(200));
            EditorPrefs.SetInt("webSocketPort", Settings.webSocketPort);

            Settings.webServerPort = EditorGUILayout.IntField("Webserver Port", Settings.webServerPort, GUILayout.MaxWidth(200));
            EditorPrefs.SetInt("webServerPort", Settings.webServerPort);

            EditorGUILayout.LabelField("Webserver is running", Extentions.webserver.IsRunning().ToString());

            GUILayout.BeginHorizontal();

            GUILayout.Space(150);
            if (GUILayout.Button("Stop", GUILayout.MaxWidth(60)))
            {
                Extentions.webserver.Stop();
            }
            if (GUILayout.Button("Restart", GUILayout.MaxWidth(60)))
            {
                Extentions.webserver.Restart();
            }

            GUILayout.EndHorizontal();

            groupEnabled = EditorGUILayout.BeginToggleGroup("Debug Settings", groupEnabled);

            Settings.debug.info = EditorGUILayout.Toggle("Info", Settings.debug.info);
            EditorPrefs.SetBool("debugInfo", Settings.debug.info);

            Settings.debug.warning = EditorGUILayout.Toggle("Warning", Settings.debug.warning);
            EditorPrefs.SetBool("debugWarning", Settings.debug.warning);

            Settings.debug.error = EditorGUILayout.Toggle("Error", Settings.debug.error);
            EditorPrefs.SetBool("debugError", Settings.debug.error);

            EditorGUILayout.EndToggleGroup();

            EditorGUILayout.BeginHorizontal(styleBlack);

            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Reset Settings", GUILayout.MaxWidth(110)))
            {
                Extentions.ResetDefaultValues();
            }

            GUILayout.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 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();
        }
コード例 #3
0
        public void Start()
        {
            if (listener == null)
            {
                listener = new HttpListener();
            }

            prefix = string.Format("http://{0}:{1}/", Extentions.GetLocalAddress(), Settings.webServerPort.ToString());

            if (!listener.IsListening)
            {
                listener.Start();

                if (!listener.Prefixes.Contains(prefix))
                {
                    listener.Prefixes.Add(prefix);
                }

                t = new Thread(new ThreadStart(ClientListener));
                t.Start();
            }
        }
コード例 #4
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();
        }