public void Dispatch() { PlayerLoopHelper.Initialize(); EntryPointExceptionHandler exceptionHandler = null; try { exceptionHandler = container.Resolve <EntryPointExceptionHandler>(); } catch (VContainerException ex) when(ex.InvalidType == typeof(EntryPointExceptionHandler)) { } var initializables = container.Resolve <IReadOnlyList <IInitializable> >(); if (initializables.Count > 0) { var loopItem = new InitializationLoopItem(initializables, exceptionHandler); disposable.Add(loopItem); PlayerLoopHelper.Dispatch(PlayerLoopTiming.Initialization, loopItem); } var postInitializables = container.Resolve <IReadOnlyList <IPostInitializable> >(); if (postInitializables.Count > 0) { var loopItem = new PostInitializationLoopItem(postInitializables, exceptionHandler); disposable.Add(loopItem); PlayerLoopHelper.Dispatch(PlayerLoopTiming.PostInitialization, loopItem); } var startables = container.Resolve <IReadOnlyList <IStartable> >(); if (startables.Count > 0) { var loopItem = new StartableLoopItem(startables, exceptionHandler); disposable.Add(loopItem); PlayerLoopHelper.Dispatch(PlayerLoopTiming.Startup, loopItem); } var postStartables = container.Resolve <IReadOnlyList <IPostStartable> >(); if (postStartables.Count > 0) { var loopItem = new PostStartableLoopItem(postStartables, exceptionHandler); disposable.Add(loopItem); PlayerLoopHelper.Dispatch(PlayerLoopTiming.PostStartup, loopItem); } var fixedTickables = container.Resolve <IReadOnlyList <IFixedTickable> >(); if (fixedTickables.Count > 0) { var loopItem = new FixedTickableLoopItem(fixedTickables, exceptionHandler); disposable.Add(loopItem); PlayerLoopHelper.Dispatch(PlayerLoopTiming.FixedUpdate, loopItem); } var postFixedTickables = container.Resolve <IReadOnlyList <IPostFixedTickable> >(); if (postFixedTickables.Count > 0) { var loopItem = new PostFixedTickableLoopItem(postFixedTickables, exceptionHandler); disposable.Add(loopItem); PlayerLoopHelper.Dispatch(PlayerLoopTiming.PostFixedUpdate, loopItem); } var tickables = container.Resolve <IReadOnlyList <ITickable> >(); if (tickables.Count > 0) { var loopItem = new TickableLoopItem(tickables, exceptionHandler); disposable.Add(loopItem); PlayerLoopHelper.Dispatch(PlayerLoopTiming.Update, loopItem); } var postTickables = container.Resolve <IReadOnlyList <IPostTickable> >(); if (postTickables.Count > 0) { var loopItem = new PostTickableLoopItem(postTickables, exceptionHandler); disposable.Add(loopItem); PlayerLoopHelper.Dispatch(PlayerLoopTiming.PostUpdate, loopItem); } var lateTickables = container.Resolve <IReadOnlyList <ILateTickable> >(); if (lateTickables.Count > 0) { var loopItem = new LateTickableLoopItem(lateTickables, exceptionHandler); disposable.Add(loopItem); PlayerLoopHelper.Dispatch(PlayerLoopTiming.LateUpdate, loopItem); } var postLateTickables = container.Resolve <IReadOnlyList <IPostLateTickable> >(); if (postLateTickables.Count > 0) { var loopItem = new PostLateTickableLoopItem(postLateTickables, exceptionHandler); disposable.Add(loopItem); PlayerLoopHelper.Dispatch(PlayerLoopTiming.PostLateUpdate, loopItem); } #if VCONTAINER_UNITASK_INTEGRATION var asyncStartables = container.Resolve <IReadOnlyList <IAsyncStartable> >(); if (asyncStartables.Count > 0) { var loopItem = new AsyncStartableLoopItem(asyncStartables, exceptionHandler); disposable.Add(loopItem); PlayerLoopHelper.Dispatch(PlayerLoopTiming.Startup, loopItem); } #endif #if VCONTAINER_ECS_INTEGRATION container.Resolve <IEnumerable <ComponentSystemBase> >(); var worldHelpers = container.Resolve <IEnumerable <WorldConfigurationHelper> >(); foreach (var x in worldHelpers) { x.SortSystems(); } #endif }
void DispatchPlayerLoopItems() { try { var markers = Container.Resolve <IEnumerable <IInitializable> >(); var loopItem = new InitializationLoopItem(markers); disposable.Add(loopItem); PlayerLoopHelper.Dispatch(PlayerLoopTiming.Initialization, loopItem); } catch (VContainerException ex) when(ex.InvalidType == typeof(IEnumerable <IInitializable>)) { } try { var markers = Container.Resolve <IEnumerable <IPostInitializable> >(); var loopItem = new PostInitializationLoopItem(markers); disposable.Add(loopItem); PlayerLoopHelper.Dispatch(PlayerLoopTiming.PostInitialization, loopItem); } catch (VContainerException ex) when(ex.InvalidType == typeof(IEnumerable <IPostInitializable>)) { } try { var markers = Container.Resolve <IEnumerable <IFixedTickable> >(); var loopItem = new FixedTickableLoopItem(markers); disposable.Add(loopItem); PlayerLoopHelper.Dispatch(PlayerLoopTiming.FixedUpdate, loopItem); } catch (VContainerException ex) when(ex.InvalidType == typeof(IEnumerable <IFixedTickable>)) { } try { var markers = Container.Resolve <IEnumerable <IPostFixedTickable> >(); var loopItem = new PostFixedTickableLoopItem(markers); disposable.Add(loopItem); PlayerLoopHelper.Dispatch(PlayerLoopTiming.PostFixedUpdate, loopItem); } catch (VContainerException ex) when(ex.InvalidType == typeof(IEnumerable <IPostFixedTickable>)) { } try { var markers = Container.Resolve <IEnumerable <ITickable> >(); var loopItem = new TickableLoopItem(markers); disposable.Add(loopItem); PlayerLoopHelper.Dispatch(PlayerLoopTiming.Update, loopItem); } catch (VContainerException ex) when(ex.InvalidType == typeof(IEnumerable <ITickable>)) { } try { var markers = Container.Resolve <IEnumerable <IPostTickable> >(); var loopItem = new PostTickableLoopItem(markers); disposable.Add(loopItem); PlayerLoopHelper.Dispatch(PlayerLoopTiming.PostUpdate, loopItem); } catch (VContainerException ex) when(ex.InvalidType == typeof(IEnumerable <IPostTickable>)) { } try { var markers = Container.Resolve <IEnumerable <ILateTickable> >(); var loopItem = new LateTickableLoopItem(markers); disposable.Add(loopItem); PlayerLoopHelper.Dispatch(PlayerLoopTiming.LateUpdate, loopItem); } catch (VContainerException ex) when(ex.InvalidType == typeof(IEnumerable <ILateTickable>)) { } try { var markers = Container.Resolve <IEnumerable <IPostLateTickable> >(); var loopItem = new PostLateTickableLoopItem(markers); disposable.Add(loopItem); PlayerLoopHelper.Dispatch(PlayerLoopTiming.PostLateUpdate, loopItem); } catch (VContainerException ex) when(ex.InvalidType == typeof(IEnumerable <IPostLateTickable>)) { } try { var _ = Container.Resolve <IEnumerable <MonoBehaviour> >(); } catch (VContainerException ex) when(ex.InvalidType == typeof(IEnumerable <MonoBehaviour>)) { } }