From 526d83e0f595432c152d61392e50aa25a928478b Mon Sep 17 00:00:00 2001 From: Falki <72734856+Falki-git@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:50:35 +0200 Subject: [PATCH 1/6] Update project to use KSP2 environmental variable --- MicroEngineerProject/MicroEngineer.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MicroEngineerProject/MicroEngineer.csproj b/MicroEngineerProject/MicroEngineer.csproj index 35af288..6334cb2 100644 --- a/MicroEngineerProject/MicroEngineer.csproj +++ b/MicroEngineerProject/MicroEngineer.csproj @@ -34,6 +34,6 @@ - + \ No newline at end of file From bc1f1d4fd06794a901157d35f0ee251c827a18cf Mon Sep 17 00:00:00 2001 From: Falki <72734856+Falki-git@users.noreply.github.com> Date: Mon, 7 Aug 2023 17:53:54 +0200 Subject: [PATCH 2/6] Add alternate units to speed entries --- MicroEngineerProject/MicroEngineer.sln | 4 +-- .../MicroEngineer/Entries/BaseEntry.cs | 26 ++++++++++++++++--- .../MicroEngineer/Entries/FlightEntries.cs | 12 +++++++++ .../MicroEngineer/Entries/OrbitalEntries.cs | 6 +++++ .../MicroEngineer/Entries/SurfaceEntries.cs | 12 +++++++++ .../MicroEngineer/Entries/TargetEntries.cs | 24 +++++++++++++++++ .../MicroEngineer/MicroEngineerMod.cs | 2 +- .../UI/Controls/BaseEntryControl.cs | 15 +++++++++++ .../MicroEngineer/Utilities/Utility.cs | 4 +-- .../plugins/micro_engineer/swinfo.json | 8 +++--- 10 files changed, 101 insertions(+), 12 deletions(-) diff --git a/MicroEngineerProject/MicroEngineer.sln b/MicroEngineerProject/MicroEngineer.sln index 4d3a884..1394d9c 100644 --- a/MicroEngineerProject/MicroEngineer.sln +++ b/MicroEngineerProject/MicroEngineer.sln @@ -11,8 +11,8 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {2CD77478-E170-4D5C-91CA-0ABB24A30E5A}.Debug|Any CPU.ActiveCfg = Release|Any CPU - {2CD77478-E170-4D5C-91CA-0ABB24A30E5A}.Debug|Any CPU.Build.0 = Release|Any CPU + {2CD77478-E170-4D5C-91CA-0ABB24A30E5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2CD77478-E170-4D5C-91CA-0ABB24A30E5A}.Debug|Any CPU.Build.0 = Debug|Any CPU {2CD77478-E170-4D5C-91CA-0ABB24A30E5A}.Release|Any CPU.ActiveCfg = Release|Any CPU {2CD77478-E170-4D5C-91CA-0ABB24A30E5A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection diff --git a/MicroEngineerProject/MicroEngineer/Entries/BaseEntry.cs b/MicroEngineerProject/MicroEngineer/Entries/BaseEntry.cs index 72d755e..1ed6781 100644 --- a/MicroEngineerProject/MicroEngineer/Entries/BaseEntry.cs +++ b/MicroEngineerProject/MicroEngineer/Entries/BaseEntry.cs @@ -1,5 +1,4 @@ -using BepInEx.Logging; -using Newtonsoft.Json; +using Newtonsoft.Json; namespace MicroMod { @@ -31,6 +30,8 @@ public class BaseEntry [JsonProperty] public string GigaUnit; [JsonProperty] + public AltUnit AltUnit; + [JsonProperty] public byte NumberOfDecimalDigits; [JsonProperty("Formatting")] private string _formatting; @@ -101,6 +102,12 @@ public virtual string ValueDisplay if (!double.TryParse(EntryValue.ToString(), out double d)) return EntryValue.ToString(); // This case shouldn't exist, but just to be sure + if (AltUnit != null && AltUnit.IsActive) + { + return !string.IsNullOrEmpty(Formatting) ? String.Format(Formatting, d * AltUnit.Factor) : + (d * AltUnit.Factor).ToString(); + } + if (Math.Abs(d) < 1) // mili { return !String.IsNullOrEmpty(this.MiliUnit) ? String.Format(Formatting, d * 1000) : @@ -146,6 +153,9 @@ public virtual string UnitDisplay if (!double.TryParse(EntryValue.ToString(), out double d)) return this.BaseUnit ?? ""; // This case shouldn't exist, but just to be sure + if (AltUnit != null && AltUnit.IsActive) + return AltUnit.Unit; + if (d > 0.001 && d < 1) // mili { return this.MiliUnit ?? this.BaseUnit ?? ""; @@ -172,5 +182,15 @@ public virtual string UnitDisplay } public virtual void RefreshData() { } - } + } + + public class AltUnit + { + [JsonProperty] + public bool IsActive; + [JsonProperty] + public string Unit; + [JsonProperty] + public float Factor; + } } \ No newline at end of file diff --git a/MicroEngineerProject/MicroEngineer/Entries/FlightEntries.cs b/MicroEngineerProject/MicroEngineer/Entries/FlightEntries.cs index 0d76542..25d9a32 100644 --- a/MicroEngineerProject/MicroEngineer/Entries/FlightEntries.cs +++ b/MicroEngineerProject/MicroEngineer/Entries/FlightEntries.cs @@ -18,6 +18,12 @@ public Speed() GigaUnit = "Gm/s"; NumberOfDecimalDigits = 2; Formatting = "N"; + AltUnit = new AltUnit() + { + IsActive = false, + Unit = "km/h", + Factor = (60f * 60f) / 1000f + }; } public override void RefreshData() @@ -400,6 +406,12 @@ public SoundSpeed() GigaUnit = "Gm/s"; NumberOfDecimalDigits = 2; Formatting = "N"; + AltUnit = new AltUnit() + { + IsActive = false, + Unit = "km/h", + Factor = (60f * 60f) / 1000f + }; } public override void RefreshData() diff --git a/MicroEngineerProject/MicroEngineer/Entries/OrbitalEntries.cs b/MicroEngineerProject/MicroEngineer/Entries/OrbitalEntries.cs index 648201b..0720d71 100644 --- a/MicroEngineerProject/MicroEngineer/Entries/OrbitalEntries.cs +++ b/MicroEngineerProject/MicroEngineer/Entries/OrbitalEntries.cs @@ -170,6 +170,12 @@ public OrbitalSpeed() GigaUnit = "Gm/s"; NumberOfDecimalDigits = 1; Formatting = "N"; + AltUnit = new AltUnit() + { + IsActive = false, + Unit = "km/h", + Factor = (60f * 60f) / 1000f + }; } public override void RefreshData() diff --git a/MicroEngineerProject/MicroEngineer/Entries/SurfaceEntries.cs b/MicroEngineerProject/MicroEngineer/Entries/SurfaceEntries.cs index 89b8f95..bcad33b 100644 --- a/MicroEngineerProject/MicroEngineer/Entries/SurfaceEntries.cs +++ b/MicroEngineerProject/MicroEngineer/Entries/SurfaceEntries.cs @@ -99,6 +99,12 @@ public VerticalVelocity() GigaUnit = "Gm/s"; NumberOfDecimalDigits = 1; Formatting = "N"; + AltUnit = new AltUnit() + { + IsActive = false, + Unit = "km/h", + Factor = (60f * 60f) / 1000f + }; } public override void RefreshData() @@ -124,6 +130,12 @@ public HorizontalVelocity() GigaUnit = "Gm/s"; NumberOfDecimalDigits = 1; Formatting = "N"; + AltUnit = new AltUnit() + { + IsActive = false, + Unit = "km/h", + Factor = (60f * 60f) / 1000f + }; } public override void RefreshData() diff --git a/MicroEngineerProject/MicroEngineer/Entries/TargetEntries.cs b/MicroEngineerProject/MicroEngineer/Entries/TargetEntries.cs index 58ffac0..67fef68 100644 --- a/MicroEngineerProject/MicroEngineer/Entries/TargetEntries.cs +++ b/MicroEngineerProject/MicroEngineer/Entries/TargetEntries.cs @@ -126,6 +126,12 @@ public RelativeSpeed() GigaUnit = "Gm/s"; NumberOfDecimalDigits = 1; Formatting = "N"; + AltUnit = new AltUnit() + { + IsActive = false, + Unit = "km/h", + Factor = (60f * 60f) / 1000f + }; } public override void RefreshData() @@ -284,6 +290,12 @@ public Target_Obtvelocity() GigaUnit = "Gm/s"; NumberOfDecimalDigits = 1; Formatting = "N"; + AltUnit = new AltUnit() + { + IsActive = false, + Unit = "km/h", + Factor = (60f * 60f) / 1000f + }; } public override void RefreshData() @@ -700,6 +712,12 @@ public RelativeSpeedAtCloseApproach1() GigaUnit = "Gm/s"; NumberOfDecimalDigits = 1; Formatting = "N"; + AltUnit = new AltUnit() + { + IsActive = false, + Unit = "km/h", + Factor = (60f * 60f) / 1000f + }; } public override void RefreshData() @@ -778,6 +796,12 @@ public RelativeSpeedAtCloseApproach2() GigaUnit = "Gm/s"; NumberOfDecimalDigits = 1; Formatting = "N"; + AltUnit = new AltUnit() + { + IsActive = false, + Unit = "km/h", + Factor = (60f * 60f) / 1000f + }; } public override void RefreshData() diff --git a/MicroEngineerProject/MicroEngineer/MicroEngineerMod.cs b/MicroEngineerProject/MicroEngineer/MicroEngineerMod.cs index 08ba07e..7cd0ea5 100644 --- a/MicroEngineerProject/MicroEngineer/MicroEngineerMod.cs +++ b/MicroEngineerProject/MicroEngineer/MicroEngineerMod.cs @@ -10,7 +10,7 @@ namespace MicroMod { - [BepInPlugin("com.micrologist.microengineer", "MicroEngineer", "1.2.0")] + [BepInPlugin("com.micrologist.microengineer", "MicroEngineer", "1.3.0")] [BepInDependency(SpaceWarpPlugin.ModGuid, SpaceWarpPlugin.ModVer)] public class MicroEngineerMod : BaseSpaceWarpPlugin { diff --git a/MicroEngineerProject/MicroEngineer/UI/Controls/BaseEntryControl.cs b/MicroEngineerProject/MicroEngineer/UI/Controls/BaseEntryControl.cs index 308eba7..9c00563 100644 --- a/MicroEngineerProject/MicroEngineer/UI/Controls/BaseEntryControl.cs +++ b/MicroEngineerProject/MicroEngineer/UI/Controls/BaseEntryControl.cs @@ -1,4 +1,5 @@ using MicroMod; +using UnityEngine; using UnityEngine.UIElements; namespace MicroEngineer.UI @@ -11,6 +12,8 @@ public class BaseEntryControl : VisualElement public static string UssValueClassName = UssClassName + "__value"; public static string UssUnitClassName = UssClassName + "__unit"; + private float _timeOfLastClick; + public Label NameLabel; public Label ValueLabel; public Label UnitLabel; @@ -45,6 +48,10 @@ public BaseEntryControl(BaseEntry entry) : this() // When entry's value changes, update value and unit labels entry.OnEntryValueChanged += HandleEntryValueChanged; + + // Handle alternate units + if (entry.AltUnit != null) + this.RegisterCallback(_ => ToggleAltUnit(entry), TrickleDown.TrickleDown); } public BaseEntryControl(string name, string value) : this() @@ -117,5 +124,13 @@ public void HandleEntryValueChanged(string value, string unit) if (Unit != unit) Unit = unit; } + + public void ToggleAltUnit(BaseEntry entry) + { + if (Time.time - _timeOfLastClick < 0.5f) + entry.AltUnit.IsActive = !entry.AltUnit.IsActive; + + _timeOfLastClick = Time.time; + } } } \ No newline at end of file diff --git a/MicroEngineerProject/MicroEngineer/Utilities/Utility.cs b/MicroEngineerProject/MicroEngineer/Utilities/Utility.cs index 6ec2480..89c026a 100644 --- a/MicroEngineerProject/MicroEngineer/Utilities/Utility.cs +++ b/MicroEngineerProject/MicroEngineer/Utilities/Utility.cs @@ -18,7 +18,7 @@ public static class Utility public static VesselComponent ActiveVessel; public static ManeuverNodeData CurrentManeuver; public static string LayoutPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "MicroLayout.json"); - public static int CurrentLayoutVersion = 13; + public static int CurrentLayoutVersion = 14; private static ManualLogSource Logger = BepInEx.Logging.Logger.CreateLogSource("MicroEngineer.Utility"); public static GameStateConfiguration GameState; public static MessageCenter MessageCenter; @@ -147,7 +147,7 @@ public static void LoadLayout(List windows) Logger.LogInfo("LoadLayout successful."); Logger.LogDebug($"Finished loading. MainGui.IsFlightActive: {MainGui.IsFlightActive}."); } - catch (FileNotFoundException ex) + catch (FileNotFoundException) { Logger.LogWarning($"MicroLayout.json file was not found at the expected location during LoadLayout. This is normal if this mod was just installed. Window states and positions will keep their default values."); diff --git a/Staging/BepInEx/plugins/micro_engineer/swinfo.json b/Staging/BepInEx/plugins/micro_engineer/swinfo.json index 0707bd2..5f1e493 100644 --- a/Staging/BepInEx/plugins/micro_engineer/swinfo.json +++ b/Staging/BepInEx/plugins/micro_engineer/swinfo.json @@ -1,15 +1,15 @@ { - "spec": "1.2", - "mod_id": "micro_engineer", + "spec": "1.3", + "mod_id": "com.micrologist.microengineer", "author": "Micrologist, Falki", "name": "Micro Engineer", "description": "Get in-flight and VAB information about your current vessel", "source": "https://github.com/Micrologist/MicroEngineer", - "version": "1.2.1", + "version": "1.3.0", "version_check": "https://raw.githubusercontent.com/Micrologist/MicroEngineer/main/Staging/BepInEx/plugins/micro_engineer/swinfo.json", "dependencies": [ { - "id": "SpaceWarp", + "id": "com.github.x606.spacewarp", "version": { "min": "1.3.0.3", "max": "*" From b3b71fce5a4aa8bca190b143e7beb0a7b29180b6 Mon Sep 17 00:00:00 2001 From: Falki <72734856+Falki-git@users.noreply.github.com> Date: Mon, 7 Aug 2023 20:12:43 +0200 Subject: [PATCH 3/6] Add nuget packages instead of dlls --- MicroEngineerProject/MicroEngineer.csproj | 25 ++--------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/MicroEngineerProject/MicroEngineer.csproj b/MicroEngineerProject/MicroEngineer.csproj index 6334cb2..5eae1eb 100644 --- a/MicroEngineerProject/MicroEngineer.csproj +++ b/MicroEngineerProject/MicroEngineer.csproj @@ -9,29 +9,8 @@ - - - - - - - external_dlls\UitkForKsp2.dll - - - external_dlls\UitkForKsp2.Controls.dll - - - external_dlls\UnityEngine.IMGUIModule.dll - - - external_dlls\UnityEngine.InputLegacyModule.dll - - - external_dlls\UnityEngine.TextRenderingModule.dll - - - external_dlls\UnityEngine.UIElementsModule.dll - + + From caceef66378ff204ebfcf0408c66a29395aef654 Mon Sep 17 00:00:00 2001 From: Falki <72734856+Falki-git@users.noreply.github.com> Date: Mon, 7 Aug 2023 20:13:04 +0200 Subject: [PATCH 4/6] Remove unneeded folder external_dlls --- MicroEngineerProject/external_dlls/.gitignore | 2 -- MicroEngineerProject/external_dlls/ADD_GAME_DLL_FILES_HERE | 1 - 2 files changed, 3 deletions(-) delete mode 100644 MicroEngineerProject/external_dlls/.gitignore delete mode 100644 MicroEngineerProject/external_dlls/ADD_GAME_DLL_FILES_HERE diff --git a/MicroEngineerProject/external_dlls/.gitignore b/MicroEngineerProject/external_dlls/.gitignore deleted file mode 100644 index 4bc8d65..0000000 --- a/MicroEngineerProject/external_dlls/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -*.dll -!.gitignore \ No newline at end of file diff --git a/MicroEngineerProject/external_dlls/ADD_GAME_DLL_FILES_HERE b/MicroEngineerProject/external_dlls/ADD_GAME_DLL_FILES_HERE deleted file mode 100644 index 8b13789..0000000 --- a/MicroEngineerProject/external_dlls/ADD_GAME_DLL_FILES_HERE +++ /dev/null @@ -1 +0,0 @@ - From 569909d2bc00c92970e277b3c09778b8271b343a Mon Sep 17 00:00:00 2001 From: Falki <72734856+Falki-git@users.noreply.github.com> Date: Mon, 7 Aug 2023 20:14:28 +0200 Subject: [PATCH 5/6] Cleanup --- .../MicroEngineer/Entries/BaseEntry.cs | 2 +- .../Entries/OabStageInfoEntries.cs | 9 ++++----- .../MicroEngineer/Managers/MessageManager.cs | 3 +-- .../Managers/MicroCelestialBodies.cs | 3 +-- .../MicroEngineer/MicroEngineerMod.cs | 6 +----- .../UI/Controllers/EditWindowsController.cs | 13 ++++--------- .../UI/Controllers/EntryWindowController.cs | 17 +++++------------ .../UI/Controllers/FlightSceneController.cs | 8 +------- .../UI/Controllers/MainGuiController.cs | 9 +-------- .../UI/Controllers/OABSceneController.cs | 9 +-------- .../UI/Controllers/StageInfoOABController.cs | 15 +-------------- .../UI/Controls/TimeEntryControl.cs | 2 +- .../MicroEngineer/Utilities/Utility.cs | 7 ++----- 13 files changed, 24 insertions(+), 79 deletions(-) diff --git a/MicroEngineerProject/MicroEngineer/Entries/BaseEntry.cs b/MicroEngineerProject/MicroEngineer/Entries/BaseEntry.cs index 1ed6781..85f2151 100644 --- a/MicroEngineerProject/MicroEngineer/Entries/BaseEntry.cs +++ b/MicroEngineerProject/MicroEngineer/Entries/BaseEntry.cs @@ -189,7 +189,7 @@ public class AltUnit [JsonProperty] public bool IsActive; [JsonProperty] - public string Unit; + public string Unit; [JsonProperty] public float Factor; } diff --git a/MicroEngineerProject/MicroEngineer/Entries/OabStageInfoEntries.cs b/MicroEngineerProject/MicroEngineer/Entries/OabStageInfoEntries.cs index 1846891..2474f9e 100644 --- a/MicroEngineerProject/MicroEngineer/Entries/OabStageInfoEntries.cs +++ b/MicroEngineerProject/MicroEngineer/Entries/OabStageInfoEntries.cs @@ -1,5 +1,4 @@ -using BepInEx.Logging; -using KSP.Game; +using KSP.Game; using KSP.Sim.DeltaV; using KSP.Sim.impl; @@ -16,7 +15,7 @@ public TotalBurnTime_OAB() { Name = "Total burn time (OAB)"; Description = "Shows the total length of burn the vessel can mantain."; - EntryType = EntryType.Time; + EntryType = EntryType.Time; Category = MicroEntryCategory.OAB; IsDefault = true; BaseUnit = "s"; @@ -105,7 +104,7 @@ public override void RefreshData() /// /// Calculates torque from the Center of Thrust and Center of Mass - /// + /// public class Torque : OabStageInfoEntry { public Torque() @@ -188,7 +187,7 @@ public override void RefreshData() if (Utility.VesselDeltaVComponentOAB?.StageInfo == null) return; - for (int i = 0; i < Utility.VesselDeltaVComponentOAB.StageInfo.Count; i++) + for (int i = 0; i < Utility.VesselDeltaVComponentOAB.StageInfo.Count; i++) { var retrieved = Utility.VesselDeltaVComponentOAB.StageInfo[i]; var stage = new DeltaVStageInfo_OAB() diff --git a/MicroEngineerProject/MicroEngineer/Managers/MessageManager.cs b/MicroEngineerProject/MicroEngineer/Managers/MessageManager.cs index dc329e4..bcee2f5 100644 --- a/MicroEngineerProject/MicroEngineer/Managers/MessageManager.cs +++ b/MicroEngineerProject/MicroEngineer/Managers/MessageManager.cs @@ -92,14 +92,13 @@ private void GameStateEntered(MessageCenterMessage obj) } private void GameStateLeft(MessageCenterMessage obj) - { + { Utility.RefreshGameManager(); var maingui = Manager.Instance.Windows.OfType().FirstOrDefault(); var stageOab = Manager.Instance.Windows.OfType().FirstOrDefault(); if (Utility.GameState.GameState == GameState.FlightView || Utility.GameState.GameState == GameState.VehicleAssemblyBuilder || Utility.GameState.GameState == GameState.Map3DView) { - _logger.LogDebug($"Initiating Save from GameStateLeft."); Utility.SaveLayout(); if (Utility.GameState.GameState == GameState.FlightView || Utility.GameState.GameState == GameState.Map3DView) diff --git a/MicroEngineerProject/MicroEngineer/Managers/MicroCelestialBodies.cs b/MicroEngineerProject/MicroEngineer/Managers/MicroCelestialBodies.cs index 9ea3112..0139359 100644 --- a/MicroEngineerProject/MicroEngineer/Managers/MicroCelestialBodies.cs +++ b/MicroEngineerProject/MicroEngineer/Managers/MicroCelestialBodies.cs @@ -24,7 +24,6 @@ public static MicroCelestialBodies Instance public MicroCelestialBodies() { - _logger.LogDebug("Instantiating singleton."); InitializeBodies(); } @@ -104,7 +103,7 @@ private void TryReorderBodies() /// private List InstantiateCelestialBodies (CelestialBodyComponent cel, int level) { - List instantiatedBodies = new(); + List instantiatedBodies = new(); instantiatedBodies.Add(InstantiateCelestialBody(cel, level)); foreach (CelestialBodyComponent body in cel.orbitingBodies) diff --git a/MicroEngineerProject/MicroEngineer/MicroEngineerMod.cs b/MicroEngineerProject/MicroEngineer/MicroEngineerMod.cs index 7cd0ea5..3b4d96d 100644 --- a/MicroEngineerProject/MicroEngineer/MicroEngineerMod.cs +++ b/MicroEngineerProject/MicroEngineer/MicroEngineerMod.cs @@ -6,7 +6,6 @@ using SpaceWarp.API.UI.Appbar; using MicroEngineer.UI; using KSP.Game; -using BepInEx.Logging; namespace MicroMod { @@ -14,7 +13,6 @@ namespace MicroMod [BepInDependency(SpaceWarpPlugin.ModGuid, SpaceWarpPlugin.ModVer)] public class MicroEngineerMod : BaseSpaceWarpPlugin { - private static readonly ManualLogSource _logger = BepInEx.Logging.Logger.CreateLogSource("MicroEngineerMod"); public static MicroEngineerMod Instance { get; set; } public string GUID; @@ -36,7 +34,6 @@ public override void OnInitialized() if (isOpen) Manager.Instance.Windows.Find(w => w.GetType() == typeof(MainGuiWindow)).IsFlightActive = isOpen; FlightSceneController.Instance.ShowGui = isOpen; - _logger.LogDebug($"Initiating Save from Appbar.RegisterAppButton."); Utility.SaveLayout(); }); @@ -49,7 +46,6 @@ public override void OnInitialized() if (isOpen) Manager.Instance.Windows.Find(w => w.GetType() == typeof(StageInfoOabWindow)).IsEditorActive = isOpen; OABSceneController.Instance.ShowGui = isOpen; - _logger.LogDebug($"Initiating Save from Appbar.RegisterOABAppButton."); Utility.SaveLayout(); }); } @@ -66,7 +62,7 @@ public void Update() bool guiState = FlightSceneController.Instance.ShowGui; FlightSceneController.Instance.ShowGui = !guiState; Manager.Instance.Windows.Find(w => w.GetType() == typeof(MainGuiWindow)).IsFlightActive = !guiState; - } + } else if (Utility.GameState.GameState == GameState.VehicleAssemblyBuilder) { bool guiState = OABSceneController.Instance.ShowGui; diff --git a/MicroEngineerProject/MicroEngineer/UI/Controllers/EditWindowsController.cs b/MicroEngineerProject/MicroEngineer/UI/Controllers/EditWindowsController.cs index bc98fc6..fb70973 100644 --- a/MicroEngineerProject/MicroEngineer/UI/Controllers/EditWindowsController.cs +++ b/MicroEngineerProject/MicroEngineer/UI/Controllers/EditWindowsController.cs @@ -1,5 +1,4 @@ -using BepInEx.Logging; -using MicroMod; +using MicroMod; using UnityEngine; using UnityEngine.UIElements; @@ -7,8 +6,6 @@ namespace MicroEngineer.UI { public class EditWindowsController : MonoBehaviour { - private static readonly ManualLogSource _logger = BepInEx.Logging.Logger.CreateLogSource("MicroEngineer.EditWindowsController"); - private EditWindowsItemControl _selectedAvailableEntry; private EditWindowsItemControl _selectedInstalledEntry; private List _editableWindows; @@ -22,7 +19,7 @@ public class EditWindowsController : MonoBehaviour public Button CloseButton { get; set; } public ScrollView AvailableScrollView { get; set; } public ScrollView InstalledScrollView { get; set; } - public DropdownField CategoryDropdown { get; set; } + public DropdownField CategoryDropdown { get; set; } public TextField SelectedWindow { get; set; } public Button PreviousWindow { get; set; } public Button NextWindow { get; set; } @@ -47,7 +44,6 @@ private System.Collections.IEnumerator StartInitialization() // wait for 1 frame until SelectedWindowId is set in FlightSceneController yield return null; - _logger.LogDebug("Entering OnEnable."); EditWindows = GetComponent(); Root = EditWindows.rootVisualElement; @@ -94,7 +90,7 @@ private void BuildCategoryDropdown() { CategoryDropdown.choices = Enum.GetNames(typeof(MicroEntryCategory)).Where(e => e != MicroEntryCategory.OAB.ToString()).ToList(); CategoryDropdown.RegisterValueChangedCallback(BuildAvailableEntries); - } + } private void BuildAvailableEntries(ChangeEvent _) { @@ -159,7 +155,7 @@ public void UnselectAvailable(EditWindowsItemControl control) AddEntry.SetEnabled(false); } - ////////////////////// INSTALLED (RIGHT SCROLLVIEW) ////////////////////// + ////////////////////// INSTALLED (RIGHT SCROLLVIEW) ////////////////////// public void ResetSelectedWindow() { @@ -374,7 +370,6 @@ private void CheckIfDecimalButtonsShouldBeEnabled(BaseEntry entry, Button increa private void RebuildFlightUI() { - _logger.LogDebug($"Initiating Save from RebuildFlightUI."); Utility.SaveLayout(); FlightSceneController.Instance.RebuildUI(); } diff --git a/MicroEngineerProject/MicroEngineer/UI/Controllers/EntryWindowController.cs b/MicroEngineerProject/MicroEngineer/UI/Controllers/EntryWindowController.cs index 402f6a3..b4a7a11 100644 --- a/MicroEngineerProject/MicroEngineer/UI/Controllers/EntryWindowController.cs +++ b/MicroEngineerProject/MicroEngineer/UI/Controllers/EntryWindowController.cs @@ -1,5 +1,4 @@ -using BepInEx.Logging; -using MicroMod; +using MicroMod; using UnityEngine; using UnityEngine.UIElements; @@ -7,8 +6,6 @@ namespace MicroEngineer.UI { public class EntryWindowController : MonoBehaviour { - private static readonly ManualLogSource _logger = BepInEx.Logging.Logger.CreateLogSource("MicroEngineer.EntryWindowController"); - public EntryWindow EntryWindow { get; set; } public VisualElement WindowRoot { get; set; } public VisualElement Root { get; set; } @@ -38,8 +35,6 @@ public EntryWindowController(EntryWindow w, VisualElement windowRoot) public void Initialize() { - _logger.LogDebug($"Creating window: {EntryWindow.Name}."); - Root = Uxmls.Instance.EntryWindow.CloneTree(); BuildTitle(); @@ -72,7 +67,6 @@ public void UpdateWindowPosition(PointerUpEvent evt) return; EntryWindow.FlightRect.position = WindowRoot[0].transform.position; - _logger.LogDebug($"Initiating Save from UpdateWindowPosition."); Utility.SaveLayout(); } @@ -85,7 +79,7 @@ private void BuildTitle() NameLabel = Root.Q