|
|
@ -34,7 +34,6 @@ import monix.bio.Task |
|
|
|
import monix.bio.UIO |
|
|
|
import monix.eval.Coeval |
|
|
|
import monix.execution.cancelables.CompositeCancelable |
|
|
|
import monix.execution.exceptions.DummyException |
|
|
|
import monix.reactive.Observable |
|
|
|
import monix.{eval => me} |
|
|
|
import scalafx.scene.control.Label |
|
|
@ -83,6 +82,7 @@ import wow.doge.mygame.utils.MonixDirectoryWatcher.ModifyEvent |
|
|
|
import wow.doge.mygame.utils.controls.JFXProgressBar |
|
|
|
import wow.doge.mygame.utils.wrappers.jme.AssetManager |
|
|
|
import wow.doge.mygame.utils.wrappers.jme.PhysicsSpace |
|
|
|
|
|
|
|
class MainApp( |
|
|
|
logger: Logger[Task], |
|
|
|
jmeThread: JmeScheduler, |
|
|
@ -151,22 +151,18 @@ class MainApp( |
|
|
|
.executeOn(gameApp.scheduler.value) |
|
|
|
} yield fib |
|
|
|
|
|
|
|
// val k = new FunctionK[Task, UIO] { |
|
|
|
|
|
|
|
// override def apply[A](fa: monix.bio.Task[A]): monix.bio.UIO[A] = |
|
|
|
// fa.hideErrors |
|
|
|
|
|
|
|
// } |
|
|
|
|
|
|
|
def gameInit( |
|
|
|
tickEventBus: GameEventBus[TickEvent] |
|
|
|
): Resource[UIO, Either[AppError, Fiber[Nothing, Unit]]] = |
|
|
|
for { |
|
|
|
r1 <- wire[GameAppResource].resource.evalMap { |
|
|
|
case Right(gameApp -> gameAppFib) => |
|
|
|
eval(tickEventBus, gameApp, gameAppFib).attempt |
|
|
|
case Left(error) => IO.terminate(new Exception(error.toString)) |
|
|
|
} |
|
|
|
r1 <- wire[GameAppResource].resource.evalMap(e => |
|
|
|
IO.fromEither(e) |
|
|
|
.flatMap { |
|
|
|
case (gameApp -> gameAppFib) => |
|
|
|
eval(tickEventBus, gameApp, gameAppFib) |
|
|
|
} |
|
|
|
.attempt |
|
|
|
) |
|
|
|
dirWatcher <- Resource.liftF( |
|
|
|
MonixDirectoryWatcher( |
|
|
|
os.pwd / "assets" / "scripts" |
|
|
|