public LoadMapSectionCommand(LoadMapSectionCommandData data, IMutableMapData mapData, IPausableCommandQueue pausableCommandQueue, MapSectionContext mapSectionContext, ZenjectSceneLoader sceneLoader) { _data = data; _mapData = mapData; _pausableCommandQueue = pausableCommandQueue; _mapSectionContext = mapSectionContext; _sceneLoader = sceneLoader; }
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); }); }); }