mirror of
https://gitlab.com/2009scape/09launcher.git
synced 2025-12-09 16:45:54 -07:00
Launcher now has selectable profiles for live, testing, and local
This commit is contained in:
parent
6ea4c51ad2
commit
b5e4dc3d23
2 changed files with 30 additions and 0 deletions
|
|
@ -48,6 +48,16 @@ object Json {
|
||||||
launcher["closeOnClientLaunch"] = SettingsWindow.closeLauncherOnLaunch.isToggled
|
launcher["closeOnClientLaunch"] = SettingsWindow.closeLauncherOnLaunch.isToggled
|
||||||
launcher["notifyUpdates"] = Settings.CHECK_FOR_UPDATES
|
launcher["notifyUpdates"] = Settings.CHECK_FOR_UPDATES
|
||||||
|
|
||||||
|
val ip = when(SettingsWindow.profileMode.selectedIndex)
|
||||||
|
{
|
||||||
|
0 -> "play.2009scape.org"
|
||||||
|
1 -> "ryannathans.net"
|
||||||
|
else -> "localhost"
|
||||||
|
}
|
||||||
|
|
||||||
|
data["ip_management"] = ip
|
||||||
|
data["ip_address"] = ip
|
||||||
|
|
||||||
FileWriter(CONF).use { writer ->
|
FileWriter(CONF).use { writer ->
|
||||||
writer.write(data.toJSONString())
|
writer.write(data.toJSONString())
|
||||||
writer.flush()
|
writer.flush()
|
||||||
|
|
@ -106,6 +116,13 @@ object Json {
|
||||||
|
|
||||||
SettingsWindow.closeLauncherOnLaunch.isToggled = launcher.getOrDefault("closeOnClientLaunch", true) as Boolean
|
SettingsWindow.closeLauncherOnLaunch.isToggled = launcher.getOrDefault("closeOnClientLaunch", true) as Boolean
|
||||||
Settings.CHECK_FOR_UPDATES = launcher.getOrDefault("notifyUpdates", true) as Boolean
|
Settings.CHECK_FOR_UPDATES = launcher.getOrDefault("notifyUpdates", true) as Boolean
|
||||||
|
|
||||||
|
SettingsWindow.profileMode.selectedIndex = when(data["ip_management"])
|
||||||
|
{
|
||||||
|
"play.2009scape.org" -> 0
|
||||||
|
"ryannathans.net" -> 1
|
||||||
|
else -> 2
|
||||||
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
println("error parsing settings, replacing with defaults...")
|
println("error parsing settings, replacing with defaults...")
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ object SettingsWindow : JFrame("Client Settings") {
|
||||||
|
|
||||||
val xpDropModeOptions = arrayOf("instant","incremental")
|
val xpDropModeOptions = arrayOf("instant","incremental")
|
||||||
val xpTrackModeOptions = arrayOf("total xp","recent skill")
|
val xpTrackModeOptions = arrayOf("total xp","recent skill")
|
||||||
|
val profileOptions = arrayOf("Live","Testing","Local")
|
||||||
|
|
||||||
var tabs = ArrayList<JPanel>()
|
var tabs = ArrayList<JPanel>()
|
||||||
var buttons = ArrayList<ImgButton>()
|
var buttons = ArrayList<ImgButton>()
|
||||||
|
|
@ -47,6 +48,7 @@ object SettingsWindow : JFrame("Client Settings") {
|
||||||
val closeLauncherOnLaunch = Checkbox()
|
val closeLauncherOnLaunch = Checkbox()
|
||||||
val checkForLauncherUpdates = Checkbox()
|
val checkForLauncherUpdates = Checkbox()
|
||||||
var RCMPreviewInitialized = false
|
var RCMPreviewInitialized = false
|
||||||
|
val profileMode = JComboBox(profileOptions)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
isUndecorated = true
|
isUndecorated = true
|
||||||
|
|
@ -283,6 +285,8 @@ object SettingsWindow : JFrame("Client Settings") {
|
||||||
val closeLauncherOnLaunchLabel = getLabel("Close launcher when client starts")
|
val closeLauncherOnLaunchLabel = getLabel("Close launcher when client starts")
|
||||||
val checkForUpdatePanel = getThemedPanel(BorderLayout())
|
val checkForUpdatePanel = getThemedPanel(BorderLayout())
|
||||||
val checkForUpdateLabel = getLabel("Notify me of launcher updates")
|
val checkForUpdateLabel = getLabel("Notify me of launcher updates")
|
||||||
|
val profilePanel = getThemedPanel(BorderLayout())
|
||||||
|
val profileLabel = getLabel("Profile")
|
||||||
|
|
||||||
checkForLauncherUpdates.onClick {
|
checkForLauncherUpdates.onClick {
|
||||||
checkForLauncherUpdates.isToggled = !checkForLauncherUpdates.isToggled
|
checkForLauncherUpdates.isToggled = !checkForLauncherUpdates.isToggled
|
||||||
|
|
@ -297,6 +301,15 @@ object SettingsWindow : JFrame("Client Settings") {
|
||||||
checkForUpdatePanel.add(checkForUpdateLabel, BorderLayout.WEST)
|
checkForUpdatePanel.add(checkForUpdateLabel, BorderLayout.WEST)
|
||||||
checkForUpdatePanel.add(checkForLauncherUpdates, BorderLayout.EAST)
|
checkForUpdatePanel.add(checkForLauncherUpdates, BorderLayout.EAST)
|
||||||
pane.add(checkForUpdatePanel)
|
pane.add(checkForUpdatePanel)
|
||||||
|
pane.add(getSeparator())
|
||||||
|
|
||||||
|
profileMode.size = Dimension(200,10)
|
||||||
|
profileMode.minimumSize = Dimension(200,10)
|
||||||
|
profileMode.maximumSize = Dimension(200,10)
|
||||||
|
profileMode.preferredSize = Dimension(200,10)
|
||||||
|
profilePanel.add(profileLabel, BorderLayout.WEST)
|
||||||
|
profilePanel.add(profileMode, BorderLayout.EAST)
|
||||||
|
pane.add(profilePanel)
|
||||||
|
|
||||||
addTab(pane, button, getLabel("Launcher Settings"))
|
addTab(pane, button, getLabel("Launcher Settings"))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue