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:
parent
eba9163a33
commit
b39f48ebfb
@ -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,
|
||||
|
||||
@ -143,7 +143,7 @@ function gulptasksStandalone($, gulp) {
|
||||
|
||||
packager({
|
||||
dir: tempDestBuildDir,
|
||||
appCopyright: "Tobias Springer",
|
||||
appCopyright: "tobspr Games",
|
||||
appVersion: getVersion(),
|
||||
buildVersion: "1.0.0",
|
||||
arch,
|
||||
|
||||
@ -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() +
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
`);
|
||||
47
mod_examples/custom_css.js
Normal file
47
mod_examples/custom_css.js
Normal file
File diff suppressed because one or more lines are too long
57
mod_examples/replace_builtin_sprites.js
Normal file
57
mod_examples/replace_builtin_sprites.js
Normal file
File diff suppressed because one or more lines are too long
@ -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": {
|
||||
|
||||
@ -293,7 +293,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
.modsList {
|
||||
.modsOverview {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
|
||||
@ -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."
|
||||
|
||||
@ -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 */
|
||||
};
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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;",
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user