-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
243 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,6 @@ | |
/packages | ||
/Test/obj | ||
/Test/bin | ||
/*.nupkg | ||
/MonkeyLoader Mods/* | ||
/MonkeyLoader Gamepacks/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<configuration> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace SampleMod | ||
{ | ||
internal interface ISampleMod | ||
{ | ||
bool Enabled { get; } | ||
|
||
void DoSomething(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<configuration> | ||
<packageSources> | ||
<add key="Nuget.org" value="https://api.nuget.org/v3/index.json" /> | ||
<add key="Installed MonkeyLoader Mods" value="MonkeyLoader Mods" /> | ||
<add key="Installed MonkeyLoader GamePacks" value="MonkeyLoader GamePacks" /> | ||
</packageSources> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using FrooxEngine.UIX; | ||
using HarmonyLib; | ||
|
||
namespace SampleMod | ||
{ | ||
internal class Patches | ||
{ | ||
private static ISampleMod ModInstance; | ||
|
||
internal static void Apply(ISampleMod instance) | ||
{ | ||
ModInstance = instance; | ||
Harmony harmony = new Harmony("com.github.mpmxyz.SampleMod"); //typically a reverse domain name is used here (https://en.wikipedia.org/wiki/Reverse_domain_name_notation) | ||
harmony.PatchAll(); // do whatever LibHarmony patching you need, this will patch all [HarmonyPatch()] instances | ||
} | ||
//Example of how a HarmonyPatch can be formatted | ||
[HarmonyPatch(typeof(Button), "OnPressBegin")] | ||
class ClassName_MethodName_Patch | ||
{ | ||
//Postfix() here will be automatically applied as a PostFix Patch | ||
[HarmonyPostfix] | ||
static void Postfix(Button __instance, Canvas.InteractionData eventData) | ||
{ | ||
if (!ModInstance.Enabled) | ||
{//Use Config.GetValue() to use the ModConfigurationKey defined earlier | ||
return; //In this example if the mod is not enabled, we'll just return before doing anything | ||
} | ||
ModInstance.DoSomething(); | ||
FrooxEngineBootstrap.LogStream.Flush(); | ||
//Do stuff after everything in the original OnPressBegin has run. | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.