From ffe1f69f3ca22579241925f962e3213a8fd26244 Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Wed, 5 Jan 2022 01:33:18 +0800 Subject: museum gui and senither gui optimisations --- features/betterGuis/museumGui.js | 34 +++++++++++++++++++++++++++++++--- features/senitherGui/index.js | 10 ++++++---- 2 files changed, 37 insertions(+), 7 deletions(-) diff --git a/features/betterGuis/museumGui.js b/features/betterGuis/museumGui.js index dad8abf..f71cd3e 100644 --- a/features/betterGuis/museumGui.js +++ b/features/betterGuis/museumGui.js @@ -1,5 +1,6 @@ import { SoopyGui, SoopyRenderEvent } from "../../../guimanager" import SoopyContentChangeEvent from "../../../guimanager/EventListener/SoopyContentChangeEvent" +import SoopyHoverChangeEvent from "../../../guimanager/EventListener/SoopyHoverChangeEvent" import SoopyKeyPressEvent from "../../../guimanager/EventListener/SoopyKeyPressEvent" import SoopyMouseClickEvent from "../../../guimanager/EventListener/SoopyMouseClickEvent" import SoopyOpenGuiEvent from "../../../guimanager/EventListener/SoopyOpenGuiEvent" @@ -235,7 +236,7 @@ class MuseumGui { this.donateTitleBox.addChild(donateTitle) this.mainPage.addChild(this.donateTitleBox) - this.donateBox = new SoopyBoxElement().setLocation(0.5+widthPer*3/2+0.025, 0.35, 0.5-widthPer*1.5-0.05, 0.6).setScrollable(true) + this.donateBox = new SoopyBoxElement().setLocation(0.5+widthPer*3/2+0.025, 0.35, 0.5-widthPer*1.5-0.05, 0.6).setScrollable(true).enableFrameBuffer() this.mainPage.addChild(this.donateBox) this.favoriteTitleBox = new SoopyBoxElement().setLocation(0.025, 0.25, 0.5-widthPer*1.5-0.05, 0.075) @@ -244,12 +245,23 @@ class MuseumGui { this.favoriteTitleBox.addChild(favoriteTitle) this.mainPage.addChild(this.favoriteTitleBox) - this.favoriteBox = new SoopyBoxElement().setLocation(0.025, 0.35, 0.5-widthPer*1.5-0.05, 0.6).setScrollable(true) + this.favoriteBox = new SoopyBoxElement().setLocation(0.025, 0.35, 0.5-widthPer*1.5-0.05, 0.6).setScrollable(true).enableFrameBuffer() this.mainPage.addChild(this.favoriteBox) - this.itemsBox = new SoopyBoxElement().setLocation(0.5-widthPer*3/2, 0.35, widthPer*3, 0.6) + this.itemsBox = new SoopyBoxElement().setLocation(0.5-widthPer*3/2, 0.35, widthPer*3, 0.6).enableFrameBuffer() this.mainPage.addChild(this.itemsBox) + new Array(this.donateBox, this.favoriteBox).forEach((box, i)=>{ + box.addEvent(new SoopyHoverChangeEvent().setHandler((hovered)=>{ + if(hovered){ + box.disableFrameBuffer() + }else{ + box.enableFrameBuffer() + box.dirtyFrameBuffer(1000) + } + })) + }) + this.donateItems = [] this.confirm_temp = "" @@ -541,6 +553,8 @@ class MuseumGui { })) this.itemsBox.addChild(confirmButton) } + + this.itemsBox.dirtyFrameBuffer() } this.favoriteBox.visable = false @@ -568,6 +582,8 @@ class MuseumGui { })) this.donateBox.addChild(itemButton) }) + + this.donateBox.dirtyFrameBuffer() } showSearchItems(){ @@ -699,6 +715,8 @@ class MuseumGui { y+=0.135 } }) + + this.itemsBox.dirtyFrameBuffer() } regenItems(page2){ @@ -754,6 +772,8 @@ class MuseumGui { y+=0.135 } }) + + this.itemsBox.dirtyFrameBuffer() } addItemToFavorites(slot, page, page2, slotNum){ @@ -858,6 +878,8 @@ class MuseumGui { FileLib.write("soopyAddonsData","museumFavoriteData.json", JSON.stringify(this.favoriteItems)) }).start() } + + this.favoriteBox.dirtyFrameBuffer() } guiOpened(event){ @@ -884,11 +906,15 @@ class MuseumGui { event.gui = this.soopyGui.ctGui this.guiUpdated = true this.soopyGui.ctGui.open() + + this.itemsBox.dirtyFrameBuffer() } return } if(this.isInMuseum){ this.soopyGui.ctGui.open() + + this.itemsBox.dirtyFrameBuffer() }else{ if(name === "Your Museum" && !this.isInMuseum){ @@ -921,6 +947,8 @@ class MuseumGui { this.pageTitle.setText("§5"+name) this.tickMenu(true) + + this.itemsBox.dirtyFrameBuffer() } } } diff --git a/features/senitherGui/index.js b/features/senitherGui/index.js index ab80d0d..50bda18 100644 --- a/features/senitherGui/index.js +++ b/features/senitherGui/index.js @@ -16,6 +16,7 @@ import SoopyHoverChangeEvent from "../../../guimanager/EventListener/SoopyHoverC import Dropdown from "../../../guimanager/GuiElement/Dropdown"; import SoopyMarkdownElement from "../../../guimanager/GuiElement/SoopyMarkdownElement" import ButtonWithArrow from "../../../guimanager/GuiElement/ButtonWithArrow"; +import SoopyRenderUpdateEvent from "../../../guimanager/EventListener/SoopyRenderUpdateEvent"; class SenitherGui extends Feature { constructor() { @@ -52,9 +53,8 @@ class SettingPage extends GuiPage { this.pages = [this.newPage(), this.newPage()] - this.pages[0].addEvent(new SoopyRenderEvent().setHandler(()=>{this.lastRender = Date.now()})) - - + this.pages[0].addEvent(new SoopyRenderUpdateEvent().setHandler(()=>{this.lastRender = Date.now()})) + let senitherTitle = new SoopyTextElement().setText("§0Senither Leaderboard").setMaxTextScale(3).setLocation(0.1, 0.05, 0.8, 0.1) this.pages[0].addChild(senitherTitle) @@ -433,7 +433,7 @@ class SettingPage extends GuiPage { this.loadFirstPageInformation() }).start() - let sidebar = new SoopyGuiElement().setLocation(0.1,0.1,0.8,0.8).setScrollable(true) + let sidebar = new SoopyGuiElement().setLocation(0.1,0.1,0.8,0.8).setScrollable(true).enableFrameBuffer() this.openSidebarPage(sidebar) let markdown = new SoopyMarkdownElement().setText("# NOTE: \nAll credit for the idea, design of this gui, and loading of data goes to Senither who made the original leaderboard (https://hypixel-leaderboard.senither.com/)\n\nThis is just a recode of that to allow for checking the leaderboard from in-game") sidebar.addChild(markdown) @@ -444,6 +444,8 @@ class SettingPage extends GuiPage { sidebar.setScrollable(true) + + sidebar.dirtyFrameBuffer(1000) } } -- cgit