示例#1
0
 void OnSave()
 {
     AT_UtilsGlobals.Save("Colors");
     Styles.Reset();
 }
示例#2
0
 void OnRestore()
 {
     AT_UtilsGlobals.Restore();
     Styles.Reset();
 }
示例#3
0
 void OnClose()
 {
     Close();
     AT_UtilsGlobals.Load();
     Styles.Reset();
 }
示例#4
0
 void OnReset()
 {
     Colors.SetDefaults();
     Styles.Reset();
 }
示例#5
0
 public void ManageGUI()
 {
     GUILayout.BeginHorizontal();
     tank_type_gui();
     tank_resource_gui();
     GUILayout.FlexibleSpace();
     if (HighLogic.LoadedSceneIsEditor && manager.Volume > 0)
     {
         if (edit)
         {
             if (VolumeField.Draw("m3", true, manager.Volume / 20, "F2"))
             {
                 var max_volume = tank.Volume + manager.Volume - manager.TotalVolume;
                 if (VolumeField.Value > max_volume)
                 {
                     VolumeField.Value = max_volume;
                 }
                 if (VolumeField.IsSet)
                 {
                     tank.Volume = VolumeField.Value;
                     tank.UpdateMaxAmount(true);
                     manager.total_volume = -1;
                     edit = false;
                 }
             }
         }
         else
         {
             edit |= GUILayout.Button(new GUIContent(Utils.formatVolume(tank.Volume), "Edit tank volume"),
                                      Styles.add_button, GUILayout.ExpandWidth(true));
         }
     }
     else
     {
         GUILayout.Label(Utils.formatVolume(tank.Volume), Styles.boxed_label, GUILayout.ExpandWidth(true));
     }
     if (!edit)
     {
         var usage = tank.Usage;
         GUILayout.Label("Filled: " + usage.ToString("P1"), Styles.fracStyle(usage), GUILayout.Width(95));
         if (HighLogic.LoadedSceneIsEditor)
         {
             if (GUILayout.Button(new GUIContent("F", "Fill the tank with the resource"),
                                  Styles.add_button, GUILayout.Width(20)))
             {
                 tank.Amount = tank.MaxAmount;
             }
             if (GUILayout.Button(new GUIContent("E", "Empty the tank"),
                                  Styles.active_button, GUILayout.Width(20)))
             {
                 tank.Amount = 0;
             }
         }
         if (manager.AddRemoveEnabled)
         {
             if (GUILayout.Button(new GUIContent("X", "Delete the tank"),
                                  Styles.danger_button, GUILayout.Width(20)))
             {
                 if (HighLogic.LoadedSceneIsEditor)
                 {
                     tank.Amount = 0;
                 }
                 manager.remove_tank(tank);
                 manager.part.UpdatePartMenu();
             }
         }
     }
     GUILayout.EndHorizontal();
 }