From 274ce76c2b3525d4aeebbc80d6e223b6db35c76c Mon Sep 17 00:00:00 2001 From: Pax1601 Date: Fri, 22 Sep 2023 17:58:37 +0200 Subject: [PATCH] Basic plugin structure --- client/plugins/databasemanager/copy.bat | 5 + client/plugins/databasemanager/index.js | 85 +++++++++ .../plugins/databasemanager/package-lock.json | 162 ++++++++++++++++++ client/plugins/databasemanager/package.json | 10 ++ client/plugins/databasemanager/plugin.json | 6 + .../src/databasemanagerplugin.ts | 71 ++++++++ client/plugins/databasemanager/src/index.ts | 5 + client/plugins/databasemanager/style.css | 37 ++++ client/plugins/databasemanager/tsconfig.json | 104 +++++++++++ client/src/index.ts | 2 +- client/src/{app.ts => olympusapp.ts} | 36 ++++ 11 files changed, 522 insertions(+), 1 deletion(-) create mode 100644 client/plugins/databasemanager/copy.bat create mode 100644 client/plugins/databasemanager/index.js create mode 100644 client/plugins/databasemanager/package-lock.json create mode 100644 client/plugins/databasemanager/package.json create mode 100644 client/plugins/databasemanager/plugin.json create mode 100644 client/plugins/databasemanager/src/databasemanagerplugin.ts create mode 100644 client/plugins/databasemanager/src/index.ts create mode 100644 client/plugins/databasemanager/style.css create mode 100644 client/plugins/databasemanager/tsconfig.json rename client/src/{app.ts => olympusapp.ts} (93%) diff --git a/client/plugins/databasemanager/copy.bat b/client/plugins/databasemanager/copy.bat new file mode 100644 index 00000000..34127e37 --- /dev/null +++ b/client/plugins/databasemanager/copy.bat @@ -0,0 +1,5 @@ +mkdir .\\..\\..\\public\\plugins\\databasemanager + +copy .\\index.js .\\..\\..\\public\\plugins\\databasemanager\\index.js +copy .\\plugin.json .\\..\\..\\public\\plugins\\databasemanager\\plugin.json +copy .\\style.css .\\..\\..\\public\\plugins\\databasemanager\\style.css \ No newline at end of file diff --git a/client/plugins/databasemanager/index.js b/client/plugins/databasemanager/index.js new file mode 100644 index 00000000..36e2c0b7 --- /dev/null +++ b/client/plugins/databasemanager/index.js @@ -0,0 +1,85 @@ +(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i { return false; }; + __classPrivateFieldGet(this, _DatabaseManagerPlugin_element, "f").classList.add("ol-dialog"); + document.body.appendChild(__classPrivateFieldGet(this, _DatabaseManagerPlugin_element, "f")); + __classPrivateFieldSet(this, _DatabaseManagerPlugin_scrollDiv, document.createElement("div"), "f"); + __classPrivateFieldGet(this, _DatabaseManagerPlugin_scrollDiv, "f").classList.add("dc-scroll-container"); + __classPrivateFieldGet(this, _DatabaseManagerPlugin_element, "f").appendChild(__classPrivateFieldGet(this, _DatabaseManagerPlugin_scrollDiv, "f")); + __classPrivateFieldSet(this, _DatabaseManagerPlugin_contentDiv, document.createElement("div"), "f"); + __classPrivateFieldGet(this, _DatabaseManagerPlugin_contentDiv, "f").classList.add("dc-content-container"); + __classPrivateFieldGet(this, _DatabaseManagerPlugin_element, "f").appendChild(__classPrivateFieldGet(this, _DatabaseManagerPlugin_contentDiv, "f")); + } + getName() { + return "Database Control Plugin"; + } + initialize(app) { + __classPrivateFieldSet(this, _DatabaseManagerPlugin_app, app, "f"); + var aircraftDatabase = __classPrivateFieldGet(this, _DatabaseManagerPlugin_app, "f").getAircraftDatabase(); + var blueprints = aircraftDatabase.getBlueprints(); + for (let key in blueprints) { + var div = document.createElement("div"); + __classPrivateFieldGet(this, _DatabaseManagerPlugin_scrollDiv, "f").appendChild(div); + div.textContent = key; + div.onclick = () => __classPrivateFieldGet(this, _DatabaseManagerPlugin_instances, "m", _DatabaseManagerPlugin_setContent).call(this, blueprints[key]); + } + return true; + } + getElement() { + return __classPrivateFieldGet(this, _DatabaseManagerPlugin_element, "f"); + } + toggle(bool) { + this.getElement().classList.toggle("hide", bool); + } +} +exports.DatabaseManagerPlugin = DatabaseManagerPlugin; +_DatabaseManagerPlugin_element = new WeakMap(), _DatabaseManagerPlugin_app = new WeakMap(), _DatabaseManagerPlugin_scrollDiv = new WeakMap(), _DatabaseManagerPlugin_contentDiv = new WeakMap(), _DatabaseManagerPlugin_instances = new WeakSet(), _DatabaseManagerPlugin_setContent = function _DatabaseManagerPlugin_setContent(blueprint) { + __classPrivateFieldGet(this, _DatabaseManagerPlugin_contentDiv, "f").replaceChildren(); + for (var key in blueprint) { + if (typeof blueprint[key] === "string") { + var dt = document.createElement("dt"); + var dd = document.createElement("dd"); + dt.innerText = key; + var input = document.createElement("input"); + input.value = blueprint[key]; + input.textContent = blueprint[key]; + dd.appendChild(input); + __classPrivateFieldGet(this, _DatabaseManagerPlugin_contentDiv, "f").appendChild(dt); + __classPrivateFieldGet(this, _DatabaseManagerPlugin_contentDiv, "f").appendChild(dd); + } + } +}; + +},{}],2:[function(require,module,exports){ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const databasemanagerplugin_1 = require("./databasemanagerplugin"); +globalThis.getOlympusPlugin = () => { + return new databasemanagerplugin_1.DatabaseManagerPlugin(); +}; + +},{"./databasemanagerplugin":1}]},{},[2]); diff --git a/client/plugins/databasemanager/package-lock.json b/client/plugins/databasemanager/package-lock.json new file mode 100644 index 00000000..1212aee1 --- /dev/null +++ b/client/plugins/databasemanager/package-lock.json @@ -0,0 +1,162 @@ +{ + "name": "DatabaseManagerPlugin", + "version": "v0.0.1", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==" + }, + "convert-source-map": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", + "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==" + }, + "core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==" + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==" + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha512-rMYPYvCzsXywIsldgLaSoPlw5PfoB/ssr7hY4pLfcodrA5M/eArza1a9VmTiNIBNMjOGr1Ow9mTyU2o69U6U9Q==" + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==" + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha512-QR/GGaKCkhwk1ePQNYDRKYZ3mwU9ypsKhB0XyFnLQdomyEqk3e8wpW3V5Jp88zbxK4n5ST1nqo+g9juTpownhQ==", + "requires": { + "error-ex": "^1.2.0" + } + }, + "process-nextick-args": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", + "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" + }, + "readable-stream": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", + "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==" + }, + "semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha512-kwrX1y7czp1E69n2ajbG65mIo9dqvJ+8aBQXOGVxqwvNbsXdFM6Lq37dLAY3mknUwru8CfcCbfOLL/gMo+fi3g==", + "requires": { + "is-utf8": "^0.2.0" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==" + }, + "through2": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.5.tgz", + "integrity": "sha512-/mrRod8xqpA+IHSLyGCQ2s8SPHiCDEeQJSep1jqLYeEUClOFG2Qsh+4FU6G9VeqpZnGW/Su8LQGc4YKni5rYSQ==", + "requires": { + "readable-stream": "~2.3.6", + "xtend": "~4.0.1" + } + }, + "tsconfig": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/tsconfig/-/tsconfig-5.0.3.tgz", + "integrity": "sha512-Cq65A3kVp6BbsUgg9DRHafaGmbMb9EhAc7fjWvudNWKjkbWrt43FnrtZt6awshH1R0ocfF2Z0uxock3lVqEgOg==", + "requires": { + "any-promise": "^1.3.0", + "parse-json": "^2.2.0", + "strip-bom": "^2.0.0", + "strip-json-comments": "^2.0.0" + } + }, + "tsify": { + "version": "5.0.4", + "resolved": "https://registry.npmjs.org/tsify/-/tsify-5.0.4.tgz", + "integrity": "sha512-XAZtQ5OMPsJFclkZ9xMZWkSNyMhMxEPsz3D2zu79yoKorH9j/DT4xCloJeXk5+cDhosEibu4bseMVjyPOAyLJA==", + "requires": { + "convert-source-map": "^1.1.0", + "fs.realpath": "^1.0.0", + "object-assign": "^4.1.0", + "semver": "^6.1.0", + "through2": "^2.0.0", + "tsconfig": "^5.0.3" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, + "xtend": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.2.tgz", + "integrity": "sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ==" + } + } +} diff --git a/client/plugins/databasemanager/package.json b/client/plugins/databasemanager/package.json new file mode 100644 index 00000000..8e717b92 --- /dev/null +++ b/client/plugins/databasemanager/package.json @@ -0,0 +1,10 @@ +{ + "name": "DatabaseManagerPlugin", + "version": "v0.0.1", + "private": true, + "scripts": { + "build": "browserify ./src/index.ts -p [ tsify --noImplicitAny] > index.js && copy.bat" + }, + "dependencies": {}, + "devDependencies": {} +} diff --git a/client/plugins/databasemanager/plugin.json b/client/plugins/databasemanager/plugin.json new file mode 100644 index 00000000..77a1f817 --- /dev/null +++ b/client/plugins/databasemanager/plugin.json @@ -0,0 +1,6 @@ +{ + "name": "Control Tip Plugin", + "version": "0.0.1", + "description": "This plugin shows useful control tips on the right side of the screen. The tips change dynamically depending on what the user does", + "author": "Peekaboo" +} \ No newline at end of file diff --git a/client/plugins/databasemanager/src/databasemanagerplugin.ts b/client/plugins/databasemanager/src/databasemanagerplugin.ts new file mode 100644 index 00000000..fa4bad6a --- /dev/null +++ b/client/plugins/databasemanager/src/databasemanagerplugin.ts @@ -0,0 +1,71 @@ +const SHOW_CONTROL_TIPS = "Show control tips" + +export class DatabaseManagerPlugin implements OlympusPlugin { + #element: HTMLElement; + #app: any; + #scrollDiv: HTMLElement; + #contentDiv: HTMLElement; + + constructor() { + this.#element = document.createElement("div"); + this.#element.id = "database-control-panel"; + this.#element.oncontextmenu = () => { return false; } + this.#element.classList.add("ol-dialog"); + document.body.appendChild(this.#element); + + this.#scrollDiv = document.createElement("div"); + this.#scrollDiv.classList.add("dc-scroll-container"); + this.#element.appendChild(this.#scrollDiv); + + this.#contentDiv = document.createElement("div"); + this.#contentDiv.classList.add("dc-content-container"); + this.#element.appendChild(this.#contentDiv); + } + + getName() { + return "Database Control Plugin" + } + + initialize(app: any) { + this.#app = app; + + var aircraftDatabase = this.#app.getAircraftDatabase(); + var blueprints: {[key: string]: UnitBlueprint} = aircraftDatabase.getBlueprints(); + + for (let key in blueprints) { + var div = document.createElement("div"); + this.#scrollDiv.appendChild(div); + div.textContent = key; + div.onclick = () => this.#setContent(blueprints[key]); + } + + return true; + } + + getElement() { + return this.#element; + } + + toggle(bool?: boolean) { + this.getElement().classList.toggle("hide", bool); + } + + #setContent(blueprint: UnitBlueprint) { + this.#contentDiv.replaceChildren(); + + for (var key in blueprint) { + if (typeof blueprint[key as keyof UnitBlueprint] === "string") + { + var dt = document.createElement("dt"); + var dd = document.createElement("dd"); + dt.innerText = key; + var input = document.createElement("input"); + input.value = blueprint[key as keyof UnitBlueprint] as string; + input.textContent = blueprint[key as keyof UnitBlueprint] as string; + dd.appendChild(input); + this.#contentDiv.appendChild(dt); + this.#contentDiv.appendChild(dd); + } + } + } +} \ No newline at end of file diff --git a/client/plugins/databasemanager/src/index.ts b/client/plugins/databasemanager/src/index.ts new file mode 100644 index 00000000..71c7bbce --- /dev/null +++ b/client/plugins/databasemanager/src/index.ts @@ -0,0 +1,5 @@ +import { DatabaseManagerPlugin } from "./databasemanagerplugin"; + +globalThis.getOlympusPlugin = () => { + return new DatabaseManagerPlugin(); +} \ No newline at end of file diff --git a/client/plugins/databasemanager/style.css b/client/plugins/databasemanager/style.css new file mode 100644 index 00000000..fa3d21dd --- /dev/null +++ b/client/plugins/databasemanager/style.css @@ -0,0 +1,37 @@ +#database-control-panel { + display: flex; + flex-direction: row; +} + +.dc-scroll-container { + overflow-y: scroll; + max-height: 600px; + width: 300px; + margin: 10px; + color: black; + font-weight: bold; +} + +.dc-scroll-container>div:nth-child(even) { + background-color: gainsboro; +} + +.dc-scroll-container>div:nth-child(odd) { + background-color: white; +} + +.dc-scroll-container>div:hover{ + background-color: var(--secondary-blue-text); + color: white; + cursor: pointer; +} + +.dc-content-container { + width: 300px; + margin: 10px; +} + +.dc-content-container>dd>input { + width: 100%; + font-weight: bold; +} diff --git a/client/plugins/databasemanager/tsconfig.json b/client/plugins/databasemanager/tsconfig.json new file mode 100644 index 00000000..2ba9ed01 --- /dev/null +++ b/client/plugins/databasemanager/tsconfig.json @@ -0,0 +1,104 @@ +{ + "compilerOptions": { + /* Visit https://aka.ms/tsconfig to read more about this file */ + /* Projects */ + // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */ + // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */ + // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */ + // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */ + // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */ + // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */ + /* Language and Environment */ + "target": "ES2017", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */ + // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */ + // "jsx": "preserve", /* Specify what JSX code is generated. */ + // "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */ + // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */ + // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */ + // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */ + // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */ + // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */ + // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */ + // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */ + // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */ + /* Modules */ + "module": "commonjs", /* Specify what module code is generated. */ + "rootDirs": ["./src", "../../@types"], /* Specify the root folder within your source files. */ + // "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */ + // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */ + // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */ + // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */ + "typeRoots": [ + "./node_modules/@types", + "../../@types" + ], /* Specify multiple folders that act like './node_modules/@types'. */ + "types": [ + "olympus" + ], /* Specify type package names to be included without being referenced in a source file. */ + // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ + // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */ + // "resolveJsonModule": true, /* Enable importing .json files. */ + // "noResolve": true, /* Disallow 'import's, 'require's or ''s from expanding the number of files TypeScript should add to a project. */ + /* JavaScript Support */ + "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */ + // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */ + // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */ + /* Emit */ + // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */ + // "declarationMap": true, /* Create sourcemaps for d.ts files. */ + // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */ + // "sourceMap": true, /* Create source map files for emitted JavaScript files. */ + // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */ + // "outDir": "./", /* Specify an output folder for all emitted files. */ + // "removeComments": true, /* Disable emitting comments. */ + // "noEmit": true, /* Disable emitting files from a compilation. */ + // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */ + // "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */ + // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */ + // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */ + // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ + // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */ + // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */ + // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */ + // "newLine": "crlf", /* Set the newline character for emitting files. */ + // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */ + // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */ + // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */ + // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */ + // "declarationDir": "./", /* Specify the output directory for generated declaration files. */ + // "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */ + /* Interop Constraints */ + // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */ + // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */ + "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */ + // "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */ + "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */ + /* Type Checking */ + "strict": true, /* Enable all strict type-checking options. */ + // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */ + // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */ + // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */ + // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */ + // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */ + // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */ + // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */ + // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */ + // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */ + // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */ + // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */ + // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */ + // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */ + // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */ + // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */ + // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */ + // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */ + // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */ + /* Completeness */ + // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */ + "skipLibCheck": true /* Skip type checking all .d.ts files. */ + }, + "include": [ + "src/*.ts", + "../../@types/*.d.ts" + ] +} \ No newline at end of file diff --git a/client/src/index.ts b/client/src/index.ts index 2b637448..6e76a0c2 100644 --- a/client/src/index.ts +++ b/client/src/index.ts @@ -1,4 +1,4 @@ -import { OlympusApp } from "./app"; +import { OlympusApp } from "./olympusapp"; var app: OlympusApp; diff --git a/client/src/app.ts b/client/src/olympusapp.ts similarity index 93% rename from client/src/app.ts rename to client/src/olympusapp.ts index 749fde68..5bd0a4c2 100644 --- a/client/src/app.ts +++ b/client/src/olympusapp.ts @@ -20,6 +20,10 @@ import { SVGInjector } from "@tanem/svg-injector"; import { ServerManager } from "./server/servermanager"; import { BLUE_COMMANDER, GAME_MASTER, RED_COMMANDER } from "./constants/constants"; +import { aircraftDatabase } from "./unit/databases/aircraftdatabase"; +import { helicopterDatabase } from "./unit/databases/helicopterdatabase"; +import { groundUnitDatabase } from "./unit/databases/groundunitdatabase"; +import { navyUnitDatabase } from "./unit/databases/navyunitdatabase"; export class OlympusApp { /* Global data */ @@ -114,6 +118,38 @@ export class OlympusApp { } } + /** + * + * @returns The aircraft database + */ + getAircraftDatabase() { + return aircraftDatabase; + } + + /** + * + * @returns The helicopter database + */ + getHelicopterDatabase() { + return helicopterDatabase; + } + + /** + * + * @returns The ground unit database + */ + getGroundUnitDatabase() { + return groundUnitDatabase; + } + + /** + * + * @returns The navy unit database + */ + getNavyUnitDatabase() { + return navyUnitDatabase; + } + /** Set a message in the login splash screen * * @param status The message to show in the login splash screen