Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display sync track button on official map leaderboards #177

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions scripts/pages/leaderboards/leaderboards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ class LeaderboardsHandler {

this.panels.tracksDropdown.RemoveAllOptions();
this.panels.tracksDropdown.visible = false;

this.panels.endOfRunButton.visible = false;
this.panels.syncTrackButton.visible = false;
}

onTimesUpdated(count: number) {
Expand Down Expand Up @@ -201,18 +204,13 @@ class LeaderboardsHandler {
* Hide the button to go to the end of run page.
*/
onMapLoad(isOfficial: boolean) {
this.panels.endOfRunButton.visible = false;
this.panels.syncTrackButton.visible = false;

if (isOfficial) {
return; // Load official leaderboard tracks instead
}

// Try to load tracks from local zones
const mapZoneData = MomentumTimerAPI.GetActiveZoneDefs();
if (mapZoneData) {
this.panels.syncTrackButton.visible = true;

// Main track
{
const trackStr = $.Localize('#Leaderboards_Tracks_Main');
Expand Down Expand Up @@ -299,6 +297,11 @@ class LeaderboardsHandler {
return;
}

// Allow player to sync their current track to the value selected in the dropdown
if (this.panels.cp.id === 'TabMenuLeaderboards') {
this.panels.syncTrackButton.visible = true;
}

this.panels.tracksDropdown.visible = true;
this.panels.tracksDropdown.SetSelectedIndex(0);
this.panels.tracksDropdown.SetPanelEvent('onuserinputsubmit', () => {
Expand Down
Loading