Skip to content

Hub

The game's track hub (the workshop side of the play page), driven from a plugin: searches shown in the hub's own list, the maps on its list, and the map its info panel shows. Put a plugin's own controls in the hub with Window.DockInHub. Everything here needs host 0.23.0.

Shown

bool Hub::Shown()

Whether the track hub is on screen.

Example
row.visible = Hub::Shown();
bool Hub::Search(const string &in text = "", const string &in sort = "top", int days = 7, const string &in author = "", 

Shows a search in the hub's own list, made the way the game makes its own searches, and switches the hub to its list (with show false the list gets the results and the hub stays on the page it's on; requires host 0.23.0). text to search for (map titles, descriptions and tags), sort one of the game's "relevance", "top", "trending" (over days days), "new", "oldest", "title", "updated", or Steam's "played", "subscribed", "liked" (searches of every map). author is a Steam id for one player's maps ("": anyone). withTags are Steam tags a map needs (all, or any one with anyTag); with gameTags, the tags picked in the hub's own filter panel apply too. False (with a warning in the log) if the hub isn't there.

Example
if (search.Submitted())
    Hub::Search(search.text, "top");

ListShown

bool Hub::ListShown()

Whether a list of maps is on screen: the hub's list or its Subscribed page (false on the hub's Home, whose tiles aren't a list). Requires host 0.23.0.

Example
if (filtering && !Hub::ListShown())
    status.text = "the filter works on the list and Subscribed pages";

View

string Hub::View()

The hub's page on screen: "home", "list" or "subscribed"; "" when the hub isn't. Requires host 0.23.0.

Example
// clearing a search keeps the hub where it is
Hub::Search("", "top", 7, "", null, false, true, Hub::View() == "list");

Entries

array<string>@ Hub::Entries()

The ids of the maps the list on screen (the hub's list or its Subscribed page) shows on this page, in order (with any hidden by Hub::HideEntry); none on the hub's Home.

Example
array<string>@ ids = Hub::Entries();

HideEntry

bool Hub::HideEntry(const string &in, bool)

Hides a map on the hub's list (true) or shows it again. The game shows its entries again when it fills the list with new results, so hide them again then (when Hub::Entries changes). False if that map isn't on the list.

Example
array<string>@ ids = Hub::Entries();
for (uint i = 0; i < ids.length(); i++)
    Hub::HideEntry(ids[i], Workshop::MyMedal(ids[i]) >= 0);     // only maps not finished yet

Thumbnails

array<string>@ Hub::Thumbnails()

The ids of every map whose thumbnail is on screen: the list's (or Subscribed's) entries, or on Home its tiles. A map in several of Home's rows is listed once. Requires host 0.23.0.

Example
array<string>@ ids = Hub::Thumbnails();

SetAuthorButton

void Hub::SetAuthorButton(const string &in label)

A button right after the author's name in the hub's info panel, labelled label; "" removes it. Requires host 0.23.0.

Example
Hub::SetAuthorButton("more by this author");

AuthorButtonClicked

bool Hub::AuthorButtonClicked()

True once after the info panel's author button (Hub::SetAuthorButton) was clicked. Reading it clears it. Requires host 0.23.0.

Example
if (Hub::AuthorButtonClicked())
    ShowMapsBy(Hub::FocusedAuthor());

SetEntryBadge

bool Hub::SetEntryBadge(const string &in id, const string &in text)

A small badge on every on-screen thumbnail of a map: a person icon and text (top left on Home's tiles, at the right end of the list's rows); "" hides it. The game reuses its widgets for other maps, so set badges again whenever Hub::Thumbnails changes (every few tenths of a second is fine). Requires host 0.23.0.

Example
array<string>@ ids = Hub::Thumbnails();
for (uint i = 0; i < ids.length(); i++)
    Hub::SetEntryBadge(ids[i], "" + Workshop::Subscribers(ids[i]));

Focused

string Hub::Focused()

The id of the map the hub's info panel shows; "" for none.

Example
string id = Hub::Focused();

FocusedAuthor

string Hub::FocusedAuthor()

The Steam id of whoever made the map the hub's info panel shows; "" for none.

Example
if (moreButton.Clicked())
    Hub::Search("", "new", 7, Hub::FocusedAuthor());