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