mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Minor refactorings
This commit is contained in:
parent
e9e88241b4
commit
f9fa3cd6a7
@ -1,3 +1,7 @@
|
|||||||
|
/* typehints:start */
|
||||||
|
import { Application } from "../application";
|
||||||
|
/* typehints:end */
|
||||||
|
|
||||||
export const IS_DEBUG =
|
export const IS_DEBUG =
|
||||||
G_IS_DEV &&
|
G_IS_DEV &&
|
||||||
typeof window !== "undefined" &&
|
typeof window !== "undefined" &&
|
||||||
@ -17,7 +21,7 @@ export const THIRDPARTY_URLS = {
|
|||||||
|
|
||||||
privacyPolicy: "https://tobspr.io/privacy.html",
|
privacyPolicy: "https://tobspr.io/privacy.html",
|
||||||
|
|
||||||
stanaloneCampaignLink: "https://get.shapez.io",
|
standaloneCampaignLink: "https://get.shapez.io/$campaign",
|
||||||
puzzleDlcStorePage: "https://store.steampowered.com/app/1625400/shapezio__Puzzle_DLC",
|
puzzleDlcStorePage: "https://store.steampowered.com/app/1625400/shapezio__Puzzle_DLC",
|
||||||
|
|
||||||
levelTutorialVideos: {
|
levelTutorialVideos: {
|
||||||
@ -29,6 +33,18 @@ export const THIRDPARTY_URLS = {
|
|||||||
modBrowser: "https://shapez.mod.io/?preview=f55f6304ca4873d9a25f3b575571b948",
|
modBrowser: "https://shapez.mod.io/?preview=f55f6304ca4873d9a25f3b575571b948",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {Application} app
|
||||||
|
* @param {string} campaign
|
||||||
|
*/
|
||||||
|
export function openStandaloneLink(app, campaign) {
|
||||||
|
const discount = globalConfig.currentDiscount > 0 ? "_discount" + globalConfig.currentDiscount : "";
|
||||||
|
const steamSuffix = G_IS_STEAM_DEMO ? "_steamdemo" : "";
|
||||||
|
app.platformWrapper.openExternalLink(
|
||||||
|
THIRDPARTY_URLS.standaloneCampaignLink.replace("$campaign", campaign + discount + steamSuffix)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
export const globalConfig = {
|
export const globalConfig = {
|
||||||
// Size of a single tile in Pixels.
|
// Size of a single tile in Pixels.
|
||||||
// NOTICE: Update webpack.production.config too!
|
// NOTICE: Update webpack.production.config too!
|
||||||
|
@ -8,7 +8,7 @@ import { BaseHUDPart } from "../base_hud_part";
|
|||||||
import { Dialog, DialogLoading, DialogOptionChooser } from "../../../core/modal_dialog_elements";
|
import { Dialog, DialogLoading, DialogOptionChooser } from "../../../core/modal_dialog_elements";
|
||||||
import { makeDiv } from "../../../core/utils";
|
import { makeDiv } from "../../../core/utils";
|
||||||
import { T } from "../../../translations";
|
import { T } from "../../../translations";
|
||||||
import { THIRDPARTY_URLS } from "../../../core/config";
|
import { openStandaloneLink } from "../../../core/config";
|
||||||
|
|
||||||
export class HUDModalDialogs extends BaseHUDPart {
|
export class HUDModalDialogs extends BaseHUDPart {
|
||||||
constructor(root, app) {
|
constructor(root, app) {
|
||||||
@ -117,19 +117,8 @@ export class HUDModalDialogs extends BaseHUDPart {
|
|||||||
this.app.sound.playUiSound(SOUNDS.dialogOk);
|
this.app.sound.playUiSound(SOUNDS.dialogOk);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.app.analytics.trackUiClick("demo_dialog_show");
|
|
||||||
|
|
||||||
dialog.buttonSignals.cancel.add(() => {
|
|
||||||
this.app.analytics.trackUiClick("demo_dialog_cancel");
|
|
||||||
});
|
|
||||||
|
|
||||||
dialog.buttonSignals.getStandalone.add(() => {
|
dialog.buttonSignals.getStandalone.add(() => {
|
||||||
this.app.analytics.trackUiClick("demo_dialog_click");
|
openStandaloneLink(this.app, "shapez_demo_dialog");
|
||||||
window.open(
|
|
||||||
THIRDPARTY_URLS.stanaloneCampaignLink +
|
|
||||||
"/shapez_demo_dialog" +
|
|
||||||
(G_IS_STEAM_DEMO ? "_steamdemo" : "")
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
return dialog.buttonSignals;
|
return dialog.buttonSignals;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { globalConfig, THIRDPARTY_URLS } from "../../../core/config";
|
import { globalConfig, openStandaloneLink } from "../../../core/config";
|
||||||
import { InputReceiver } from "../../../core/input_receiver";
|
import { InputReceiver } from "../../../core/input_receiver";
|
||||||
import { makeDiv } from "../../../core/utils";
|
import { makeDiv } from "../../../core/utils";
|
||||||
import { T } from "../../../translations";
|
import { T } from "../../../translations";
|
||||||
@ -45,20 +45,10 @@ export class HUDStandaloneAdvantages extends BaseHUDPart {
|
|||||||
);
|
);
|
||||||
|
|
||||||
this.trackClicks(this.contentDiv.querySelector("button.steamLinkButton"), () => {
|
this.trackClicks(this.contentDiv.querySelector("button.steamLinkButton"), () => {
|
||||||
const discount =
|
openStandaloneLink(this.root.app, "shapez_std_advg");
|
||||||
globalConfig.currentDiscount > 0 ? "_discount" + globalConfig.currentDiscount : "";
|
|
||||||
|
|
||||||
this.root.app.analytics.trackUiClick("standalone_advantage_visit_steam");
|
|
||||||
this.root.app.platformWrapper.openExternalLink(
|
|
||||||
THIRDPARTY_URLS.stanaloneCampaignLink +
|
|
||||||
"/shapez_std_advg" +
|
|
||||||
discount +
|
|
||||||
(G_IS_STEAM_DEMO ? "_steamdemo" : "")
|
|
||||||
);
|
|
||||||
this.close();
|
this.close();
|
||||||
});
|
});
|
||||||
this.trackClicks(this.contentDiv.querySelector("button.otherCloseButton"), () => {
|
this.trackClicks(this.contentDiv.querySelector("button.otherCloseButton"), () => {
|
||||||
this.root.app.analytics.trackUiClick("standalone_advantage_no_thanks");
|
|
||||||
this.close();
|
this.close();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { globalConfig, THIRDPARTY_URLS } from "../../../core/config";
|
import { openStandaloneLink } from "../../../core/config";
|
||||||
import { makeDiv } from "../../../core/utils";
|
import { makeDiv } from "../../../core/utils";
|
||||||
import { BaseHUDPart } from "../base_hud_part";
|
import { BaseHUDPart } from "../base_hud_part";
|
||||||
import { DynamicDomAttach } from "../dynamic_dom_attach";
|
import { DynamicDomAttach } from "../dynamic_dom_attach";
|
||||||
@ -11,17 +11,10 @@ export class HUDSteamCapsule extends BaseHUDPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
initialize() {
|
initialize() {
|
||||||
const discount = globalConfig.currentDiscount > 0 ? "_discount" + globalConfig.currentDiscount : "";
|
|
||||||
|
|
||||||
this.domAttach = new DynamicDomAttach(this.root, this.element);
|
this.domAttach = new DynamicDomAttach(this.root, this.element);
|
||||||
|
|
||||||
this.trackClicks(this.element, () => {
|
this.trackClicks(this.element, () => {
|
||||||
this.root.app.platformWrapper.openExternalLink(
|
openStandaloneLink(this.root.app, "shapez_steamcapsule");
|
||||||
THIRDPARTY_URLS.stanaloneCampaignLink +
|
|
||||||
"/shapez_steamcapsule" +
|
|
||||||
discount +
|
|
||||||
(G_IS_STEAM_DEMO ? "_steamdemo" : "")
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,8 +76,6 @@ export class HUDPartTutorialHints extends BaseHUDPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
show() {
|
show() {
|
||||||
this.root.app.analytics.trackUiClick("tutorial_hint_show");
|
|
||||||
this.root.app.analytics.trackUiClick("tutorial_hint_show_lvl_" + this.root.hubGoals.level);
|
|
||||||
this.element.classList.add("enlarged", "noBlur");
|
this.element.classList.add("enlarged", "noBlur");
|
||||||
this.enlarged = true;
|
this.enlarged = true;
|
||||||
this.root.app.inputMgr.makeSureAttachedAndOnTop(this.inputReciever);
|
this.root.app.inputMgr.makeSureAttachedAndOnTop(this.inputReciever);
|
||||||
|
@ -23,10 +23,8 @@ export class HUDTutorialVideoOffer extends BaseHUDPart {
|
|||||||
"ok:good",
|
"ok:good",
|
||||||
]);
|
]);
|
||||||
|
|
||||||
this.root.app.analytics.trackUiClick("ingame_video_link_show_" + level);
|
|
||||||
ok.add(() => {
|
ok.add(() => {
|
||||||
this.root.app.platformWrapper.openExternalLink(tutorialVideoLink);
|
this.root.app.platformWrapper.openExternalLink(tutorialVideoLink);
|
||||||
this.root.app.analytics.trackUiClick("ingame_video_link_open_" + level);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { globalConfig, THIRDPARTY_URLS } from "../../../core/config";
|
import { globalConfig, openStandaloneLink } from "../../../core/config";
|
||||||
import { makeDiv } from "../../../core/utils";
|
import { makeDiv } from "../../../core/utils";
|
||||||
import { T } from "../../../translations";
|
import { T } from "../../../translations";
|
||||||
import { BaseHUDPart } from "../base_hud_part";
|
import { BaseHUDPart } from "../base_hud_part";
|
||||||
@ -34,16 +34,7 @@ export class HUDWatermark extends BaseHUDPart {
|
|||||||
: "")
|
: "")
|
||||||
);
|
);
|
||||||
this.trackClicks(this.linkElement, () => {
|
this.trackClicks(this.linkElement, () => {
|
||||||
this.root.app.analytics.trackUiClick("watermark_click_2_direct");
|
openStandaloneLink(this.root.app, "shapez_watermark");
|
||||||
const discount =
|
|
||||||
globalConfig.currentDiscount > 0 ? "_discount" + globalConfig.currentDiscount : "";
|
|
||||||
|
|
||||||
this.root.app.platformWrapper.openExternalLink(
|
|
||||||
THIRDPARTY_URLS.stanaloneCampaignLink +
|
|
||||||
"/shapez_watermark" +
|
|
||||||
discount +
|
|
||||||
(G_IS_STEAM_DEMO ? "_steamdemo" : "")
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,12 +24,6 @@ export class AnalyticsInterface {
|
|||||||
*/
|
*/
|
||||||
setUserContext(userName) {}
|
setUserContext(userName) {}
|
||||||
|
|
||||||
/**
|
|
||||||
* Tracks a click no an ui element
|
|
||||||
* @param {string} elementName
|
|
||||||
*/
|
|
||||||
trackUiClick(elementName) {}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tracks when a new state is entered
|
* Tracks when a new state is entered
|
||||||
* @param {string} stateId
|
* @param {string} stateId
|
||||||
|
@ -19,7 +19,7 @@ const analyticsUrl = G_IS_DEV ? "http://localhost:8001" : "https://analytics.sha
|
|||||||
const analyticsLocalFile = G_IS_STEAM_DEMO ? "shapez_token_steamdemo.bin" : "shapez_token_123.bin";
|
const analyticsLocalFile = G_IS_STEAM_DEMO ? "shapez_token_steamdemo.bin" : "shapez_token_123.bin";
|
||||||
|
|
||||||
const CURRENT_ABT = "abt_spl";
|
const CURRENT_ABT = "abt_spl";
|
||||||
const CURRENT_ABT_COUNT = 2;
|
const CURRENT_ABT_COUNT = G_IS_STEAM_DEMO ? 3 : 2;
|
||||||
|
|
||||||
export class ShapezGameAnalytics extends GameAnalyticsInterface {
|
export class ShapezGameAnalytics extends GameAnalyticsInterface {
|
||||||
constructor(app) {
|
constructor(app) {
|
||||||
@ -79,7 +79,9 @@ export class ShapezGameAnalytics extends GameAnalyticsInterface {
|
|||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
if (this.abtVariant === "1") {
|
if (this.abtVariant === "1") {
|
||||||
THIRDPARTY_URLS.stanaloneCampaignLink = "https://get.shapez.io/bundle";
|
THIRDPARTY_URLS.standaloneCampaignLink = "https://get.shapez.io/bundle/$campaign";
|
||||||
|
} else if (this.abtVariant === "2") {
|
||||||
|
THIRDPARTY_URLS.standaloneCampaignLink = "steam://advertise/1318690";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -64,23 +64,6 @@ export class GoogleAnalyticsImpl extends AnalyticsInterface {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
trackUiClick(elementName) {
|
|
||||||
const stateKey = this.app.stateMgr.getCurrentState().key;
|
|
||||||
const fullSelector = stateKey + ">" + elementName;
|
|
||||||
|
|
||||||
try {
|
|
||||||
if (window.gtag) {
|
|
||||||
logger.log("📊 Tracking click on:", fullSelector);
|
|
||||||
window.gtag("event", "click", {
|
|
||||||
event_category: "ui",
|
|
||||||
event_label: fullSelector,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} catch (ex) {
|
|
||||||
logger.warn("📊 Failed to track ui click:", ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tracks an event so GA keeps track of the user
|
* Tracks an event so GA keeps track of the user
|
||||||
*/
|
*/
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { getLogoSprite } from "../core/background_resources_loader";
|
import { getLogoSprite } from "../core/background_resources_loader";
|
||||||
import { cachebust } from "../core/cachebust";
|
import { cachebust } from "../core/cachebust";
|
||||||
import { globalConfig, THIRDPARTY_URLS } from "../core/config";
|
import { globalConfig, openStandaloneLink, THIRDPARTY_URLS } from "../core/config";
|
||||||
import { GameState } from "../core/game_state";
|
import { GameState } from "../core/game_state";
|
||||||
import { DialogWithForm } from "../core/modal_dialog_elements";
|
import { DialogWithForm } from "../core/modal_dialog_elements";
|
||||||
import { FormElementInput } from "../core/modal_dialog_forms";
|
import { FormElementInput } from "../core/modal_dialog_forms";
|
||||||
@ -247,7 +247,6 @@ export class MainMenuState extends GameState {
|
|||||||
this.app.savegameMgr.getSavegamesMetaData().length > 0 &&
|
this.app.savegameMgr.getSavegamesMetaData().length > 0 &&
|
||||||
!this.app.restrictionMgr.getHasUnlimitedSavegames()
|
!this.app.restrictionMgr.getHasUnlimitedSavegames()
|
||||||
) {
|
) {
|
||||||
this.app.analytics.trackUiClick("importgame_slot_limit_show");
|
|
||||||
this.showSavegameSlotLimit();
|
this.showSavegameSlotLimit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -257,7 +256,6 @@ export class MainMenuState extends GameState {
|
|||||||
if (file) {
|
if (file) {
|
||||||
const closeLoader = this.dialogs.showLoadingDialog();
|
const closeLoader = this.dialogs.showLoadingDialog();
|
||||||
waitNextFrame().then(() => {
|
waitNextFrame().then(() => {
|
||||||
this.app.analytics.trackUiClick("import_savegame");
|
|
||||||
const reader = new FileReader();
|
const reader = new FileReader();
|
||||||
reader.addEventListener("load", event => {
|
reader.addEventListener("load", event => {
|
||||||
const contents = event.target.result;
|
const contents = event.target.result;
|
||||||
@ -354,11 +352,9 @@ export class MainMenuState extends GameState {
|
|||||||
".exitAppButton": this.onExitAppButtonClicked,
|
".exitAppButton": this.onExitAppButtonClicked,
|
||||||
".steamLink": this.onSteamLinkClicked,
|
".steamLink": this.onSteamLinkClicked,
|
||||||
".discordLink": () => {
|
".discordLink": () => {
|
||||||
this.app.analytics.trackUiClick("main_menu_link_discord");
|
|
||||||
this.app.platformWrapper.openExternalLink(THIRDPARTY_URLS.discord);
|
this.app.platformWrapper.openExternalLink(THIRDPARTY_URLS.discord);
|
||||||
},
|
},
|
||||||
".githubLink": () => {
|
".githubLink": () => {
|
||||||
this.app.analytics.trackUiClick("main_menu_link_github");
|
|
||||||
this.app.platformWrapper.openExternalLink(THIRDPARTY_URLS.github);
|
this.app.platformWrapper.openExternalLink(THIRDPARTY_URLS.github);
|
||||||
},
|
},
|
||||||
".producerLink": () => this.app.platformWrapper.openExternalLink("https://tobspr.io"),
|
".producerLink": () => this.app.platformWrapper.openExternalLink("https://tobspr.io"),
|
||||||
@ -449,14 +445,9 @@ export class MainMenuState extends GameState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onSteamLinkClicked() {
|
onSteamLinkClicked() {
|
||||||
this.app.analytics.trackUiClick("main_menu_steam_link");
|
|
||||||
const discount = globalConfig.currentDiscount > 0 ? "_discount" + globalConfig.currentDiscount : "";
|
const discount = globalConfig.currentDiscount > 0 ? "_discount" + globalConfig.currentDiscount : "";
|
||||||
this.app.platformWrapper.openExternalLink(
|
|
||||||
THIRDPARTY_URLS.stanaloneCampaignLink +
|
openStandaloneLink(this.app, "shapez_mainmenu");
|
||||||
"/shapez_mainmenu" +
|
|
||||||
discount +
|
|
||||||
(G_IS_STEAM_DEMO ? "_steamdemo" : "")
|
|
||||||
);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -470,12 +461,10 @@ export class MainMenuState extends GameState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onRedditClicked() {
|
onRedditClicked() {
|
||||||
this.app.analytics.trackUiClick("main_menu_reddit_link");
|
|
||||||
this.app.platformWrapper.openExternalLink(THIRDPARTY_URLS.reddit);
|
this.app.platformWrapper.openExternalLink(THIRDPARTY_URLS.reddit);
|
||||||
}
|
}
|
||||||
|
|
||||||
onLanguageChooseClicked() {
|
onLanguageChooseClicked() {
|
||||||
this.app.analytics.trackUiClick("choose_language");
|
|
||||||
const setting = /** @type {EnumSetting} */ (this.app.settings.getSettingHandleById("language"));
|
const setting = /** @type {EnumSetting} */ (this.app.settings.getSettingHandleById("language"));
|
||||||
|
|
||||||
const { optionSelected } = this.dialogs.showOptionChooser(T.settings.labels.language.title, {
|
const { optionSelected } = this.dialogs.showOptionChooser(T.settings.labels.language.title, {
|
||||||
@ -611,10 +600,7 @@ export class MainMenuState extends GameState {
|
|||||||
* @param {SavegameMetadata} game
|
* @param {SavegameMetadata} game
|
||||||
*/
|
*/
|
||||||
resumeGame(game) {
|
resumeGame(game) {
|
||||||
this.app.analytics.trackUiClick("resume_game");
|
|
||||||
|
|
||||||
this.app.adProvider.showVideoAd().then(() => {
|
this.app.adProvider.showVideoAd().then(() => {
|
||||||
this.app.analytics.trackUiClick("resume_game_adcomplete");
|
|
||||||
const savegame = this.app.savegameMgr.getSavegameById(game.internalId);
|
const savegame = this.app.savegameMgr.getSavegameById(game.internalId);
|
||||||
savegame
|
savegame
|
||||||
.readAsync()
|
.readAsync()
|
||||||
@ -689,8 +675,6 @@ export class MainMenuState extends GameState {
|
|||||||
* @param {SavegameMetadata} game
|
* @param {SavegameMetadata} game
|
||||||
*/
|
*/
|
||||||
deleteGame(game) {
|
deleteGame(game) {
|
||||||
this.app.analytics.trackUiClick("delete_game");
|
|
||||||
|
|
||||||
const signals = this.dialogs.showWarning(
|
const signals = this.dialogs.showWarning(
|
||||||
T.dialogs.confirmSavegameDelete.title,
|
T.dialogs.confirmSavegameDelete.title,
|
||||||
T.dialogs.confirmSavegameDelete.text
|
T.dialogs.confirmSavegameDelete.text
|
||||||
@ -719,8 +703,6 @@ export class MainMenuState extends GameState {
|
|||||||
* @param {SavegameMetadata} game
|
* @param {SavegameMetadata} game
|
||||||
*/
|
*/
|
||||||
downloadGame(game) {
|
downloadGame(game) {
|
||||||
this.app.analytics.trackUiClick("download_game");
|
|
||||||
|
|
||||||
const savegame = this.app.savegameMgr.getSavegameById(game.internalId);
|
const savegame = this.app.savegameMgr.getSavegameById(game.internalId);
|
||||||
savegame.readAsync().then(() => {
|
savegame.readAsync().then(() => {
|
||||||
const data = ReadWriteProxy.serializeObject(savegame.currentData);
|
const data = ReadWriteProxy.serializeObject(savegame.currentData);
|
||||||
@ -739,12 +721,7 @@ export class MainMenuState extends GameState {
|
|||||||
["cancel:bad", "getStandalone:good"]
|
["cancel:bad", "getStandalone:good"]
|
||||||
);
|
);
|
||||||
getStandalone.add(() => {
|
getStandalone.add(() => {
|
||||||
this.app.analytics.trackUiClick("visit_steampage_from_slot_limit");
|
openStandaloneLink(this.app, "shapez_slotlimit");
|
||||||
this.app.platformWrapper.openExternalLink(
|
|
||||||
THIRDPARTY_URLS.stanaloneCampaignLink +
|
|
||||||
"/shapez_slotlimit" +
|
|
||||||
(G_IS_STEAM_DEMO ? "_steamdemo" : "")
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -753,7 +730,6 @@ export class MainMenuState extends GameState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onTranslationHelpLinkClicked() {
|
onTranslationHelpLinkClicked() {
|
||||||
this.app.analytics.trackUiClick("translation_help_link");
|
|
||||||
this.app.platformWrapper.openExternalLink(
|
this.app.platformWrapper.openExternalLink(
|
||||||
"https://github.com/tobspr/shapez.io/blob/master/translations"
|
"https://github.com/tobspr/shapez.io/blob/master/translations"
|
||||||
);
|
);
|
||||||
@ -764,19 +740,16 @@ export class MainMenuState extends GameState {
|
|||||||
this.app.savegameMgr.getSavegamesMetaData().length > 0 &&
|
this.app.savegameMgr.getSavegamesMetaData().length > 0 &&
|
||||||
!this.app.restrictionMgr.getHasUnlimitedSavegames()
|
!this.app.restrictionMgr.getHasUnlimitedSavegames()
|
||||||
) {
|
) {
|
||||||
this.app.analytics.trackUiClick("startgame_slot_limit_show");
|
|
||||||
this.showSavegameSlotLimit();
|
this.showSavegameSlotLimit();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.app.analytics.trackUiClick("startgame");
|
|
||||||
this.app.adProvider.showVideoAd().then(() => {
|
this.app.adProvider.showVideoAd().then(() => {
|
||||||
const savegame = this.app.savegameMgr.createNewSavegame();
|
const savegame = this.app.savegameMgr.createNewSavegame();
|
||||||
|
|
||||||
this.moveToState("InGameState", {
|
this.moveToState("InGameState", {
|
||||||
savegame,
|
savegame,
|
||||||
});
|
});
|
||||||
this.app.analytics.trackUiClick("startgame_adcomplete");
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,9 +21,7 @@ export class MobileWarningState extends GameState {
|
|||||||
<p>If you want to play on your computer, you can also get the game on Steam:</p>
|
<p>If you want to play on your computer, you can also get the game on Steam:</p>
|
||||||
|
|
||||||
|
|
||||||
<a href="${
|
<a href="https://get.shapez.io/shapez_mobile" class="standaloneLink" target="_blank">Play on Steam!</a>
|
||||||
THIRDPARTY_URLS.stanaloneCampaignLink + "/shapez_mobile"
|
|
||||||
}" class="standaloneLink" target="_blank">Get on Steam!</a>
|
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { THIRDPARTY_URLS } from "../core/config";
|
import { openStandaloneLink, THIRDPARTY_URLS } from "../core/config";
|
||||||
import { TextualGameState } from "../core/textual_game_state";
|
import { TextualGameState } from "../core/textual_game_state";
|
||||||
import { MODS } from "../mods/modloader";
|
import { MODS } from "../mods/modloader";
|
||||||
import { T } from "../translations";
|
import { T } from "../translations";
|
||||||
@ -132,18 +132,11 @@ export class ModsState extends TextualGameState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
openBrowseMods() {
|
openBrowseMods() {
|
||||||
this.app.analytics.trackUiClick("mods_sbrowse_link");
|
|
||||||
this.app.platformWrapper.openExternalLink(THIRDPARTY_URLS.modBrowser);
|
this.app.platformWrapper.openExternalLink(THIRDPARTY_URLS.modBrowser);
|
||||||
}
|
}
|
||||||
|
|
||||||
onSteamLinkClicked() {
|
onSteamLinkClicked() {
|
||||||
this.app.analytics.trackUiClick("mods_steam_link");
|
openStandaloneLink(this.app, "shapez_modsettings");
|
||||||
this.app.platformWrapper.openExternalLink(
|
|
||||||
THIRDPARTY_URLS.stanaloneCampaignLink +
|
|
||||||
"/shapez_modsettings" +
|
|
||||||
(G_IS_STEAM_DEMO ? "_steamdemo" : "")
|
|
||||||
);
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user