mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Add TSLint to github actions, fix existing type errors
This commit is contained in:
parent
79e7fb31b9
commit
cb1ff53338
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -44,3 +44,7 @@ jobs:
|
||||
uses: ibiqlik/action-yamllint@v1.0.0
|
||||
with:
|
||||
file_or_dir: translations/*.yaml
|
||||
|
||||
- name: TSLint
|
||||
run: |
|
||||
yarn tslint
|
||||
|
@ -201,33 +201,6 @@
|
||||
flex-grow: 1;
|
||||
@include S(margin-bottom, 10px);
|
||||
}
|
||||
|
||||
.contest {
|
||||
flex-grow: 1;
|
||||
background: rgb(32, 187, 166);
|
||||
@include S(padding, 15px);
|
||||
|
||||
h3 {
|
||||
@include Heading;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
@include S(margin-bottom, 5px);
|
||||
}
|
||||
p {
|
||||
color: #fff;
|
||||
@include Text;
|
||||
strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
@include S(margin-bottom, 5px);
|
||||
}
|
||||
|
||||
button {
|
||||
background: #fff;
|
||||
color: #333538;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.mainContainer {
|
||||
|
@ -385,7 +385,7 @@ export class Application {
|
||||
}
|
||||
|
||||
const scale = this.getEffectiveUiScale();
|
||||
waitNextFrame().then(() => document.documentElement.style.setProperty("--ui-scale", scale));
|
||||
waitNextFrame().then(() => document.documentElement.style.setProperty("--ui-scale", `${scale}`));
|
||||
window.focus();
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,9 @@ export class HUDEntityDebugger extends BaseHUDPart {
|
||||
`
|
||||
);
|
||||
|
||||
/** @type {HTMLElement} */
|
||||
this.mousePosElem = this.element.querySelector(".mousePos");
|
||||
/** @type {HTMLElement} */
|
||||
this.chunkPosElem = this.element.querySelector(".chunkPos");
|
||||
this.entityInfoElem = this.element.querySelector(".entityInfo");
|
||||
}
|
||||
|
@ -106,16 +106,22 @@ export class HUDSettingsMenu extends BaseHUDPart {
|
||||
this.root.app.inputMgr.makeSureAttachedAndOnTop(this.inputReciever);
|
||||
|
||||
const totalMinutesPlayed = Math.ceil(this.root.time.now() / 60);
|
||||
this.statsElement.querySelector(".playtime").innerText = T.global.time.xMinutes.replace(
|
||||
"<x>",
|
||||
"" + totalMinutesPlayed
|
||||
);
|
||||
|
||||
this.statsElement.querySelector(".buildingsPlaced").innerText = formatBigNumberFull(
|
||||
/** @type {HTMLElement} */
|
||||
const playtimeElement = this.statsElement.querySelector(".playtime");
|
||||
/** @type {HTMLElement} */
|
||||
const buildingsPlacedElement = this.statsElement.querySelector(".buildingsPlaced");
|
||||
/** @type {HTMLElement} */
|
||||
const beltsPlacedElement = this.statsElement.querySelector(".beltsPlaced");
|
||||
|
||||
playtimeElement.innerText = T.global.time.xMinutes.replace("<x>", `${totalMinutesPlayed}`);
|
||||
|
||||
buildingsPlacedElement.innerText = formatBigNumberFull(
|
||||
this.root.entityMgr.getAllWithComponent(StaticMapEntityComponent).length -
|
||||
this.root.entityMgr.getAllWithComponent(BeltComponent).length
|
||||
);
|
||||
this.statsElement.querySelector(".beltsPlaced").innerText = formatBigNumberFull(
|
||||
|
||||
beltsPlacedElement.innerText = formatBigNumberFull(
|
||||
this.root.entityMgr.getAllWithComponent(BeltComponent).length
|
||||
);
|
||||
}
|
||||
|
12
src/js/globals.d.ts
vendored
12
src/js/globals.d.ts
vendored
@ -36,11 +36,6 @@ declare interface CanvasRenderingContext2D {
|
||||
webkitImageSmoothingEnabled: boolean;
|
||||
}
|
||||
|
||||
declare interface HTMLCanvasElement {
|
||||
opaque: boolean;
|
||||
webkitOpaque: boolean;
|
||||
}
|
||||
|
||||
// Just for compatibility with the shared code
|
||||
declare interface Logger {
|
||||
log(...args);
|
||||
@ -127,13 +122,6 @@ declare interface NodeRequire {
|
||||
context(src: string, flag: boolean, regexp: RegExp): WebpackContext;
|
||||
}
|
||||
|
||||
// HTML Element
|
||||
declare interface Element {
|
||||
style: any;
|
||||
innerText: string;
|
||||
innerHTML: string;
|
||||
}
|
||||
|
||||
declare interface Object {
|
||||
entries(obj: object): Array<[string, any]>;
|
||||
}
|
||||
|
@ -102,7 +102,10 @@ export class AdinplayAdProvider extends AdProviderInterface {
|
||||
|
||||
// Add the player
|
||||
const videoElement = this.adContainerMainElement.querySelector(".videoInner");
|
||||
this.adContainerMainElement.querySelector(".adInner").style.maxWidth = w + "px";
|
||||
/** @type {HTMLElement} */
|
||||
const adInnerElement = this.adContainerMainElement.querySelector(".adInner");
|
||||
|
||||
adInnerElement.style.maxWidth = w + "px";
|
||||
|
||||
const self = this;
|
||||
window.aiptag.cmd.player.push(function () {
|
||||
|
@ -40,7 +40,7 @@ export class BaseSetting {
|
||||
|
||||
/**
|
||||
* @param {Application} app
|
||||
* @param {Element} element
|
||||
* @param {HTMLElement} element
|
||||
* @param {any} dialogs
|
||||
*/
|
||||
bind(app, element, dialogs) {
|
||||
|
@ -218,11 +218,6 @@ export class MainMenuState extends GameState {
|
||||
this.trackClicks(qs(".languageChoose"), this.onLanguageChooseClicked);
|
||||
this.trackClicks(qs(".helpTranslate"), this.onTranslationHelpLinkClicked);
|
||||
|
||||
const contestButton = qs(".participateContest");
|
||||
if (contestButton) {
|
||||
this.trackClicks(contestButton, this.onContestClicked);
|
||||
}
|
||||
|
||||
if (G_IS_STANDALONE) {
|
||||
this.trackClicks(qs(".exitAppButton"), this.onExitAppButtonClicked);
|
||||
}
|
||||
@ -312,15 +307,6 @@ export class MainMenuState extends GameState {
|
||||
this.app.platformWrapper.openExternalLink(THIRDPARTY_URLS.reddit);
|
||||
}
|
||||
|
||||
onContestClicked() {
|
||||
this.app.analytics.trackUiClick("contest_click");
|
||||
|
||||
this.dialogs.showInfo(
|
||||
T.mainMenu.contests.contest_01_03062020.title,
|
||||
T.mainMenu.contests.contest_01_03062020.longDesc
|
||||
);
|
||||
}
|
||||
|
||||
onLanguageChooseClicked() {
|
||||
this.app.analytics.trackUiClick("choose_language");
|
||||
const setting = /** @type {EnumSetting} */ (getApplicationSettingById("language"));
|
||||
|
@ -37,7 +37,7 @@ export class PreloadState extends GameState {
|
||||
return false;
|
||||
}
|
||||
|
||||
onEnter(payload) {
|
||||
onEnter() {
|
||||
this.htmlElement.classList.add("prefab_LoadingState");
|
||||
|
||||
const elementsToRemove = ["#loadingPreload", "#fontPreload"];
|
||||
@ -52,9 +52,13 @@ export class PreloadState extends GameState {
|
||||
const dialogsElement = document.body.querySelector(".modalDialogParent");
|
||||
this.dialogs.initializeToElement(dialogsElement);
|
||||
|
||||
/** @type {HTMLElement} */
|
||||
this.statusText = this.htmlElement.querySelector(".loadingStatus > .desc");
|
||||
/** @type {HTMLElement} */
|
||||
this.statusBar = this.htmlElement.querySelector(".loadingStatus > .bar > .inner");
|
||||
/** @type {HTMLElement} */
|
||||
this.statusBarText = this.htmlElement.querySelector(".loadingStatus > .bar > .status");
|
||||
|
||||
this.currentStatus = "booting";
|
||||
this.currentIndex = 0;
|
||||
|
||||
|
@ -94,6 +94,7 @@ export class SettingsState extends TextualGameState {
|
||||
|
||||
initSettings() {
|
||||
allApplicationSettings.forEach(setting => {
|
||||
/** @type {HTMLElement} */
|
||||
const element = this.htmlElement.querySelector("[data-setting='" + setting.id + "']");
|
||||
setting.bind(this.app, element, this.dialogs);
|
||||
setting.syncValueToElement();
|
||||
|
@ -3,7 +3,7 @@
|
||||
/* Basic Options */
|
||||
"target": "es6" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
|
||||
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
|
||||
// "lib": [], /* Specify library files to be included in the compilation. */
|
||||
"lib": ["DOM","ES2018"], /* Specify library files to be included in the compilation. */
|
||||
"allowJs": true /* Allow javascript files to be compiled. */,
|
||||
"checkJs": true /* Report errors in .js files. */,
|
||||
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
||||
|
@ -181,7 +181,6 @@ mainMenu:
|
||||
savegameLevel: 第<x>关
|
||||
savegameLevelUnknown:
|
||||
未知关卡
|
||||
# contestOver: This contest has ended - Join the discord to get noticed about new contests!
|
||||
continue: 继续游戏
|
||||
newGame: 新游戏
|
||||
madeBy: 作者:<author-link>
|
||||
|
Loading…
Reference in New Issue
Block a user