Esempio n. 1
0
    /// <summary>
    /// GUI window function: Display controls for loaded CSV files.
    /// </summary>
    private void Legend(int windowID)
    {
        // back button
        GUILayout.BeginHorizontal(GUILayout.Width(UI_Toolbar.I.innerWidth));
        if (GUILayout.Button("<", GUILayout.Width(30f)))
        {
            hidden = true;
        }
        if (GUILayout.Button("Load from CSV..."))
        {
            _windows.Push(CsvBrowser);
        }
        GUILayout.EndHorizontal();

        if (LogLoader.paths.Count < 1)
        {
            GUILayout.Label("No paths loaded.");
        }

        // list botpaths
        Color c = GUI.contentColor;

        for (int i = 0; i < LogLoader.paths.Count; i++)
        {
            GUILayout.BeginHorizontal();
            GUI.contentColor = LogLoader.paths[i].color;
            if (GUILayout.Button(LogLoader.paths[i].csvName))
            {
                LogLoader.paths[i].visible = !LogLoader.paths[i].visible;
                continue;
            }
            // highlight path if mouseover button
            // this event appears to be broken
            if (IsMouseOver())
            {
                LogLoader.paths[i].highlight = true;
            }
            else
            {
                LogLoader.paths[i].highlight = false;
            }
            // observe button
            if (GUILayout.Button("O"))
            {
                CamController.SetAreaOfInterest(LogLoader.paths[i]);
            }
            // unload path button
            if (GUILayout.Button("X"))
            {
                LogLoader.RemovePath(LogLoader.paths[i]);
            }
            GUILayout.EndHorizontal();
        }
        // reset content color
        GUI.contentColor = c;
    }