class Options : PersistentOptions { static val instance = Options() @Option( values = """ On - Are you sure? Cheater! : true Off - Good choice! : false """) var cheat = false @Option( values = """ No : false Yes. Is it Halloween? : true """ ) var useFrankenDolls = false @Option( values = """ Off : 0 Slow : 5 Medium : 10 Fast : 20 """ ) var edgePanSpeed = 10 @Option( values = """ Off : -1 Small : 30 Medium : 60 Large : 120 """ ) var edgePanMargin = 60 @Option( values = """ No : false Yes : true """) var isFullScreen = false init { rememberDefaultValues() } override fun toString() = "Options cheat=$cheat useFrankenDolls=$useFrankenDolls edgePanSpeed=$edgePanSpeed edgePanMargin=$edgePanMargin isFullScreen=$isFullScreen" } class OptionsDirector : Menu { override fun begin() { super.begin() Options.instance.initialiseControls() } override fun ending() { Options.instance.readControls() Options.instance.save() } override fun message( message : String ) { if ( message == "resetOptions" ) { Options.instance.reset() } } } class AnimatedOptionButton : OptionButton { @Attribute( about="Time for the animation, moving the actor into view" ) var showInSeconds = 0.5 override fun activated() { super.activated() actor.scaleXY = 0.1 } override fun createAction() : Action { actor.x += actor.stage.firstView().worldWidth val duration = 0.5 val animation = MoveBy( actor.position, duration, Vector2(-actor.stage.firstView().worldWidth, 0), Eases.easeOut ) and ScaleTo( actor, duration, 1.0 ) then EventAction( actor, "ding" ) return Delay(showInSeconds) then animation } }