2020-05-09 14:45:23 +00:00
|
|
|
|
import "./core/polyfills";
|
|
|
|
|
import "./core/assert";
|
|
|
|
|
import "./core/error_handler";
|
|
|
|
|
|
|
|
|
|
import { createLogger, logSection } from "./core/logging";
|
|
|
|
|
import { Application } from "./application";
|
|
|
|
|
import { IS_DEBUG } from "./core/config";
|
|
|
|
|
import { initComponentRegistry } from "./game/component_registry";
|
|
|
|
|
import { initDrawUtils } from "./core/draw_utils";
|
|
|
|
|
import { initItemRegistry } from "./game/item_registry";
|
|
|
|
|
import { initMetaBuildingRegistry } from "./game/meta_building_registry";
|
2020-05-14 19:54:11 +00:00
|
|
|
|
import { initGameSpeedRegistry } from "./game/game_speed_registry";
|
2020-05-09 14:45:23 +00:00
|
|
|
|
|
|
|
|
|
const logger = createLogger("main");
|
|
|
|
|
|
|
|
|
|
if (window.coreThreadLoadedCb) {
|
|
|
|
|
logger.log("Javascript parsed, calling html thread");
|
|
|
|
|
window.coreThreadLoadedCb();
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-10 09:52:59 +00:00
|
|
|
|
// Logrocket
|
|
|
|
|
// if (!G_IS_DEV && !G_IS_STANDALONE) {
|
|
|
|
|
// const monthlyUsers = 300; // thousand
|
|
|
|
|
// const logrocketLimit = 10; // thousand
|
|
|
|
|
// const percentageOfUsers = logrocketLimit / monthlyUsers;
|
2020-06-03 12:32:02 +00:00
|
|
|
|
|
2020-06-10 09:52:59 +00:00
|
|
|
|
// if (Math.random() <= percentageOfUsers) {
|
|
|
|
|
// logger.log("Analyzing this session with logrocket");
|
|
|
|
|
// const logrocket = require("logrocket");
|
|
|
|
|
// logrocket.init("p1x9zh/shapezio");
|
2020-06-03 12:32:02 +00:00
|
|
|
|
|
2020-06-10 09:52:59 +00:00
|
|
|
|
// try {
|
|
|
|
|
// logrocket.getSessionURL(function (sessionURL) {
|
|
|
|
|
// logger.log("Connected lockrocket to GA");
|
|
|
|
|
// // @ts-ignore
|
|
|
|
|
// try {
|
|
|
|
|
// window.ga("send", {
|
|
|
|
|
// hitType: "event",
|
|
|
|
|
// eventCategory: "LogRocket",
|
|
|
|
|
// eventAction: sessionURL,
|
|
|
|
|
// });
|
|
|
|
|
// } catch (ex) {
|
|
|
|
|
// logger.warn("Logrocket connection to analytics failed:", ex);
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// } catch (ex) {
|
|
|
|
|
// logger.warn("Logrocket connection to analytics failed:", ex);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
2020-06-03 12:32:02 +00:00
|
|
|
|
|
2020-05-09 14:45:23 +00:00
|
|
|
|
console.log(
|
2020-05-21 11:55:45 +00:00
|
|
|
|
`%cshapez.io ️%c\n© 2020 Tobias Springer IT Solutions\nCommit %c${G_BUILD_COMMIT_HASH}%c on %c${new Date(
|
2020-05-09 14:45:23 +00:00
|
|
|
|
G_BUILD_TIME
|
|
|
|
|
).toLocaleString()}\n`,
|
|
|
|
|
"font-size: 35px; font-family: Arial;font-weight: bold; padding: 10px 0;",
|
|
|
|
|
"color: #aaa",
|
|
|
|
|
"color: #7f7",
|
|
|
|
|
"color: #aaa",
|
|
|
|
|
"color: #7f7"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
console.log("Environment: %c" + G_APP_ENVIRONMENT, "color: #fff");
|
|
|
|
|
|
|
|
|
|
if (G_IS_DEV && IS_DEBUG) {
|
|
|
|
|
console.log("\n%c🛑 DEBUG ENVIRONMENT 🛑\n", "color: #f77");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* typehints:start */
|
|
|
|
|
// @ts-ignore
|
|
|
|
|
assert(false, "typehints built in, this should never be the case!");
|
|
|
|
|
/* typehints:end */
|
|
|
|
|
|
|
|
|
|
/* dev:start */
|
|
|
|
|
console.log("%cDEVCODE BUILT IN", "color: #f77");
|
|
|
|
|
/* dev:end */
|
|
|
|
|
|
|
|
|
|
logSection("Boot Process", "#f9a825");
|
|
|
|
|
|
|
|
|
|
initDrawUtils();
|
|
|
|
|
initComponentRegistry();
|
|
|
|
|
initItemRegistry();
|
|
|
|
|
initMetaBuildingRegistry();
|
2020-05-14 19:54:11 +00:00
|
|
|
|
initGameSpeedRegistry();
|
2020-05-09 14:45:23 +00:00
|
|
|
|
|
|
|
|
|
let app = null;
|
|
|
|
|
|
|
|
|
|
function bootApp() {
|
|
|
|
|
logger.log("Page Loaded");
|
|
|
|
|
app = new Application();
|
|
|
|
|
app.boot();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
window.addEventListener("load", bootApp);
|