Esempio n. 1
0
    /// <summary>
    /// GUI window function: browse and load CSV files
    /// </summary>
    private void CsvBrowser(int windowID)
    {
        // hide button
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("<", GUILayout.Width(30f)))
        {
            _windows.Pop();
        }
        // refresh files and folders
        if (GUILayout.Button("R", GUILayout.Width(30f)))
        {
            Refresh();
        }
        GUILayout.EndHorizontal();

        // go up one directory
        if (_subPath != "")
        {
            if (GUILayout.Button(".."))
            {
                _subPath = Directory.GetParent(_subPath).Name;
                Refresh();
            }
        }
        // list subdirectories
        for (int i = 0; i < _folders.Count; i++)
        {
            // enter subdirectory
            if (GUILayout.Button(_folders[i]))
            {
                _subPath += new DirectoryInfo(_folders[i]).Name;
                Refresh();
            }
        }
        if (LogLoader.loading)
        {
            GUILayout.Label("Loading...");
        }
        else
        {
            // list files
            for (int i = 0; i < _files.Count; i++)
            {
                // try paths from file
                if (GUILayout.Button(_files[i]))
                {
                    // change state when loading first data
                    if (BotNavSim.isIdle)
                    {
                        BotNavSim.state = BotNavSim.State.ViewingData;
                    }
                    LogLoader.LoadPaths(currentDir + "\\" + _files[i]);
                }
            }
        }
    }