Exemple #1
0
        private static void ShowSaveDialog()
        {
            loadDialogVisible = false;
            GUILayout.BeginArea(new Rect((float)(Screen.width / 3), (float)(Screen.height / 3), (float)(Screen.width / 3), 120f));
            GUILayout.BeginVertical(new GUIStyle("Box"), (GUILayoutOption[])new GUILayoutOption[0]);
            Vector2 vector = GUILayout.BeginScrollView(default(Vector2), (GUILayoutOption[])new GUILayoutOption[1]
            {
                GUILayout.Height((float)(Screen.height / 3))
            });

            GUILayout.Label("Save Camera and Message Settings", (GUILayoutOption[])new GUILayoutOption[0]);
            string a = GUILayout.TextField(saveFileName, 100, (GUILayoutOption[])new GUILayoutOption[0]);

            if (a != saveFileName)
            {
                saveFileName = a;
            }
            if (GUILayout.Button("Save", (GUILayoutOption[])new GUILayoutOption[0]) && saveFileName != "Enter Filename here")
            {
                SaveFileManager sfm = new SaveFileManager();
                sfm.SaveCameraDictionaryToFile(cameraDictionary, saveFileName);
                saveDialogVisible = false;
            }
            if (GUILayout.Button("Cancel", (GUILayoutOption[])new GUILayoutOption[0]))
            {
                saveDialogVisible = false;
            }
            GUILayout.EndScrollView();
            GUILayout.EndVertical();
            GUILayout.EndArea();
        }
Exemple #2
0
        private static void ShowLoadDialog()
        {
            pluginActive = false;

            saveDialogVisible = false;
            GUILayout.BeginArea(new Rect((float)(Screen.width / 3), (float)(Screen.height / 3), (float)(Screen.width / 3), (float)(Screen.height / 3)));
            GUILayout.BeginVertical(new GUIStyle("Box"), (GUILayoutOption[])new GUILayoutOption[0]);
            Vector2 vector2 = GUILayout.BeginScrollView(default(Vector2), (GUILayoutOption[])new GUILayoutOption[1]
            {
                GUILayout.Height((float)(Screen.height / 3))
            });

            GUILayout.Label("Load Camera Message Settings ", (GUILayoutOption[])new GUILayoutOption[0]);
            FolderAssist folderAssist = new FolderAssist();

            folderAssist.CreateFolderInfo(UserData.Path + "cameramessage/", "*.csv", true, true);

            SaveFileManager sfm = new SaveFileManager();

            foreach (FolderAssist.FileInfo fileInfo in folderAssist.lstFile)
            {
                GUILayout.BeginHorizontal();

                if (GUILayout.Button(fileInfo.FileName, (GUILayoutOption[])new GUILayoutOption[0]))
                {
                    cameraDictionary  = sfm.LoadCameraDictionaryFile(fileInfo.FileName);
                    loadDialogVisible = false;
                    pluginActive      = true;
                }

                if (GUILayout.Button("Delete", deleteButtonStyle))
                {
                    sfm.DeleteSaveFile(fileInfo);
                    loadDialogVisible = false;
                    pluginActive      = true;
                }

                GUILayout.EndHorizontal();
            }


            if (GUILayout.Button("Cancel", (GUILayoutOption[])new GUILayoutOption[0]))
            {
                loadDialogVisible = false;
                pluginActive      = true;
            }
            GUILayout.EndScrollView();
            GUILayout.EndVertical();
            GUILayout.EndArea();
        }
Exemple #3
0
        void IPlugin.OnLevelWasLoaded(int level)
        {
            //Console.WriteLine("on level was loaded");

            GameObject gameObject = GameObject.Find("CommonSpace");

            bool flag = false;

            CameraMessageBase[] componentsInChildren = gameObject.GetComponentsInChildren <CameraMessageBase>();
            for (int i = 0; i < componentsInChildren.Length; i++)
            {
                CameraMessageBase cameraMessageBase = componentsInChildren[i];
                flag = true;
                cameraMessageBase.InitializeCaches();
            }
            if (!flag)
            {
                CameraMessageBase cameraMessageBase = gameObject.AddComponent <CameraMessageBase>();

                if (CameraMessageBase.studioneocam == null)
                {
                    //getCameraV2();
                    //getCameraBase();
                    Helpers.GetCameraStudioNeo();
                }


                cameraMessageBase.InitializeCaches();

                PluginUserSettings userSettings = SaveFileManager.LoadUserSettingsFromFile();
                CameraMessageBase.textSpeed       = userSettings.Textspeed;
                CameraMessageBase.textSpeedString = CameraMessageBase.textSpeed.ToString().Substring(CameraMessageBase.textSpeed.ToString().Length - 1);
                CameraMessageBase.messageDelay    = userSettings.MessageDelay.ToString();

                //Console.WriteLine("loaded textSpeed: '" + userSettings.Textspeed + "'");
            }
        }
Exemple #4
0
        private void ShowMainAndCameraButtons()
        {
            GUILayout.BeginArea(new Rect((float)(Screen.width / 3), (float)(Screen.height / 1.9), (float)(Screen.width / 4), (float)(Screen.height / 2)));

            // Menubuttons
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);

            if (GUILayout.Button("Play"))
            {
                isPlayingAutomatically = false;

                if (!playButtonPressed)
                {
                    reachedEndOfAutoPlayback = false;
                    playButtonPressed        = true;
                }
            }

            if (GUILayout.Button("Stop"))
            {
                playButtonPressed        = false;
                isPlayingAutomatically   = false;
                reachedEndOfAutoPlayback = true;
                lastPlayedButton         = "C0";
                lastButtonPressed        = "C1";
                loadedMessageText        = "";
            }

            if (GUILayout.Button("Back"))
            {
                playButtonPressed = false;
                ShowPreviousCamera();
            }

            if (GUILayout.Button("Next"))
            {
                playButtonPressed = false;
                ShowNextCamera();
            }

            if (GUILayout.Button("Save"))
            {
                saveDialogVisible = true;
            }

            if (GUILayout.Button("Load"))
            {
                loadDialogVisible = true;
            }

            if (GUILayout.Button("Settings"))
            {
                if (settingsDialogVisible)
                {
                    settingsDialogVisible = false;
                }
                else
                {
                    settingsDialogVisible = true;
                }
            }

            GUILayout.EndHorizontal();
            GUILayout.EndArea();



            // better performance with scrollarea

            /*
             * GUI.BeginGroup(new Rect(640, 620, 50, 300), "", "box");
             * DoScrollArea(new Rect(0, 0, 50, 300), bunchOfButtons, 32);
             * GUI.EndGroup();
             */

            DrawCameraButtons();


            if (settingsDialogVisible)
            {
                GUILayout.BeginArea(new Rect((float)(Screen.width / 3) + 400, (float)(Screen.height / 3), 400, (float)(Screen.height / 2)));
                GUILayout.BeginVertical();

                GUILayout.BeginHorizontal();
                // todo: make a slider
                GUILayout.Label("Delay (s) between Messages for automatic playback: ");
                messageDelay = GUILayout.TextField(messageDelay, new GUILayoutOption[0]);
                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();
                // todo: make a slider
                GUILayout.Label("Text speed (0 (fastest) - 9 (slowest)): ");
                textSpeedString = GUILayout.TextField(textSpeedString, new GUILayoutOption[0]);

                GUILayout.EndHorizontal();

                if (GUILayout.Button("OK"))
                {
                    settingsDialogVisible = false;

                    // change textspeed
                    try
                    {
                        string textSpeedConvString = "0.0" + textSpeedString;
                        textSpeed = float.Parse(textSpeedConvString);
                    }
                    catch (Exception)
                    {
                        Console.WriteLine("couldn't convert user input to float: " + textSpeedString + ". Setting default");
                        textSpeedString = "4";
                        textSpeed       = 0.04f;
                    }

                    // save settings to file
                    SaveFileManager.SaveSettingsToFile(new PluginUserSettings(textSpeed, int.Parse(messageDelay)));
                }

                GUILayout.EndVertical();
                GUILayout.EndArea();
            }
        }