From ce112c714b740c0e9e958f2016091bd3f01d7ba6 Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Tue, 23 Nov 2021 21:41:31 +0800 Subject: Add onboarding menu --- features/globalSettings/index.js | 25 ++++++++++++++++++++----- features/soopyGui/index.js | 2 +- 2 files changed, 21 insertions(+), 6 deletions(-) (limited to 'features') diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index eb1e088..58e84e4 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -41,16 +41,31 @@ class Hud extends Feature { this.privacySettings = [this.reportErrorsSetting, this.sendChatSetting] - // this.GuiPage = new FirstLoadingPage(this) + this.firstLoadPageData = JSON.parse(FileLib.read("soopyAddonsData", "soopyv2firstloaddata.json") || "{}") || {} + + this.GuiPage = new FirstLoadingPage(this) soopyV2Server.reportErrorsSetting = this.reportErrorsSetting this.registerChat("&aYour new API key is &r&b${key}&r", this.newKey) - // new Thread(()=>{ - // Thread.sleep(1000) //TODO: DO ON 2nd WORLDLOAD - // ChatLib.command("soopyv2 first_load_thing", true)//TODO: ONLY RUN ON FIRST INSTALL - // }).start() + this.registerEvent("worldLoad", this.worldLoad) + + this.ranFirstLoadThing = false + + setTimeout(()=>{ + this.worldLoad.call(this) + }, 1000) + } + + worldLoad(){ + if(!this.ranFirstLoadThing && World && !this.firstLoadPageData.shown){ + ChatLib.command("soopyv2 first_load_thing", true) + this.ranFirstLoadThing = true + this.firstLoadPageData.shown = true + this.firstLoadPageData.version = 1 + FileLib.write("soopyAddonsData", "soopyv2firstloaddata.json", JSON.stringify(this.firstLoadPageData)) + } } findKey(){ diff --git a/features/soopyGui/index.js b/features/soopyGui/index.js index aa4f691..904176a 100644 --- a/features/soopyGui/index.js +++ b/features/soopyGui/index.js @@ -98,7 +98,7 @@ class SoopyGui extends Feature { this.buttonListElm.children = [] this.pages.forEach((p, i)=>{ - let settingsButton = new ButtonWithArrow().setText("§0" + p.name).setLocation(0, 0.25*i, 1, 0.2) + let settingsButton = new ButtonWithArrow().setText("§0" + p.name).setLocation(0, 0.225*i, 1, 0.2) settingsButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{this.clickedOpen(p)})) this.buttonListElm.addChild(settingsButton) }) -- cgit