private void TryReconnect() { _modalViewController.Show("Reconnecting..."); _networkManager.Connect(allowOfflineMode: false).Subscribe(Observer.Create <NetworkConnectionResult>(result => { _modalViewController.Hide(); }, error => { TryReconnect(); })); }
public void Initialize() { var observables = new List <IObservable <AssetBinding> >(); foreach (var assetLoadingFunction in _assetLoadingFunctions) { observables.Add(assetLoadingFunction.Invoke()); } _modalViewController.Show("Loading Assets..."); // NOTE: Not good practice! // Maybe use oncomplete to bind on container? observables.Merge().Subscribe(binding => _container .Bind(binding.type) .FromInstance(binding.asset), () => { _modalViewController.Hide(); _sceneLoader.LoadScene(_nextScene, LoadSceneMode.Additive); }); }
private void HandleMapSceneLoaded(DiContainer container, IMutableMapData mapData, MapStoreId mapStoreId) { // MapSection command may inject mutable map data if on editor mode. container.Bind <IMapData>().FromInstance(mapData); container.Bind <MapStoreId>().FromInstance(mapStoreId); container.Bind <IMutableMapData>().FromInstance(mapData).WhenInjectedInto <LoadMapSectionCommand>(); container.Bind <LoadMapCommandData>().FromInstance(_data); // This needs to happen after 1 frame because we are currently still loading the next scene. // Otherwise, the dependency graph cannot be yet built. Observable.NextFrame().Subscribe(onNext => { // This needs to be created directly since the section command is dependant on this command. LoadMapSectionCommandData loadMapSectionCommandData = new LoadMapSectionCommandData(0, _data); ICommand loadMapSectionCommand = _commandFactory.Create(typeof(LoadMapSectionCommand), typeof(LoadMapSectionCommandData), loadMapSectionCommandData); loadMapSectionCommand.Run().Subscribe(next => { _modalViewController.Hide(); _sceneLoadedSubject.OnNext(Unit.Default); }); }); }