File tree Expand file tree Collapse file tree 3 files changed +29
-13
lines changed
Expand file tree Collapse file tree 3 files changed +29
-13
lines changed Original file line number Diff line number Diff line change 11using HarmonyLib ;
2+ using KSA ;
23
34namespace StarMap . SimpleExampleMod
45{
@@ -10,13 +11,20 @@ internal static class Patcher
1011 public static void Patch ( )
1112 {
1213 Console . WriteLine ( "Patching SimpleMod..." ) ;
13- _harmony ? . PatchAll ( ) ;
14+ _harmony ? . PatchAll ( typeof ( Patcher ) . Assembly ) ;
1415 }
1516
1617 public static void Unload ( )
1718 {
1819 _harmony ? . UnpatchAll ( _harmony . Id ) ;
1920 _harmony = null ;
2021 }
22+
23+ [ HarmonyPatch ( typeof ( ModLibrary ) , nameof ( ModLibrary . LoadAll ) ) ]
24+ [ HarmonyPostfix ]
25+ public static void AfterLoad ( )
26+ {
27+ Console . WriteLine ( "ModLibrary.LoadAll patched by SimpleMod." ) ;
28+ }
2129 }
2230}
Original file line number Diff line number Diff line change 11using Brutal . ImGuiApi ;
2+ using KSA ;
23using StarMap . API ;
34
45namespace StarMap . SimpleExampleMod
56{
6- public class SimpleMod : IStarMapMod , IStarMapOnUi
7+ [ StarMapMod ]
8+ public class SimpleMod
79 {
8- public bool ImmediateUnload => false ;
9-
10+ [ StarMapAfterGui ]
1011 public void OnAfterUi ( double dt )
1112 {
1213 ImGuiWindowFlags flags = ImGuiWindowFlags . MenuBar ;
@@ -62,22 +63,25 @@ public void OnAfterUi(double dt)
6263 ImGui . End ( ) ;
6364 }
6465
65- public void OnBeforeUi ( double dt )
66+ [ StarMapImmediateLoad ]
67+ public void OnImmediateLoad ( Mod mod )
6668 {
69+ Console . WriteLine ( "SimpleMod - On immediate loaded" ) ;
70+
6771 }
6872
73+ [ StarMapAllModsLoaded ]
6974 public void OnFullyLoaded ( )
7075 {
76+ Console . WriteLine ( "SimpleMod - On fully loaded" ) ;
7177 Patcher . Patch ( ) ;
7278
7379 }
7480
75- public void OnImmediatLoad ( )
76- {
77- }
78-
81+ [ StarMapUnload ]
7982 public void Unload ( )
8083 {
84+ Console . WriteLine ( "SimpleMod - Unload" ) ;
8185 Patcher . Unload ( ) ;
8286 }
8387 }
Original file line number Diff line number Diff line change 1717 </None >
1818 </ItemGroup >
1919
20- <ItemGroup Condition = " '$(Configuration)' == 'Debug' " >
20+ <ItemGroup >
2121 <Reference Include =" ..\..\Import\KSA.dll" >
2222 <ExcludeAssets >runtime</ExcludeAssets >
2323 </Reference >
3535 </Reference >
3636 </ItemGroup >
3737
38- <ItemGroup Condition =" '$(Configuration)' ! = 'Debug'" >
39- <PackageReference Include =" StarMap.KSA.Dummy " Version = " 1.0.4 " >
38+ <ItemGroup Condition =" '$(Configuration)' = = 'Debug'" >
39+ <Reference Include =" ..\..\Import\StarMap.API.dll " >
4040 <ExcludeAssets >runtime</ExcludeAssets >
41- </PackageReference >
41+ </Reference >
42+ </ItemGroup >
43+
44+ <ItemGroup Condition =" '$(Configuration)' != 'Debug'" >
45+ <PackageReference Include =" StarMap.API" Version =" 0.2.1" />
4246 </ItemGroup >
4347
4448</Project >
You can’t perform that action at this time.
0 commit comments