Ejemplo n.º 1
0
 /// <summary>
 /// On awake, displaying correct button based on the instance of the PluginController
 /// </summary>
 private void Awake()
 {
     if (PluginController.GetInstance().IsActive())
     {
         DisplayStopUI();
         Messages.Log("Displaying stop");
     }
     else
     {
         DisplayStartUI();
         Messages.Log("Displaying start");
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// To display in GUI
        /// </summary>
        void OnGUI()
        {
            // Listening to play button
            EditorApplication.playModeStateChanged += CheckPlayModeState;


            GUILayout.Label("Network settings", EditorStyles.boldLabel);

            if (networkConfigs.Count >= 1)
            {
                DrawTable();
            }

            DrawAddButton();

            GUILayout.Label("Logs", EditorStyles.boldLabel);
            if (EditorGUILayout.Toggle("Display Unity logs", enableUnityLogs) != enableUnityLogs)
            {
                enableUnityLogs = !enableUnityLogs;
                if (enableUnityLogs)
                {
                    Messages.EnableUnityLogs();
                }

                else
                {
                    Messages.DisableUnityLogs();
                }
            }

            if (EditorGUILayout.Toggle("Store logs in file", enableFileLogs) != enableFileLogs)
            {
                enableFileLogs = !enableFileLogs;
                if (enableFileLogs)
                {
                    //Messages.EnableFileLogs();
                }
                else
                {
                    // Messages.DisableFileLogs();
                }
            }

            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (stopped)
            {
                EditorGUI.BeginDisabledGroup(CheckIfNothingIsChecked() || !EditorApplication.isPlaying);
                if (GUILayout.Button("Start", GUILayout.Width(70)))
                {
                    Messages.Log("Starting TheiaVR plugin");
                    try
                    {
                        PluginController.GetInstance().Start(networkConfigs);

                        DisplayStopUI();
                    }
                    catch (Exception vException)
                    {
                        Messages.LogError(vException.Message);
                    }

                    Messages.Log("TheiaVR correctly started");
                }

                EditorGUI.EndDisabledGroup();
            }

            if (started)
            {
                if (GUILayout.Button("Stop", GUILayout.Width(70)))
                {
                    Messages.Log("Stopping TheiaVR plugin");
                    try
                    {
                        PluginController.GetInstance().Stop();
                        DisplayStartUI();
                    }
                    catch (Exception vException)
                    {
                        Messages.LogError(vException.Message);
                    }
                }
            }

            GUILayout.FlexibleSpace();
            EditorGUILayout.EndHorizontal();
            minSize = new Vector2(601f, 248f);
        }
Ejemplo n.º 3
0
 protected void OnApplicationQuit()
 {
     PluginController.GetInstance().Stop();
 }