Object-ified console commands (singleton!)

Former-commit-id: d04fc939a659fc4a6b952d64894bd28edf97bc38
Former-commit-id: 6c20526f3bdda2d9d08dc156b3b0fe271e89bffb
This commit is contained in:
Song Minjae
2016-12-14 00:28:09 +09:00
parent e1642c799c
commit 22bb5d83e1
38 changed files with 204 additions and 214 deletions

View File

@@ -8,7 +8,7 @@ import java.util.Formatter
/**
* Created by minjaesong on 16-01-16.
*/
class CodexEdictis : ConsoleCommand {
internal object CodexEdictis : ConsoleCommand {
val ccW = GameFontBase.colToCode["o"]
@@ -25,24 +25,22 @@ class CodexEdictis : ConsoleCommand {
val sb = StringBuilder()
val formatter = Formatter(sb)
Echo().execute("Codex: " + formatter.format(Lang["DEV_MESSAGE_CONSOLE_COMMAND_UNKNOWN"], args[1]).toString())
Echo.execute("Codex: " + formatter.format(Lang["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")
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["DEV_MESSAGE_CONSOLE_AVAILABLE_COMMANDS"])
Echo.execute(Lang["DEV_MESSAGE_CONSOLE_AVAILABLE_COMMANDS"])
CommandDict.dict.forEach { name, cmd ->
echo.execute("$ccW" + name)
Echo.execute("$ccW" + name)
cmd.printUsage()
}
}