コード例 #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 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 ();
		}
コード例 #2
0
ファイル: Extentions.cs プロジェクト: pey849/House-Rules
 public static void OnPlayModeStateChanged(PlayModeState currentMode, PlayModeState changedMode)
 {
     if (currentMode == PlayModeState.Stopped && changedMode == PlayModeState.Playing ||
         currentMode == PlayModeState.AboutToPlay && changedMode == PlayModeState.Playing)
     {
         AirConsole controller = GameObject.FindObjectOfType <AirConsole>();
         OpenBrowser(controller, Application.dataPath + Settings.WEBTEMPLATE_PATH);
     }
 }
コード例 #3
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();
        }
コード例 #4
0
 // Use this for initialization
 void Start()
 {
     airConsole   = new AirConsole();
     Score        = 0;
     timesPressed = 0;
     AirConsole.instance.onMessage += OnMessage;
     JumpVector = new Vector3(0, 8, 0);
     gameObject.AddComponent <Rigidbody>();
     rb = gameObject.GetComponent <Rigidbody>();
     //rb.velocity = JumpVector;
     InitAudioDictionary();
     rb.useGravity = false;
     pipeFactRef   = GameObject.Find("PipeFactory").GetComponent <PipeObjectFactory>();
 }
コード例 #5
0
ファイル: Extentions.cs プロジェクト: pey849/House-Rules
        static void CreateAirController()
        {
            AirConsole airConsole = GameObject.FindObjectOfType <AirConsole>();

            if (airConsole == null)
            {
                GameObject _tmp = new GameObject("AirConsole");
                _tmp.AddComponent <AirConsole>();
            }
            else
            {
                EditorUtility.DisplayDialog("Already exists", "AirController object already exists in the current scene", "ok");
                EditorGUIUtility.PingObject(airConsole.GetInstanceID());
            }
        }
コード例 #6
0
ファイル: Extentions.cs プロジェクト: lumley/AirBrains
        public static void OpenBrowser(AirConsole controller, string startUpPath)
        {
            // set the root path for webserver
            webserver.SetPath(startUpPath);
            webserver.Start();

            if (controller != null && controller.enabled)
            {
                if (controller.controllerHtml != null)
                {
                    string sourcePath = Path.Combine(Directory.GetCurrentDirectory(),
                                                     AssetDatabase.GetAssetPath(controller.controllerHtml));
                    string targetPath = Path.Combine(Directory.GetCurrentDirectory(),
                                                     "Assets" + Settings.WEBTEMPLATE_PATH + "/controller.html");

                    // rename index.html to screen.html
                    File.Copy(sourcePath, targetPath, true);

                    if (controller.browserStartMode != StartMode.NoBrowserStart)
                    {
                        string url = AirConsole.GetUrl(controller.browserStartMode) + "http://" + GetLocalAddress() +
                                     ":" + Settings.webServerPort + "/";

                        // add port info if starting the unity editor version
                        if (startUpPath.Contains(Settings.WEBTEMPLATE_PATH))
                        {
                            url += "?unity-editor-websocket-port=" + Settings.webSocketPort + "&unity-plugin-version=" +
                                   Settings.VERSION;
                        }
                        Application.OpenURL(url);
                    }
                    else
                    {
                        AirConsole.instance.ProcessJS(
                            "{action:\"onReady\", code:\"0\", devices:[], server_time_offset: 0, device_id: 0, location: \"\" }");
                    }
                }
                else
                {
                    EditorUtility.DisplayDialog("AirController",
                                                "Please link a controller file to the AirController object.", "ok");
                    Debug.Break();
                }
            }
        }
コード例 #7
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();
        }
コード例 #8
0
ファイル: Extentions.cs プロジェクト: ajgriesemer/GameDev
        public static void OpenBrowser(AirConsole controller, string startUpPath) {

            // set the root path for webserver
            webserver.SetPath(startUpPath);
            webserver.Start();

            if (controller != null && controller.enabled) {

                if (controller.controllerHtml != null) {

                    string sourcePath = Path.Combine(Directory.GetCurrentDirectory(), AssetDatabase.GetAssetPath(controller.controllerHtml));
                    string targetPath = Path.Combine(Directory.GetCurrentDirectory(), "Assets" + Settings.WEBTEMPLATE_PATH + "/controller.html");

                    // rename index.html to screen.html
                    File.Copy(sourcePath, targetPath, true);

                    if (controller.browserStartMode != StartMode.NoBrowserStart) {

                        string url = AirConsole.GetUrl(controller.browserStartMode) + "http://" + GetLocalAddress() + ":" + Settings.webServerPort + "/";

                        // add port info if starting the unity editor version
                        if (startUpPath.Contains(Settings.WEBTEMPLATE_PATH)) {
                            url += "?unity-editor-websocket-port=" + Settings.webSocketPort + "&unity-plugin-version=1.3.0.c";
                        }
                        Application.OpenURL(url);
                    } else {
						AirConsole.instance.ProcessJS("{action:\"onReady\", code:\"0\", devices:[], server_time_offset: 0, device_id: 0, location: \"\" }");
					}

                } else {

                    EditorUtility.DisplayDialog("AirController", "Please link a controller file to the AirController object.", "ok");
                    Debug.Break();
                }
            }
        }