InterprocessLib
Library for mods to send data to the renderer and back.
模組介紹 作者原文
InterprocessLib
A library for Resonite that allows mods to send data to other processes such as the Unity renderer.
The library only depends on Renderite.Shared.
BepisLoader, BepInEx, RML and Standalone example projects are included in the Tests folder.
Usage
After including the library in your project, all you have to do is create your own instance of the Messenger class. You can do this at any time, even before Resonite starts.!!! Make sure both processes register with the same name!!!
var messenger = new Messenger("PluginName");
From here you can use the messenger to send data or receive data.
messenger.SendValue("TestValue", 637);
messenger.ReceiveValue("TestValue", (val) =>
{
Log($"TestValue: {val}");
});
For BepisLoader, BepInEx and RML, if you have a config entry in both processes with the same type and name, you can sync them like this:
messenger.SyncConfigEntry(MyConfigEntry);
You can also work with lists:
var list = new List();
list.Add(2f);
list.Add(7f);
list.Add(21f);
messenger.SendValueCollection, float>("TestValueList", list);
messenger.ReceiveValueCollection, float>("TestValueList", (list) =>
{
Log($"TestValueList: {string.Join(",", list!)}");
});
You can send any class or struct that has the IMemoryPackable interface:
var cmd = new TestCommand();
cmd.Value = 2932;
cmd.Text = "Hello world";
cmd.Time = DateTime.Now;
messenger.SendObject("TestCustomRendererCommand", cmd);
messenger.ReceiveObject("TestCustomRendererCommand", (recvCmd) =>
{
Log($"TestCustomRendererCommand: {recvCmd?.Value}, {recvCmd?.Text}, {recvCmd?.Time}");
});
For more examples, you can check the tests files:
Installation (BepisLoader/BepInEx) (Manual)
- Install BepisLoader and BepInExRenderer and RenderiteHook for Resonite.
- Download the latest release ZIP file (e.g., Nytra-InterprocessLib-1.0.0.zip) from the Releases page.
- Extract the ZIP and copy the plugins folder to your BepInEx folder in your Resonite installation directory and the renderer directory:
- Default location: C:\Program Files (x86)\Steam\steamapps\common\Resonite\BepInEx\
- Renderer default location: C:\Program Files (x86)\Steam\steamapps\common\Resonite\Renderer\BepInEx\
- Start the game. If you want to verify that the mod is working you can check your BepInEx logs.
Installation (RML) (Manual)
- Install ResoniteModLoader for Resonite.
- Download the latest release file InterprocessLib.FrooxEngine.dll and optionally the RML extensions InterprocessLib.RML_Extensions.dll from the Releases page.
- Put those downloaded files into your 'rml_libs' folder in your Resonite installation directory:
- Default location: C:\Program Files (x86)\Steam\steamapps\common\Resonite\rml_libs\
- Start the game. If you want to verify that the mod is working you can check your Resonite logs.
安裝與使用 安裝:按包內說明操作
- 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
- 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
- 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
- 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。
不同模組的安裝位置差異較大,包內說明是最可靠的依據。
下面這些內容需要先安裝,否則該模組不會生效: