mirror of
https://gitlab.com/2009scape/rt4-client.git
synced 2025-12-09 16:45:46 -07:00
add support for custom offsets
This commit is contained in:
parent
b009601848
commit
5e90004474
1 changed files with 20 additions and 9 deletions
|
|
@ -57,15 +57,19 @@ class plugin : Plugin() {
|
||||||
val primaryColor = Color(165, 165, 165) // Color for "XP Gained:"
|
val primaryColor = Color(165, 165, 165) // Color for "XP Gained:"
|
||||||
val secondaryColor = Color(255, 255, 255) // Color for "0"
|
val secondaryColor = Color(255, 255, 255) // Color for "0"
|
||||||
|
|
||||||
@Exposed(description = "Default: true, Use Local JSON or the prices from the Live/Stable server API")
|
@Exposed("Default: true, Use Local JSON or the prices from the Live/Stable server API")
|
||||||
var useLiveGEPrices = true
|
var useLiveGEPrices = true
|
||||||
|
|
||||||
@Exposed(description = "Used to calculate Combat Actions until next level.")
|
@Exposed("Used to calculate Combat Actions until next level.")
|
||||||
var playerXPMultiplier = 5
|
var playerXPMultiplier = 5
|
||||||
|
|
||||||
@Exposed(description = "Start minimized/collapsed by default")
|
@Exposed("Start minimized/collapsed by default")
|
||||||
var launchMinimized = false
|
var launchMinimized = false
|
||||||
|
|
||||||
|
@Exposed("Default 16 on Windows, 0 Linux/macOS. If Kondo is not " +
|
||||||
|
"perfectly snapped to the edge of the game due to window chrome you can update this to fix it")
|
||||||
|
var uiOffset = 0
|
||||||
|
|
||||||
private const val FIXED_WIDTH = 765
|
private const val FIXED_WIDTH = 765
|
||||||
private const val NAVBAR_WIDTH = 30
|
private const val NAVBAR_WIDTH = 30
|
||||||
private const val MAIN_CONTENT_WIDTH = 242
|
private const val MAIN_CONTENT_WIDTH = 242
|
||||||
|
|
@ -84,6 +88,7 @@ class plugin : Plugin() {
|
||||||
private var lastLogin = ""
|
private var lastLogin = ""
|
||||||
private var initialized = false;
|
private var initialized = false;
|
||||||
private var lastClickTime = 0L
|
private var lastClickTime = 0L
|
||||||
|
private var lastUIOffset = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
fun allSpritesLoaded() : Boolean {
|
fun allSpritesLoaded() : Boolean {
|
||||||
|
|
@ -118,19 +123,18 @@ class plugin : Plugin() {
|
||||||
private fun UpdateDisplaySettings() {
|
private fun UpdateDisplaySettings() {
|
||||||
val mode = GetWindowMode()
|
val mode = GetWindowMode()
|
||||||
val currentScrollPaneWidth = if (mainContentPanel.isVisible) NAVBAR_WIDTH + MAIN_CONTENT_WIDTH else NAVBAR_WIDTH
|
val currentScrollPaneWidth = if (mainContentPanel.isVisible) NAVBAR_WIDTH + MAIN_CONTENT_WIDTH else NAVBAR_WIDTH
|
||||||
val osName = System.getProperty("os.name").toLowerCase()
|
lastUIOffset = uiOffset
|
||||||
val offset = if (osName.contains("win")) 16 else 0
|
|
||||||
when (mode) {
|
when (mode) {
|
||||||
WindowMode.FIXED -> {
|
WindowMode.FIXED -> {
|
||||||
if (frame.width < FIXED_WIDTH + currentScrollPaneWidth + offset) {
|
if (frame.width < FIXED_WIDTH + currentScrollPaneWidth + uiOffset) {
|
||||||
frame.setSize(FIXED_WIDTH + currentScrollPaneWidth + offset, frame.height)
|
frame.setSize(FIXED_WIDTH + currentScrollPaneWidth + uiOffset, frame.height)
|
||||||
}
|
}
|
||||||
|
|
||||||
val difference = frame.width - (FIXED_WIDTH + offset + currentScrollPaneWidth)
|
val difference = frame.width - (FIXED_WIDTH + uiOffset + currentScrollPaneWidth)
|
||||||
GameShell.leftMargin = difference / 2
|
GameShell.leftMargin = difference / 2
|
||||||
}
|
}
|
||||||
WindowMode.RESIZABLE -> {
|
WindowMode.RESIZABLE -> {
|
||||||
GameShell.canvasWidth = frame.width - (currentScrollPaneWidth + offset)
|
GameShell.canvasWidth = frame.width - (currentScrollPaneWidth + uiOffset)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rightPanelWrapper?.preferredSize = Dimension(currentScrollPaneWidth, frame.height)
|
rightPanelWrapper?.preferredSize = Dimension(currentScrollPaneWidth, frame.height)
|
||||||
|
|
@ -143,6 +147,11 @@ class plugin : Plugin() {
|
||||||
StoreData("kondoPlayerXPMultiplier", playerXPMultiplier)
|
StoreData("kondoPlayerXPMultiplier", playerXPMultiplier)
|
||||||
LootTrackerView.gePriceMap = LootTrackerView.loadGEPrices()
|
LootTrackerView.gePriceMap = LootTrackerView.loadGEPrices()
|
||||||
StoreData("kondoLaunchMinimized", launchMinimized)
|
StoreData("kondoLaunchMinimized", launchMinimized)
|
||||||
|
StoreData("kondoUIOffset", uiOffset)
|
||||||
|
if(lastUIOffset != uiOffset){
|
||||||
|
UpdateDisplaySettings()
|
||||||
|
reloadInterfaces = true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun OnMiniMenuCreate(currentEntries: Array<out MiniMenuEntry>?) {
|
override fun OnMiniMenuCreate(currentEntries: Array<out MiniMenuEntry>?) {
|
||||||
|
|
@ -288,6 +297,8 @@ class plugin : Plugin() {
|
||||||
// Restore saved values
|
// Restore saved values
|
||||||
useLiveGEPrices = (GetData("kondoUseRemoteGE") as? Boolean) ?: true
|
useLiveGEPrices = (GetData("kondoUseRemoteGE") as? Boolean) ?: true
|
||||||
playerXPMultiplier = (GetData("kondoPlayerXPMultiplier") as? Int) ?: 5
|
playerXPMultiplier = (GetData("kondoPlayerXPMultiplier") as? Int) ?: 5
|
||||||
|
val osName = System.getProperty("os.name").toLowerCase()
|
||||||
|
uiOffset = (GetData("kondoUIOffset") as? Int) ?: if (osName.contains("win")) 16 else 0
|
||||||
launchMinimized = (GetData("kondoLaunchMinimized") as? Boolean) ?: false
|
launchMinimized = (GetData("kondoLaunchMinimized") as? Boolean) ?: false
|
||||||
|
|
||||||
cardLayout = CardLayout()
|
cardLayout = CardLayout()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue