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 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'features/globalSettings') 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(){ -- cgit