1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-03-02 03:39:21 +00:00

Get rid of 'builtins' file since its useless and causes performance issues

This commit is contained in:
tobspr
2020-06-27 10:51:52 +02:00
parent 14246929b3
commit 2e266f5f21
60 changed files with 256 additions and 403 deletions

View File

@@ -5,7 +5,6 @@ import { Application } from "../../application";
import { AdProviderInterface } from "../ad_provider";
import { createLogger } from "../../core/logging";
import { ClickDetector } from "../../core/click_detector";
import { performanceNow } from "../../core/builtins";
import { clamp } from "../../core/utils";
import { T } from "../../translations";
@@ -52,7 +51,7 @@ export class AdinplayAdProvider extends AdProviderInterface {
return (
this.getHasAds() &&
!this.videoAdResolveFunction &&
performanceNow() - this.lastVideoAdShowTime > minimumTimeBetweenVideoAdsMs
performance.now() - this.lastVideoAdShowTime > minimumTimeBetweenVideoAdsMs
);
}
@@ -141,7 +140,7 @@ export class AdinplayAdProvider extends AdProviderInterface {
showVideoAd() {
assert(this.getHasAds(), "Called showVideoAd but ads are not supported!");
assert(!this.videoAdResolveFunction, "Video ad still running, can not show again!");
this.lastVideoAdShowTime = performanceNow();
this.lastVideoAdShowTime = performance.now();
document.body.appendChild(this.adContainerMainElement);
this.adContainerMainElement.classList.add("visible");
this.adContainerMainElement.classList.remove("waitingForFinish");
@@ -167,7 +166,7 @@ export class AdinplayAdProvider extends AdProviderInterface {
this.videoAdResolveTimer = null;
// When the ad closed, also set the time
this.lastVideoAdShowTime = performanceNow();
this.lastVideoAdShowTime = performance.now();
resolve();
};

View File

@@ -3,7 +3,6 @@ import { Application } from "../../application";
/* typehints:end */
import { AdProviderInterface } from "../ad_provider";
import { performanceNow } from "../../core/builtins";
import { createLogger } from "../../core/logging";
const minimumTimeBetweenVideoAdsMs = G_IS_DEV ? 1 : 5 * 60 * 1000;
@@ -45,7 +44,7 @@ export class GamedistributionAdProvider extends AdProviderInterface {
return (
this.getHasAds() &&
!this.videoAdResolveFunction &&
performanceNow() - this.lastVideoAdShowTime > minimumTimeBetweenVideoAdsMs
performance.now() - this.lastVideoAdShowTime > minimumTimeBetweenVideoAdsMs
);
}
@@ -84,7 +83,7 @@ export class GamedistributionAdProvider extends AdProviderInterface {
showVideoAd() {
assert(this.getHasAds(), "Called showVideoAd but ads are not supported!");
assert(!this.videoAdResolveFunction, "Video ad still running, can not show again!");
this.lastVideoAdShowTime = performanceNow();
this.lastVideoAdShowTime = performance.now();
console.log("🎬 Gamedistribution: Start ad");
try {
@@ -104,7 +103,7 @@ export class GamedistributionAdProvider extends AdProviderInterface {
this.videoAdResolveTimer = null;
// When the ad closed, also set the time
this.lastVideoAdShowTime = performanceNow();
this.lastVideoAdShowTime = performance.now();
resolve();
};

View File

@@ -1,5 +1,4 @@
import { AnalyticsInterface } from "../analytics";
import { Math_random, performanceNow } from "../../core/builtins";
import { createLogger } from "../../core/logging";
const logger = createLogger("ga");

View File

@@ -1,4 +1,3 @@
import { Math_min } from "../../core/builtins";
import { globalConfig, IS_DEMO, IS_MOBILE } from "../../core/config";
import { createLogger } from "../../core/logging";
import { queryParamOptions } from "../../core/query_parameters";
@@ -130,7 +129,7 @@ export class PlatformWrapperImplBrowser extends PlatformWrapperInterface {
return 1;
}
const avgDims = Math_min(this.app.screenWidth, this.app.screenHeight);
const avgDims = Math.min(this.app.screenWidth, this.app.screenHeight);
return clamp((avgDims / 1000.0) * 1.9, 0.1, 10);
}