Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.

Commit 569909d

Browse files
committed
Cleanup
1 parent caceef6 commit 569909d

File tree

13 files changed

+24
-79
lines changed

13 files changed

+24
-79
lines changed

MicroEngineerProject/MicroEngineer/Entries/BaseEntry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ public class AltUnit
189189
[JsonProperty]
190190
public bool IsActive;
191191
[JsonProperty]
192-
public string Unit;
192+
public string Unit;
193193
[JsonProperty]
194194
public float Factor;
195195
}

MicroEngineerProject/MicroEngineer/Entries/OabStageInfoEntries.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using BepInEx.Logging;
2-
using KSP.Game;
1+
using KSP.Game;
32
using KSP.Sim.DeltaV;
43
using KSP.Sim.impl;
54

@@ -16,7 +15,7 @@ public TotalBurnTime_OAB()
1615
{
1716
Name = "Total burn time (OAB)";
1817
Description = "Shows the total length of burn the vessel can mantain.";
19-
EntryType = EntryType.Time;
18+
EntryType = EntryType.Time;
2019
Category = MicroEntryCategory.OAB;
2120
IsDefault = true;
2221
BaseUnit = "s";
@@ -105,7 +104,7 @@ public override void RefreshData()
105104

106105
/// <summary>
107106
/// Calculates torque from the Center of Thrust and Center of Mass
108-
/// </summary>
107+
/// </summary>
109108
public class Torque : OabStageInfoEntry
110109
{
111110
public Torque()
@@ -188,7 +187,7 @@ public override void RefreshData()
188187

189188
if (Utility.VesselDeltaVComponentOAB?.StageInfo == null) return;
190189

191-
for (int i = 0; i < Utility.VesselDeltaVComponentOAB.StageInfo.Count; i++)
190+
for (int i = 0; i < Utility.VesselDeltaVComponentOAB.StageInfo.Count; i++)
192191
{
193192
var retrieved = Utility.VesselDeltaVComponentOAB.StageInfo[i];
194193
var stage = new DeltaVStageInfo_OAB()

MicroEngineerProject/MicroEngineer/Managers/MessageManager.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,13 @@ private void GameStateEntered(MessageCenterMessage obj)
9292
}
9393

9494
private void GameStateLeft(MessageCenterMessage obj)
95-
{
95+
{
9696
Utility.RefreshGameManager();
9797
var maingui = Manager.Instance.Windows.OfType<MainGuiWindow>().FirstOrDefault();
9898
var stageOab = Manager.Instance.Windows.OfType<StageInfoOabWindow>().FirstOrDefault();
9999

100100
if (Utility.GameState.GameState == GameState.FlightView || Utility.GameState.GameState == GameState.VehicleAssemblyBuilder || Utility.GameState.GameState == GameState.Map3DView)
101101
{
102-
_logger.LogDebug($"Initiating Save from GameStateLeft.");
103102
Utility.SaveLayout();
104103

105104
if (Utility.GameState.GameState == GameState.FlightView || Utility.GameState.GameState == GameState.Map3DView)

MicroEngineerProject/MicroEngineer/Managers/MicroCelestialBodies.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ public static MicroCelestialBodies Instance
2424

2525
public MicroCelestialBodies()
2626
{
27-
_logger.LogDebug("Instantiating singleton.");
2827
InitializeBodies();
2928
}
3029

@@ -104,7 +103,7 @@ private void TryReorderBodies()
104103
/// <returns></returns>
105104
private List<CelestialBody> InstantiateCelestialBodies (CelestialBodyComponent cel, int level)
106105
{
107-
List<CelestialBody> instantiatedBodies = new();
106+
List<CelestialBody> instantiatedBodies = new();
108107
instantiatedBodies.Add(InstantiateCelestialBody(cel, level));
109108

110109
foreach (CelestialBodyComponent body in cel.orbitingBodies)

MicroEngineerProject/MicroEngineer/MicroEngineerMod.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@
66
using SpaceWarp.API.UI.Appbar;
77
using MicroEngineer.UI;
88
using KSP.Game;
9-
using BepInEx.Logging;
109

1110
namespace MicroMod
1211
{
1312
[BepInPlugin("com.micrologist.microengineer", "MicroEngineer", "1.3.0")]
1413
[BepInDependency(SpaceWarpPlugin.ModGuid, SpaceWarpPlugin.ModVer)]
1514
public class MicroEngineerMod : BaseSpaceWarpPlugin
1615
{
17-
private static readonly ManualLogSource _logger = BepInEx.Logging.Logger.CreateLogSource("MicroEngineerMod");
1816
public static MicroEngineerMod Instance { get; set; }
1917
public string GUID;
2018

@@ -36,7 +34,6 @@ public override void OnInitialized()
3634
if (isOpen)
3735
Manager.Instance.Windows.Find(w => w.GetType() == typeof(MainGuiWindow)).IsFlightActive = isOpen;
3836
FlightSceneController.Instance.ShowGui = isOpen;
39-
_logger.LogDebug($"Initiating Save from Appbar.RegisterAppButton.");
4037
Utility.SaveLayout();
4138
});
4239

@@ -49,7 +46,6 @@ public override void OnInitialized()
4946
if (isOpen)
5047
Manager.Instance.Windows.Find(w => w.GetType() == typeof(StageInfoOabWindow)).IsEditorActive = isOpen;
5148
OABSceneController.Instance.ShowGui = isOpen;
52-
_logger.LogDebug($"Initiating Save from Appbar.RegisterOABAppButton.");
5349
Utility.SaveLayout();
5450
});
5551
}
@@ -66,7 +62,7 @@ public void Update()
6662
bool guiState = FlightSceneController.Instance.ShowGui;
6763
FlightSceneController.Instance.ShowGui = !guiState;
6864
Manager.Instance.Windows.Find(w => w.GetType() == typeof(MainGuiWindow)).IsFlightActive = !guiState;
69-
}
65+
}
7066
else if (Utility.GameState.GameState == GameState.VehicleAssemblyBuilder)
7167
{
7268
bool guiState = OABSceneController.Instance.ShowGui;

MicroEngineerProject/MicroEngineer/UI/Controllers/EditWindowsController.cs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
using BepInEx.Logging;
2-
using MicroMod;
1+
using MicroMod;
32
using UnityEngine;
43
using UnityEngine.UIElements;
54

65
namespace MicroEngineer.UI
76
{
87
public class EditWindowsController : MonoBehaviour
98
{
10-
private static readonly ManualLogSource _logger = BepInEx.Logging.Logger.CreateLogSource("MicroEngineer.EditWindowsController");
11-
129
private EditWindowsItemControl _selectedAvailableEntry;
1310
private EditWindowsItemControl _selectedInstalledEntry;
1411
private List<EntryWindow> _editableWindows;
@@ -22,7 +19,7 @@ public class EditWindowsController : MonoBehaviour
2219
public Button CloseButton { get; set; }
2320
public ScrollView AvailableScrollView { get; set; }
2421
public ScrollView InstalledScrollView { get; set; }
25-
public DropdownField CategoryDropdown { get; set; }
22+
public DropdownField CategoryDropdown { get; set; }
2623
public TextField SelectedWindow { get; set; }
2724
public Button PreviousWindow { get; set; }
2825
public Button NextWindow { get; set; }
@@ -47,7 +44,6 @@ private System.Collections.IEnumerator StartInitialization()
4744
// wait for 1 frame until SelectedWindowId is set in FlightSceneController
4845
yield return null;
4946

50-
_logger.LogDebug("Entering OnEnable.");
5147
EditWindows = GetComponent<UIDocument>();
5248
Root = EditWindows.rootVisualElement;
5349

@@ -94,7 +90,7 @@ private void BuildCategoryDropdown()
9490
{
9591
CategoryDropdown.choices = Enum.GetNames(typeof(MicroEntryCategory)).Where(e => e != MicroEntryCategory.OAB.ToString()).ToList();
9692
CategoryDropdown.RegisterValueChangedCallback(BuildAvailableEntries);
97-
}
93+
}
9894

9995
private void BuildAvailableEntries(ChangeEvent<string> _)
10096
{
@@ -159,7 +155,7 @@ public void UnselectAvailable(EditWindowsItemControl control)
159155
AddEntry.SetEnabled(false);
160156
}
161157

162-
////////////////////// INSTALLED (RIGHT SCROLLVIEW) //////////////////////
158+
////////////////////// INSTALLED (RIGHT SCROLLVIEW) //////////////////////
163159

164160
public void ResetSelectedWindow()
165161
{
@@ -374,7 +370,6 @@ private void CheckIfDecimalButtonsShouldBeEnabled(BaseEntry entry, Button increa
374370

375371
private void RebuildFlightUI()
376372
{
377-
_logger.LogDebug($"Initiating Save from RebuildFlightUI.");
378373
Utility.SaveLayout();
379374
FlightSceneController.Instance.RebuildUI();
380375
}

MicroEngineerProject/MicroEngineer/UI/Controllers/EntryWindowController.cs

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
using BepInEx.Logging;
2-
using MicroMod;
1+
using MicroMod;
32
using UnityEngine;
43
using UnityEngine.UIElements;
54

65
namespace MicroEngineer.UI
76
{
87
public class EntryWindowController : MonoBehaviour
98
{
10-
private static readonly ManualLogSource _logger = BepInEx.Logging.Logger.CreateLogSource("MicroEngineer.EntryWindowController");
11-
129
public EntryWindow EntryWindow { get; set; }
1310
public VisualElement WindowRoot { get; set; }
1411
public VisualElement Root { get; set; }
@@ -38,8 +35,6 @@ public EntryWindowController(EntryWindow w, VisualElement windowRoot)
3835

3936
public void Initialize()
4037
{
41-
_logger.LogDebug($"Creating window: {EntryWindow.Name}.");
42-
4338
Root = Uxmls.Instance.EntryWindow.CloneTree();
4439

4540
BuildTitle();
@@ -72,7 +67,6 @@ public void UpdateWindowPosition(PointerUpEvent evt)
7267
return;
7368

7469
EntryWindow.FlightRect.position = WindowRoot[0].transform.position;
75-
_logger.LogDebug($"Initiating Save from UpdateWindowPosition.");
7670
Utility.SaveLayout();
7771
}
7872

@@ -85,7 +79,7 @@ private void BuildTitle()
8579
NameLabel = Root.Q<Label>("window-name");
8680
NameLabel.text = EntryWindow.Name;
8781
SettingsButton = Root.Q<Button>("settings-button");
88-
SettingsButton.RegisterCallback<ClickEvent>(OpenSettingsWindow);
82+
SettingsButton.RegisterCallback<ClickEvent>(OpenSettingsWindow);
8983
PopOutButton = Root.Q<Button>("popout-button");
9084
PopOutButton.RegisterCallback<ClickEvent>(OnPopOutOrCloseButton);
9185
CloseButton = Root.Q<Button>("close-button");
@@ -105,7 +99,7 @@ private void BuildTitle()
10599
private void OpenSettingsWindow(ClickEvent evt)
106100
{
107101
var editableWindowId = FlightSceneController.Instance.GetEditableWindows().FindIndex(w => w.Name == EntryWindow.Name);
108-
FlightSceneController.Instance.ToggleEditWindows(true, editableWindowId);
102+
FlightSceneController.Instance.ToggleEditWindows(true, editableWindowId);
109103
}
110104

111105
private void BuildHeader()
@@ -201,14 +195,13 @@ private void OnTitleClick(EventBase evt)
201195
}
202196

203197
private void OnPopOutOrCloseButton(ClickEvent evt)
204-
{
198+
{
205199
EntryWindow.IsFlightPoppedOut = !EntryWindow.IsFlightPoppedOut;
206200

207201
// Activate/expand windows that get popped out.
208202
if (EntryWindow.IsFlightPoppedOut)
209203
EntryWindow.IsFlightActive = true;
210204

211-
_logger.LogDebug($"Initiating Save from OnPopOutOrCloseButton.");
212205
Utility.SaveLayout();
213206
FlightSceneController.Instance.RebuildUI();
214207
}
@@ -256,7 +249,7 @@ private void BuildManeuverFooter(ManeuverWindow window)
256249
ManeuverNodeNumberLabel.text = $"Node #{index + 1}";
257250
});
258251

259-
Footer.Add(maneuverFooter);
252+
Footer.Add(maneuverFooter);
260253

261254
window.OnNodeCountChanged += CheckIfManeuverHeaderAndFooterShouldBeHidden;
262255
window.OnSelectedNodeIndexChanged += UpdateManeuverNodeHeader;

MicroEngineerProject/MicroEngineer/UI/Controllers/FlightSceneController.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using BepInEx.Logging;
2-
using KSP.UI.Binding;
1+
using KSP.UI.Binding;
32
using MicroMod;
43
using UitkForKsp2.API;
54
using UnityEngine;
@@ -10,7 +9,6 @@ namespace MicroEngineer.UI
109
public class FlightSceneController
1110
{
1211
private static FlightSceneController _instance;
13-
private static readonly ManualLogSource _logger = BepInEx.Logging.Logger.CreateLogSource("MicroEngineer.FlightSceneController");
1412
private bool _showGui = false;
1513
private EditWindowsController _editWindowsController;
1614
private bool _maneuverWindowShown = true;
@@ -26,7 +24,6 @@ public bool ShowGui
2624
get => _showGui;
2725
set
2826
{
29-
_logger.LogDebug($"Inside ShowGui SET. Old value: {_showGui}. New value: {value}");
3027
_showGui = value;
3128

3229
GameObject.Find("BTN-MicroEngineerBtn")?.GetComponent<UIValue_WriteBool_Toggle>()?.SetValue(value);
@@ -78,7 +75,6 @@ public static FlightSceneController Instance
7875

7976
public void InitializeUI()
8077
{
81-
_logger.LogDebug("InitializeUI triggered.");
8278
//Build MainGui
8379
MainGui = Window.CreateFromUxml(Uxmls.Instance.BaseWindow, "MainGui", null, true);
8480
MainGuiController mainGuiController = MainGui.gameObject.AddComponent<MainGuiController>();
@@ -119,15 +115,13 @@ public void InitializeUI()
119115

120116
public void RebuildUI()
121117
{
122-
_logger.LogDebug("RebuildUI triggered.");
123118
DestroyUI();
124119
if (ShowGui)
125120
InitializeUI();
126121
}
127122

128123
public void DestroyUI()
129124
{
130-
_logger.LogDebug("DestroyUI triggered.");
131125
if (MainGui != null && MainGui.gameObject != null)
132126
MainGui.gameObject.DestroyGameObject();
133127
GameObject.Destroy(MainGui);

MicroEngineerProject/MicroEngineer/UI/Controllers/MainGuiController.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1-
using BepInEx.Logging;
2-
using MicroMod;
1+
using MicroMod;
32
using UnityEngine;
43
using UnityEngine.UIElements;
54

65
namespace MicroEngineer.UI
76
{
87
public class MainGuiController : MonoBehaviour
98
{
10-
private static readonly ManualLogSource _logger = BepInEx.Logging.Logger.CreateLogSource("MicroEngineer.MainGuiController");
11-
129
public MainGuiWindow MainGuiWindow { get; set; }
1310
public UIDocument MainGui { get; set; }
1411
public VisualElement Root { get; set; }
@@ -22,7 +19,6 @@ public MainGuiController()
2219

2320
public void OnEnable()
2421
{
25-
_logger.LogDebug("Entering OnEnable.");
2622
MainGui = GetComponent<UIDocument>();
2723
Root = MainGui.rootVisualElement;
2824
Header = Root.Q<VisualElement>("header");
@@ -42,7 +38,6 @@ private void UpdateWindowPosition(PointerUpEvent evt)
4238
return;
4339

4440
MainGuiWindow.FlightRect.position = Root[0].transform.position;
45-
_logger.LogDebug($"Initiating Save from UpdateWindowPosition.");
4641
Utility.SaveLayout();
4742
}
4843

@@ -68,15 +63,13 @@ public void BuildDockedWindows()
6863
EntryWindowController ewc = new EntryWindowController(entryWindow, Root);
6964

7065
Body.Add(ewc.Root);
71-
_logger.LogDebug($"Window {entryWindow.Name} added to root.");
7266
}
7367
}
7468

7569
private void OnCloseButton(ClickEvent evt)
7670
{
7771
MainGuiWindow.IsFlightActive = false;
7872

79-
_logger.LogDebug($"Initiating Save from OnCloseButton.");
8073
Utility.SaveLayout();
8174
FlightSceneController.Instance.ShowGui = false;
8275
}

MicroEngineerProject/MicroEngineer/UI/Controllers/OABSceneController.cs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
using BepInEx.Logging;
2-
using KSP.UI.Binding;
1+
using KSP.UI.Binding;
32
using MicroMod;
43
using UitkForKsp2.API;
54
using UnityEngine;
@@ -10,7 +9,6 @@ namespace MicroEngineer.UI
109
public class OABSceneController
1110
{
1211
private static OABSceneController _instance;
13-
private static readonly ManualLogSource _logger = BepInEx.Logging.Logger.CreateLogSource("MicroEngineer.OABSceneController");
1412
private bool _showGui = false;
1513

1614
public UIDocument StageInfoWindow { get; set; }
@@ -20,7 +18,6 @@ public bool ShowGui
2018
get => _showGui;
2119
set
2220
{
23-
_logger.LogDebug($"Entering ShowGui SET. Old value: {_showGui}. New value: {value}");
2421
_showGui = value;
2522

2623
GameObject.Find("BTN-MicroEngineerOAB")?.GetComponent<UIValue_WriteBool_Toggle>()?.SetValue(value);
@@ -42,8 +39,6 @@ public static OABSceneController Instance
4239

4340
public void InitializeUI()
4441
{
45-
_logger.LogDebug("InitializeUI triggered.");
46-
4742
StageInfoWindow = Window.CreateFromUxml(Uxmls.Instance.StageInfoOAB, "StageInfoOAB", null, true);
4843
StageInfoOABController controller = StageInfoWindow.gameObject.AddComponent<StageInfoOABController>();
4944
StageInfoWindow.rootVisualElement[0].RegisterCallback<PointerMoveEvent>(evt => Utility.ClampToScreenUitk(StageInfoWindow.rootVisualElement[0]));
@@ -54,15 +49,13 @@ public void InitializeUI()
5449

5550
public void RebuildUI()
5651
{
57-
_logger.LogDebug("RebuildUI triggered.");
5852
DestroyUI();
5953
if (ShowGui)
6054
InitializeUI();
6155
}
6256

6357
public void DestroyUI()
6458
{
65-
_logger.LogDebug("DestroyUI triggered.");
6659
if (StageInfoWindow != null && StageInfoWindow.gameObject != null)
6760
StageInfoWindow.gameObject.DestroyGameObject();
6861
GameObject.Destroy(StageInfoWindow);

0 commit comments

Comments
 (0)