Files
Terrarum/src/net/torvald/terrarum/console/CodexEdictis.kt
Song Minjae c4b64140be actors are now active/dormant depending on the distance to the player, only the active actors are to be updated. Actors outside of the camera (actually a distance to the player) are not rendered
Former-commit-id: 5f80c2ef3592aab5567723087c264e05458e98b3
Former-commit-id: 7714c6f5a6d7a48d4f5adfe8f6990b249bdb80b0
2016-04-24 16:37:08 +09:00

46 lines
1.3 KiB
Kotlin

package net.torvald.terrarum.console
import net.torvald.terrarum.Game
import net.torvald.terrarum.langpack.Lang
import net.torvald.terrarum.ui.ConsoleWindow
import java.util.Formatter
/**
* Created by minjaesong on 16-01-16.
*/
class CodexEdictis : ConsoleCommand {
override fun execute(args: Array<String>) {
if (args.size == 1) {
printList()
}
else {
try {
val commandObj = CommandDict.getCommand(args[1].toLowerCase())
commandObj.printUsage()
}
catch (e: NullPointerException) {
val sb = StringBuilder()
val formatter = Formatter(sb)
Echo().execute("Codex: " + formatter.format(Lang.get("DEV_MESSAGE_CONSOLE_COMMAND_UNKNOWN"), args[1]).toString())
}
}
}
override fun printUsage() {
val echo = Echo()
echo.execute("Usage: codex (command)")
echo.execute("shows how to use 'command'")
echo.execute("leave blank to get list of available commands")
}
private fun printList() {
val echo = Echo()
echo.execute(Lang.get("DEV_MESSAGE_CONSOLE_AVAILABLE_COMMANDS"))
CommandDict.dict.keys.forEach { s -> echo.execute("" + s) }
}
}