1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-16 11:41:50 +00:00

Minor restructure, start to add mod examples

This commit is contained in:
tobspr 2022-01-15 13:35:19 +01:00
parent eba9163a33
commit b39f48ebfb
14 changed files with 128 additions and 19 deletions

View File

@ -146,7 +146,7 @@ gulp.task("main.webserver", () => {
*/ */
function serve({ version = "web" }) { function serve({ version = "web" }) {
browserSync.init({ browserSync.init({
server: [buildFolder, path.join(baseDir, "src", "js")], server: [buildFolder, path.join(baseDir, "mod_examples")],
port: 3005, port: 3005,
ghostMode: { ghostMode: {
clicks: false, clicks: false,

View File

@ -143,7 +143,7 @@ function gulptasksStandalone($, gulp) {
packager({ packager({
dir: tempDestBuildDir, dir: tempDestBuildDir,
appCopyright: "Tobias Springer", appCopyright: "tobspr Games",
appVersion: getVersion(), appVersion: getVersion(),
buildVersion: "1.0.0", buildVersion: "1.0.0",
arch, arch,

View File

@ -145,7 +145,7 @@ module.exports = ({
braces: false, braces: false,
ecma: es6 ? 6 : 5, ecma: es6 ? 6 : 5,
preamble: preamble:
"/* shapez.io Codebase - Copyright 2020 Tobias Springer - " + "/* shapez.io Codebase - Copyright 2022 tobspr Games - " +
getVersion() + getVersion() +
" @ " + " @ " +
getRevision() + getRevision() +

View File

@ -213,20 +213,26 @@ registerMod(() => {
this.signals.stateEntered.add(state => { this.signals.stateEntered.add(state => {
if (state.key === "MainMenuState") { if (state.key === "MainMenuState") {
const element = document.createElement("div"); const element = document.createElement("div");
element.innerText = "Hello World from mod!";
element.id = "demo_mod_hello_world_element"; element.id = "demo_mod_hello_world_element";
document.body.appendChild(element); document.body.appendChild(element);
const button = document.createElement("button");
button.classList.add("styledButton");
button.innerText = "Hello!";
button.addEventListener("click", () => {
this.dialogs.showInfo("Mod Message", "Button clicked!");
});
element.appendChild(button);
} }
}); });
this.modInterface.registerCss(` this.modInterface.registerCss(`
#demo_mod_hello_world_element { #demo_mod_hello_world_element {
position: fixed; position: absolute;
top: 10px; top: calc(10px * var(--ui-scale));
left: 10px; left: calc(10px * var(--ui-scale));
color: red; color: red;
z-index: 999; z-index: 0;
font-size: 50px;
} }
`); `);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -3,7 +3,7 @@
"version": "1.0.0", "version": "1.0.0",
"main": "index.js", "main": "index.js",
"repository": "https://github.com/tobspr/shapez.io", "repository": "https://github.com/tobspr/shapez.io",
"author": "Tobias Springer <tobias.springer1@gmail.com>", "author": "tobspr Games <hello@tobspr.io>",
"license": "MIT", "license": "MIT",
"private": true, "private": true,
"scripts": { "scripts": {

View File

@ -293,7 +293,7 @@
} }
} }
.modsList { .modsOverview {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;

View File

@ -15,8 +15,8 @@
<meta name="theme-color" content="#393747" /> <meta name="theme-color" content="#393747" />
<!-- seo --> <!-- seo -->
<meta name="copyright" content="2020 Tobias Springer IT Solutions and .io Games" /> <meta name="copyright" content="2022 tobspr Games" />
<meta name="author" content="Tobias Springer, tobias.springer1@gmail.com" /> <meta name="author" content="tobspr Games - tobspr.io" />
<meta <meta
name="description" name="description"
content="shapez.io is an open-source factory building game about combining and producing different types of shapes." content="shapez.io is an open-source factory building game about combining and producing different types of shapes."

View File

@ -117,7 +117,7 @@ export default {
// disableSlowAsserts: true, // disableSlowAsserts: true,
// ----------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------
// Allows to load a mod from an external source for developing it // Allows to load a mod from an external source for developing it
// externalModUrl: "http://localhost:3005/mods/demo_mod.nobuild/index.js", // externalModUrl: "http://localhost:3005/combined.js",
// ----------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------
/* dev:end */ /* dev:end */
}; };

View File

@ -150,7 +150,7 @@ export class HUDModalDialogs extends BaseHUDPart {
internalShowDialog(dialog) { internalShowDialog(dialog) {
const elem = dialog.createElement(); const elem = dialog.createElement();
dialog.setIndex(this.dialogStack.length); dialog.setIndex(1000 + this.dialogStack.length);
// Hide last dialog in queue // Hide last dialog in queue
if (this.dialogStack.length > 0) { if (this.dialogStack.length > 0) {

View File

@ -53,7 +53,7 @@ if (window.coreThreadLoadedCb) {
// } // }
console.log( console.log(
`%cshapez.io %c\n© 2020 Tobias Springer IT Solutions\nCommit %c${G_BUILD_COMMIT_HASH}%c on %c${new Date( `%cshapez.io %c\n© 2022 tobspr Games\nCommit %c${G_BUILD_COMMIT_HASH}%c on %c${new Date(
G_BUILD_TIME G_BUILD_TIME
).toLocaleString()}\n`, ).toLocaleString()}\n`,
"font-size: 35px; font-family: Arial;font-weight: bold; padding: 10px 0;", "font-size: 35px; font-family: Arial;font-weight: bold; padding: 10px 0;",

View File

@ -43,7 +43,6 @@ export class ModLoader {
if (G_IS_DEV || G_IS_STANDALONE) { if (G_IS_DEV || G_IS_STANDALONE) {
let exports = {}; let exports = {};
const modules = require.context("../", true, /\.js$/); const modules = require.context("../", true, /\.js$/);
Array.from(modules.keys()).forEach(key => { Array.from(modules.keys()).forEach(key => {
// @ts-ignore // @ts-ignore
const module = modules(key); const module = modules(key);

View File

@ -153,7 +153,7 @@ export class MainMenuState extends GameState {
hasMods hasMods
? ` ? `
<div class="modsList"> <div class="modsOverview">
<div class="header"> <div class="header">
<h3>${T.mods.title}</h3> <h3>${T.mods.title}</h3>
<button class="styledButton editMods"></button> <button class="styledButton editMods"></button>
@ -226,7 +226,7 @@ export class MainMenuState extends GameState {
</div> </div>
<div class="author">${T.mainMenu.madeBy.replace( <div class="author">${T.mainMenu.madeBy.replace(
"<author-link>", "<author-link>",
'<a class="producerLink" target="_blank">Tobias Springer</a>' '<a class="producerLink" target="_blank">tobspr Games</a>'
)}</div> )}</div>
</div> </div>