Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
8b7ed00
Initial commit
Falki-git Jun 4, 2023
a4cd6ff
Add LatLonEntryControl
Falki-git Jun 5, 2023
791b561
Rename value change event
Falki-git Jun 5, 2023
f986b53
Add SeparatorEntryControl
Falki-git Jun 6, 2023
9193c04
Add docked window uxml, update icons
Falki-git Jun 9, 2023
99b54ea
Add StageInfo window
Falki-git Jun 9, 2023
bd47fc3
Connect new MainGui to ME's inner workings
Falki-git Jun 10, 2023
02adf34
Update UnityProject files
Falki-git Jun 10, 2023
cc504a7
Add StageInfo window
Falki-git Jun 11, 2023
a85bcf7
Create popedout windows (tentative implementation)
Falki-git Jun 12, 2023
122db36
Fix poppedout windows from not affecting each other
Falki-git Jun 12, 2023
7d81bdd
BaseWindow is now base for all windows
Falki-git Jun 13, 2023
4f7c1e3
Add docked/undocked switching
Falki-git Jun 14, 2023
2911899
Preserve positions of windows on docking/undocking
Falki-git Jun 15, 2023
8e0f8f6
Fix windows properly toggling with the app.bar button
Falki-git Jun 15, 2023
61c692c
Handle MainGui's Close button
Falki-git Jun 15, 2023
464d3f1
Initial EditWindows commit
Falki-git Jun 17, 2023
c9e7aa2
Move EditWindowsController
Falki-git Jun 17, 2023
994b7d9
Cleanup
Falki-git Jun 17, 2023
f83d9e3
Add AvailableEntries selection
Falki-git Jun 19, 2023
1c2fb7d
Add InstalledControls, add MoveUp & MoveDown
Falki-git Jun 19, 2023
b2e7840
Update Unity project files
Falki-git Jun 19, 2023
c6ae788
Add AddEntry, RemoveEntry
Falki-git Jun 20, 2023
aaebd95
Update Unity project
Falki-git Jun 20, 2023
457c3bf
Set a name for Separator entry
Falki-git Jun 21, 2023
e0ac0c3
Handle CloseButton
Falki-git Jun 21, 2023
0175125
Rename Entry, rename Window
Falki-git Jun 21, 2023
3ad3009
Update csproj
Falki-git Jun 21, 2023
5ccf9be
Fix window positioning
Falki-git Jun 21, 2023
f8cfd7d
Add NewWindow, DeleteWindow, LockWindow
Falki-git Jun 21, 2023
8dbbf03
Add Increase/DecreaseDecimalDigits
Falki-git Jun 22, 2023
bab7b9a
Double click triggers Add/Remove
Falki-git Jun 22, 2023
5072797
Cleanup
Falki-git Jun 22, 2023
a0d1994
Change StageInfoOabWindow to be BaseWindow
Falki-git Jun 22, 2023
9f10705
Update project to target KSP2 1.3.0
Falki-git Jun 22, 2023
d14371b
Bump version
Falki-git Jun 22, 2023
c66e97f
Remove IMGUI initialization in OAB
Falki-git Jun 22, 2023
3cb8f06
Enable opening EditWindows with a specific window selected
Falki-git Jun 22, 2023
890d8b6
Keep windows inside screen bounds
Falki-git Jun 23, 2023
29804bf
Cleanup
Falki-git Jun 23, 2023
b034b51
Remove unused uxmls
Falki-git Jun 23, 2023
6d1df79
Add StageInfoOABEntryControl
Falki-git Jun 23, 2023
04a6443
Update Unity project
Falki-git Jun 23, 2023
a18ab73
Add TimeControl
Falki-git Jun 24, 2023
2cf0a5e
Initial commit for StageInfoOAB
Falki-git Jun 24, 2023
c1f435a
Make Torque always active
Falki-git Jun 24, 2023
5db4169
Less verbose LoadLayout warning
Falki-git Jun 24, 2023
83d4e8d
Add Torque, TotalAslDeltaV, TotalVacDeltaV, TotalBurnTime
Falki-git Jun 24, 2023
965ba7e
Finish StageInfoOabEntries
Falki-git Jun 25, 2023
53295a1
Save layout after window dragging + cleanup
Falki-git Jun 25, 2023
61e9223
Add CelestialBody selection
Falki-git Jun 25, 2023
3be5b6a
Insert empty stage if there are no stages
Falki-git Jun 25, 2023
68c4553
Update unity project
Falki-git Jun 25, 2023
2ae38a9
Fix CelestialBody dropdown alignment
Falki-git Jun 25, 2023
d7cfee6
Set default position for StageInfoOAB
Falki-git Jun 25, 2023
7d1a83d
Update unity project
Falki-git Jun 25, 2023
bfa43a1
Bump layout version
Falki-git Jun 25, 2023
f0253f5
Update unity project
Falki-git Jun 25, 2023
599c93c
Disable game input on installed entry focus
Falki-git Jun 26, 2023
0d4a486
Doubleclick on editwindows control is if last click is <500 ms ago
Falki-git Jun 26, 2023
b783dc1
Center OAB Body header label
Falki-git Jun 26, 2023
43cece3
Sync namespaces and contents for controls with VS
Falki-git Jun 26, 2023
1b3b88e
When FlightUI is closing, close EditWindows too
Falki-git Jun 26, 2023
840abac
Hide poppedout Maneuver/Target windows when man/tgt don't exist
Falki-git Jun 26, 2023
ccba4ae
Bump layout version
Falki-git Jun 26, 2023
f1d4b42
Handle snapping of poppedout windows
Falki-git Jun 26, 2023
2cf2bbb
Fix some entries to be of type Time
Falki-git Jun 26, 2023
a0e5407
Add ALT+E as a keyboard shortcut for opening UI
Falki-git Jun 27, 2023
6e987bc
Add maneuver node manipulation
Falki-git Jun 27, 2023
9b1ec79
Switch AltitudeFromScenery and AltitudeFromTerrain
Falki-git Jun 27, 2023
95d2699
Change all "internal" to "public"
Falki-git Jun 27, 2023
499232d
Remove IMGUI code
Falki-git Jun 27, 2023
2d99363
Update staging folder
Falki-git Jun 27, 2023
0513163
Update unity project
Falki-git Jun 27, 2023
5d605e8
Remove old IMGUI classes and unused methods
Falki-git Jun 27, 2023
08c8d66
Remove duplicate reference
Falki-git Jun 27, 2023
a475b33
Cleanup
Falki-git Jun 27, 2023
73334b8
Fix layout saving
Falki-git Jun 28, 2023
c5fe95a
SaveLayout will grab windows itself
Falki-git Jun 28, 2023
28592de
Make StageInfo (flight) window editable
Falki-git Jun 28, 2023
59d5ad4
Remove OAB entries from available categories
Falki-git Jun 28, 2023
a81e7f1
Fix log
Falki-git Jun 28, 2023
0682b41
Require UitkForKsp2 1.4.0
Falki-git Jun 28, 2023
902b76d
Bump layout version to lucky number 13
Falki-git Jun 28, 2023
20a8f59
Update MicroEngineer.sln
Falki-git Jun 28, 2023
343a731
Fix negative time showing minus at the wrong place
Falki-git Jun 28, 2023
28dc969
Update README.md
Falki-git Jun 28, 2023
4798b95
Require SW 1.3.0.3
Falki-git Jun 28, 2023
eeb5985
Merge branch 'uitk-rewrite' of https://github.com/Falki-git/MicroEngi…
Falki-git Jun 28, 2023
3757123
Merge branch 'main' into uitk-rewrite
Falki-git Jun 28, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 37 additions & 26 deletions MicroEngineerProject/MicroEngineer.csproj
Original file line number Diff line number Diff line change
@@ -1,28 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<ImplicitUsings>true</ImplicitUsings>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BepInEx.BaseLib" Version="5.4.21" Publicize="true" />
<Reference Include="external_dlls\SpaceWarp.dll" />
<Reference Include="external_dlls\UnityEngine.dll" />
<Reference Include="external_dlls\UnityEngine.CoreModule.dll" />
<Reference Include="external_dlls\Assembly-CSharp.dll" />
<Reference Include="external_dlls\NewtonSoft.Json.dll" />
<Reference Include="external_dlls\NewtonSoft.Json.dll" />
<Reference Include="UnityEngine.IMGUIModule">
<HintPath>external_dlls\UnityEngine.IMGUIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule">
<HintPath>external_dlls\UnityEngine.TextRenderingModule.dll</HintPath>
</Reference>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="echo Killing task KSP2_x64.exe&#xD;&#xA;taskkill /f /fi &quot;pid gt 0&quot; /im KSP2_x64.exe&#xD;&#xA;&#xD;&#xA;echo Copying output .dll to &quot;..Kerbal Space Program 2 0.1.3.0 DEV\BepInEx\plugins\micro_engineer\&quot;&#xD;&#xA;xcopy /y &quot;$(TargetDir)$(ProjectName).dll&quot; &quot;D:\Steam\steamapps\common\Kerbal Space Program 2 0.1.3.0 DEV\BepInEx\plugins\micro_engineer\&quot;&#xD;&#xA;&#xD;&#xA;echo Copying output .pdb to &quot;..Kerbal Space Program 2 0.1.3.0 DEV\BepInEx\plugins\micro_engineer\&quot;&#xD;&#xA;xcopy /y &quot;$(TargetDir)$(ProjectName).pdb&quot; &quot;D:\Steam\steamapps\common\Kerbal Space Program 2 0.1.3.0 DEV\BepInEx\plugins\micro_engineer\&quot;&#xD;&#xA;&#xD;&#xA;echo Starting KSP2_x64.exe&#xD;&#xA;powershell &quot;start-process &quot;&quot;D:\Steam\steamapps\common\Kerbal Space Program 2 0.1.3.0 DEV\KSP2_x64.exe&quot;&quot;&quot;" />
</Target>
</Project>
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<ImplicitUsings>true</ImplicitUsings>
<RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BepInEx.BaseLib" Version="5.4.21" Publicize="true" />
<Reference Include="external_dlls\SpaceWarp.dll" />
<Reference Include="external_dlls\UnityEngine.dll" />
<Reference Include="external_dlls\UnityEngine.CoreModule.dll" />
<Reference Include="external_dlls\Assembly-CSharp.dll" />
<Reference Include="external_dlls\NewtonSoft.Json.dll" />
<Reference Include="UitkForKsp2">
<HintPath>external_dlls\UitkForKsp2.dll</HintPath>
</Reference>
<Reference Include="UitkForKsp2.Controls">
<HintPath>external_dlls\UitkForKsp2.Controls.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.IMGUIModule">
<HintPath>external_dlls\UnityEngine.IMGUIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.InputLegacyModule">
<HintPath>external_dlls\UnityEngine.InputLegacyModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule">
<HintPath>external_dlls\UnityEngine.TextRenderingModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UIElementsModule">
<HintPath>external_dlls\UnityEngine.UIElementsModule.dll</HintPath>
</Reference>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="echo Killing task KSP2_x64.exe&#xD;&#xA;taskkill /f /fi &quot;pid gt 0&quot; /im KSP2_x64.exe&#xD;&#xA;&#xD;&#xA;echo Copying output .dll to &quot;..Kerbal Space Program 2 0.1.3.0 DEV\BepInEx\plugins\micro_engineer\&quot;&#xD;&#xA;xcopy /y &quot;$(TargetDir)$(ProjectName).dll&quot; &quot;D:\Steam\steamapps\common\Kerbal Space Program 2 0.1.3.0 DEV\BepInEx\plugins\micro_engineer\&quot;&#xD;&#xA;&#xD;&#xA;echo Copying output .pdb to &quot;..Kerbal Space Program 2 0.1.3.0 DEV\BepInEx\plugins\micro_engineer\&quot;&#xD;&#xA;xcopy /y &quot;$(TargetDir)$(ProjectName).pdb&quot; &quot;D:\Steam\steamapps\common\Kerbal Space Program 2 0.1.3.0 DEV\BepInEx\plugins\micro_engineer\&quot;&#xD;&#xA;&#xD;&#xA;echo Starting KSP2_x64.exe&#xD;&#xA;powershell &quot;start-process &quot;&quot;D:\Steam\steamapps\common\Kerbal Space Program 2 0.1.3.0 DEV\KSP2_x64.exe&quot;&quot;&quot;" />
</Target>
</Project>
51 changes: 48 additions & 3 deletions MicroEngineerProject/MicroEngineer/Entries/BaseEntry.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Newtonsoft.Json;
using BepInEx.Logging;
using Newtonsoft.Json;

namespace MicroMod
{
Expand All @@ -15,6 +16,7 @@ public class BaseEntry
public string Description;
[JsonProperty]
public MicroEntryCategory Category;
public EntryType EntryType;
public bool IsDefault;
[JsonProperty]
public bool HideWhenNoData;
Expand All @@ -38,10 +40,53 @@ public string Formatting
set => _formatting = value;
}

public virtual object EntryValue { get; set; }
private object entryValue;
public virtual object EntryValue
{
get => entryValue;

set
{
if (value != entryValue)
{
entryValue = value;

switch (EntryType)
{
case EntryType.BasicText:
OnEntryValueChanged?.Invoke(ValueDisplay, UnitDisplay);
break;
case EntryType.Time:
var time = Utility.ParseSecondsToTimeFormat((double?)value ?? 0);
OnEntryTimeValueChanged?.Invoke(time.Days, time.Hours, time.Minutes, time.Seconds);
break;
case EntryType.LatitudeLongitude:
var latLon = Utility.ParseDegreesToDMSFormat((double?)value ?? 0);
OnEntryLatLonChanged?.Invoke(latLon.Degrees, latLon.Minutes, latLon.Seconds, BaseUnit);
break;
case EntryType.StageInfo:
OnStageInfoChanged?.Invoke((List<Stage>)entryValue);
break;
case EntryType.Separator:
break;
default:
break;
}
}
}
}

public delegate void EntryValueChanged(string value, string unit);
public delegate void EntryTimeValueChanged(int days, int hours, int minutes, int seconds);
public delegate void EntryLatLonChanged(int degrees, int minutes, int seconds, string direction);
public delegate void StageInfoChanged(List<Stage> stages);
public event EntryValueChanged OnEntryValueChanged;
public event EntryTimeValueChanged OnEntryTimeValueChanged;
public event EntryLatLonChanged OnEntryLatLonChanged;
public event StageInfoChanged OnStageInfoChanged;

/// <summary>
/// Controls how the value should be displayed. Should be overriden in a inheritet class for a concrete implementation.
/// Controls how the value should be displayed. Can be overriden in a inheritet class for a more specialized implementation.
/// </summary>
public virtual string ValueDisplay
{
Expand Down
5 changes: 2 additions & 3 deletions MicroEngineerProject/MicroEngineer/Entries/BodyEntries.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

namespace MicroMod
namespace MicroMod
{
public class BodyEntry : BaseEntry
{ }
Expand Down Expand Up @@ -68,5 +67,5 @@ public override void RefreshData()
}

public override string ValueDisplay => base.ValueDisplay;
}
}
}
5 changes: 2 additions & 3 deletions MicroEngineerProject/MicroEngineer/Entries/FlightEntries.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

namespace MicroMod
namespace MicroMod
{
public class FlightEntry : BaseEntry
{ }
Expand Down Expand Up @@ -317,7 +316,7 @@ public override string ValueDisplay
return String.IsNullOrEmpty(base.Formatting) ? EntryValue.ToString() : String.Format(base.Formatting, EntryValue);
}
}
}
}

public class DragCoefficient : FlightEntry
{
Expand Down
Loading