mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
Statistics tab
This commit is contained in:
@@ -18,6 +18,9 @@ export const globalConfig = {
|
||||
assetsSharpness: 1.2,
|
||||
shapesSharpness: 1.4,
|
||||
|
||||
statisticsGraphDpi: 2.5,
|
||||
statisticsGraphSlices: 100,
|
||||
|
||||
// [Calculated] physics step size
|
||||
physicsDeltaMs: 0,
|
||||
physicsDeltaSeconds: 0,
|
||||
@@ -38,6 +41,8 @@ export const globalConfig = {
|
||||
|
||||
undergroundBeltMaxTiles: 5,
|
||||
|
||||
analyticsSliceDurationSeconds: 10,
|
||||
|
||||
buildingSpeeds: {
|
||||
cutter: 1 / 4,
|
||||
rotater: 1 / 1,
|
||||
|
||||
@@ -48,9 +48,26 @@ function stringPolyfills() {
|
||||
}
|
||||
}
|
||||
|
||||
function objectPolyfills() {
|
||||
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/entries
|
||||
// @ts-ignore
|
||||
if (!Object.entries) {
|
||||
// @ts-ignore
|
||||
Object.entries = function (obj) {
|
||||
var ownProps = Object.keys(obj),
|
||||
i = ownProps.length,
|
||||
resArray = new Array(i); // preallocate the Array
|
||||
while (i--) resArray[i] = [ownProps[i], obj[ownProps[i]]];
|
||||
|
||||
return resArray;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function initPolyfills() {
|
||||
mathPolyfills();
|
||||
stringPolyfills();
|
||||
objectPolyfills();
|
||||
}
|
||||
|
||||
function initExtensions() {
|
||||
|
||||
@@ -725,6 +725,23 @@ export function makeDiv(parent, id = null, classes = [], innerHTML = "") {
|
||||
return div;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to create a new button
|
||||
* @param {Element} parent
|
||||
* @param {Array<string>=} classes
|
||||
* @param {string=} innerHTML
|
||||
*/
|
||||
export function makeButton(parent, classes = [], innerHTML = "") {
|
||||
const element = document.createElement("button");
|
||||
for (let i = 0; i < classes.length; ++i) {
|
||||
element.classList.add(classes[i]);
|
||||
}
|
||||
element.classList.add("styledButton");
|
||||
element.innerHTML = innerHTML;
|
||||
parent.appendChild(element);
|
||||
return element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes all children of the given element
|
||||
* @param {Element} elem
|
||||
|
||||
Reference in New Issue
Block a user