Testing out JmonkeyEngine to make a game in Scala with Akka Actors within a pure FP layer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
2.2 KiB

4 years ago
  1. package wow.doge.mygame.game
  2. import akka.actor.typed.Behavior
  3. import akka.actor.typed.scaladsl.Behaviors
  4. import akka.util.Timeout
  5. import wow.doge.mygame.scriptsystem.ScriptCachingActor
  6. object TestActor {
  7. sealed trait Command
  8. case object Test extends Command
  9. private case object Done extends Command
  10. import scala.concurrent.duration._
  11. implicit val timeout = Timeout(15.seconds)
  12. def apply(
  13. // scriptCacheBehavior: Behavior[ScriptCachingActor.Command]
  14. ): Behavior[Command] =
  15. Behaviors.setup { ctx =>
  16. ctx.spawn(ScriptCachingActor(), "scriptCacher")
  17. Behaviors.receiveMessage { msg =>
  18. msg match {
  19. case Test =>
  20. Behaviors.same
  21. case Done => Behaviors.same
  22. }
  23. }
  24. }
  25. def testKotlinScriptCompilation() = {
  26. // ctx.ask(
  27. // router,
  28. // ScriptActor.Compile(
  29. // // os.pwd / "some.sc",
  30. // os.pwd / "src" / "main" / "resources" / "hello2.main.kts",
  31. // _
  32. // )
  33. // ) {
  34. // case Success(value) =>
  35. // ctx.log.debug("Received Value")
  36. // ctx.log.debug(value.toString())
  37. // Done
  38. // case Failure(exception) =>
  39. // ctx.log.debug(s"Received Error ${exception.getMessage()}")
  40. // Done
  41. // }
  42. }
  43. def testTaskWrapper() = {
  44. // val x = scriptStorer
  45. // .askT(
  46. // ScriptStoringActor
  47. // .Get(os.pwd / "src" / "main" / "resources" / "hello2.sc", _)
  48. // )(timeout, ctx.system.scheduler)
  49. }
  50. def testScriptCaching() = {
  51. // ctx.ask(
  52. // scriptStorer,
  53. // ScriptStoringActor
  54. // .Get(os.pwd / "src" / "main" / "resources" / "hello2.sc", _)
  55. // ) {
  56. // case Success(value) => {
  57. // ctx.log.debug(value.toString())
  58. // ctx.ask(
  59. // scriptStorer,
  60. // ScriptStoringActor
  61. // .Get(os.pwd / "src" / "main" / "resources" / "hello2.sc", _)
  62. // ) {
  63. // case Success(value) => {
  64. // ctx.log.debug(value.toString())
  65. // Done
  66. // }
  67. // case Failure(exception) =>
  68. // ctx.log.debug(exception.getMessage())
  69. // Done
  70. // }
  71. // Done
  72. // }
  73. // case Failure(exception) =>
  74. // ctx.log.debug(exception.getMessage())
  75. // Done
  76. // }
  77. }
  78. }