new debugging tool ActorValueTracker

Former-commit-id: f30d2a859521082609425722edb91d3c366fbc58
Former-commit-id: 1486ad6b0a85415124c87522f07c012d4a335567
This commit is contained in:
Song Minjae
2016-12-29 20:06:37 +09:00
parent a6bbf256f0
commit 767802e75f
3 changed files with 252 additions and 3 deletions

View File

@@ -0,0 +1,48 @@
package net.torvald.terrarum.console
import net.torvald.terrarum.Terrarum
import net.torvald.terrarum.debuggerapp.ActorValueTracker
import java.util.*
/**
* Created by SKYHi14 on 2016-12-29.
*/
object AVTracker : ConsoleCommand {
private val jPanelInstances = ArrayList<ActorValueTracker>()
override fun execute(args: Array<String>) {
if (args.size < 2) {
jPanelInstances.add(ActorValueTracker(Terrarum.ingame.player))
}
else {
try {
val actorID = args[1].toInt()
if (Terrarum.ingame.hasActor(actorID)) {
jPanelInstances.add(ActorValueTracker(Terrarum.ingame.getActorByID(actorID)))
}
else {
throw IllegalArgumentException()
}
}
catch (e: NumberFormatException) {
EchoError("Illegal actor ID input")
return
}
catch (e1: IllegalArgumentException) {
EchoError("No such actor with specified ID")
return
}
}
}
override fun printUsage() {
Echo("Pops up new window that provides real-time information about the actor's actor value")
}
fun update() {
jPanelInstances.forEach {
it.setInfoLabel()
}
}
}