Skip to content

Commit e2907a1

Browse files
committed
Adjust for the summer sale
1 parent 1e6199b commit e2907a1

39 files changed

+333
-138
lines changed

src/css/ingame_hud/standalone_advantages.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,14 @@
153153
transform: rotate(3deg);
154154
}
155155
}
156+
157+
.specialOffer {
158+
color: #000000;
159+
@include PlainText;
160+
align-self: center;
161+
text-align: center;
162+
@include S(margin-top, 5px);
163+
}
156164
}
157165

158166
.point {

src/css/states/main_menu.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,18 @@
332332
transform: rotate(5deg);
333333
}
334334
}
335+
.specialOffer {
336+
color: #000000;
337+
@include PlainText;
338+
align-self: center;
339+
text-align: center;
340+
@include S(margin-top, 5px);
341+
@include InlineAnimation(1s ease-in-out infinite) {
342+
50% {
343+
transform: scale(1.02, 1.03) translateY(2%);
344+
}
345+
}
346+
}
335347

336348
.points {
337349
display: grid;

src/js/game/hud/parts/standalone_advantages.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ export class HUDStandaloneAdvantages extends BaseHUDPart {
4949
: ""
5050
}
5151
</button>
52+
${
53+
["1", "3"].includes(this.root.app.gameAnalytics.abtVariant)
54+
? `<span class="specialOffer">${T.global.discountSummerSale}</span>`
55+
: ""
56+
}
5257
<button class="otherCloseButton" data-btn-variant="${G_IS_STEAM_DEMO ? "steam-demo" : "prod"}">${
5358
T.ingame.standaloneAdvantages.no_thanks
5459
}</button>

src/js/platform/browser/game_analytics.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { globalConfig, THIRDPARTY_URLS } from "../../core/config";
1+
import { globalConfig } from "../../core/config";
22
import { createLogger } from "../../core/logging";
33
import { queryParamOptions } from "../../core/query_parameters";
44
import { randomInt } from "../../core/utils";
@@ -36,8 +36,8 @@ const analyticsUrl = G_IS_DEV ? "http://localhost:8001" : "https://analytics.sha
3636
// Be sure to increment the ID whenever it changes
3737
const analyticsLocalFile = G_IS_STEAM_DEMO ? "shapez_token_steamdemo.bin" : "shapez_token_123.bin";
3838

39-
const CURRENT_ABT = "abt_dsct";
40-
const CURRENT_ABT_COUNT = 2;
39+
const CURRENT_ABT = "abt_ssst";
40+
const CURRENT_ABT_COUNT = 4;
4141

4242
export class ShapezGameAnalytics extends GameAnalyticsInterface {
4343
constructor(app) {

src/js/states/main_menu.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@ export class MainMenuState extends GameState {
4242
const showLanguageIcon = !G_CHINA_VERSION && !G_WEGAME_VERSION;
4343
const showExitAppButton = G_IS_STANDALONE;
4444
const showPuzzleDLC =
45-
G_IS_DEV ||
46-
(!G_WEGAME_VERSION && (G_IS_STANDALONE || WEB_STEAM_SSO_AUTHENTICATED) && !G_IS_STEAM_DEMO);
45+
!G_WEGAME_VERSION && (G_IS_STANDALONE || WEB_STEAM_SSO_AUTHENTICATED) && !G_IS_STEAM_DEMO;
4746
const showWegameFooter = G_WEGAME_VERSION;
4847
const hasMods = MODS.anyModsActive();
4948

@@ -111,6 +110,11 @@ export class MainMenuState extends GameState {
111110
}
112111
Play shapez on Steam
113112
</a>
113+
${
114+
["1", "3"].includes(this.app.gameAnalytics.abtVariant)
115+
? `<span class="specialOffer">${T.global.discountSummerSale}</span>`
116+
: ""
117+
}
114118
${!G_IS_STEAM_DEMO ? `<div class="onlinePlayerCount"></div>` : ""}
115119
116120
`;

src/js/states/preload.js

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -47,22 +47,25 @@ export class PreloadState extends GameState {
4747
}
4848

4949
async fetchDiscounts() {
50-
// Bundle is always -10% off
51-
let baseDiscount = this.app.gameAnalytics.abtVariant === "0" ? 1 : 0.9;
52-
53-
await timeoutPromise(
54-
fetch("https://analytics.shapez.io/v1/discounts")
55-
.then(res => res.json())
56-
.then(data => {
57-
globalConfig.currentDiscount =
58-
100 -
59-
baseDiscount * (100 - Number(data["1318690"].data.price_overview.discount_percent));
60-
logger.log("Fetched current discount:", globalConfig.currentDiscount);
61-
}),
62-
2000
63-
).catch(err => {
64-
logger.warn("Failed to fetch current discount:", err);
65-
});
50+
// Summer sale specific
51+
const bundle = ["0", "1"].includes(this.app.gameAnalytics.abtVariant);
52+
globalConfig.currentDiscount = 60;
53+
globalConfig.standaloneCampaignLink = bundle
54+
? "https://get.shapez.io/bundle/$campaign"
55+
: "https://get.shapez.io/$campaign";
56+
57+
// Regular
58+
// await timeoutPromise(
59+
// fetch("https://analytics.shapez.io/v1/discounts")
60+
// .then(res => res.json())
61+
// .then(data => {
62+
// globalConfig.currentDiscount = Number(data["1318690"].data.price_overview.discount_percent);
63+
// logger.log("Fetched current discount:", globalConfig.currentDiscount);
64+
// }),
65+
// 2000
66+
// ).catch(err => {
67+
// logger.warn("Failed to fetch current discount:", err);
68+
// });
6669
}
6770

6871
async sendBeacon() {

translations/base-ar.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ global:
5252
space: SPACE
5353
loggingIn: Logging in
5454
loadingResources: Downloading additional resources (<percentage> %)
55+
discount: -<percentage>%
56+
discountSummerSale: SPECIAL PROMOTION! Offer ends 7 July
5557
demoBanners:
5658
title: Demo Version
5759
intro: |-

translations/base-cat.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ global:
5555
space: ESPAI
5656
loggingIn: Logging in
5757
loadingResources: Downloading additional resources (<percentage> %)
58+
discount: -<percentage>%
59+
discountSummerSale: SPECIAL PROMOTION! Offer ends 7 July
5860
demoBanners:
5961
title: Demo - Versió de prova
6062
intro: |-

translations/base-cz.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ global:
5151
space: SPACE
5252
loggingIn: Přihlašuji
5353
loadingResources: Stahování dalších zdrojů (<percentage> %)
54+
discount: -<percentage>%
55+
discountSummerSale: SPECIAL PROMOTION! Offer ends 7 July
5456
demoBanners:
5557
title: Demo verze
5658
intro: |-

translations/base-da.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ global:
5353
space: MELLEMRUM
5454
loggingIn: Logging in
5555
loadingResources: Downloader yderligere ressourcer (<percentage> %)
56+
discount: -<percentage>%
57+
discountSummerSale: SPECIAL PROMOTION! Offer ends 7 July
5658
demoBanners:
5759
title: Demoversion
5860
intro: |-

0 commit comments

Comments
 (0)