mirror of
https://gitlab.com/2009scape/tools/2009scape-map-viewer.git
synced 2026-08-01 14:39:25 -06:00
Region loading, map redraw improvements
This commit is contained in:
parent
ec83fcd86a
commit
34cd83a1ff
1 changed files with 28 additions and 2 deletions
|
|
@ -17,6 +17,7 @@ import java.awt.*
|
|||
import java.awt.event.KeyEvent
|
||||
import java.awt.event.MouseAdapter
|
||||
import java.awt.event.MouseEvent
|
||||
import java.lang.Exception
|
||||
import javax.swing.*
|
||||
import javax.swing.border.*
|
||||
import kotlin.system.exitProcess
|
||||
|
|
@ -173,7 +174,7 @@ object Rs2MapEditor {
|
|||
}
|
||||
}
|
||||
SwingUtilities.invokeLater {
|
||||
this.repaint()
|
||||
this.revalidate()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -642,7 +643,32 @@ object Rs2MapEditor {
|
|||
class LoadRegionItem : JMenuItem("Load") {
|
||||
init {
|
||||
addActionListener {
|
||||
println("This feature has not been enabled yet")
|
||||
val region = if(npcsUpdated || tileDataUpdated || itemsUpdated){
|
||||
val response = JOptionPane.showConfirmDialog(this,"You have unsaved changes, continue?")
|
||||
if(response == 0){
|
||||
JOptionPane.showInputDialog("Enter Desired Region ID")
|
||||
}
|
||||
else return@addActionListener
|
||||
}
|
||||
else JOptionPane.showInputDialog("Enter Desired Region ID")
|
||||
|
||||
val regionId = region.toIntOrNull() ?: JOptionPane.showInputDialog("Invalid Integer Entered").toIntOrNull() ?: return@addActionListener
|
||||
|
||||
Rs2MapEditor.region = regionId
|
||||
Rs2MapEditor.plane = 0
|
||||
npcs = NPCSpawnParser.parseNPCSpawns(regionId)
|
||||
items = GroundItemSpawnParser.parseItemSpawns(regionId)
|
||||
sceneries = TileSceneryParser.parseRegion(regionId)
|
||||
npcPanel.redrawRows()
|
||||
itemPanel.redrawRows()
|
||||
try {
|
||||
MapTileParser.init()
|
||||
mapPanel.repaintMap()
|
||||
} catch (e: Exception){
|
||||
mapPanel.removeAll()
|
||||
mapPanel.revalidate()
|
||||
JOptionPane.showMessageDialog(this, "No Map Data for Region ID $regionId.")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue