diff options
Diffstat (limited to 'features')
-rw-r--r-- | features/globalSettings/firstLoadPage.js | 40 | ||||
-rw-r--r-- | features/globalSettings/firstLoadPages.js | 62 | ||||
-rw-r--r-- | features/globalSettings/index.js | 67 | ||||
-rw-r--r-- | features/soopyGui/GuiPage.js | 2 | ||||
-rw-r--r-- | features/soopyGui/index.js | 15 |
5 files changed, 179 insertions, 7 deletions
diff --git a/features/globalSettings/firstLoadPage.js b/features/globalSettings/firstLoadPage.js new file mode 100644 index 0000000..429c867 --- /dev/null +++ b/features/globalSettings/firstLoadPage.js @@ -0,0 +1,40 @@ +import SoopyMouseClickEvent from "../../../guimanager/EventListener/SoopyMouseClickEvent" +import ButtonWithArrow from "../../../guimanager/GuiElement/ButtonWithArrow" +import SoopyGuiElement from "../../../guimanager/GuiElement/SoopyGuiElement" + +class FirstLoadPage extends SoopyGuiElement { + constructor(){ + super() + + this.setLocation(0,0,1,1) + + this.guiPage = undefined + } + + setLoc(addBack, addNext){ + if(addBack){ + let backButton = new ButtonWithArrow().setLocation(0.05, 0.85, 0.2, 0.1).setDirectionRight(false).setText("§0Back") + + backButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{ + this.guiPage.prevPage() + })) + + this.addChild(backButton) + } + if(addNext){ + let nextButton = new ButtonWithArrow().setLocation(0.75, 0.85, 0.2, 0.1).setText("§0Next") + + nextButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{ + this.guiPage.nextPage() + })) + + this.addChild(nextButton) + } + } + + load(){ + + } +} + +export default FirstLoadPage
\ No newline at end of file diff --git a/features/globalSettings/firstLoadPages.js b/features/globalSettings/firstLoadPages.js new file mode 100644 index 0000000..c7a90f0 --- /dev/null +++ b/features/globalSettings/firstLoadPages.js @@ -0,0 +1,62 @@ +import SoopyMouseClickEvent from "../../../guimanager/EventListener/SoopyMouseClickEvent"; +import ButtonWithArrow from "../../../guimanager/GuiElement/ButtonWithArrow"; +import SoopyGuiElement from "../../../guimanager/GuiElement/SoopyGuiElement"; +import SoopyTextElement from "../../../guimanager/GuiElement/SoopyTextElement"; +import FirstLoadPage from "./firstLoadPage"; + +class WelcomePage extends FirstLoadPage{ + constructor(){ + super() + + this.addChild(new SoopyTextElement().setText("§0Welcome to SoopyAddons V2!").setLocation(0.1, 0.05,0.8,0.1).setMaxTextScale(10)); + + this.addChild(new SoopyTextElement().setText("§7First lets get privacy settings out of the way.").setLocation(0.1, 0.15,0.8,0.075).setMaxTextScale(10)); + + this.settingsArea = new SoopyGuiElement().setLocation(0.1, 0.25,0.8,0.75); + + this.addChild(this.settingsArea); + } + + load(){ + let y = 0 + + this.guiPage.mainThing.privacySettings.forEach(setting => { + setting = setting.getGuiObject() + + setting.location.location.y.set(y, 0) + + this.settingsArea.addChild(setting); + + y += 0.045+setting.location.size.y.get() + }) + } +} + +class HowToOpenMenuPage extends FirstLoadPage{ + constructor(){ + super() + + this.addChild(new SoopyTextElement().setText("§0Your all set!").setLocation(0.1, 0.1,0.8,0.3).setMaxTextScale(10)); + + this.addChild(new SoopyTextElement().setText("§7To change any settings, or to access this menu again run §2/soopyaddons§7.").setLocation(0.1, 0.3,0.8,0.1).setMaxTextScale(10)); + + let openSettingsButton = new ButtonWithArrow().setText("§0Open settings").setLocation(0.1, 0.5,0.3,0.2).setDirectionRight(false) + + openSettingsButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{ + ChatLib.command("soopyv2", true) + })) + + this.addChild(openSettingsButton); + + let closeButton = new ButtonWithArrow().setText("§0Close").setLocation(0.6, 0.5,0.3,0.2) + + closeButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{ + Client.currentGui.close() + })) + + this.addChild(closeButton); + + } +} + +export default [new WelcomePage(), new HowToOpenMenuPage()]
\ No newline at end of file diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index 422754f..04e3a20 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -4,6 +4,9 @@ import Feature from "../../featureClass/class"; import ButtonSetting from "../settings/settingThings/button"; import TextSetting from "../settings/settingThings/textSetting"; import ToggleSetting from "../settings/settingThings/toggle"; +import firstLoadPages from "./firstLoadPages"; +import GuiPage from "../soopyGui/GuiPage" +import SoopyTextElement from "../../../guimanager/GuiElement/SoopyTextElement"; class Hud extends Feature { constructor() { @@ -13,8 +16,8 @@ class Hud extends Feature { } initVariables(){ - this.apiKeySetting = undefined + this.GuiPage = undefined } onEnable(){ @@ -23,7 +26,20 @@ class Hud extends Feature { this.notifyNewVersion = new ToggleSetting("Notify when there is a new update", "Will notify you when there is a new version of soopyv2 avalible for download", true, "notify_update", this) //TODO: Make false by default when uploaded on ct website + + // this.reportErrorsSetting = new ToggleSetting("Send module errors to soopy server", "This will allow me to more effectivly fix them", false, "privacy_send_errors", this) + // this.sendChatSetting = new ToggleSetting("Send (hashed) chat messages to soopy server", "This will allow the hide spam feature to detect messages that are spam", false, "privacy_send_chat", this) + + // this.privacySettings = [this.reportErrorsSetting, this.sendChatSetting] + + // this.GuiPage = new FirstLoadingPage(this) + this.registerChat("&aYour new API key is &r&b${key}&r", this.newKey) + + // new Thread(()=>{ + // Thread.sleep(1000) + // ChatLib.command("soopyv2 first_load_thing", true)//TODO: ONLY RUN ON FIRST INSTALL + // }).start() } verifyKey(){ @@ -49,6 +65,55 @@ class Hud extends Feature { } } +class FirstLoadingPage extends GuiPage { + constructor(mainThing){ + super(-10) + + this.showBackButton = false + + this.name = "First load thing" + + this.mainThing = mainThing + + this.pageThings = [] + + firstLoadPages.forEach((page, i)=>{ + let newPage = this.newPage() + + newPage.addChild(page) + + page.setLoc(i!==0, i!== firstLoadPages.length-1) + page.guiPage = this + + this.pageThings.push(newPage) + }) + + this.pageNum = 0 + + this.finaliseLoading() + } + + nextPage(){ + this.pageNum++ + + this.goToPage(this.pageNum) + } + + prevPage(){ + this.pageNum-- + + this.goToPage(this.pageNum) + } + + onOpen(){ + this.pageNum = 0 + + firstLoadPages.forEach((page, i)=>{ + page.load() + }) + } +} + module.exports = { class: new Hud() }
\ No newline at end of file diff --git a/features/soopyGui/GuiPage.js b/features/soopyGui/GuiPage.js index 09142d0..13778fe 100644 --- a/features/soopyGui/GuiPage.js +++ b/features/soopyGui/GuiPage.js @@ -9,6 +9,8 @@ class GuiPage{ this.name = "" this.pages = {} + + this.showBackButton = true } finaliseLoading(){ diff --git a/features/soopyGui/index.js b/features/soopyGui/index.js index 7248e12..2a70b8f 100644 --- a/features/soopyGui/index.js +++ b/features/soopyGui/index.js @@ -25,6 +25,8 @@ class SoopyGui extends Feature { this.currCategory = undefined this.activePages = [] this.lastClickedOpen = undefined + + this.activeCategory = undefined } onEnable(){ @@ -75,8 +77,8 @@ class SoopyGui extends Feature { if(page){ this.pages.forEach(p=>{ - if(p.name.toLowerCase() === page.toLowerCase()){ - this.clickedOpen(p) + if(p.name.replace(/ /g, "_").toLowerCase() === page.toLowerCase()){ + this.clickedOpen(p, false) } }) } @@ -101,7 +103,7 @@ class SoopyGui extends Feature { }) } - clickedOpen(category){ + clickedOpen(category, anim=true){ if(!this.lastClickedOpen)this.lastClickedOpen = 0 if(Date.now()-this.lastClickedOpen < 100) return //Stopping infinite loop where button getting reset causes click event to get fired again this.lastClickedOpen = Date.now() @@ -113,12 +115,13 @@ class SoopyGui extends Feature { this.mainWindowElement.addChild(this.backButton) this.activePages = category.pages + this.currCategory = category Object.values(this.activePages).forEach(p=>{ this.mainWindowElement.addChild(p) }) - this.goToPageNum(1, true) + this.goToPageNum(1, anim) category.onOpen() } @@ -162,7 +165,7 @@ class SoopyGui extends Feature { }) this.categoryPage.location.location.x.set(-pageNum, animate?1000:0) - this.backButton.location.location.y.set(pageNum === 0?-0.2:0, animate?1000:0) + this.backButton.location.location.y.set((pageNum === 0 || !this.currCategory.showBackButton)?-0.2:0, animate?1000:0) } goToPageNum(pageNum, animate=true){ if(pageNum<0) return; @@ -180,7 +183,7 @@ class SoopyGui extends Feature { }) this.categoryPage.location.location.x.set(-pageNum, animate?1000:0) - this.backButton.location.location.y.set(pageNum === 0?-0.2:0, animate?1000:0) + this.backButton.location.location.y.set((pageNum === 0 || !this.currCategory.showBackButton)?-0.2:0, animate?1000:0) } openSidebarPage(child){ this.sidebarPage.location.location.x.set(0.625, 500) |