1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-16 03:31:52 +00:00

Integrate mods into gui

This commit is contained in:
Jasper Meggitt 2020-05-31 15:17:15 -07:00
parent 643ebb6067
commit 87139872f7
6 changed files with 28 additions and 0 deletions

View File

@ -207,6 +207,10 @@
@include S(margin-top, 15px); @include S(margin-top, 15px);
} }
.modsButton {
@include S(margin-top, 15px);
}
.savegames { .savegames {
@include S(max-height, 105px); @include S(max-height, 105px);
overflow-y: auto; overflow-y: auto;

View File

@ -3,6 +3,7 @@ const options = queryString.parse(location.search);
export let queryParamOptions = { export let queryParamOptions = {
embedProvider: null, embedProvider: null,
modDeveloper: true,
}; };
if (options.embed) { if (options.embed) {

View File

@ -38,6 +38,10 @@ export class HUDSettingsMenu extends BaseHUDPart {
title: T.ingame.settingsMenu.buttons.settings, title: T.ingame.settingsMenu.buttons.settings,
action: () => this.goToSettings(), action: () => this.goToSettings(),
}, },
{
title: T.ingame.settingsMenu.buttons.mods,
action: () => this.goToMods(),
},
{ {
title: T.ingame.settingsMenu.buttons.menu, title: T.ingame.settingsMenu.buttons.menu,
action: () => this.returnToMenu(), action: () => this.returnToMenu(),
@ -73,6 +77,10 @@ export class HUDSettingsMenu extends BaseHUDPart {
this.root.gameState.goToSettings(); this.root.gameState.goToSettings();
} }
goToMods() {
this.root.gameState.goToMods();
}
shouldPauseGame() { shouldPauseGame() {
return this.visible; return this.visible;
} }

View File

@ -154,6 +154,13 @@ export class InGameState extends GameState {
}); });
} }
/**
* Goes back to the mods state
*/
goToMods() {
this.saveThenGoToState("ModsState");
}
/** /**
* Goes back to the settings state * Goes back to the settings state
*/ */

View File

@ -74,6 +74,7 @@ export class MainMenuState extends GameState {
} }
<button class="playButton styledButton">${T.mainMenu.play}</button> <button class="playButton styledButton">${T.mainMenu.play}</button>
<button class="importButton styledButton">${T.mainMenu.importSavegame}</button> <button class="importButton styledButton">${T.mainMenu.importSavegame}</button>
<button class="modsButton styledButton">${T.mainMenu.mods}</button>
</div> </div>
@ -196,6 +197,7 @@ export class MainMenuState extends GameState {
const qs = this.htmlElement.querySelector.bind(this.htmlElement); const qs = this.htmlElement.querySelector.bind(this.htmlElement);
this.trackClicks(qs(".mainContainer .playButton"), this.onPlayButtonClicked); this.trackClicks(qs(".mainContainer .playButton"), this.onPlayButtonClicked);
this.trackClicks(qs(".mainContainer .importButton"), this.requestImportSavegame); this.trackClicks(qs(".mainContainer .importButton"), this.requestImportSavegame);
this.trackClicks(qs(".mainContainer .modsButton"), this.onModsButtonClicked);
if (G_IS_DEV && globalConfig.debug.fastGameEnter) { if (G_IS_DEV && globalConfig.debug.fastGameEnter) {
const games = this.app.savegameMgr.getSavegamesMetaData(); const games = this.app.savegameMgr.getSavegamesMetaData();
@ -375,6 +377,10 @@ export class MainMenuState extends GameState {
this.moveToState("SettingsState"); this.moveToState("SettingsState");
} }
onModsButtonClicked() {
this.moveToState("ModsState");
}
doStartNewGame() { doStartNewGame() {
this.app.analytics.trackUiClick("startgame"); this.app.analytics.trackUiClick("startgame");

View File

@ -114,6 +114,7 @@ mainMenu:
play: Play play: Play
changelog: Changelog changelog: Changelog
importSavegame: Import importSavegame: Import
mods: Mods
openSourceHint: This game is open source! openSourceHint: This game is open source!
discordLink: Official Discord Server discordLink: Official Discord Server
@ -337,6 +338,7 @@ ingame:
buttons: buttons:
continue: Continue continue: Continue
settings: Settings settings: Settings
mods: Mods
menu: Return to menu menu: Return to menu
# Bottom left tutorial hints # Bottom left tutorial hints