diff options
-rw-r--r-- | featureClass/featureManager.js | 7 | ||||
-rw-r--r-- | features/dungeonMap/metadata.json | 6 | ||||
-rw-r--r-- | features/fragBot/index.js | 1 | ||||
-rw-r--r-- | features/globalSettings/firstLoadPages.js | 44 | ||||
-rw-r--r-- | features/globalSettings/index.js | 2 | ||||
-rw-r--r-- | features/soopyGui/index.js | 1 | ||||
-rw-r--r-- | features/stat_next_to_name/index.js | 2 | ||||
-rw-r--r-- | features/streamsGUI/index.js | 37 |
8 files changed, 86 insertions, 14 deletions
diff --git a/featureClass/featureManager.js b/featureClass/featureManager.js index d52d892..538bd91 100644 --- a/featureClass/featureManager.js +++ b/featureClass/featureManager.js @@ -495,6 +495,7 @@ class FeatureManager { } } -const featureManager = new FeatureManager(); - -export default featureManager;
\ No newline at end of file +if(!global.soopyv2featuremanagerthing){ + global.soopyv2featuremanagerthing = new FeatureManager() +} +export default global.soopyv2featuremanagerthing
\ No newline at end of file diff --git a/features/dungeonMap/metadata.json b/features/dungeonMap/metadata.json index 2d0df77..7d44ae4 100644 --- a/features/dungeonMap/metadata.json +++ b/features/dungeonMap/metadata.json @@ -1,8 +1,8 @@ { "name": "Dungeon Map", - "description": "A really good dungeon map", - "isHidden": false, + "description": "A really good dungeon map (IN PROGRESS)", + "isHidden": true, "isTogglable": true, - "defaultEnabled": true, + "defaultEnabled": false, "sortA": 1 }
\ No newline at end of file diff --git a/features/fragBot/index.js b/features/fragBot/index.js index e3a571f..48bfd87 100644 --- a/features/fragBot/index.js +++ b/features/fragBot/index.js @@ -17,6 +17,7 @@ class FragBot extends Feature { this.commandQueue = [] new SettingBase("To host a fragbot use /fragbot", "", undefined, "host_fragbot_info", this) + new SettingBase("NOTE: All this does atm is accept party invites", "More features for this coming soon", true, "stat_next_to_name_description", this) this.uploadToWebsite = new ToggleSetting("Advertise fragbot status", "Will show up as a fragbot in other peoples fragbot lists", true, "advertise_fragbot", this) diff --git a/features/globalSettings/firstLoadPages.js b/features/globalSettings/firstLoadPages.js index eebd5be..6185bd5 100644 --- a/features/globalSettings/firstLoadPages.js +++ b/features/globalSettings/firstLoadPages.js @@ -2,6 +2,8 @@ import SoopyMouseClickEvent from "../../../guimanager/EventListener/SoopyMouseCl import ButtonWithArrow from "../../../guimanager/GuiElement/ButtonWithArrow"; import SoopyGuiElement from "../../../guimanager/GuiElement/SoopyGuiElement"; import SoopyTextElement from "../../../guimanager/GuiElement/SoopyTextElement"; +import Notification from "../../../guimanager/Notification"; +import FeatureManager from "../../featureClass/featureManager"; import FirstLoadPage from "./firstLoadPage"; class WelcomePage extends FirstLoadPage{ @@ -89,4 +91,44 @@ class HowToOpenMenuPage extends FirstLoadPage{ } } -export default [new WelcomePage(), new ApiKeyPage(), new HowToOpenMenuPage()]
\ No newline at end of file +class DisableFeatures extends FirstLoadPage{ + constructor(){ + super() + + this.addChild(new SoopyTextElement().setText("§0Lastly do you want to disable all features?").setLocation(0.1, 0.1,0.8,0.3).setMaxTextScale(10)); + + this.addChild(new SoopyTextElement().setText("§7(So you can only enable the ones you want)").setLocation(0.1, 0.3,0.8,0.1).setMaxTextScale(10)); + + let openSettingsButton = new ButtonWithArrow().setText("§0Disable all features").setLocation(0.35, 0.5,0.3,0.2) + + openSettingsButton.addEvent(new SoopyMouseClickEvent().setHandler(()=>{ + + new Thread(()=>{ + new Notification("Disabling features...", []) + Object.keys(FeatureManager.featureMetas).forEach((f)=>{ + let meta = FeatureManager.featureMetas[f] + + let isHidden = meta.isHidden + if(typeof isHidden === "string"){ + return + } + if(isHidden) return + if(!meta.isTogglable) return + + FeatureManager.featureSettingsData[f].enabled = false + FeatureManager.featureSettingsDataLastUpdated = true + + if(FeatureManager.isFeatureLoaded(f)){ + FeatureManager.unloadFeature(f) + } + }) + new Notification("Disabled all features!", []) + }).start() + })) + + this.addChild(openSettingsButton); + + } +} + +export default [new WelcomePage(), new ApiKeyPage(), new DisableFeatures(), new HowToOpenMenuPage()]
\ No newline at end of file diff --git a/features/globalSettings/index.js b/features/globalSettings/index.js index 58e84e4..88a91ea 100644 --- a/features/globalSettings/index.js +++ b/features/globalSettings/index.js @@ -33,7 +33,7 @@ class Hud extends Feature { this.findApiKey = new ButtonSetting("Attempt to load api key from other mods", "This will scan other mods configs to attempt to find your key", "find_key", this, "Click!", this.findKey, undefined) - 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.notifyNewVersion = new ToggleSetting("Notify when there is a new update", "Will notify you when there is a new version of soopyv2 avalible for download", false, "notify_update", this) this.reportErrorsSetting = new ToggleSetting("Send module errors to soopy server", "This will allow me to more effectivly fix them", false, "privacy_send_errors", this) diff --git a/features/soopyGui/index.js b/features/soopyGui/index.js index 904176a..8dc52de 100644 --- a/features/soopyGui/index.js +++ b/features/soopyGui/index.js @@ -191,6 +191,7 @@ class SoopyGui extends Feature { this.mainWindowElement.location.location.x.set(0.075, 500) // this.sidebarPage.visable = true + this.sidebarPage.clearChildren() this.sidebarPage.addChild(child) } diff --git a/features/stat_next_to_name/index.js b/features/stat_next_to_name/index.js index b7addb9..ee8d7d2 100644 --- a/features/stat_next_to_name/index.js +++ b/features/stat_next_to_name/index.js @@ -1,6 +1,7 @@ /// <reference types="../../../CTAutocomplete" /> /// <reference lib="es2015" /> import Feature from "../../featureClass/class"; +import SettingBase from "../settings/settingThings/settingBase"; class StatNextToName extends Feature { constructor() { @@ -8,6 +9,7 @@ class StatNextToName extends Feature { } onEnable(){ + new SettingBase("NOTE: this does not work", "COMING SOON(tm) (sooner than sb 1.0)", true, "stat_next_to_name_description", this) } onDisable(){ diff --git a/features/streamsGUI/index.js b/features/streamsGUI/index.js index aaf5ab7..b62bdcd 100644 --- a/features/streamsGUI/index.js +++ b/features/streamsGUI/index.js @@ -8,6 +8,8 @@ import SoopyMarkdownElement from "../../../guimanager/GuiElement/SoopyMarkdownEl import SoopyImageElement from "../../../guimanager/GuiElement/SoopyImageElement"; import SoopyGuiElement from "../../../guimanager/GuiElement/SoopyGuiElement"; import SoopyMouseClickEvent from "../../../guimanager/EventListener/SoopyMouseClickEvent"; +import ButtonWithArrow from "../../../guimanager/GuiElement/ButtonWithArrow"; +import BoxWithText from "../../../guimanager/GuiElement/BoxWithText"; class StreamsGui extends Feature { constructor() { @@ -75,12 +77,34 @@ class StreamPage extends GuiPage { this.openSidebarPage(sidebar) - /* - TODO: finish this + sidebar.addChild(new SoopyTextElement().setText("§0"+data.user_name).setMaxTextScale(3).setLocation(0.1, 0.05, 0.8, 0.1)) - - Open stream in browser button - - show live chat - */ + let title = new SoopyMarkdownElement().setText("§0"+data.title).setLocation(0.1, 0.15, 0.8, 0.1) + sidebar.addChild(title) + + let image = new SoopyImageElement().setImage(data.image).setLocation(0.1, 0.15+title.getHeight(), 0.8, 0.4).loadHeightFromImage() + sidebar.addChild(image) + + let button = new ButtonWithArrow().setText("§0Watch on Twitch").setLocation(0.1, 0.15+image.location.size.y.get()+title.getHeight(), 0.8, 0.1) + sidebar.addChild(button) + + button.addEvent(new SoopyMouseClickEvent().setHandler(()=>{ + java.awt.Desktop.getDesktop().browse( + new java.net.URI("https://twitch.tv/" + data.user_login) + ); + })) + + let language + if(data.language){ + language = new BoxWithText().setText("§0Language: "+data.language).setLocation(0.3, 0.25+image.location.size.y.get()+title.getHeight(), 0.4, 0.1) + + sidebar.addChild(language) + } + + image.onImageHeightChange(()=>{ + button.location.location.y.set(0.15+image.location.size.y.get()+title.getHeight()) + if(language) language.location.location.y.set(0.25+image.location.size.y.get()+title.getHeight()) + }, this) } onOpen(){ @@ -124,7 +148,8 @@ class StreamElement extends SoopyBoxElement { this.channelElement.setText((twitch ? "§0"+stream.user_name : "§0"+stream.channelTitle) + (twitch?"&7 - " + stream.viewer_count + " viewer"+(stream.viewer_count!==1?"s":""):"")) - this.channelImg.setImage(twitch ? `https://static-cdn.jtvnw.net/previews-ttv/live_user_${stream.user_login}-640x360.jpg` : stream.thumbnails.high.url) + this.streamData.image = twitch ? `https://static-cdn.jtvnw.net/previews-ttv/live_user_${stream.user_login}-640x360.jpg` : stream.thumbnails.high.url + this.channelImg.setImage(this.streamData.image) return this } |