CustomAppAPI
An API for adding custom apps to the phone.
模組介紹 作者原文
How to use:
Download the CustomAppAPI.dll file in the mod download.
Add the CustomAppAPI.dll to your references in Visual Studio along with your BepInEx Plugin.
Create a new class which inherits from the CustomApp class.
Implement the inherited abstract members, and you're ready to go!
Implementation
The DisplayName will be the app name that shows up on the home screen of the phone.
The Icon will be the texture that shows up next to the app name.
A static LoadTexture function is provided in CustomApp to load a Texture2D from a file path.
To get the file path to your mod.dll, Path.GetDirectoryName(BaseUnityPlugin.Info.Location) will get you the folder your mod is located in, where BaseUnityPlugin is your main plugin class. You may need a static accessor to get the instance of it.
Example Code:
public class MyMod: BaseUnityPlugin {
private static MyMod _instance;
public static MyMod Instance => _instance;
public string ModFolderPath => Path.GetDirectoryName(Info.Location);
private void Awake() {
_instance = this;
}
}
public class MyCustomApp: CustomApp {
public override string DisplayName => "My Custom App";
public override Texture2D Icon => LoadTexture(Path.Combine(MyMod.Instance.ModFolderPath, "myAppIcon.png"));
}
安裝與使用 安裝:按包內說明操作
- 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
- 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
- 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
- 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。
不同模組的安裝位置差異較大,包內說明是最可靠的依據。
下面這些內容需要先安裝,否則該模組不會生效: