Skip to content

Commit

Permalink
Merge pull request #117 from SpaceWarpDev/configuration
Browse files Browse the repository at this point in the history
Add config manager.
  • Loading branch information
cheese3660 authored Mar 3, 2023
2 parents a9d2428 + e945b53 commit 4167f95
Show file tree
Hide file tree
Showing 33 changed files with 8,648 additions and 1 deletion.
14 changes: 14 additions & 0 deletions SpaceWarp/Patching/ConfigurationManagerPatch.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using HarmonyLib;
using SpaceWarp.API.UI;
using UnityEngine;

namespace SpaceWarp.Patching;
[HarmonyPatch(typeof(ConfigurationManager.ConfigurationManager))]
[HarmonyPatch("OnGUI")]
public class ConfigurationManagerPatch
{
public static void Prefix()
{
GUI.skin = Skins.ConsoleSkin;
}
}
3 changes: 3 additions & 0 deletions SpaceWarp/SpaceWarp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@
<HintPath>..\external_dlls\KSPLogging.dll</HintPath>
<Private>false</Private>
</Reference>
<Reference Include="BepInEx.ConfigurationManager">
<HintPath>..\ThirdParty\ConfigurationManager\ConfigurationManager.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="BepInEx.BaseLib" Version="5.4.21" Publicize="true" />
Expand Down
3 changes: 3 additions & 0 deletions SpaceWarp/SpaceWarpManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ internal static class SpaceWarpManager

internal static IReadOnlyList<BaseSpaceWarpPlugin> SpaceWarpPlugins;

internal static ConfigurationManager.ConfigurationManager _configurationManager;

internal static void GetSpaceWarpPlugins()
{
_configurationManager = (ConfigurationManager.ConfigurationManager)Chainloader.PluginInfos[ConfigurationManager.ConfigurationManager.GUID].Instance;
// obsolete warning for Chainloader.Plugins, is fine since we need ordered list
// to break this we would likely need to upgrade to BIE 6, which isn't happening
#pragma warning disable CS0618
Expand Down
1 change: 1 addition & 0 deletions SpaceWarp/SpaceWarpPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

namespace SpaceWarp;

[BepInDependency(ConfigurationManager.ConfigurationManager.GUID,ConfigurationManager.ConfigurationManager.Version)]
[BepInPlugin(ModGuid, ModName, ModVer)]
public sealed class SpaceWarpPlugin : BaseSpaceWarpPlugin
{
Expand Down
9 changes: 9 additions & 0 deletions SpaceWarp/UI/ModListUI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ private void FillWindow(int windowID)
_drawUI = false;
GUIUtility.ExitGUI();
}

GUILayout.BeginVertical();
GUILayout.BeginHorizontal();
GUILayout.BeginVertical();

Expand Down Expand Up @@ -114,6 +116,13 @@ private void FillWindow(int windowID)
}

GUILayout.EndHorizontal();
if (GUILayout.Button("Open Configuration Manager"))
{
SpaceWarpManager._configurationManager.DisplayingWindow =
!SpaceWarpManager._configurationManager.DisplayingWindow;
_drawUI = false;
}
GUILayout.EndVertical();
GUI.DragWindow();
}

Expand Down
Binary file not shown.
4,288 changes: 4,288 additions & 0 deletions ThirdParty/BepInEx 5.4.21/BepInEx/core/0Harmony.xml

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
86 changes: 86 additions & 0 deletions ThirdParty/BepInEx 5.4.21/BepInEx/core/BepInEx.Harmony.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
169 changes: 169 additions & 0 deletions ThirdParty/BepInEx 5.4.21/BepInEx/core/BepInEx.Preloader.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Loading

0 comments on commit 4167f95

Please sign in to comment.