-Added close button to settings menu

-Added launcher settings tab

-Added automatic launcher update checker
This commit is contained in:
ceikry 2021-08-10 15:14:48 -05:00
parent b8ca80cd3d
commit 9fd2d9710d
12 changed files with 223 additions and 55 deletions

View file

@ -40,6 +40,8 @@ object SettingsWindow : JFrame("Client Settings") {
val slayerColor = JTextField()
val slayerOpacity = JTextField()
val slayerEnabled = Checkbox()
val closeLauncherOnLaunch = Checkbox()
val checkForLauncherUpdates = Checkbox()
init {
isUndecorated = true
@ -56,6 +58,7 @@ object SettingsWindow : JFrame("Client Settings") {
addDebugTab()
addRightClickTab()
addMiscTab()
addLauncherSettingsTab()
val saveButton = ImgButton("/save_hi.png","/save_lo.png")
saveButton.onClick {
@ -64,6 +67,14 @@ object SettingsWindow : JFrame("Client Settings") {
}
saveButton.placeAt(width - 30, height - 30, 30, 30)
add(saveButton)
val closeButton = ImgButton("/close_hi.png", "/close_dark.png")
closeButton.onClick {
isVisible = false
Json.parse()
}
closeButton.placeAt(width - 25, 5, 20, 20)
add(closeButton)
}
fun addMiscTab() {
@ -71,13 +82,6 @@ object SettingsWindow : JFrame("Client Settings") {
pane.layout = BoxLayout(pane, BoxLayout.PAGE_AXIS)
val button = ImgButton("/misc.png", "/misc.png", false)
val label = BackgroundLabel("/messageBox.png", "Misc<br/>Settings")
label.placeAt(40, 30, 90, 56)
add(label)
button.onMouseEnter { label.isVisible = true }
button.onMouseExit { label.isVisible = false }
val xpTogglePanel = getThemedPanel(BorderLayout())
val xpDropPanel = getThemedPanel(BorderLayout())
val xpTrackPanel = getThemedPanel(BorderLayout())
@ -131,20 +135,13 @@ object SettingsWindow : JFrame("Client Settings") {
slayerOpacityPanel.add(slayerOpacity, BorderLayout.EAST)
pane.add(slayerOpacityPanel)
addTab(pane, button, getLabel("Theme: all lowercase"))
addTab(pane, button, getLabel("Misc Settings"))
}
fun addDebugTab(){
val pane = getThemedPanel()
pane.layout = BoxLayout(pane, BoxLayout.PAGE_AXIS)
val button = ImgButton("/settings.png", "/settings.png", false)
val label = BackgroundLabel("/messageBox.png", "Debug<br/>Settings")
label.placeAt(0,30, 90, 56)
add(label)
button.onMouseEnter { label.isVisible = true }
button.onMouseExit { label.isVisible = false }
val button = ImgButton("/debug_settings.png", "/debug_settings.png", false)
val itemDebug = getThemedPanel(BorderLayout())
val itemDebugLabel = getLabel("Item IDs Visible")
@ -166,7 +163,7 @@ object SettingsWindow : JFrame("Client Settings") {
npcDebug.add(npcDebugCheckbox, BorderLayout.EAST)
pane.add(npcDebug)
addTab(pane, button)
addTab(pane, button, getLabel("Debug Settings"))
}
fun addRightClickTab() {
@ -174,13 +171,6 @@ object SettingsWindow : JFrame("Client Settings") {
pane.layout = BoxLayout(pane, BoxLayout.PAGE_AXIS)
val button = ImgButton("/rightClick.png", "/rightClick.png", false)
val label = BackgroundLabel("/messageBox.png", "Rightclick<br/>Settings")
label.placeAt(5,30, 90, 56)
add(label)
button.onMouseEnter { label.isVisible = true }
button.onMouseExit { label.isVisible = false }
val rs3BorderPanel = getThemedPanel(BorderLayout())
val bgColorPanel = getThemedPanel(BorderLayout())
val bgOpacityPanel = getThemedPanel(BorderLayout())
@ -241,7 +231,34 @@ object SettingsWindow : JFrame("Client Settings") {
borderOpacityPanel.add(borderOpacity, BorderLayout.EAST)
pane.add(borderOpacityPanel)
addTab(pane, button, getLabel("Color: HEX || Opacity: 0-255"))
addTab(pane, button, getLabel("Rightclick Settings"))
}
fun addLauncherSettingsTab(){
val pane = getThemedPanel()
pane.layout = BoxLayout(pane, BoxLayout.PAGE_AXIS)
val button = ImgButton("/launcher_settings.png", "/launcher_settings.png", false)
val closeLauncherOnLaunchPanel = getThemedPanel(BorderLayout())
val closeLauncherOnLaunchLabel = getLabel("Close launcher when client starts")
val checkForUpdatePanel = getThemedPanel(BorderLayout())
val checkForUpdateLabel = getLabel("Notify me of launcher updates")
checkForLauncherUpdates.onClick {
checkForLauncherUpdates.isToggled = !checkForLauncherUpdates.isToggled
Settings.CHECK_FOR_UPDATES = checkForLauncherUpdates.isToggled
}
closeLauncherOnLaunchPanel.add(closeLauncherOnLaunchLabel, BorderLayout.WEST)
closeLauncherOnLaunchPanel.add(closeLauncherOnLaunch, BorderLayout.EAST)
pane.add(closeLauncherOnLaunchPanel)
pane.add(getSeparator())
checkForUpdatePanel.add(checkForUpdateLabel, BorderLayout.WEST)
checkForUpdatePanel.add(checkForLauncherUpdates, BorderLayout.EAST)
pane.add(checkForUpdatePanel)
addTab(pane, button, getLabel("Launcher Settings"))
}
fun addTab(content: JPanel, button: ImgButton, tabNote: JLabel = getLabel("")){
@ -251,7 +268,7 @@ object SettingsWindow : JFrame("Client Settings") {
content.isVisible = false
button.placeAt(buttonSpacer, 0, 30, 30)
button.onClick { activeTab = buttons.indexOf(button); updateVisibleTab() }
buttonSpacer += 35
buttonSpacer += 40
add(button)
button.isEnabled = false
buttons.add(button)
@ -265,6 +282,7 @@ object SettingsWindow : JFrame("Client Settings") {
activeTab = 0
updateVisibleTab()
Json.parse()
checkForLauncherUpdates.isToggled = Settings.CHECK_FOR_UPDATES
isVisible = true
}