Newer
Older
open-logistic-tycoon / app.js.map
{"version":3,"sources":["Game.js","config.js","kernel/Boot.js","kernel/Loader.js","kernel/Renderer.js"],"names":["Game","constructor","console","log","this","initMainMenu","app","kernel","boot","renderer","addRenderFunc","btn","document","createElement","classList","add","innerHTML","addEventListener","e","alert","renderMenu","config","version","build","title","include","css","modules","square","plugins","sample","Boot","renderTitle","includeCSS","loader","Loader","Renderer","cssfile","head","querySelector","kernelInit","game","loadGame","rendererFuncs","UITab","Menu","GameField","Settings","type","func","push","item","menuList","renderedItemData","li","appendChild","render"],"mappings":"MAAAA,KACAC,cACAC,QAAAC,IAAA,WAAA,EACAC,KAAAC,aAAA,CACA,CAEAA,eACAC,IAAAC,OAAAC,KAAAC,SAAAC,cAAA,OAAA,KACA,IAAAC,EAAAC,SAAAC,cAAA,QAAA,EAQA,OAPAF,EAAAG,UAAAC,IAAA,KAAA,EACAJ,EAAAG,UAAAC,IAAA,eAAA,EACAJ,EAAAK,UAAA,WACAL,EAAAM,iBAAA,QAAAC,IACAC,MAAA,mBAAA,CACA,CAAA,EAEA,CAAAR,IAAAA,CAAA,CACA,CAAA,EAEAL,IAAAC,OAAAC,KAAAC,SAAAC,cAAA,OAAA,KACA,IAAAC,EAAAC,SAAAC,cAAA,QAAA,EAQA,OAPAF,EAAAG,UAAAC,IAAA,KAAA,EACAJ,EAAAG,UAAAC,IAAA,eAAA,EACAJ,EAAAK,UAAA,YACAL,EAAAM,iBAAA,QAAAC,IACAC,MAAA,cAAA,CACA,CAAA,EAEA,CAAAR,IAAAA,CAAA,CACA,CAAA,EAEAL,IAAAC,OAAAC,KAAAC,SAAAC,cAAA,OAAA,KACA,IAAAC,EAAAC,SAAAC,cAAA,QAAA,EAQA,OAPAF,EAAAG,UAAAC,IAAA,KAAA,EACAJ,EAAAG,UAAAC,IAAA,eAAA,EACAJ,EAAAK,UAAA,WACAL,EAAAM,iBAAA,QAAAC,IACAC,MAAA,eAAA,CACA,CAAA,EAEA,CAAAR,IAAAA,CA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CACA,CAEAoC,WACA,OAAA,IAAA1C,KAAAI,KAAAE,GAAA,CACA,CACA,OCVA8B,SACAnC,cACAG,KAAAuC,cAAA,CACAC,MAAA,GACAC,KAAA,GACAC,UAAA,GACAC,SAAA,EACA,CACA,CAEArC,cAAAsC,EAAAC,GACA7C,KAAAuC,cAAAK,GAAAE,KAAAD,CAAA,CACA,CAEA7B,aACA,IAIA+B,EAHAC,EADAxC,SAAA2B,cAAA,gBAAA,EACAA,cAAA,eAAA,EACAa,EAAApC,UAAA,GAEA,IAAAmC,KAAA/C,KAAAuC,cAAAE,KAAA,CACA,IAAAQ,EAAAF,EAAA,EACAG,EAAA1C,SAAAC,cAAA,IAAA,EACAyC,EAAAxC,UAAAC,IAAA,gBAAA,EACAuC,EAAAC,YAAAF,EAAA1C,GAAA,EACAyC,EAAAG,YAAAD,CAAA,CACA,CACA,CAEAE,UAGA","file":"app.js","sourcesContent":["class Game {\n\tconstructor() {\n\t\tconsole.log(\"Init Game\"); \n\t\tthis.initMainMenu();\n\t}\n\n\tinitMainMenu() {\n\t\tapp.kernel.boot.renderer.addRenderFunc(\"Menu\", () => {\n\t\t\tconst btn = document.createElement(\"BUTTON\");\n\t\t\tbtn.classList.add(\"btn\");\n\t\t\tbtn.classList.add(\"btn-secondary\");\n\t\t\tbtn.innerHTML = \"New Game\";\n\t\t\tbtn.addEventListener(\"click\", e => {\n\t\t\t\talert(\"STARTING NEW GAME\");\n\t\t\t});\n\n\t\t\treturn { btn: btn };\n\t\t});\n\n\t\tapp.kernel.boot.renderer.addRenderFunc(\"Menu\", () => {\n\t\t\tconst btn = document.createElement(\"BUTTON\");\n\t\t\tbtn.classList.add(\"btn\");\n\t\t\tbtn.classList.add(\"btn-secondary\");\n\t\t\tbtn.innerHTML = \"Load Game\";\n\t\t\tbtn.addEventListener(\"click\", e => {\n\t\t\t\talert(\"Loading GAME\");\n\t\t\t});\n\n\t\t\treturn { btn: btn };\n\t\t});\n\n\t\tapp.kernel.boot.renderer.addRenderFunc(\"Menu\", () => {\n\t\t\tconst btn = document.createElement(\"BUTTON\");\n\t\t\tbtn.classList.add(\"btn\");\n\t\t\tbtn.classList.add(\"btn-secondary\");\n\t\t\tbtn.innerHTML = \"Settings\";\n\t\t\tbtn.addEventListener(\"click\", e => {\n\t\t\t\talert(\"OPEN SETTINGS\");\n\t\t\t});\n\n\t\t\treturn { btn: btn };\n\t\t});\n\n\t\tapp.kernel.boot.renderer.addRenderFunc(\"Menu\", () => {\n\t\t\tconst btn = document.createElement(\"BUTTON\");\n\t\t\tbtn.classList.add(\"btn\");\n\t\t\tbtn.classList.add(\"btn-secondary\");\n\t\t\tbtn.innerHTML = \"Exit\";\n\t\t\tbtn.addEventListener(\"click\", e => {\n\t\t\t\talert(\"EXIT\");\n\t\t\t});\n\n\t\t\treturn { btn: btn };\n\t\t});\n\n\t\tapp.kernel.boot.renderer.renderMenu();\n\t}\n}","const config = {\n\t\"version\": \"v0.1 dev\",\n\t\"build\": 1,\n\t\"title\": \"Open Logistic Tycoon\",\n\t\"include\": {\n\t\t\"css\": [\n\t\t\t\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css\",\n\t\t\t\"game/resources/dist.min.css\"\n\t\t]\n\t},\n\t\"modules\": {\n\t\t\"square\": true\t\n\t},\n\t\"plugins\": {\n\t\t\"sample\": false\n\t}\n}","class Boot {\n\tconstructor() {\n\t\tconsole.log(\"Init Boot\");\n\n\t\tthis.renderTitle();\n\t\tthis.includeCSS();\n\t\tthis.loader = new Loader();\n\t\tthis.renderer = new Renderer();\n\t}\n\n\tincludeCSS() {\n\t\tconst head = document.querySelector('head');\n\t\tfor(let cssfile of config.include.css) {\n\t\t\thead.innerHTML = head.innerHTML + `<link type=\"text/css\" rel=\"stylesheet\" href=\"${cssfile}\">`;\n\t\t}\n\t}\n\n\trenderTitle() {\n\t\tdocument.querySelector('title').innerHTML = config.title + \" \" + config.version;\n\t\tdocument.querySelector(\"#ui .main-menu .game-title\").innerHTML = `${config.title} <span class=\"version\">${config.version}</span>`;\n\t}\n}\n\nconst kernelInit = (function(){\n\tthis.boot = new Boot();\n\n\treturn this;\n});\n\nlet app = {};\n\ndocument.addEventListener(\"DOMContentLoaded\", e => {\n\tapp.kernel = kernelInit();\n\tapp.game = app.kernel.boot.loader.loadGame();\n});\n","class Loader {\n\tconstructor(app) {\n\t\tconsole.log(\"Init Loader\");\n\n\t\tthis.app = app;\n\t}\n\n\tloadGame() {\n\t\treturn new Game(this.app);\n\t}\n}","class Renderer {\n\tconstructor() {\n\t\tthis.rendererFuncs = {\n\t\t\t\"UITab\": [],\n\t\t\t\"Menu\": [],\n\t\t\t\"GameField\": [],\n\t\t\t\"Settings\": []\n\t\t};\n\t}\n\n\taddRenderFunc(type, func) {\n\t\tthis.rendererFuncs[type].push(func);\n\t}\n\n\trenderMenu() {\n\t\tconst menuContainer = document.querySelector(\"#ui .main-menu\");\n\t\tconst menuList = menuContainer.querySelector(\".menu-list ul\");\n\t\tmenuList.innerHTML = \"\";\n\n\t\tfor(let item of this.rendererFuncs.Menu) {\n\t\t\tconst renderedItemData = item();\n\t\t\tlet li = document.createElement(\"li\");\n\t\t\tli.classList.add(\"menu-list-item\");\n\t\t\tli.appendChild(renderedItemData.btn);\n\t\t\tmenuList.appendChild(li);\n\t\t}\n\t}\n\n\trender() {\n\n\t}\n}"]}