CustomAppAPI
An API for adding custom apps to the phone.
Last updated | a year ago |
Total downloads | 25261 |
Total rating | 3 |
Categories | Libraries |
Dependency string | tari-CustomAppAPI-1.0.1 |
Dependants | 4 other packages depend on this package |
This mod requires the following mods to function
BepInEx-BepInExPack
BepInEx pack for Mono Unity games. Preconfigured and ready to use.
Preferred version: 5.4.2100README
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"));
}