1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2025-12-13 10:11: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" }) {
browserSync.init({
server: [buildFolder, path.join(baseDir, "src", "js")],
server: [buildFolder, path.join(baseDir, "mod_examples")],
port: 3005,
ghostMode: {
clicks: false,

View File

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

View File

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

View File

@ -213,20 +213,26 @@ registerMod(() => {
this.signals.stateEntered.add(state => {
if (state.key === "MainMenuState") {
const element = document.createElement("div");
element.innerText = "Hello World from mod!";
element.id = "demo_mod_hello_world_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(`
#demo_mod_hello_world_element {
position: fixed;
top: 10px;
left: 10px;
position: absolute;
top: calc(10px * var(--ui-scale));
left: calc(10px * var(--ui-scale));
color: red;
z-index: 999;
font-size: 50px;
z-index: 0;
}
`);

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

View File

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

View File

@ -15,8 +15,8 @@
<meta name="theme-color" content="#393747" />
<!-- seo -->
<meta name="copyright" content="2020 Tobias Springer IT Solutions and .io Games" />
<meta name="author" content="Tobias Springer, tobias.springer1@gmail.com" />
<meta name="copyright" content="2022 tobspr Games" />
<meta name="author" content="tobspr Games - tobspr.io" />
<meta
name="description"
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,
// -----------------------------------------------------------------------------------
// 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 */
};

View File

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

View File

@ -53,7 +53,7 @@ if (window.coreThreadLoadedCb) {
// }
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
).toLocaleString()}\n`,
"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) {
let exports = {};
const modules = require.context("../", true, /\.js$/);
Array.from(modules.keys()).forEach(key => {
// @ts-ignore
const module = modules(key);

View File

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