From 1c86e20162f4d9aec97ab5154b4303ab63d1aaa7 Mon Sep 17 00:00:00 2001 From: Blockzilla101 Date: Wed, 29 Jun 2022 17:27:44 +0500 Subject: [PATCH 1/2] Revert "v7 gaming" This reverts commit 47fabdc93bcd3dd867127662d26dc80a436c782a. --- bundles/bundle.properties | 1 + mod.json | 3 +- scripts/button.js | 66 +++++++++++++++++++++++++++++++++++++++ scripts/main.js | 8 +++-- 4 files changed, 74 insertions(+), 4 deletions(-) create mode 100644 bundles/bundle.properties create mode 100644 scripts/button.js diff --git a/bundles/bundle.properties b/bundles/bundle.properties new file mode 100644 index 0000000..743770b --- /dev/null +++ b/bundles/bundle.properties @@ -0,0 +1 @@ +console = Console diff --git a/mod.json b/mod.json index 51696f6..7e992a4 100644 --- a/mod.json +++ b/mod.json @@ -1,8 +1,7 @@ { "name": "dev-mode", "displayName": "Developer Mode", - "author": "deltanedas", - "description": "Lets you type into the console.\nPress [stat]F8[] to open.", + "description": "Lets you type into the console.\nPress [stat]F8[] to open on PC.\n[stat]Requires [#00aaff]DeltaNedas/ui-lib[] on mobile.", "version": "3.3.2", "hidden": true, "minGameVersion": "136", diff --git a/scripts/button.js b/scripts/button.js new file mode 100644 index 0000000..ca21975 --- /dev/null +++ b/scripts/button.js @@ -0,0 +1,66 @@ +/* + Copyright (c) DeltaNedas 2020 + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +const ui = require("ui-lib/library"); + +// Android also doesn't load the logger automatically in 6.0 +Vars.loadLogger(); + +var shown = false; + +const toggle = () => { + shown = !shown; +}; + +/* button for poor mobile users */ +ui.addButton("console", "terminal", toggle); + +/* or if you don't want to start a game */ +ui.addMenuButton("$console", "terminal", toggle); + +// Always show console - even outside of a game +ui.addArea("console", { + init(console) { + Core.scene.add(console.bottom().left()); + console.visibility = () => shown; + }, + post() {}, + + group: null +}); + +ui.addTable("console", "console", console => { + console.bottom().left(); + console.background(Tex.buttonTrans); + console.defaults().margin(8); + + // Clear the console + console.button(Icon.refresh, Styles.clearPartiali, 40, () => { + Vars.ui.scriptfrag.clearMessages(); + }); + + // Prompt for a line of JS + console.button(Icon.terminal, Styles.clearPartiali, 40, () => { + Vars.ui.scriptfrag.toggle(); + }).marginRight(8); + + console.add("$console").marginLeft(8); +}); + +ui.onLoad(() => { + Vars.ui.scriptfrag.visibility = () => shown; +}); diff --git a/scripts/main.js b/scripts/main.js index 995d240..e8461f0 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -8,11 +8,15 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program. If not, see . + along with this program. If not, see . */ Vars.enableConsole = true; + +if (Vars.mobile) { + require("button"); +} From 4eaf79fe554ace4ceed138913dd118a6445dd1b0 Mon Sep 17 00:00:00 2001 From: Blockzilla101 Date: Wed, 29 Jun 2022 17:44:57 +0500 Subject: [PATCH 2/2] v7 --- scripts/button.js | 10 +++++----- scripts/main.js | 2 -- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/scripts/button.js b/scripts/button.js index ca21975..b969beb 100644 --- a/scripts/button.js +++ b/scripts/button.js @@ -49,18 +49,18 @@ ui.addTable("console", "console", console => { console.defaults().margin(8); // Clear the console - console.button(Icon.refresh, Styles.clearPartiali, 40, () => { - Vars.ui.scriptfrag.clearMessages(); + console.button(Icon.refresh, Styles.cleari, 40, () => { + Vars.ui.consolefrag.clearMessages(); }); // Prompt for a line of JS - console.button(Icon.terminal, Styles.clearPartiali, 40, () => { - Vars.ui.scriptfrag.toggle(); + console.button(Icon.terminal, Styles.cleari, 40, () => { + Vars.ui.consolefrag.toggle(); }).marginRight(8); console.add("$console").marginLeft(8); }); ui.onLoad(() => { - Vars.ui.scriptfrag.visibility = () => shown; + Vars.ui.consolefrag.visibility = () => shown; }); diff --git a/scripts/main.js b/scripts/main.js index e8461f0..75a54eb 100644 --- a/scripts/main.js +++ b/scripts/main.js @@ -15,8 +15,6 @@ along with this program. If not, see . */ -Vars.enableConsole = true; - if (Vars.mobile) { require("button"); }