FiberLib
FiberLib is a library mod for sending and receiving packets from a Bopl Battle Mod. It is currently in a bare bones state and only includes necessary tools, but will soon include more utilities for ma
截圖 共 1 張
模組介紹 作者原文
.svg)
FiberLib
FiberLib is a library mod for sending and receiving packets from a Bopl Battle Mod. It is currently in a bare bones state and only includes necessary tools, but will soon include more utilities for making the developer experience simpler.
Documentation
(This project still under development, so API can change)
- First make a global static variable for signature to send/recive packets
public static Signature signature;
- Register a packet recive handler
public class MyMod: BaseUnityPlugin
{
private void ReciveHandler(Packet packet, Connection connection, NetIdentity identity)
{
byte data = packet.data;
Console.WriteLine($"recived {data.length} bytes");
}
private void Awake()
{
signature = PacketManager.RegisterPacketReciveHandler(ReciveHandler);
}
}
- Send Packet
public class MyMod: BaseUnityPlugin
{
private void OnGUI()
{
if (GUI.Button(new Rect(0, 50, 170f, 30f), "Send Packet"))
{
Console.WriteLine("Sending packet!");
Packet packet = new Packet(signature, Encoding.UTF8.GetBytes("Hello, World!"))
PacketManager.SendPacket(packet);
}
}
}
安裝與使用 安裝:按包內說明操作
- 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
- 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
- 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
- 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。
不同模組的安裝位置差異較大,包內說明是最可靠的依據。
下面這些內容需要先安裝,否則該模組不會生效: