From 9d28a1f2f6eb9bb0a5c0ed7bc1b057634972822f Mon Sep 17 00:00:00 2001 From: tobspr Date: Wed, 15 Jun 2022 21:29:10 +0200 Subject: [PATCH] Further abt testing, v2 --- src/css/ingame_hud/standalone_advantages.scss | 62 ++++++++++++++++--- src/js/core/config.js | 2 +- .../game/hud/parts/standalone_advantages.js | 4 +- src/js/platform/browser/game_analytics.js | 45 ++++++-------- 4 files changed, 78 insertions(+), 35 deletions(-) diff --git a/src/css/ingame_hud/standalone_advantages.scss b/src/css/ingame_hud/standalone_advantages.scss index 0357ffeb..a7207b98 100644 --- a/src/css/ingame_hud/standalone_advantages.scss +++ b/src/css/ingame_hud/standalone_advantages.scss @@ -39,15 +39,63 @@ @include IncreasedClickArea(0px); @include S(margin-top, 15px); - @include InlineAnimation(5s ease-in-out) { - 0% { - opacity: 0.05; + &[data-btn-variant="0"] { + // nothing + } + + &[data-btn-variant="1"] { + @include InlineAnimation(1s ease-in-out) { + 0% { + opacity: 0.05; + } + 50% { + opacity: 0.05; + } + 100% { + opacity: 1; + } + } + } + + &[data-btn-variant="2"] { + @include InlineAnimation(2.5s ease-in-out) { + 0% { + opacity: 0.05; + } + 50% { + opacity: 0.05; + } + 100% { + opacity: 1; + } } - 50% { - opacity: 0.05; + } + + &[data-btn-variant="3"] { + @include InlineAnimation(5s ease-in-out) { + 0% { + opacity: 0.05; + } + 50% { + opacity: 0.05; + } + 100% { + opacity: 1; + } } - 100% { - opacity: 1; + } + + &[data-btn-variant="4"] { + @include InlineAnimation(10s ease-in-out) { + 0% { + opacity: 0.05; + } + 80% { + opacity: 0.05; + } + 100% { + opacity: 1; + } } } } diff --git a/src/js/core/config.js b/src/js/core/config.js index 000c5dce..dc8f6f94 100644 --- a/src/js/core/config.js +++ b/src/js/core/config.js @@ -21,7 +21,7 @@ export const THIRDPARTY_URLS = { privacyPolicy: "https://tobspr.io/privacy.html", - standaloneCampaignLink: "https://get.shapez.io/$campaign", + standaloneCampaignLink: "https://get.shapez.io/bundle/$campaign", puzzleDlcStorePage: "https://store.steampowered.com/app/1625400/shapezio__Puzzle_DLC", levelTutorialVideos: { diff --git a/src/js/game/hud/parts/standalone_advantages.js b/src/js/game/hud/parts/standalone_advantages.js index 9b2440a8..79ae4b48 100644 --- a/src/js/game/hud/parts/standalone_advantages.js +++ b/src/js/game/hud/parts/standalone_advantages.js @@ -39,7 +39,9 @@ export class HUDStandaloneAdvantages extends BaseHUDPart { : "" } - + ` ); diff --git a/src/js/platform/browser/game_analytics.js b/src/js/platform/browser/game_analytics.js index 1e41229a..2488eee5 100644 --- a/src/js/platform/browser/game_analytics.js +++ b/src/js/platform/browser/game_analytics.js @@ -18,8 +18,8 @@ const analyticsUrl = G_IS_DEV ? "http://localhost:8001" : "https://analytics.sha // Be sure to increment the ID whenever it changes const analyticsLocalFile = G_IS_STEAM_DEMO ? "shapez_token_steamdemo.bin" : "shapez_token_123.bin"; -const CURRENT_ABT = "abt_spl"; -const CURRENT_ABT_COUNT = 2; +const CURRENT_ABT = "abt_sacb"; +const CURRENT_ABT_COUNT = 5; export class ShapezGameAnalytics extends GameAnalyticsInterface { constructor(app) { @@ -52,36 +52,29 @@ export class ShapezGameAnalytics extends GameAnalyticsInterface { } fetchABVariant() { - return this.app.storage - .readFileAsync("shapez_" + CURRENT_ABT + ".bin") - .then( - abt => { + return this.app.storage.readFileAsync("shapez_" + CURRENT_ABT + ".bin").then( + abt => { + if (typeof queryParamOptions.abtVariant === "string") { + this.abtVariant = queryParamOptions.abtVariant; + logger.log("Set", CURRENT_ABT, "to (OVERRIDE) ", this.abtVariant); + } else { + this.abtVariant = abt; + logger.log("Read abtVariant:", abt); + } + }, + err => { + if (err === FILE_NOT_FOUND) { if (typeof queryParamOptions.abtVariant === "string") { this.abtVariant = queryParamOptions.abtVariant; logger.log("Set", CURRENT_ABT, "to (OVERRIDE) ", this.abtVariant); } else { - this.abtVariant = abt; - logger.log("Read abtVariant:", abt); - } - }, - err => { - if (err === FILE_NOT_FOUND) { - if (typeof queryParamOptions.abtVariant === "string") { - this.abtVariant = queryParamOptions.abtVariant; - logger.log("Set", CURRENT_ABT, "to (OVERRIDE) ", this.abtVariant); - } else { - this.abtVariant = String(randomInt(0, CURRENT_ABT_COUNT - 1)); - logger.log("Set", CURRENT_ABT, "to", this.abtVariant); - } - this.app.storage.writeFileAsync("shapez_" + CURRENT_ABT + ".bin", this.abtVariant); + this.abtVariant = String(randomInt(0, CURRENT_ABT_COUNT - 1)); + logger.log("Set", CURRENT_ABT, "to", this.abtVariant); } + this.app.storage.writeFileAsync("shapez_" + CURRENT_ABT + ".bin", this.abtVariant); } - ) - .then(() => { - if (this.abtVariant === "1") { - THIRDPARTY_URLS.standaloneCampaignLink = "https://get.shapez.io/bundle/$campaign"; - } - }); + } + ); } /**