You are viewing a potentially older version of this package. View all versions.
tari-CustomAppAPI-1.0.0 icon

CustomAppAPI

An API for adding custom apps to the phone.

Date uploaded 9 months ago
Version 1.0.0
Download link tari-CustomAppAPI-1.0.0.zip
Downloads 886
Dependency string tari-CustomAppAPI-1.0.0

This mod requires the following mods to function

BepInEx-BepInExPack-5.4.2100 icon
BepInEx-BepInExPack

BepInEx pack for Mono Unity games. Preconfigured and ready to use.

Preferred version: 5.4.2100

README

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"));

}

CHANGELOG

1.0.0

  • Initial release.

1.0.1

  • Add default 'Content' RectTransform to custom apps
  • Add default 'Notification' to custom apps based on the Email app