mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-06 17:44:33 +00:00
Properly render discounts
This commit is contained in:
parent
d976245cc1
commit
9f3cf49fad
@ -142,20 +142,15 @@
|
|||||||
|
|
||||||
> .discount {
|
> .discount {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@include S(top, -7px);
|
@include S(top, -12px);
|
||||||
@include S(right, -5px);
|
@include S(right, -15px);
|
||||||
background: #4c6b22;
|
background: #4c6b22;
|
||||||
color: #c5ea3f;
|
color: #c5ea3f;
|
||||||
@include S(border-radius, $globalBorderRadius);
|
@include S(border-radius, $globalBorderRadius);
|
||||||
@include S(padding, 1px, 3px, 1px, 4px);
|
@include S(padding, 1px, 3px, 1px, 4px);
|
||||||
@include SuperSmallText;
|
@include PlainText;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
transform: rotate(1deg);
|
transform: rotate(3deg);
|
||||||
@include InlineAnimation(1.3s ease-in-out infinite) {
|
|
||||||
50% {
|
|
||||||
transform: rotate(4deg) scale(1.1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -327,14 +327,9 @@
|
|||||||
color: #c5ea3f;
|
color: #c5ea3f;
|
||||||
@include S(border-radius, $globalBorderRadius);
|
@include S(border-radius, $globalBorderRadius);
|
||||||
@include S(padding, 1px, 3px, 1px, 4px);
|
@include S(padding, 1px, 3px, 1px, 4px);
|
||||||
@include SuperSmallText;
|
@include PlainText;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
transform: rotate(1deg);
|
transform: rotate(5deg);
|
||||||
@include InlineAnimation(1.3s ease-in-out infinite) {
|
|
||||||
50% {
|
|
||||||
transform: rotate(4deg) scale(1.1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,9 +22,10 @@ export const THIRDPARTY_URLS = {
|
|||||||
twitter: "https://twitter.com/tobspr",
|
twitter: "https://twitter.com/tobspr",
|
||||||
privacyPolicy: "https://tobspr.io/privacy.html",
|
privacyPolicy: "https://tobspr.io/privacy.html",
|
||||||
|
|
||||||
standaloneCampaignLink: G_IS_STANDALONE
|
standaloneCampaignLink:
|
||||||
? "https://get.shapez.io/bundle/$campaign"
|
G_IS_STANDALONE || true
|
||||||
: "https://get.shapez.io/$campaign",
|
? "https://get.shapez.io/bundle/$campaign"
|
||||||
|
: "https://get.shapez.io/$campaign",
|
||||||
puzzleDlcStorePage: "https://get.shapez.io/mm_puzzle_dlc?target=dlc",
|
puzzleDlcStorePage: "https://get.shapez.io/mm_puzzle_dlc?target=dlc",
|
||||||
|
|
||||||
levelTutorialVideos: {
|
levelTutorialVideos: {
|
||||||
|
@ -42,7 +42,10 @@ export class HUDStandaloneAdvantages extends BaseHUDPart {
|
|||||||
<button class="steamLinkButton steam_dlbtn_0">
|
<button class="steamLinkButton steam_dlbtn_0">
|
||||||
${
|
${
|
||||||
globalConfig.currentDiscount > 0
|
globalConfig.currentDiscount > 0
|
||||||
? `<span class='discount'>-${globalConfig.currentDiscount}%!</span>`
|
? `<span class='discount'>${T.global.discount.replace(
|
||||||
|
"<percentage>",
|
||||||
|
String(globalConfig.currentDiscount)
|
||||||
|
)}</span>`
|
||||||
: ""
|
: ""
|
||||||
}
|
}
|
||||||
</button>
|
</button>
|
||||||
|
@ -13,7 +13,10 @@ export class HUDWatermark extends BaseHUDPart {
|
|||||||
globalConfig.currentDiscount > 0 ? ["withDiscount"] : [],
|
globalConfig.currentDiscount > 0 ? ["withDiscount"] : [],
|
||||||
linkText +
|
linkText +
|
||||||
(globalConfig.currentDiscount > 0
|
(globalConfig.currentDiscount > 0
|
||||||
? `<span class='discount'>-${globalConfig.currentDiscount}%!</span>`
|
? `<span class='discount'>${T.global.discount.replace(
|
||||||
|
"<percentage>",
|
||||||
|
String(globalConfig.currentDiscount)
|
||||||
|
)}</span>`
|
||||||
: "")
|
: "")
|
||||||
);
|
);
|
||||||
this.trackClicks(this.linkElement, () => {
|
this.trackClicks(this.linkElement, () => {
|
||||||
|
@ -16,8 +16,6 @@ const chinaShapes = G_WEGAME_VERSION || G_CHINA_VERSION;
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
const WEB_DEMO_LEVELS = app => {
|
const WEB_DEMO_LEVELS = app => {
|
||||||
const variant = app.gameAnalytics.abtVariant;
|
|
||||||
|
|
||||||
const levels = [
|
const levels = [
|
||||||
// 1
|
// 1
|
||||||
// Circle
|
// Circle
|
||||||
@ -39,7 +37,7 @@ const WEB_DEMO_LEVELS = app => {
|
|||||||
// Rectangle
|
// Rectangle
|
||||||
{
|
{
|
||||||
shape: "RuRuRuRu", // miners t1
|
shape: "RuRuRuRu", // miners t1
|
||||||
required: variant === "0" ? 50 : 30,
|
required: 30,
|
||||||
reward: enumHubGoalRewards.reward_balancer,
|
reward: enumHubGoalRewards.reward_balancer,
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -57,49 +55,35 @@ const WEB_DEMO_LEVELS = app => {
|
|||||||
required: 75,
|
required: 75,
|
||||||
reward: enumHubGoalRewards.reward_tunnel,
|
reward: enumHubGoalRewards.reward_tunnel,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// 6
|
||||||
|
// Painter
|
||||||
|
{
|
||||||
|
shape: "Cu------", // miners t2
|
||||||
|
required: 50,
|
||||||
|
reward: enumHubGoalRewards.reward_painter,
|
||||||
|
},
|
||||||
|
|
||||||
|
// 7
|
||||||
|
{
|
||||||
|
shape: "CrCrCrCr", // unused
|
||||||
|
required: 85,
|
||||||
|
reward: enumHubGoalRewards.reward_rotater_ccw,
|
||||||
|
},
|
||||||
|
|
||||||
|
// 8
|
||||||
|
{
|
||||||
|
shape: "RbRb----", // painter t2
|
||||||
|
required: 100,
|
||||||
|
reward: enumHubGoalRewards.reward_mixer,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
shape: "RpRp----",
|
||||||
|
required: 0,
|
||||||
|
reward: enumHubGoalRewards.reward_demo_end,
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
if (["0", "1", "2", "3"].includes(variant)) {
|
|
||||||
levels.push(
|
|
||||||
// 6
|
|
||||||
// Painter
|
|
||||||
{
|
|
||||||
shape: "Cu------", // miners t2
|
|
||||||
required: variant === "0" ? 75 : 50,
|
|
||||||
reward: enumHubGoalRewards.reward_painter,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (["0", "1", "2"].includes(variant)) {
|
|
||||||
levels.push(
|
|
||||||
// 7
|
|
||||||
{
|
|
||||||
shape: "CrCrCrCr", // unused
|
|
||||||
required: variant === "0" ? 120 : 85,
|
|
||||||
reward: enumHubGoalRewards.reward_rotater_ccw,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (["0", "1"].includes(variant)) {
|
|
||||||
levels.push(
|
|
||||||
// 8
|
|
||||||
{
|
|
||||||
shape: "RbRb----", // painter t2
|
|
||||||
required: variant === "0" ? 170 : 100,
|
|
||||||
reward: enumHubGoalRewards.reward_mixer,
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// End of demo
|
|
||||||
levels.push({
|
|
||||||
shape: levels[levels.length - 1].shape,
|
|
||||||
required: 0,
|
|
||||||
reward: enumHubGoalRewards.reward_demo_end,
|
|
||||||
});
|
|
||||||
|
|
||||||
return levels;
|
return levels;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -168,7 +152,7 @@ const STEAM_DEMO_LEVELS = () => [
|
|||||||
},
|
},
|
||||||
// End of demo
|
// End of demo
|
||||||
{
|
{
|
||||||
shape: "RbRb----",
|
shape: "CpCpCpCp",
|
||||||
required: 0,
|
required: 0,
|
||||||
reward: enumHubGoalRewards.reward_demo_end,
|
reward: enumHubGoalRewards.reward_demo_end,
|
||||||
},
|
},
|
||||||
|
@ -36,8 +36,8 @@ const analyticsUrl = G_IS_DEV ? "http://localhost:8001" : "https://analytics.sha
|
|||||||
// Be sure to increment the ID whenever it changes
|
// Be sure to increment the ID whenever it changes
|
||||||
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_lvcp";
|
const CURRENT_ABT = "abt_dsct";
|
||||||
const CURRENT_ABT_COUNT = 4;
|
const CURRENT_ABT_COUNT = 2;
|
||||||
|
|
||||||
export class ShapezGameAnalytics extends GameAnalyticsInterface {
|
export class ShapezGameAnalytics extends GameAnalyticsInterface {
|
||||||
constructor(app) {
|
constructor(app) {
|
||||||
|
@ -103,7 +103,10 @@ export class MainMenuState extends GameState {
|
|||||||
<a href="#" class="steamLink steam_dlbtn_0" target="_blank">
|
<a href="#" class="steamLink steam_dlbtn_0" target="_blank">
|
||||||
${
|
${
|
||||||
globalConfig.currentDiscount > 0
|
globalConfig.currentDiscount > 0
|
||||||
? `<span class='discount'>-${globalConfig.currentDiscount}%!</span>`
|
? `<span class='discount'>${T.global.discount.replace(
|
||||||
|
"<percentage>",
|
||||||
|
String(globalConfig.currentDiscount)
|
||||||
|
)}</span>`
|
||||||
: ""
|
: ""
|
||||||
}
|
}
|
||||||
Play shapez on Steam
|
Play shapez on Steam
|
||||||
|
@ -46,13 +46,16 @@ export class PreloadState extends GameState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fetchDiscounts() {
|
async fetchDiscounts() {
|
||||||
|
// Bundle is always -10% off
|
||||||
|
let baseDiscount = this.app.gameAnalytics.abtVariant === "0" ? 1 : 0.9;
|
||||||
|
|
||||||
await timeoutPromise(
|
await timeoutPromise(
|
||||||
fetch("https://analytics.shapez.io/v1/discounts")
|
fetch("https://analytics.shapez.io/v1/discounts")
|
||||||
.then(res => res.json())
|
.then(res => res.json())
|
||||||
.then(data => {
|
.then(data => {
|
||||||
globalConfig.currentDiscount = Number(
|
globalConfig.currentDiscount =
|
||||||
data["1318690"].data.price_overview.discount_percent
|
100 -
|
||||||
);
|
baseDiscount * (100 - Number(data["1318690"].data.price_overview.discount_percent));
|
||||||
logger.log("Fetched current discount:", globalConfig.currentDiscount);
|
logger.log("Fetched current discount:", globalConfig.currentDiscount);
|
||||||
}),
|
}),
|
||||||
2000
|
2000
|
||||||
|
@ -58,6 +58,8 @@ global:
|
|||||||
# What symbol to use to separate the integer part from the fractional part of a number, e.g. "0.4"
|
# What symbol to use to separate the integer part from the fractional part of a number, e.g. "0.4"
|
||||||
decimalSeparator: "."
|
decimalSeparator: "."
|
||||||
|
|
||||||
|
discount: -<percentage>% off!
|
||||||
|
|
||||||
# The suffix for large numbers, e.g. 1.3k, 400.2M, etc.
|
# The suffix for large numbers, e.g. 1.3k, 400.2M, etc.
|
||||||
suffix:
|
suffix:
|
||||||
thousands: k
|
thousands: k
|
||||||
|
Loading…
Reference in New Issue
Block a user