Created
June 13, 2018 01:42
-
-
Save Jire/b1e6f8a6d5fd2d1c56546b0f33e653f4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ps.eden.server.game.content.dialogue | |
/** | |
* @author Jire | |
*/ | |
class ActionStage(id: Int) : Stage(id) { | |
var defaultHandler: (() -> Any?)? = null | |
private set | |
val onButtonHandlers = HashMap<Int, () -> Any?>() | |
operator fun <R> Int.invoke(onButtonID: () -> R) { | |
onButtonHandlers[this] = onButtonID | |
} | |
fun <R> or(onDefaultID: () -> R) { | |
defaultHandler = onDefaultID | |
} | |
fun or(onDefaultID: Int) = or { onDefaultID } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment