Ejemplo n.º 1
0
 void ConfigsGUI()
 {
     GUILayout.BeginVertical();
     GUILayout.Label("Manage named configurations", Styles.label, GUILayout.ExpandWidth(true));
     GUILayout.BeginHorizontal();
     GUILayout.Label("Name:", GUILayout.ExpandWidth(false));
     config_name = GUILayout.TextField(config_name, GUILayout.ExpandWidth(true), GUILayout.MinWidth(50));
     if (TCAScenario.NamedConfigs.ContainsKey(config_name))
     {
         if (GUILayout.Button(new GUIContent("Overwrite", "Overwrite selected configuration with the current one"),
                              Styles.danger_button, GUILayout.ExpandWidth(false)))
         {
             TCAScenario.SaveNamedConfig(config_name, CFG, true);
         }
     }
     else if (GUILayout.Button(new GUIContent("Add", "Save current configuration"),
                               Styles.add_button, GUILayout.ExpandWidth(false)) &&
              config_name != string.Empty)
     {
         TCAScenario.SaveNamedConfig(config_name, CFG);
         UpdateNamedConfigs();
         named_configs.SelectItem(TCAScenario.NamedConfigs.IndexOfKey(config_name));
     }
     SelectConfig();
     if (GUILayout.Button(new GUIContent("Load", "Load selected configuration"),
                          Styles.active_button, GUILayout.ExpandWidth(false)) &&
         selected_config != null)
     {
         CFG.Copy(selected_config);
     }
     if (GUILayout.Button(new GUIContent("Delete", "Delete selected configuration"),
                          Styles.danger_button, GUILayout.ExpandWidth(false)) &&
         selected_config != null)
     {
         TCAScenario.NamedConfigs.Remove(selected_config.Name);
         named_configs.SelectItem(named_configs.SelectedIndex - 1);
         UpdateNamedConfigs();
         selected_config = null;
     }
     GUILayout.EndHorizontal();
     GUILayout.EndVertical();
 }