Example #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;
    }
Example #2
0
 /// <summary>
 /// Halt current simulation.
 /// Load the next simulation in batch, or
 ///  change state to State.end if at the end of batch.
 /// </summary>
 public static void NextSimulation()
 {
     // stop current simulation
     if (state == State.simulating)
     {
         Halt(StopCode.Unspecified);
     }
     // next in batch
     simulationNumber++;
     if (simulationNumber > batch.Count)
     {
         // end of batch
         Halt(StopCode.Unspecified);
         End();
         return;
     }
     Debug.Log("Simulation NextSimulation: " + simulationNumber + " of " + batch.Count);
     // load simulation settings
     settings = batch[simulationNumber - 1];
     Log.Settings();
     // load environment
     EnvLoader.SearchForEnvironments();
     environment = EnvLoader.LoadEnvironment(settings.environmentName);
     destination.transform.position = RandomInBounds(Instance.bounds);
     // load robot
     if (robot)
     {
         CamController.RemoveAreaOfInterest(robot);
     }
     BotLoader.SearchForRobots();
     robot            = BotLoader.LoadRobot(settings.robotName);
     robot.navigation = NavLoader.LoadPlugin(settings.navigationAssemblyName);
     // configure camera
     CamController.AddAreaOfInterest(robot);
     CamController.SetViewMode(CamController.ViewMode.Birdseye);
     CamController.SetAreaOfInterest(robot);
     // reset test number
     testNumber = 0;
     NextTest();
 }