diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-02-04 16:10:29 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-02-04 16:10:29 +0800 |
commit | 7882632751f1132e67dcee92389e82317b8db123 (patch) | |
tree | 833899d85393b046304ffb2f5db50e52ddddd005 /features/soopyGui/index.js | |
parent | f724d7e9f5ec6d5e2f004a240f5117a41a752dc8 (diff) | |
download | SoopyV2-7882632751f1132e67dcee92389e82317b8db123.tar.gz SoopyV2-7882632751f1132e67dcee92389e82317b8db123.tar.bz2 SoopyV2-7882632751f1132e67dcee92389e82317b8db123.zip |
maby fix buttons like settings not showing up in /soopyv2 menu
Diffstat (limited to 'features/soopyGui/index.js')
-rw-r--r-- | features/soopyGui/index.js | 34 |
1 files changed, 8 insertions, 26 deletions
diff --git a/features/soopyGui/index.js b/features/soopyGui/index.js index 45e97a6..13a8813 100644 --- a/features/soopyGui/index.js +++ b/features/soopyGui/index.js @@ -9,6 +9,7 @@ import ButtonWithArrow from "../../../guimanager/GuiElement/ButtonWithArrow"; import SoopyMouseClickEvent from "../../../guimanager/EventListener/SoopyMouseClickEvent"; import SoopyOpenGuiEvent from "../../../guimanager/EventListener/SoopyOpenGuiEvent"; import SoopyGui2 from "../../../guimanager/SoopyGui"; +import categoryManager from "./categoryManager"; class SoopyGui extends Feature { @@ -17,7 +18,6 @@ class SoopyGui extends Feature { this.gui = undefined - this.pages = [] this.currentPage = 0 this.backButton = undefined @@ -78,7 +78,7 @@ class SoopyGui extends Feature { this.gui.open() if(page){ - this.pages.forEach(p=>{ + this.getPages().forEach(p=>{ if(p.name.replace(/ /g, "_").toLowerCase() === page.toLowerCase()){ this.clickedOpen(p, false) } @@ -86,20 +86,8 @@ class SoopyGui extends Feature { } } - addCategory(category){ - // this.pages = this.pages.filter(a=>a.name!==category.name) - - this.pages.push(category) - this.sortPages() - - this.updateButtons() - } - - deleteCategory(category){ - this.pages = this.pages.filter(a=>a!==category) - this.sortPages() - - this.updateButtons() + getPages(){ + return categoryManager.arr } updateButtons(){ @@ -107,7 +95,7 @@ class SoopyGui extends Feature { this.buttonListElm.children = [] - this.pages.forEach((p, i)=>{ + this.getPages().forEach((p, i)=>{ 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) @@ -137,18 +125,11 @@ class SoopyGui extends Feature { category.onOpen() } - sortPages(){ - this.pages = this.pages.sort((a, b)=>{ - return b.priority - a.priority - }) - } - onDisable(){ this.gui.delete() this.gui = undefined - this.pages = [] this.currentPage = 0 this.backButton = undefined this.activePages = [] @@ -169,7 +150,7 @@ class SoopyGui extends Feature { this.currentPage = pageNum - this.pages.forEach((p)=>{ + this.getPages().forEach((p)=>{ Object.values(p.pages).forEach((e, i)=>{ e.location.location.x.set(i-pageNum+1, animate?500:0) }) @@ -185,9 +166,10 @@ class SoopyGui extends Feature { if(pageNum===0){ this.currCategory = undefined this.closeSidebarPage() + this.updateButtons() } - this.pages.forEach((p)=>{ + this.getPages().forEach((p)=>{ Object.values(p.pages).forEach((e, i)=>{ e.location.location.x.set(i-pageNum+1, animate?500:0) }) |