コード例 #1
0
    IEnumerator _Load()
    {
        if (!EditCheck())
        {
            yield break;
        }

        while (currentSong.isSaving)
        {
            yield return(null);
        }

        if (errorManager.HasErrorToDisplay())
        {
            yield break;
        }

        Song backup = currentSong;

        if (!FileExplorer.OpenFilePanel(new ExtensionFilter("Chart files", "chart", "mid"), "chart,mid", out currentFileName))
        {
            currentSong = backup;

            // Immediate exit
            yield break;
        }

        Debug.Log("Loading song: " + System.IO.Path.GetFullPath(currentFileName));

        yield return(StartCoroutine(_Load(currentFileName)));

        selectedObjectsManager.currentSelectedObject = null;
    }
コード例 #2
0
    string GetAudioFile()
    {
        string audioFilepath = string.Empty;

        FileExplorer.OpenFilePanel(audioExFilter, "mp3,ogg,wav", out audioFilepath);
        return(audioFilepath);
    }
コード例 #3
0
    IEnumerator _Load()
    {
        if (!EditCheck())
        {
            yield break;
        }

        while (currentSong.isSaving)
        {
            yield return(null);
        }

        if (SaveErrorCheck())
        {
            yield break;
        }

        Song backup = currentSong;

        try
        {
            currentFileName = FileExplorer.OpenFilePanel("Chart files (*.chart, *.mid)\0*.chart;*.mid", "chart,mid");
        }
        catch (FileExplorer.FileExplorerExitException e)
        {
            // Most likely closed the window explorer, just ignore for now.
            currentSong = backup;
            Debug.Log(e.Message);

            // Immediate exit
            yield break;
        }
        catch (System.Exception e)
        {
            currentSong = backup;
            Logger.LogException(e, "Error when getting file to open");

            // Immediate exit
            yield break;
        }

        Debug.Log("Loading song: " + System.IO.Path.GetFullPath(currentFileName));

        yield return(StartCoroutine(_Load(currentFileName)));

        currentSelectedObject = null;
    }
コード例 #4
0
    string GetAudioFile()
    {
        string audioFilepath = string.Empty;
        string defExt        = string.Empty;

        foreach (string extention in validAudioExtensions)
        {
            if (defExt != string.Empty)
            {
                defExt += ",";
            }

            defExt += extention;
        }

        FileExplorer.OpenFilePanel(audioExFilter, defExt, out audioFilepath);
        return(audioFilepath);
    }
コード例 #5
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();
        EditorGUILayout.PropertyField(_inputProperties, true);
        serializedObject.ApplyModifiedProperties();

        InputConfigBuilder.InputProperties inputProperties = ((InputConfigBuilder)target).inputProperties;

        if (s_shouldReset)
        {
            inputProperties.shortcutInputs = new ShortcutInputConfig[0];
            s_shouldReset = false;
        }

        if (GUILayout.Button("Load Config From File"))
        {
            string filename;
            if (FileExplorer.OpenFilePanel(new ExtensionFilter("Config files", "json"), "json", out filename))
            {
                InputConfig inputConfig = new InputConfig();
                InputConfig.LoadFromFile(filename, inputConfig);
                inputProperties.shortcutInputs = inputConfig.shortcutInputs;
            }
        }
        if (GUILayout.Button("Save Config To File"))
        {
            string filename;

            if (inputProperties.shortcutInputs.Length > 0)
            {
                if (FileExplorer.SaveFilePanel(new ExtensionFilter("Config files", "json"), "InputPropertiesConfig", "json", out filename))
                {
                    InputConfig inputConfig = new InputConfig();
                    inputConfig.shortcutInputs = inputProperties.shortcutInputs;
                    InputConfig.Save(inputConfig, filename);
                }
            }
            else
            {
                Debug.LogError("Trying to save empty input properties. This is not allowed.");
            }
        }
    }