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.3 KiB
84 lines
2.3 KiB
package wow.doge.mygame.game
|
|
|
|
import akka.actor.typed.Behavior
|
|
import akka.actor.typed.scaladsl.Behaviors
|
|
import akka.util.Timeout
|
|
import wow.doge.mygame.scriptsystem.ScriptCachingActor
|
|
|
|
object TestActor {
|
|
sealed trait Command
|
|
case object Test extends Command
|
|
private case object Done extends Command
|
|
|
|
import scala.concurrent.duration._
|
|
implicit val timeout = Timeout(15.seconds)
|
|
|
|
def apply(
|
|
// scriptCacheBehavior: Behavior[ScriptCachingActor.Command]
|
|
): Behavior[Command] =
|
|
Behaviors.setup { ctx =>
|
|
ctx.spawn(ScriptCachingActor(), "scriptCacher")
|
|
Behaviors.receiveMessage { msg =>
|
|
msg match {
|
|
case Test =>
|
|
Behaviors.same
|
|
case Done => Behaviors.same
|
|
}
|
|
}
|
|
}
|
|
def testKotlinScriptCompilation() = {
|
|
// ctx.ask(
|
|
// router,
|
|
// ScriptActor.Compile(
|
|
// // os.pwd / "some.sc",
|
|
// os.pwd / "src" / "main" / "resources" / "hello2.main.kts",
|
|
// _
|
|
// )
|
|
// ) {
|
|
// case Success(value) =>
|
|
// ctx.log.debugP("Received Value")
|
|
// ctx.log.debugP(value.toString())
|
|
// Done
|
|
// case Failure(exception) =>
|
|
// ctx.log.debugP(s"Received Error ${exception.getMessage()}")
|
|
// Done
|
|
// }
|
|
}
|
|
|
|
def testTaskWrapper() = {
|
|
// val x = scriptStorer
|
|
// .askT(
|
|
// ScriptStoringActor
|
|
// .Get(os.pwd / "src" / "main" / "resources" / "hello2.sc", _)
|
|
// )(timeout, ctx.system.scheduler)
|
|
}
|
|
|
|
def testScriptCaching() = {
|
|
// ctx.ask(
|
|
// scriptStorer,
|
|
// ScriptStoringActor
|
|
// .Get(os.pwd / "src" / "main" / "resources" / "hello2.sc", _)
|
|
// ) {
|
|
// case Success(value) => {
|
|
// ctx.log.debugP(value.toString())
|
|
// ctx.ask(
|
|
// scriptStorer,
|
|
// ScriptStoringActor
|
|
// .Get(os.pwd / "src" / "main" / "resources" / "hello2.sc", _)
|
|
// ) {
|
|
// case Success(value) => {
|
|
// ctx.log.debugP(value.toString())
|
|
// Done
|
|
// }
|
|
// case Failure(exception) =>
|
|
// ctx.log.debugP(exception.getMessage())
|
|
// Done
|
|
// }
|
|
// Done
|
|
// }
|
|
// case Failure(exception) =>
|
|
// ctx.log.debugP(exception.getMessage())
|
|
// Done
|
|
// }
|
|
}
|
|
}
|