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:
@@ -12,8 +12,13 @@ import { cachebust } from "./cachebust";
|
||||
|
||||
const logger = createLogger("background_loader");
|
||||
|
||||
export function getLogoSprite() {
|
||||
// @todo: ugh, in a hurry
|
||||
return G_WEGAME_VERSION ? "logo_wegame.png" : G_CHINA_VERSION ? "logo_cn.png" : "logo.png";
|
||||
}
|
||||
|
||||
const essentialMainMenuSprites = [
|
||||
G_CHINA_VERSION ? "logo_cn.png" : "logo.png",
|
||||
getLogoSprite(),
|
||||
...G_ALL_UI_IMAGES.filter(src => src.startsWith("ui/") && src.indexOf(".gif") < 0),
|
||||
];
|
||||
const essentialMainMenuSounds = [
|
||||
|
||||
@@ -66,6 +66,8 @@ const preparementShape = "CpRpCp--:SwSwSwSw";
|
||||
// Tiers need % of the previous tier as requirement too
|
||||
const tierGrowth = 2.5;
|
||||
|
||||
const chinaShapes = G_WEGAME_VERSION || G_CHINA_VERSION;
|
||||
|
||||
/**
|
||||
* Generates all upgrades
|
||||
* @returns {Object<string, UpgradeTiers>} */
|
||||
@@ -144,7 +146,7 @@ function generateUpgrades(limitedVersion = false) {
|
||||
{
|
||||
required: [
|
||||
{
|
||||
shape: G_CHINA_VERSION
|
||||
shape: chinaShapes
|
||||
? "CyCyCyCy:CyCyCyCy:RyRyRyRy:RuRuRuRu"
|
||||
: "CbRbRbCb:CwCwCwCw:WbWbWbWb",
|
||||
amount: 50000,
|
||||
@@ -205,7 +207,7 @@ function generateUpgrades(limitedVersion = false) {
|
||||
{
|
||||
required: [
|
||||
{
|
||||
shape: G_CHINA_VERSION ? "CuCuCuCu:CwCwCwCw:Sb--Sr--" : "RpRpRpRp:CwCwCwCw",
|
||||
shape: chinaShapes ? "CuCuCuCu:CwCwCwCw:Sb--Sr--" : "RpRpRpRp:CwCwCwCw",
|
||||
amount: 6500,
|
||||
},
|
||||
],
|
||||
@@ -382,7 +384,7 @@ export function generateLevelDefinitions(limitedVersion = false) {
|
||||
// 13
|
||||
// Tunnel Tier 2
|
||||
{
|
||||
shape: G_CHINA_VERSION ? "CuCuCuCu:CwCwCwCw:Sb--Sr--" : "RpRpRpRp:CwCwCwCw", // painting t3
|
||||
shape: chinaShapes ? "CuCuCuCu:CwCwCwCw:Sb--Sr--" : "RpRpRpRp:CwCwCwCw", // painting t3
|
||||
required: 3800,
|
||||
reward: enumHubGoalRewards.reward_underground_belt_tier_2,
|
||||
},
|
||||
@@ -391,7 +393,7 @@ export function generateLevelDefinitions(limitedVersion = false) {
|
||||
...(limitedVersion
|
||||
? [
|
||||
{
|
||||
shape: G_CHINA_VERSION ? "CuCuCuCu:CwCwCwCw:Sb--Sr--" : "RpRpRpRp:CwCwCwCw",
|
||||
shape: chinaShapes ? "CuCuCuCu:CwCwCwCw:Sb--Sr--" : "RpRpRpRp:CwCwCwCw",
|
||||
required: 0,
|
||||
reward: enumHubGoalRewards.reward_demo_end,
|
||||
},
|
||||
@@ -425,7 +427,7 @@ export function generateLevelDefinitions(limitedVersion = false) {
|
||||
// 17
|
||||
// Double painter
|
||||
{
|
||||
shape: G_CHINA_VERSION
|
||||
shape: chinaShapes
|
||||
? "CyCyCyCy:CyCyCyCy:RyRyRyRy:RuRuRuRu"
|
||||
: "CbRbRbCb:CwCwCwCw:WbWbWbWb", // miner t4 (two variants)
|
||||
required: 20000,
|
||||
@@ -467,7 +469,7 @@ export function generateLevelDefinitions(limitedVersion = false) {
|
||||
// 22
|
||||
// Constant signal
|
||||
{
|
||||
shape: G_CHINA_VERSION
|
||||
shape: chinaShapes
|
||||
? "RrSySrSy:RyCrCwCr:CyCyRyCy"
|
||||
: "Cg----Cr:Cw----Cw:Sy------:Cy----Cy",
|
||||
required: 25000,
|
||||
@@ -477,7 +479,7 @@ export function generateLevelDefinitions(limitedVersion = false) {
|
||||
// 23
|
||||
// Display
|
||||
{
|
||||
shape: G_CHINA_VERSION
|
||||
shape: chinaShapes
|
||||
? "CrCrCrCr:CwCwCwCw:WwWwWwWw:CrCrCrCr"
|
||||
: "CcSyCcSy:SyCcSyCc:CcSyCcSy",
|
||||
required: 25000,
|
||||
@@ -486,7 +488,7 @@ export function generateLevelDefinitions(limitedVersion = false) {
|
||||
|
||||
// 24 Logic gates
|
||||
{
|
||||
shape: G_CHINA_VERSION
|
||||
shape: chinaShapes
|
||||
? "Su----Su:RwRwRwRw:Cu----Cu:CwCwCwCw"
|
||||
: "CcRcCcRc:RwCwRwCw:Sr--Sw--:CyCyCyCy",
|
||||
required: 25000,
|
||||
|
||||
1
src/js/globals.d.ts
vendored
1
src/js/globals.d.ts
vendored
@@ -20,6 +20,7 @@ declare const G_ALL_UI_IMAGES: Array<string>;
|
||||
declare const G_IS_RELEASE: boolean;
|
||||
|
||||
declare const G_CHINA_VERSION: boolean;
|
||||
declare const G_WEGAME_VERSION: boolean;
|
||||
|
||||
// Polyfills
|
||||
declare interface String {
|
||||
|
||||
@@ -101,7 +101,10 @@ export class ClientAPI {
|
||||
*/
|
||||
apiTryLogin() {
|
||||
if (!G_IS_STANDALONE) {
|
||||
return Promise.reject("Not possible outside of standalone.");
|
||||
const token = window.prompt(
|
||||
"Please enter the auth token for the puzzle DLC (If you have none, you can't login):"
|
||||
);
|
||||
return Promise.resolve({ token });
|
||||
}
|
||||
|
||||
const renderer = getIPCRenderer();
|
||||
|
||||
@@ -53,6 +53,10 @@ export class ShapezGameAnalytics extends GameAnalyticsInterface {
|
||||
initialize() {
|
||||
this.syncKey = null;
|
||||
|
||||
if (G_WEGAME_VERSION) {
|
||||
return;
|
||||
}
|
||||
|
||||
setInterval(() => this.sendTimePoints(), 60 * 1000);
|
||||
|
||||
// Retrieve sync key from player
|
||||
@@ -136,6 +140,10 @@ export class ShapezGameAnalytics extends GameAnalyticsInterface {
|
||||
* @param {string} value
|
||||
*/
|
||||
sendGameEvent(category, value) {
|
||||
if (G_WEGAME_VERSION) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.syncKey) {
|
||||
logger.warn("Can not send event due to missing sync key");
|
||||
return;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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!
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user