1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-02-11 10:29:19 +00:00

Mod improvements

This commit is contained in:
tobspr 2022-01-22 10:03:42 +01:00
parent ade7176dba
commit 408d1a7dca
6 changed files with 65 additions and 17 deletions

View File

@ -199,10 +199,6 @@
transform: translateX(50%) rotate(-7deg) scale(1.1); transform: translateX(50%) rotate(-7deg) scale(1.1);
} }
} }
@include DarkThemeOverride {
color: $colorBlueBright;
}
} }
} }
@ -326,6 +322,7 @@
/* @load-async */ /* @load-async */
background-image: uiResource("icons/edit_key.png") !important; background-image: uiResource("icons/edit_key.png") !important;
} }
@include DarkThemeInvert;
} }
} }
@ -354,13 +351,14 @@
box-sizing: border-box; box-sizing: border-box;
@include PlainText; @include PlainText;
@include S(margin-bottom, 5px); @include S(margin-bottom, 5px);
display: grid; display: flex;
grid-template-columns: 1fr auto auto; flex-direction: column;
@include S(grid-gap, 5px);
.author, .author,
.version { .version {
@include SuperSmallText; @include SuperSmallText;
align-self: end;
opacity: 0.4;
} }
.name { .name {
overflow: hidden; overflow: hidden;
@ -457,19 +455,19 @@
.newGameButton { .newGameButton {
@include IncreasedClickArea(0px); @include IncreasedClickArea(0px);
@include S(margin-left, 15px); @include S(margin-left, 10px);
} }
.modsButton { .modsButton {
@include IncreasedClickArea(0px); @include IncreasedClickArea(0px);
@include S(margin-left, 15px); @include S(margin-left, 10px);
@include S(width, 20px); // @include S(width, 20px);
& { // & {
/* @load-async */ // /* @load-async */
background-image: uiResource("res/ui/icons/mods_white.png") !important; // background-image: uiResource("res/ui/icons/mods_white.png") !important;
} // }
background-position: center center; background-position: center center;
background-size: D(15px); background-size: D(15px);
background-color: $modsColor !important; background-color: $modsColor !important;
@ -837,6 +835,23 @@
} }
} }
.modsOverview {
background: $darkModeControlsBackground;
.modsList {
border-color: darken($darkModeControlsBackground, 5);
.mod {
background: darken($darkModeControlsBackground, 5);
color: white;
}
}
.dlcHint {
color: $accentColorBright;
}
}
.footer { .footer {
> a, > a,
.sidelinks > a { .sidelinks > a {

View File

@ -62,6 +62,11 @@
@include S(margin-top, 100px); @include S(margin-top, 100px);
color: lighten($accentColorDark, 15); color: lighten($accentColorDark, 15);
button {
@include S(margin-top, 10px);
@include S(padding, 10px, 20px);
}
&::before { &::before {
@include S(margin-bottom, 15px); @include S(margin-bottom, 15px);
content: ""; content: "";
@ -94,6 +99,10 @@
display: grid; display: grid;
grid-template-columns: 1fr D(100px) D(80px) D(50px); grid-template-columns: 1fr D(100px) D(80px) D(50px);
@include DarkThemeOverride {
background: darken($darkModeControlsBackground, 5);
}
.checkbox { .checkbox {
align-self: center; align-self: center;
justify-self: center; justify-self: center;

View File

@ -28,6 +28,8 @@ export const THIRDPARTY_URLS = {
25: "https://www.youtube.com/watch?v=7OCV1g40Iew&", 25: "https://www.youtube.com/watch?v=7OCV1g40Iew&",
26: "https://www.youtube.com/watch?v=gfm6dS1dCoY", 26: "https://www.youtube.com/watch?v=gfm6dS1dCoY",
}, },
modBrowser: "https://shapez.mod.io/?preview=f55f6304ca4873d9a25f3b575571b948",
}; };
// export const A_B_TESTING_LINK_TYPE = Math.random() > 0.95 ? "steam_1_pr" : "steam_2_npr"; // export const A_B_TESTING_LINK_TYPE = Math.random() > 0.95 ? "steam_1_pr" : "steam_2_npr";

View File

@ -161,7 +161,10 @@ export class MainMenuState extends GameState {
${MODS.mods ${MODS.mods
.map(mod => { .map(mod => {
return ` return `
<div class="mod">${mod.metadata.name} @ v${mod.metadata.version}</div> <div class="mod">
<div class="name">${mod.metadata.name}</div>
<div class="author">by ${mod.metadata.author}</div>
</div>
`; `;
}) })
.join("")} .join("")}
@ -413,7 +416,10 @@ export class MainMenuState extends GameState {
} }
// Mods // Mods
this.trackClicks(makeButton(outerDiv, ["modsButton", "styledButton"], "&nbsp;"), this.onModsClicked); this.trackClicks(
makeButton(outerDiv, ["modsButton", "styledButton"], T.mods.title),
this.onModsClicked
);
buttonContainer.appendChild(outerDiv); buttonContainer.appendChild(outerDiv);
} }

View File

@ -18,6 +18,11 @@ export class ModsState extends TextualGameState {
<h1><button class="backButton"></button> ${this.getStateHeaderTitle()}</h1> <h1><button class="backButton"></button> ${this.getStateHeaderTitle()}</h1>
<div class="actions"> <div class="actions">
${
(G_IS_STANDALONE || G_IS_DEV) && MODS.mods.length > 0
? `<button class="styledButton browseMods">${T.mods.browseMods}</button>`
: ""
}
${ ${
G_IS_STANDALONE || G_IS_DEV G_IS_STANDALONE || G_IS_DEV
? `<button class="styledButton openModsFolder">${T.mods.openFolder}</button>` ? `<button class="styledButton openModsFolder">${T.mods.openFolder}</button>`
@ -53,8 +58,9 @@ export class ModsState extends TextualGameState {
return ` return `
<div class="modsStats noMods"> <div class="modsStats noMods">
${T.mods.modsInfo} ${T.mods.modsInfo}
<button class="styledButton browseMods">${T.mods.browseMods}</button>
</div> </div>
`; `;
@ -100,6 +106,10 @@ export class ModsState extends TextualGameState {
if (openModsFolder) { if (openModsFolder) {
this.trackClicks(openModsFolder, this.openModsFolder); this.trackClicks(openModsFolder, this.openModsFolder);
} }
const browseMods = this.htmlElement.querySelector(".browseMods");
if (browseMods) {
this.trackClicks(browseMods, this.openBrowseMods);
}
const checkboxes = this.htmlElement.querySelectorAll(".checkbox"); const checkboxes = this.htmlElement.querySelectorAll(".checkbox");
Array.from(checkboxes).forEach(checkbox => { Array.from(checkboxes).forEach(checkbox => {
@ -119,6 +129,11 @@ export class ModsState extends TextualGameState {
ipcRenderer.invoke("open-mods-folder"); ipcRenderer.invoke("open-mods-folder");
} }
openBrowseMods() {
this.app.analytics.trackUiClick("mods_sbrowse_link");
this.app.platformWrapper.openExternalLink(THIRDPARTY_URLS.modBrowser);
}
onSteamLinkClicked() { onSteamLinkClicked() {
this.app.analytics.trackUiClick("mods_steam_link"); this.app.analytics.trackUiClick("mods_steam_link");
this.app.platformWrapper.openExternalLink( this.app.platformWrapper.openExternalLink(

View File

@ -1098,6 +1098,7 @@ mods:
version: Version version: Version
openFolder: Open Mods Folder openFolder: Open Mods Folder
folderOnlyStandalone: Opening the mod folder is only possible when running the standalone. folderOnlyStandalone: Opening the mod folder is only possible when running the standalone.
browseMods: Browse Mods
modsInfo: >- modsInfo: >-
To install and manage mods, copy them to the mods folder within the game directory. You can also use the 'Open Mods Folder' button on the top right. To install and manage mods, copy them to the mods folder within the game directory. You can also use the 'Open Mods Folder' button on the top right.