Skip to content

Registry

The plugin registry: the list of plugins the game can install, read from registry.json on GitHub. Index i runs from 0 to Count() - 1 once State() is "ready".

Refresh

void Registry::Refresh()

Downloads the registry again. It's already loaded once when the game starts.

Example
if (refreshButton.Clicked())
    Registry::Refresh();

State

string Registry::State()

"" (not asked for yet), "loading", "ready", or "error: ...".

Example
if (Registry::State() != "ready")
{
    statusText.text = "registry: " + (Registry::State() == "" ? "not loaded" : Registry::State());
    return;
}

Count

uint Registry::Count()

How many plugins the registry lists.

Example
countText.text = Registry::Count() + " in the registry";

Id

string Registry::Id(uint)

The listed plugin's id, the name its folder will have.

Example
bool installed = Plugins::IsInstalled(Registry::Id(i));

Name

string Registry::Name(uint)

The listed plugin's display name.

Example
row.text = Registry::Name(i) + "   " + Registry::Version(i);

Description

string Registry::Description(uint)

The listed plugin's one-line description.

Example
panel.AddLine(Registry::Description(i));

Author

string Registry::Author(uint)

The listed plugin's author.

Example
string byline = "by " + Registry::Author(i);

Version

string Registry::Version(uint)

The newest version the registry lists for the plugin.

Example
bool update = Plugins::InstalledVersion(Registry::Id(i)) != "" &&
              Plugins::InstalledVersion(Registry::Id(i)) != Registry::Version(i);

Page

string Registry::Page(uint)

The plugin's GitHub page, https://github.com/<owner>/<repo>.

Example
if (githubButton.Clicked())
    Host::OpenUrl(Registry::Page(i));

Icon

string Registry::Icon(uint)

The path of the downloaded copy of the plugin's icon, or "" while it hasn't been downloaded (or if there is none).

Example
window.AddImage(Registry::Icon(i) != "" ? Registry::Icon(i) : Plugins::DefaultIcon(), 64, 64);

HostVersion

string Registry::HostVersion()

The newest plugin host version the registry lists.

Example
if (Registry::HostVersion() != "" && Registry::HostVersion() != Host::Version())
    statusText.text = "plugin manager " + Registry::HostVersion() + " is available";