1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-03-02 03:39:21 +00:00

Wegame version & DLC Translation in Chinese

This commit is contained in:
tobspr
2021-05-25 09:19:57 +02:00
parent 65721e0837
commit b3d1204d9c
18 changed files with 332 additions and 222 deletions

View File

@@ -2,6 +2,7 @@ import { TextualGameState } from "../core/textual_game_state";
import { T } from "../translations";
import { THIRDPARTY_URLS } from "../core/config";
import { cachebust } from "../core/cachebust";
import { getLogoSprite } from "../core/background_resources_loader";
export class AboutState extends TextualGameState {
constructor() {
@@ -15,9 +16,7 @@ export class AboutState extends TextualGameState {
getMainContentHTML() {
return `
<div class="head">
<img src="${cachebust(
G_CHINA_VERSION ? "res/logo_cn.png" : "res/logo.png"
)}" alt="shapez.io Logo">
<img src="${cachebust("res/" + getLogoSprite())}" alt="shapez.io Logo">
</div>
<div class="text">
${T.about.body

View File

@@ -1,3 +1,4 @@
import { getLogoSprite } from "../core/background_resources_loader";
import { cachebust } from "../core/cachebust";
import { A_B_TESTING_LINK_TYPE, globalConfig, THIRDPARTY_URLS } from "../core/config";
import { GameState } from "../core/game_state";
@@ -49,7 +50,7 @@ export class MainMenuState extends GameState {
return `
<div class="topButtons">
${
G_CHINA_VERSION
G_CHINA_VERSION || G_WEGAME_VERSION
? ""
: `<button class="languageChoose" data-languageicon="${this.app.settings.getLanguage()}"></button>`
}
@@ -69,10 +70,12 @@ export class MainMenuState extends GameState {
</video>
<div class="logo">
<img src="${cachebust(
G_CHINA_VERSION ? "res/logo_cn.png" : "res/logo.png"
)}" alt="shapez.io Logo">
<span class="updateLabel">v${G_BUILD_VERSION} - Puzzle DLC!</span>
<img src="${cachebust("res/" + getLogoSprite())}" alt="shapez.io Logo">
${
G_WEGAME_VERSION
? ""
: `<span class="updateLabel">v${G_BUILD_VERSION} - Puzzle DLC!</span>`
}
</div>
<div class="mainWrapper ${showDemoBadges ? "demo" : "noDemo"}" data-columns="${
@@ -92,7 +95,7 @@ export class MainMenuState extends GameState {
</div>
${
(G_IS_STANDALONE && puzzleDlc) || G_IS_DEV
!G_WEGAME_VERSION && ((G_IS_STANDALONE && puzzleDlc) || G_IS_DEV)
? `
<div class="puzzleContainer">
<img class="dlcLogo" src="${cachebust(
@@ -104,7 +107,7 @@ export class MainMenuState extends GameState {
}
${
G_IS_STANDALONE && !puzzleDlc
!G_WEGAME_VERSION && G_IS_STANDALONE && !puzzleDlc
? `
<div class="puzzleContainer notOwned">
<img class="dlcLogo" src="${cachebust(
@@ -119,7 +122,11 @@ export class MainMenuState extends GameState {
}
</div>
<div class="footer ${G_CHINA_VERSION ? "china" : ""}">
${
G_WEGAME_VERSION
? "<div class='footer wegame'></div>"
: `
<div class="footer ${G_CHINA_VERSION ? "china" : ""} ">
${
G_CHINA_VERSION
@@ -150,6 +157,8 @@ export class MainMenuState extends GameState {
'<a class="producerLink" target="_blank">Tobias Springer</a>'
)}</div>
</div>
`
}
`;
}
@@ -263,7 +272,7 @@ export class MainMenuState extends GameState {
this.trackClicks(qs(".settingsButton"), this.onSettingsButtonClicked);
if (!G_CHINA_VERSION) {
if (!G_CHINA_VERSION && !G_WEGAME_VERSION) {
this.trackClicks(qs(".languageChoose"), this.onLanguageChooseClicked);
this.trackClicks(qs(".redditLink"), this.onRedditClicked);
this.trackClicks(qs(".changelog"), this.onChangelogClicked);
@@ -283,14 +292,16 @@ export class MainMenuState extends GameState {
}
const discordLink = this.htmlElement.querySelector(".discordLink");
this.trackClicks(
discordLink,
() => {
this.app.analytics.trackUiClick("main_menu_link_discord");
this.app.platformWrapper.openExternalLink(THIRDPARTY_URLS.discord);
},
{ preventClick: true }
);
if (discordLink) {
this.trackClicks(
discordLink,
() => {
this.app.analytics.trackUiClick("main_menu_link_discord");
this.app.platformWrapper.openExternalLink(THIRDPARTY_URLS.discord);
},
{ preventClick: true }
);
}
const githubLink = this.htmlElement.querySelector(".githubLink");
if (githubLink) {
@@ -305,9 +316,15 @@ export class MainMenuState extends GameState {
}
const producerLink = this.htmlElement.querySelector(".producerLink");
this.trackClicks(producerLink, () => this.app.platformWrapper.openExternalLink("https://tobspr.io"), {
preventClick: true,
});
if (producerLink) {
this.trackClicks(
producerLink,
() => this.app.platformWrapper.openExternalLink("https://tobspr.io"),
{
preventClick: true,
}
);
}
const puzzleModeButton = qs(".puzzleDlcPlayButton");
if (puzzleModeButton) {

View File

@@ -1,6 +1,7 @@
import { GameState } from "../core/game_state";
import { cachebust } from "../core/cachebust";
import { THIRDPARTY_URLS } from "../core/config";
import { getLogoSprite } from "../core/background_resources_loader";
export class MobileWarningState extends GameState {
constructor() {
@@ -10,9 +11,7 @@ export class MobileWarningState extends GameState {
getInnerHTML() {
return `
<img class="logo" src="${cachebust(
G_CHINA_VERSION ? "res/logo_cn.png" : "res/logo.png"
)}" alt="shapez.io Logo">
<img class="logo" src="${cachebust("res/" + getLogoSprite())}" alt="shapez.io Logo">
<p>
I'm sorry, but shapez.io is not available on mobile devices yet!

View File

@@ -1,4 +1,5 @@
import { CHANGELOG } from "../changelog";
import { getLogoSprite } from "../core/background_resources_loader";
import { cachebust } from "../core/cachebust";
import { globalConfig } from "../core/config";
import { GameState } from "../core/game_state";
@@ -19,7 +20,7 @@ export class PreloadState extends GameState {
return `
<div class="loadingImage"></div>
<div class="loadingStatus">
<span class="desc">${G_CHINA_VERSION ? "加载中" : "Booting"}</span>
<span class="desc">${G_CHINA_VERSION || G_WEGAME_VERSION ? "加载中" : "Booting"}</span>
</div>
</div>
<span class="prefab_GameHint"></span>
@@ -112,7 +113,7 @@ export class PreloadState extends GameState {
.then(() => this.setStatus("Initializing language"))
.then(() => {
if (G_CHINA_VERSION) {
if (G_CHINA_VERSION || G_WEGAME_VERSION) {
return this.app.settings.updateLanguage("zh-CN");
}
@@ -164,7 +165,7 @@ export class PreloadState extends GameState {
return;
}
if (G_CHINA_VERSION) {
if (G_CHINA_VERSION || G_WEGAME_VERSION) {
return;
}
@@ -227,7 +228,7 @@ export class PreloadState extends GameState {
}
update() {
if (G_CHINA_VERSION) {
if (G_CHINA_VERSION || G_WEGAME_VERSION) {
return;
}
const now = performance.now();
@@ -260,7 +261,7 @@ export class PreloadState extends GameState {
*/
setStatus(text) {
logger.log("✅ " + text);
if (G_CHINA_VERSION) {
if (G_CHINA_VERSION || G_WEGAME_VERSION) {
return Promise.resolve();
}
this.currentStatus = text;
@@ -278,9 +279,7 @@ export class PreloadState extends GameState {
subElement.innerHTML = `
<div class="logo">
<img src="${cachebust(
G_CHINA_VERSION ? "res/logo_cn.png" : "res/logo.png"
)}" alt="Shapez.io Logo">
<img src="${cachebust("res/" + getLogoSprite())}" alt="Shapez.io Logo">
</div>
<div class="failureInner">
<div class="errorHeader">

View File

@@ -30,7 +30,7 @@ export class SettingsState extends TextualGameState {
<div class="other">
${
G_CHINA_VERSION
G_CHINA_VERSION || G_WEGAME_VERSION
? ""
: `
<button class="styledButton about">${T.about.title}</button>
@@ -74,7 +74,7 @@ export class SettingsState extends TextualGameState {
for (let i = 0; i < allApplicationSettings.length; ++i) {
const setting = allApplicationSettings[i];
if (G_CHINA_VERSION && setting.id === "language") {
if ((G_CHINA_VERSION || G_WEGAME_VERSION) && setting.id === "language") {
continue;
}
@@ -105,7 +105,7 @@ export class SettingsState extends TextualGameState {
onEnter(payload) {
this.renderBuildText();
if (!G_CHINA_VERSION) {
if (!G_CHINA_VERSION && !G_WEGAME_VERSION) {
this.trackClicks(this.htmlElement.querySelector(".about"), this.onAboutClicked, {
preventDefault: false,
});
@@ -144,7 +144,7 @@ export class SettingsState extends TextualGameState {
initSettings() {
allApplicationSettings.forEach(setting => {
if (G_CHINA_VERSION && setting.id === "language") {
if ((G_CHINA_VERSION || G_WEGAME_VERSION) && setting.id === "language") {
return;
}