public static Result <GameStateHolderModule> Create() { var module = new GameStateHolderModule(); return(ModulesRegister.Get <IUnityNetworkClientProvider>() .Specify($"Cannot get {nameof(IUnityNetworkClientProvider)}") .Then(module, (networkClient, _this) => _this._networkClient = networkClient) .Then(_ => module)); }
private void InitModuleReferences() { _blockItemsPoolModule = ModulesRegister.Get <IBlockItemsPoolModule>() .ThrowIfError(() => $"Cannot initialize module references at {nameof(GameLevelInitializer)}") .Value; _gameStateModule = ModulesRegister.Get <IGameStateModule>() .ThrowIfError(() => $"Cannot initialize module references at {nameof(GameLevelInitializer)}") .Value; }
public Result <IUnityNetworkMiddlewareSchema> BuildUnityNetworkClientPipeline( NetworkClientMiddlewareManifests manifest) { var coroutineRunner = ModulesRegister.Get <ICoroutineRunner>(); if (coroutineRunner.IsError) { return(Result <IUnityNetworkMiddlewareSchema> .FromError( $"Unable to get {nameof(coroutineRunner)} at {nameof(UnityNetworkClientPipelineBuilder<T>)}")); } var compositionManifest = manifest.RequestComposition; var requestProcessor = UnityWebRequestProcessorMiddleware <T> .Create(Option <T> .None, coroutineRunner.Value, manifest.RequestProcessor); var statusCodeValidator = StatusCodeValidationMiddleware <T> .Create( ((T)(IUnityNetworkMiddlewareSchema)requestProcessor).ToSome()); var compositionMiddleware = UnityRequestCompositionMiddleware <T> .Create( ((T)(IUnityNetworkMiddlewareSchema)statusCodeValidator).ToSome(), compositionManifest); return(((IUnityNetworkMiddlewareSchema)compositionMiddleware).ToValue()); }
protected override Task <Result <Unit> > SetInitialAsync() => ModulesRegister.Get <IGameStateModule>() .Then(this, (gameStateModule, _this) => _this._gameStateModule = gameStateModule) .ToUnit() .ToTask();