Ejemplo n.º 1
0
 void DrawDirectoryArea()
 {
     if (GUILayout.Button("Open Directory"))
     {
         OpenInFileBrowser.Open(this.settingsPlugin.settings.gameDefinitionDirectoryPath);
     }
 }
Ejemplo n.º 2
0
        private void Action_SaveEncryptedContentToEditor()
        {
            string path = Default_ES3Settings.FullPath;

            SaveEncryptedContent(path);
            OpenInFileBrowser.Open(path);
        }
Ejemplo n.º 3
0
        void OnWindow(int id)
        {
            scroll = GUILayout.BeginScrollView(scroll);

            if (GUILayout.Button("open SettingFolder"))
            {
                OpenInFileBrowser.Open(Application.persistentDataPath);
            }
            GUILayout.Space(16f);
            GUILayout.Label("Settings:");

            if (settingTree != null)
            {
                settingTree.ForEach(node =>
                {
                    ShowSettingNodeGUI(node);
                });
            }

            GUI.contentColor = Color.white;
            if (extraGuiFunc != null)
            {
                GUILayout.Space(16);
                extraGuiFunc.Invoke();
            }


            GUILayout.EndScrollView();
            GUI.DragWindow();
        }
Ejemplo n.º 4
0
 public void ShowDirectory()
 {
     if (!Directory.Exists(FilesDataClass.FilePath))
     {
         Directory.CreateDirectory(FilesDataClass.FilePath);
     }
     OpenInFileBrowser.Open(FilesDataClass.FilePath);
 }
Ejemplo n.º 5
0
 public void OpenScreenshotsFolder()
 {
     if (OpenInFileBrowser.IsInMacOS)
     {
         OpenInFileBrowser.OpenInMac(Application.dataPath + "/screenshots/");
     }
     else if (OpenInFileBrowser.IsInWinOS)
     {
         OpenInFileBrowser.OpenInWin(Application.dataPath + "/screenshots/");
     }
     else
     {
         //linux is not supported. Rip
         StartCoroutine(RenderError("Unable to perform operation on this operating system. Sorry"));
     }
 }
Ejemplo n.º 6
0
        protected override void _Initialize()
        {
            DevConsole.RegisterCommand("plugins.folder", "Opens the plugins folder", this, delegate(string[] args)
            {
                OpenInFileBrowser.Open(Structure.PluginsPath);
            });

            if (Game.IsHost)
            {
                DevConsole.RegisterCommand("plugins.reload", "Reloads all plugins", this, delegate(string[] args)
                {
                    LoadLoaders(Structure.PluginsPath);
                });

                DevConsole.RegisterCommand("plugins.sync", "Synchronize plugins for all clients", this, delegate(string[] args)
                {
                    SynchronizeWithPlayers();
                });
            }
        }
Ejemplo n.º 7
0
 static void ChangeSublimeTextPath()
 {
     if (Application.platform == RuntimePlatform.OSXEditor)
     {
         if (EditorUtility.DisplayDialog("OS X Compatibility Error",
                                         "On OSX we need a file inside the Sublime Text.app\n" +
                                         "You can edit the SublimeUnity.txt with your custom path,\n" +
                                         "However installing Sublime to its default path is recommended",
                                         "Ok, let me fiddle",
                                         "I'll install Sublime to the default path"))
         {
             OpenInFileBrowser.Open(GetSublimeUnityPath());
         }
     }
     else
     {
         string s = EditorUtility.OpenFilePanel("Select Sublime Executable", "", "");
         if (s != "")
         {
             sublimePath = s;
         }
     }
 }
Ejemplo n.º 8
0
    void OnGUI()
    {
        if (exporterLabel == null)
        {
            exporterLabel          = new GUIStyle(GUI.skin.label);
            exporterLabel.richText = true;
        }

        if (exporterTextArea == null)
        {
            exporterTextArea             = new GUIStyle(GUI.skin.textArea);
            exporterTextArea.fixedWidth  = descSize.x;
            exporterTextArea.fixedHeight = descSize.y;
        }

        if (exporterClickableLabel == null)
        {
            exporterClickableLabel          = new GUIStyle(EditorStyles.centeredGreyMiniLabel);
            exporterClickableLabel.richText = true;
        }

        GUILayout.Space(SPACE_SIZE);

        // Model settings
        GUILayout.Label("Model properties", EditorStyles.boldLabel);

        // Model name
        GUILayout.Label("Name");
        param_name = EditorGUILayout.TextField(param_name);
        GUILayout.Space(SPACE_SIZE);

        GUILayout.Label("Texture properties", EditorStyles.boldLabel);

        GUILayout.Label("Texture max size");
        Exporter.opt_maxSize = EditorGUILayout.IntField(Exporter.opt_maxSize);
        GUILayout.Label("Texture jpg quality");
        Exporter.opt_jpgQuality = EditorGUILayout.IntField(Exporter.opt_jpgQuality);
        GUILayout.Space(SPACE_SIZE);

        GUILayout.Label("Options", EditorStyles.boldLabel);
        opt_exportAnimation = EditorGUILayout.Toggle("Export animation", opt_exportAnimation);
        opt_splitChunks     = EditorGUILayout.Toggle("Split chunks", opt_splitChunks);

        GUILayout.Label("Lights", EditorStyles.boldLabel);
        EditorGUIUtility.labelWidth = 200;
        opt_halfSpotAngle           = EditorGUILayout.Toggle("Half spot angle(Hilo3d, Threejs...)", Exporter.opt_halfSpotAngle);
        opt_quadraticAttenuation    = EditorGUILayout.Toggle("Light quadratic attenuation(Hilo3d...)", Exporter.opt_quadraticAttenuation);

        GUILayout.Label("Materials", EditorStyles.boldLabel);
        opt_noLighting = EditorGUILayout.Toggle("No Lighting(Always for mobile)", Exporter.opt_noLighting);

        //GUILayout.Space(SPACE_SIZE);

        //if (categories.Count > 0)
        //	categoryIndex = EditorGUILayout.Popup(categoryIndex, categoriesNames.ToArray());

        //GUILayout.Space(SPACE_SIZE);
        bool enable = updateExporterStatus();

        if (enable)
        {
            GUI.color = blueColor;
        }
        else
        {
            GUI.color = greyColor;
        }

        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("Export", GUILayout.Width(250), GUILayout.Height(40)))
        {
            if (System.IO.File.Exists(zipPath))
            {
                System.IO.File.Delete(zipPath);
            }
            zipPath    = Application.temporaryCachePath + "/" + param_name + ".zip";
            exportPath = Application.temporaryCachePath + "/" + param_name + ".gltf";
            exporter.ExportCoroutine(exportPath, null, false, true, opt_exportAnimation, true);
            OpenInFileBrowser.Open(Path.GetDirectoryName(exportPath));
        }
    }
    /// <summary>
    /// Draw buttons on the bottom of the Grapher window.
    /// </summary>
    private void DrawBottomControls()
    {
        GUILayout.BeginArea(toolbarRect);
        GUILayout.BeginHorizontal();

        GUI.enabled = false;

        if (!EditorApplication.isPlaying && (channels.Count > 0))
        {
            GUI.enabled = true;
        }

        if (GUILayout.Button("Save" + Grapher.SessionName))
        {
            string path     = FileHandler.BrowserSaveFiles(Grapher.SessionName);
            string dirPath  = Path.GetDirectoryName(path);
            string fileName = Path.GetFileNameWithoutExtension(path);
            Grapher.SaveToFiles(fileName, dirPath);
        }
        GUI.enabled = false;

        if (!EditorApplication.isPlaying)
        {
            GUI.enabled = true;
        }
        // SHOW IN EXPLORER BUTTON
        if (GUILayout.Button("Show in Explorer"))
        {
            OpenInFileBrowser.Open(FileHandler.defaultWritePath);
        }

        // SETTINGS BUTTON
        GUI.enabled = true;
        if (GUILayout.Button("Settings"))
        {
            SettingsWindow.Init();
        }

        // RESET BUTTON
        if (GUILayout.Button("Reset"))
        {
            Reset();
        }


        if (!EditorApplication.isPlaying)
        {
            GUI.enabled = true;
        }
        // OPEN BUTTON
        if (GUILayout.Button("Load"))
        {
            //Reset();
            OpenFiles();
            ReplayInit();
        }

        GUI.enabled = false;


        GUILayout.EndHorizontal();
        GUILayout.EndArea();
    }
Ejemplo n.º 10
0
 public void OnOpenScreenshotFolderClicked()
 {
     OpenInFileBrowser.Open(ScreenshotManager.ScreenshotFolder);
 }
Ejemplo n.º 11
0
 private static void OpenSavePathInFinder()
 {
     SetPath();
     OpenInFileBrowser.Open(path);
 }
    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        instance.UpdateFilePath();

        // Log Time
        EditorGUILayout.PropertyField(logTime, logTimeContent);

        // Filename
        EditorGUILayout.PropertyField(fileName, fileNameContent);

        // Output path type
        EditorGUILayout.PropertyField(showAbsolute);
        if (showAbsolute.boolValue)
        {
            EditorGUILayout.PropertyField(absolutePath, absolutePathContent);
        }

        // Open output path, copy html to output path
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Open Output Path"))
        {
            OpenInFileBrowser.Open(filePath.stringValue);
        }
        if (GUILayout.Button("Copy HTML to Output Path"))
        {
            copyPath = filePath.stringValue.Replace('\\', '/');
            if (!copyPath.EndsWith("/"))
            {
                copyPath += "/";
            }
            copyPath += "index.html";
            FileUtil.ReplaceFile("Assets/UnityFileDebug/Lib/index.html", copyPath);
        }
        EditorGUILayout.EndHorizontal();

        // If running, show full output path and count
        if (Application.isPlaying)
        {
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();
            EditorGUILayout.Separator();

            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("Copy Output Filepath"))
            {
                EditorGUIUtility.systemCopyBuffer = filePathFull.stringValue;
            }
            EditorGUILayout.LabelField(filePathFull.stringValue);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.LabelField("Logs added: " + instance.count);
        }

        EditorGUILayout.Separator();
        EditorGUILayout.Separator();
        EditorGUILayout.Separator();
        EditorGUILayout.Separator();
        EditorGUILayout.Separator();

        // Tell the user what its about
        EditorGUILayout.HelpBox("Unity File Debug is made by Sacred Seed Studio and is MIT Licensed. Please feel free to use, modify, contribute, report bugs, and suggest features", MessageType.Info, true);
        EditorGUILayout.BeginHorizontal();
        if (GUILayout.Button("Source"))
        {
            Application.OpenURL("https://github.com/Sacred-Seed-Studio/Unity-File-Debug");
        }
        if (GUILayout.Button("Readme"))
        {
            Application.OpenURL("https://github.com/Sacred-Seed-Studio/Unity-File-Debug/blob/master/README.md");
        }
        if (GUILayout.Button("Bugs / Feature Request"))
        {
            Application.OpenURL("https://github.com/Sacred-Seed-Studio/Unity-File-Debug/issues");
        }
        EditorGUILayout.EndHorizontal();

        serializedObject.ApplyModifiedProperties();
    }
Ejemplo n.º 13
0
 /// <summary>
 /// Open a folder at a specified path.
 /// </summary>
 /// <param name="path">Path to open folder at.</param>
 public void OpenFolder(string path)
 {
     m_CurrentFolderViewProcess = OpenInFileBrowser.Open(path);
 }
Ejemplo n.º 14
0
 private void Action_SaveEncryptedContentToCurrentPath()
 {
     SaveEncryptedContent(_saveDataPath);
     OpenInFileBrowser.Open(_saveDataPath);
 }
    /// <summary>
    /// Draw buttons on the bottom of the Grapher window.
    /// </summary>
    private void DrawBottomControls()
    {
        GUILayout.BeginArea(toolbarRect);
        GUILayout.BeginHorizontal();

        GUI.enabled = false;

        if (!EditorApplication.isPlaying && (channels.Count > 0 || replayFiles.Count > 0))
        {
            GUI.enabled = true;
        }
        // PLAY PAUSE BUTTON
        string pp = replayControl == ReplayControls.Play ? "Pause" : "Play  ";

        if (GUILayout.Button(pp))
        {
            foreach (Channel ch in channels)
            {
                ch.replayEnded = false;
            }
            replayControl = replayControl == ReplayControls.Play ? ReplayControls.Pause : ReplayControls.Play;
        }

        GUI.enabled = false;

        if (!EditorApplication.isPlaying && channels.Count > 0 &&
            (replayControl == ReplayControls.Play || replayControl == ReplayControls.Pause))
        {
            GUI.enabled = true;
        }
        // STOP BUTTON
        if (GUILayout.Button("Stop"))
        {
            replayControl = ReplayControls.Stop;
        }

        GUI.enabled = false;

        if (!EditorApplication.isPlaying && (replayControl != ReplayControls.Play || replayControl != ReplayControls.Pause))
        {
            GUI.enabled = true;
        }
        // OPEN BUTTON
        if (GUILayout.Button("Open"))
        {
            OpenFiles();
            ReplayInit();
        }

        GUI.enabled = false;

        if (!EditorApplication.isPlaying && replayFiles.Count > 0)
        {
            GUI.enabled = true;
        }
        // CLEAR REPLAY FILES BUTTON
        if (GUILayout.Button("Clear Replay Files"))
        {
            replayControl = ReplayControls.Stop;
            channels.Clear();
            replayFiles.Clear();
            replaySampleQueues.Clear();
            replayControl = ReplayControls.Stop;
        }

        GUI.enabled = false;

        if (!EditorApplication.isPlaying)
        {
            GUI.enabled = true;
        }
        // SHOW IN EXPLORER BUTTON
        if (GUILayout.Button("Show in Explorer"))
        {
            OpenInFileBrowser.Open(FileHandler.writePath);
        }

        // SETTINGS BUTTON
        GUI.enabled = true;
        if (GUILayout.Button("Settings"))
        {
            SettingsWindow.Init();
        }

        // RESET BUTTON
        if (GUILayout.Button("Reset"))
        {
            Reset();
        }

        GUILayout.EndHorizontal();
        GUILayout.EndArea();
    }
Ejemplo n.º 16
0
 public void OpenConfigFolder()
 {
     OpenInFileBrowser.Open($"{Application.persistentDataPath}/Config/");
 }
Ejemplo n.º 17
0
    void OnGUI()
    {
        if (exporterLabel == null)
        {
            exporterLabel          = new GUIStyle(GUI.skin.label);
            exporterLabel.richText = true;
        }

        if (exporterTextArea == null)
        {
            exporterTextArea             = new GUIStyle(GUI.skin.textArea);
            exporterTextArea.fixedWidth  = descSize.x;
            exporterTextArea.fixedHeight = descSize.y;
        }

        if (exporterClickableLabel == null)
        {
            exporterClickableLabel          = new GUIStyle(EditorStyles.centeredGreyMiniLabel);
            exporterClickableLabel.richText = true;
        }
        //Header
        GUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        GUILayout.Label(header);
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();

        // Account settings
        if (access_token.Length == 0)
        {
            GUILayout.Label("Log in with your Sketchfab account", EditorStyles.centeredGreyMiniLabel);
            user_name     = EditorGUILayout.TextField("Email", user_name);
            user_password = EditorGUILayout.PasswordField("Password", user_password);
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("<color=" + clickableLabelColor + ">Create an account  - </color>", exporterClickableLabel, GUILayout.Height(20)))
            {
                Application.OpenURL(createAccountUrl);
            }
            if (GUILayout.Button("<color=" + clickableLabelColor + ">Reset your password  - </color>", exporterClickableLabel, GUILayout.Height(20)))
            {
                Application.OpenURL(resetPasswordUrl);
            }
            if (GUILayout.Button("<color=" + clickableLabelColor + ">Report an issue</color>", exporterClickableLabel, GUILayout.Height(20)))
            {
                Application.OpenURL(reportAnIssueUrl);
            }
            GUILayout.EndHorizontal();
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Login", GUILayout.Width(150), GUILayout.Height(25)))
            {
                www = publisher.www;
                publisher.oauth(user_name, user_password);
                EditorPrefs.SetString(usernameEditorKey, user_name);
                //EditorPrefs.SetString(passwordEditorKey, user_password);
            }
            GUILayout.EndHorizontal();
        }
        else
        {
            if (latestVersion.Length == 0)
            {
                Color current = GUI.color;
                GUI.color = Color.red;
                GUILayout.Label("An error occured when looking for the latest exporter version\nYou might be using an old and not fully supported version", EditorStyles.centeredGreyMiniLabel);
                if (GUILayout.Button("Click here to be redirected to release page"))
                {
                    Application.OpenURL(latestReleaseUrl);
                }
                GUI.color = current;
            }
            else if (exporterVersion != latestVersion)
            {
                Color current = GUI.color;
                GUI.color = redColor;
                GUILayout.Label("New version " + latestVersion + " available (current version is " + exporterVersion + ")", EditorStyles.centeredGreyMiniLabel);
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Go to release page", GUILayout.Width(150), GUILayout.Height(25)))
                {
                    Application.OpenURL(latestReleaseUrl);
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
                GUI.color = current;
            }
            else
            {
                GUILayout.BeginHorizontal();
                GUILayout.Label("Exporter is up to date (version:" + exporterVersion + ")", EditorStyles.centeredGreyMiniLabel);

                GUILayout.FlexibleSpace();
                if (GUILayout.Button("<color=" + clickableLabelColor + ">Help  -</color>", exporterClickableLabel, GUILayout.Height(20)))
                {
                    Application.OpenURL(latestReleaseUrl);
                }

                if (GUILayout.Button("<color=" + clickableLabelColor + ">Report an issue</color>", exporterClickableLabel, GUILayout.Height(20)))
                {
                    Application.OpenURL(reportAnIssueUrl);
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.BeginHorizontal("Box");
            GUILayout.Label("Account: <b>" + userDisplayName + "</b> (" + (isUserPro ? "PRO" : "FREE") + " account)", exporterLabel);
            if (GUILayout.Button("Logout"))
            {
                access_token = "";
                //EditorPrefs.DeleteKey(usernameEditorKey);
                //EditorPrefs.DeleteKey(passwordEditorKey);
                resizeWindow(loginSize);
            }
            GUILayout.EndHorizontal();
        }

        GUILayout.Space(SPACE_SIZE);

        if (access_token.Length > 0)
        {
            // Model settings
            GUILayout.Label("Model properties", EditorStyles.boldLabel);

            // Model name
            GUILayout.Label("Name");
            param_name = EditorGUILayout.TextField(param_name);
            GUILayout.Label("(" + param_name.Length + "/" + NAME_LIMIT + ")", EditorStyles.centeredGreyMiniLabel);
            EditorStyles.textField.wordWrap = true;
            GUILayout.Space(SPACE_SIZE);

            GUILayout.Label("Description");
            param_description = EditorGUILayout.TextArea(param_description, exporterTextArea);
            GUILayout.Label("(" + param_description.Length + " / 1024)", EditorStyles.centeredGreyMiniLabel);
            GUILayout.Space(SPACE_SIZE);
            GUILayout.Label("Tags (separated by spaces)");
            param_tags = EditorGUILayout.TextField(param_tags);
            GUILayout.Label("'unity' and 'unity3D' added automatically (" + param_tags.Length + "/50)", EditorStyles.centeredGreyMiniLabel);
            GUILayout.Space(SPACE_SIZE);
            // ENable only if user is pro

            GUILayout.Label("PRO only features", EditorStyles.centeredGreyMiniLabel);
            if (isUserPro)
            {
                EditorGUILayout.BeginVertical("Box");
                GUILayout.BeginHorizontal();
                param_private = EditorGUILayout.Toggle("Private model", param_private);
                if (GUILayout.Button("(<color=" + clickableLabelColor + ">more info</color>)", exporterClickableLabel, GUILayout.Height(20)))
                {
                    Application.OpenURL(latestReleaseUrl);
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
                GUI.enabled = isUserPro && param_private;
                GUILayout.Label("Password");
                param_password = EditorGUILayout.TextField(param_password);
                EditorGUILayout.EndVertical();
                GUI.enabled = true;
            }
            GUILayout.Label("Options", EditorStyles.boldLabel);
            GUILayout.BeginHorizontal();
            opt_exportAnimation = EditorGUILayout.Toggle("Export animation (beta)", opt_exportAnimation);
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();
            param_autopublish = EditorGUILayout.Toggle("Publish immediately ", param_autopublish);
            if (GUILayout.Button("(<color=" + clickableLabelColor + ">more info</color>)", exporterClickableLabel, GUILayout.Height(20)))
            {
                Application.OpenURL(latestReleaseUrl);
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();
            //GUILayout.Space(SPACE_SIZE);

            //if (categories.Count > 0)
            //	categoryIndex = EditorGUILayout.Popup(categoryIndex, categoriesNames.ToArray());

            //GUILayout.Space(SPACE_SIZE);
            bool enable = updateExporterStatus();

            if (enable)
            {
                GUI.color = blueColor;
            }
            else
            {
                GUI.color = greyColor;
            }
            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Save Local", GUILayout.Width(250), GUILayout.Height(40)))
            {
                if (System.IO.File.Exists(zipPath))
                {
                    System.IO.File.Delete(zipPath);
                }
                exporter.ExportCoroutine(exportPath, null, true, true, opt_exportAnimation, true);
                OpenInFileBrowser.Open(Path.GetDirectoryName(exportPath));
            }
            if (publisher != null && publisher.getState() == ExporterState.PUBLISH_MODEL && publisher.www != null)
            {
                Rect r = EditorGUILayout.BeginVertical();
                EditorGUI.ProgressBar(r, progress(), "Upload progress");
                GUILayout.Space(18);
                EditorGUILayout.EndVertical();
            }
            else
            {
                GUI.enabled = enable;
                if (GUILayout.Button(status, GUILayout.Width(250), GUILayout.Height(40)))
                {
                    if (!enable)
                    {
                        EditorUtility.DisplayDialog("Error", status, "Ok");
                    }
                    else
                    {
                        if (System.IO.File.Exists(zipPath))
                        {
                            System.IO.File.Delete(zipPath);
                        }

                        exporter.ExportCoroutine(exportPath, null, true, true, opt_exportAnimation, true);

                        if (File.Exists(zipPath))
                        {
                            publisher.setFilePath(zipPath);
                            publisher.publish(buildParameterDict(), access_token);
                            www = publisher.www;
                        }
                        else
                        {
                            Debug.Log("Zip file has not been generated. Aborting publish.");
                        }
                    }
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
            }
        }
    }
Ejemplo n.º 18
0
    void OnGUIWindow(int id)
    {
        if (hide = GUILayout.Toggle(hide, "Hide GUI"))
        {
            return;
        }

        GUILayout.Space(4);

        GUILayout.Label("FolderPath:");
        if (GUILayout.Button(parentFolder))
        {
            OpenInFileBrowser.Open(parentFolder);
        }

        GUILayout.BeginHorizontal();
        GUILayout.Label("FileName: ");
        fileName = GUILayout.TextField(fileName, GUILayout.Width(320));
        GUILayout.Label(fileExtension);
        GUILayout.EndHorizontal();

        GUILayout.Space(16);

        var filePath = Path.Combine(parentFolder, fileName + fileExtension);
        var exist    = File.Exists(filePath);

        if (exist && !recorder.playing && !recorder.recording)
        {
            recorder.playFilePath = filePath;
            GUILayout.BeginHorizontal();
            if (GUILayout.Button("/play"))
            {
                recorder.Play();
            }
            if (GUILayout.Button("create playData"))
            {
                recorder.CreatePlayData();
            }
            GUILayout.EndHorizontal();
        }
        else if (!exist && !recorder.recording)
        {
            recorder.recordFilePath = filePath;
            if (GUILayout.Button("/record"))
            {
                recorder.StartRecording();
            }
        }

        if ((recorder.playing || recorder.recording))
        {
            if (GUILayout.Button("/stop"))
            {
                if (recorder.recording)
                {
                    var array = fileName.Split('_');
                    var num   = 0;
                    if (0 < array.Length && int.TryParse(array.Last(), out num))
                    {
                        array[array.Length - 1] = (num + 1).ToString();
                        fileName = string.Join("_", array);
                    }
                    else
                    {
                        fileName += "_0";
                    }
                }
                recorder.Stop();
            }
        }
        else
        {
            GUILayout.Space(16);
            GUILayout.BeginVertical("box");
            if (SetIpField("Remote IP: ", ref remoteIp) || SetPortField("Remote Port", ref remotePort))
            {
                sender.CreateRemoteEP(remoteIp, remotePort);
            }
            GUILayout.Space(8);
            if (SetPortField("Local Port: ", ref localPort))
            {
                server.StartServer(localPort);
            }
            GUILayout.EndVertical();
        }

        if (0 < error.Length)
        {
            var color = GUI.color;
            GUI.color = Color.red;
            GUILayout.Label(error);
            GUI.color = color;
        }

        GUILayout.Space(16);
        if (recorder.playing || recorder.recording)
        {
            var fileSize = (float)recorder.fileSize;
            var unit     = "B";
            if (1024 < fileSize)
            {
                fileSize /= 1024;
                unit      = "KB";
            }
            if (1024 < fileSize)
            {
                fileSize /= 1024;
                unit      = "MB";
            }

            GUILayout.BeginHorizontal();
            GUILayout.Label(recorder.playing ? "playing: " : "recording: ");
            GUILayout.Label(recorder.time.ToString(), GUILayout.Width(200));
            GUILayout.FlexibleSpace();
            GUILayout.Label("file size: ");
            GUILayout.Label(fileSize.ToString(".000") + unit);
            GUILayout.EndHorizontal();
        }

        GUI.DragWindow();
    }
Ejemplo n.º 19
0
 static void OpenPersistentFolder()
 {
     OpenInFileBrowser.Open(Application.persistentDataPath);
 }