mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Abt adjustments, again
This commit is contained in:
parent
0d6bdd9bfb
commit
24a4010935
@ -39,16 +39,12 @@
|
||||
@include IncreasedClickArea(0px);
|
||||
@include S(margin-top, 15px);
|
||||
|
||||
&[data-btn-variant="0"] {
|
||||
// nothing
|
||||
}
|
||||
|
||||
&[data-btn-variant="1"] {
|
||||
@include InlineAnimation(1s ease-in-out) {
|
||||
&[data-btn-variant="prod"] {
|
||||
@include InlineAnimation(8s ease-in-out) {
|
||||
0% {
|
||||
opacity: 0.05;
|
||||
}
|
||||
50% {
|
||||
80% {
|
||||
opacity: 0.05;
|
||||
}
|
||||
100% {
|
||||
@ -57,21 +53,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
&[data-btn-variant="2"] {
|
||||
@include InlineAnimation(2.5s ease-in-out) {
|
||||
0% {
|
||||
opacity: 0.05;
|
||||
}
|
||||
50% {
|
||||
opacity: 0.05;
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&[data-btn-variant="3"] {
|
||||
&[data-btn-variant="steam-demo"] {
|
||||
@include InlineAnimation(5s ease-in-out) {
|
||||
0% {
|
||||
opacity: 0.05;
|
||||
@ -84,20 +66,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&[data-btn-variant="4"] {
|
||||
@include InlineAnimation(10s ease-in-out) {
|
||||
0% {
|
||||
opacity: 0.05;
|
||||
}
|
||||
80% {
|
||||
opacity: 0.05;
|
||||
}
|
||||
100% {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.playtimeDisclaimer {
|
||||
|
@ -109,6 +109,14 @@
|
||||
font-weight: 700 !important;
|
||||
}
|
||||
|
||||
.onlinePlayerCount {
|
||||
color: #fff;
|
||||
@include S(margin-top, 15px);
|
||||
@include SuperSmallText;
|
||||
@include S(height, 15px);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
h3 {
|
||||
@include Heading;
|
||||
font-weight: bold;
|
||||
@ -422,6 +430,7 @@
|
||||
box-shadow: 0 D(5px) D(15px) rgba(#000, 0.2);
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
|
||||
.buttons {
|
||||
|
@ -39,7 +39,7 @@ export class HUDStandaloneAdvantages extends BaseHUDPart {
|
||||
: ""
|
||||
}
|
||||
</button>
|
||||
<button class="otherCloseButton" data-btn-variant="${this.root.app.gameAnalytics.abtVariant}">${
|
||||
<button class="otherCloseButton" data-btn-variant="${G_IS_STEAM_DEMO ? "steam-demo" : "prod"}">${
|
||||
T.ingame.standaloneAdvantages.no_thanks
|
||||
}</button>
|
||||
</div>
|
||||
|
@ -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_sacb";
|
||||
const CURRENT_ABT_COUNT = 5;
|
||||
const CURRENT_ABT = "abt_mmat";
|
||||
const CURRENT_ABT_COUNT = 3;
|
||||
|
||||
export class ShapezGameAnalytics extends GameAnalyticsInterface {
|
||||
constructor(app) {
|
||||
|
@ -35,6 +35,8 @@ let firstPlayForwarded = false;
|
||||
export class MainMenuState extends GameState {
|
||||
constructor() {
|
||||
super("MainMenuState");
|
||||
|
||||
this.refreshInterval = null;
|
||||
}
|
||||
|
||||
getInnerHTML() {
|
||||
@ -72,10 +74,15 @@ export class MainMenuState extends GameState {
|
||||
!G_IS_STEAM_DEMO &&
|
||||
/** @type { PlatformWrapperImplElectron}*/ (this.app.platformWrapper).dlcs.puzzle);
|
||||
|
||||
let abtVariant = this.app.gameAnalytics.abtVariant;
|
||||
const bannerHtml = `
|
||||
<h3>${T.demoBanners.title}</h3>
|
||||
<p>${T.demoBanners.intro}</p>
|
||||
<span class="playtimeDisclaimer">${T.demoBanners.playtimeDisclaimer}</span>
|
||||
${
|
||||
abtVariant === "0"
|
||||
? `<span class="playtimeDisclaimer">${T.demoBanners.playtimeDisclaimer}</span>`
|
||||
: ""
|
||||
}
|
||||
<a href="#" class="steamLink steam_dlbtn_0" target="_blank">
|
||||
${
|
||||
globalConfig.currentDiscount > 0
|
||||
@ -84,6 +91,8 @@ export class MainMenuState extends GameState {
|
||||
}
|
||||
|
||||
</a>
|
||||
${abtVariant === "2" ? `<div class="onlinePlayerCount"></div>` : ""}
|
||||
|
||||
`;
|
||||
|
||||
return `
|
||||
@ -113,11 +122,7 @@ export class MainMenuState extends GameState {
|
||||
</div>
|
||||
|
||||
<div class="mainContainer">
|
||||
${
|
||||
showBrowserWarning
|
||||
? `<div class="browserWarning">${T.mainMenu.browserWarning}</div>`
|
||||
: ""
|
||||
}
|
||||
${showBrowserWarning ? `<div class="browserWarning">${T.mainMenu.browserWarning}</div>` : ""}
|
||||
<div class="buttons"></div>
|
||||
</div>
|
||||
|
||||
@ -373,6 +378,9 @@ export class MainMenuState extends GameState {
|
||||
|
||||
this.renderMainMenu();
|
||||
this.renderSavegames();
|
||||
this.fetchPlayerCount();
|
||||
|
||||
this.refreshInterval = setInterval(() => this.fetchPlayerCount(), 10000);
|
||||
}
|
||||
|
||||
renderMainMenu() {
|
||||
@ -416,9 +424,27 @@ export class MainMenuState extends GameState {
|
||||
buttonContainer.appendChild(outerDiv);
|
||||
}
|
||||
|
||||
fetchPlayerCount() {
|
||||
const element = this.htmlElement.querySelector(".onlinePlayerCount");
|
||||
if (!element) {
|
||||
return;
|
||||
}
|
||||
fetch("https://analytics.shapez.io/v1/player-count", {
|
||||
cache: "no-cache",
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then(
|
||||
count => {
|
||||
element.innerText = T.demoBanners.playerCount.replace("<playerCount>", String(count));
|
||||
},
|
||||
ex => {
|
||||
console.warn("Failed to get player count:", ex);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
onPuzzleModeButtonClicked(force = false) {
|
||||
const hasUnlockedBlueprints = this.app.savegameMgr.getSavegamesMetaData().some(s => s.level >= 12);
|
||||
console.log(hasUnlockedBlueprints);
|
||||
if (!force && !hasUnlockedBlueprints) {
|
||||
const { ok } = this.dialogs.showWarning(
|
||||
T.dialogs.puzzlePlayRegularRecommendation.title,
|
||||
@ -794,5 +820,6 @@ export class MainMenuState extends GameState {
|
||||
|
||||
onLeave() {
|
||||
this.dialogs.cleanup();
|
||||
clearInterval(this.refreshInterval);
|
||||
}
|
||||
}
|
||||
|
@ -106,6 +106,8 @@ demoBanners:
|
||||
</ul>
|
||||
playtimeDisclaimer: >-
|
||||
The full version contains more than <strong>24 hours of content</strong>.
|
||||
playerCount: >-
|
||||
<playerCount> players like you are currently playing shapez on Steam
|
||||
|
||||
mainMenu:
|
||||
play: Play
|
||||
|
Loading…
Reference in New Issue
Block a user