// Start is called before the first frame update void Start() { Debug.Log($"Запущен {nameof(StubSpawner)}."); var contexts = Contexts.sharedInstance; contexts.SubscribeId(); gameContext = contexts.game; PositionChunks chunks = new PositionChunks(2); systems = new Systems() .Add(new ParentsSystems(contexts)) .Add(new AISystems(contexts)) .Add(new MovementSystems(contexts)) .Add(new GlobalTransformSystem(contexts)) .Add(new ShootingSystems(contexts)) .Add(new UpdatePositionChunksSystem(contexts, chunks)) .Add(new CollisionSystems(contexts, chunks)) .Add(new EffectsSystems(contexts)) .Add(new TimeSystems(contexts)) .Add(new DestroySystems(contexts)) ; systems.ActivateReactiveSystems(); systems.Initialize(); var collidersDrawer = FindObjectOfType <CollidersDrawer>(); collidersDrawer.ChangeContext(gameContext); }
private void Start() { UdpSendUtils udpSendUtils = udpControllerSingleton.GetUdpSendUtils(); systems = CreateSystems(udpSendUtils); Contexts.sharedInstance.game.ReplaceZoneInfo(Vector2.zero, 100f); systems.ActivateReactiveSystems(); systems.Initialize(); //Костыль на временное отключение enabled = false; StartCoroutine(DelayedStart(2.5f)); }
public void RestartController() { updateSystems.ClearReactiveSystems(); updateSystems.ActivateReactiveSystems(); updateSystems.Cleanup(); updateSystems.TearDown(); fixedUpdateSystems.ClearReactiveSystems(); fixedUpdateSystems.ActivateReactiveSystems(); fixedUpdateSystems.Cleanup(); fixedUpdateSystems.TearDown(); lateUpdateSystems.ClearReactiveSystems(); lateUpdateSystems.ActivateReactiveSystems(); lateUpdateSystems.Cleanup(); lateUpdateSystems.TearDown(); updateSystems.Initialize(); fixedUpdateSystems.Initialize(); lateUpdateSystems.Initialize(); }
void Start() { _contexts = Contexts.sharedInstance; if (!_contexts.game.hasGlobals) { _contexts.game.SetGlobals(globals); } else { _contexts.game.ReplaceGlobals(globals); } if (!_contexts.game.hasUIRoot) { _contexts.game.SetUIRoot(uiRoot); } else { _contexts.game.ReplaceUIRoot(uiRoot); } if (!_contexts.game.hasGlobals) { _contexts.game.SetText(text); } else { _contexts.game.ReplaceText(text); } JsonManager.Serialize("save.json"); _contexts.game.SetGameData(JsonManager.Deserialize("save.json")); _systems = CreateSystems(_contexts, _systems); _systems.ActivateReactiveSystems(); _systems.Initialize(); timer = 0; }
void when_systems() { Pool pool = null; before = () => { pool = new Pool(10); }; context["fixtures"] = () => { it["initializes InitializeSystemSpy"] = () => { var initializeSystem = new InitializeSystemSpy(); initializeSystem.initialized.should_be_false(); initializeSystem.Initialize(); initializeSystem.initialized.should_be_true(); }; it["executes ExecuteSystemSpy"] = () => { var initializeSystem = new ExecuteSystemSpy(); initializeSystem.executed.should_be_false(); initializeSystem.Execute(); initializeSystem.executed.should_be_true(); }; it["initializes and executes InitializeExecuteSystemSpy"] = () => { var initializeSystem = new InitializeExecuteSystemSpy(); initializeSystem.initialized.should_be_false(); initializeSystem.executed.should_be_false(); initializeSystem.Initialize(); initializeSystem.Execute(); initializeSystem.initialized.should_be_true(); initializeSystem.executed.should_be_true(); }; it["executes ReactiveSystemSpy"] = () => { var system = createReactiveSystem(pool); var spy = (ReactiveSubSystemSpy)system.subsystem; spy.didExecute.should_be(0); spy.initialized.should_be_false(); system.Execute(); spy.didExecute.should_be(1); spy.initialized.should_be_false(); }; }; context["systems"] = () => { Systems systems = null; before = () => { systems = new Systems(); }; it["returns systems when adding system"] = () => { systems.Add(new InitializeSystemSpy()).should_be_same(systems); }; it["initializes IInitializeSystem"] = () => { var system = new InitializeSystemSpy(); systems.Add(system); systems.Initialize(); system.initialized.should_be_true(); }; it["executes IExecuteSystem"] = () => { var system = new ExecuteSystemSpy(); systems.Add(system); systems.Execute(); system.executed.should_be_true(); }; it["initializes and executes IInitializeSystem, IExecuteSystem"] = () => { var system = new InitializeExecuteSystemSpy(); systems.Add(system); systems.Initialize(); systems.Execute(); system.initialized.should_be_true(); system.executed.should_be_true(); }; it["initializes and executes ReactiveSystem"] = () => { var system = createReactiveSystem(pool); systems.Add(system); systems.Initialize(); systems.Execute(); systems.Execute(); var spy = (ReactiveSubSystemSpy)system.subsystem; spy.didExecute.should_be(1); spy.initialized.should_be_true(); }; it["clears reactive systems"] = () => { var system = createReactiveSystem(pool); systems.Add(system); systems.Initialize(); systems.ClearReactiveSystems(); systems.Execute(); var spy = (ReactiveSubSystemSpy)system.subsystem; spy.didExecute.should_be(0); spy.initialized.should_be_true(); }; it["clears reactive systems recursively"] = () => { var system = createReactiveSystem(pool); systems.Add(system); var parentSystems = new Systems(); parentSystems.Add(systems); parentSystems.Initialize(); parentSystems.ClearReactiveSystems(); parentSystems.Execute(); var spy = (ReactiveSubSystemSpy)system.subsystem; spy.didExecute.should_be(0); spy.initialized.should_be_true(); }; it["deactivates reactive systems"] = () => { var system = createReactiveSystem(pool); systems.Add(system); systems.Initialize(); systems.DeactivateReactiveSystems(); systems.Execute(); var spy = (ReactiveSubSystemSpy)system.subsystem; spy.didExecute.should_be(0); spy.initialized.should_be_true(); }; it["deactivates reactive systems recursively"] = () => { var system = createReactiveSystem(pool); systems.Add(system); var parentSystems = new Systems(); parentSystems.Add(systems); parentSystems.Initialize(); parentSystems.DeactivateReactiveSystems(); parentSystems.Execute(); var spy = (ReactiveSubSystemSpy)system.subsystem; spy.didExecute.should_be(0); spy.initialized.should_be_true(); }; it["activates reactive systems"] = () => { var system = createReactiveSystem(pool); systems.Add(system); systems.Initialize(); systems.DeactivateReactiveSystems(); systems.ActivateReactiveSystems(); systems.Execute(); var spy = (ReactiveSubSystemSpy)system.subsystem; spy.didExecute.should_be(0); spy.initialized.should_be_true(); pool.CreateEntity().AddComponentA(); systems.Execute(); spy.didExecute.should_be(1); }; it["activates reactive systems recursively"] = () => { var system = createReactiveSystem(pool); systems.Add(system); var parentSystems = new Systems(); parentSystems.Add(systems); parentSystems.Initialize(); parentSystems.DeactivateReactiveSystems(); parentSystems.ActivateReactiveSystems(); parentSystems.Execute(); var spy = (ReactiveSubSystemSpy)system.subsystem; spy.didExecute.should_be(0); spy.initialized.should_be_true(); pool.CreateEntity().AddComponentA(); systems.Execute(); spy.didExecute.should_be(1); }; }; }
void when_systems() { Pool pool = null; before = () => { pool = new Pool(10); }; context["fixtures"] = () => { it["initializes InitializeSystemSpy"] = () => { var system = new InitializeSystemSpy(); system.didInitialize.should_be(0); system.Initialize(); system.didInitialize.should_be(1); }; it["executes ExecuteSystemSpy"] = () => { var system = new ExecuteSystemSpy(); system.didExecute.should_be(0); system.Execute(); system.didExecute.should_be(1); }; it["cleans up CleanupSystemSpy"] = () => { var system = new CleanupSystemSpy(); system.didCleanup.should_be(0); system.Cleanup(); system.didCleanup.should_be(1); }; it["tears down TearDownSystemSpy"] = () => { var system = new TearDownSystemSpy(); system.didTearDown.should_be(0); system.TearDown(); system.didTearDown.should_be(1); }; it["initializes, executes, cleans up and tears down InitializeExecuteCleanupTearDownSystemSpy"] = () => { var system = new InitializeExecuteCleanupTearDownSystemSpy(); system.didInitialize.should_be(0); system.Initialize(); system.didInitialize.should_be(1); system.didExecute.should_be(0); system.Execute(); system.didExecute.should_be(1); system.didCleanup.should_be(0); system.Cleanup(); system.didCleanup.should_be(1); system.didTearDown.should_be(0); system.TearDown(); system.didTearDown.should_be(1); }; it["executes ReactiveSystemSpy"] = () => { var system = createReactiveSystem(pool); var spy = (ReactiveSubSystemSpy)system.subsystem; system.Execute(); spy.entities.Length.should_be(1); }; }; context["systems"] = () => { Systems systems = null; before = () => { systems = new Systems(); }; it["returns systems when adding system"] = () => { systems.Add(new InitializeSystemSpy()).should_be_same(systems); }; it["initializes IInitializeSystem"] = () => { var system = new InitializeSystemSpy(); systems.Add(system); systems.Initialize(); system.didInitialize.should_be(1); }; it["executes IExecuteSystem"] = () => { var system = new ExecuteSystemSpy(); systems.Add(system); systems.Execute(); system.didExecute.should_be(1); }; it["cleans up ICleanupSystem"] = () => { var system = new CleanupSystemSpy(); systems.Add(system); systems.Cleanup(); system.didCleanup.should_be(1); }; it["initializes, executes, cleans up and tears down InitializeExecuteCleanupTearDownSystemSpy"] = () => { var system = new InitializeExecuteCleanupTearDownSystemSpy(); systems.Add(system); system.didInitialize.should_be(0); systems.Initialize(); system.didInitialize.should_be(1); system.didExecute.should_be(0); systems.Execute(); system.didExecute.should_be(1); system.didCleanup.should_be(0); systems.Cleanup(); system.didCleanup.should_be(1); system.didTearDown.should_be(0); systems.TearDown(); system.didTearDown.should_be(1); }; it["initializes, executes, cleans up and tears down ReactiveSystem"] = () => { var system = createReactiveSystem(pool); var spy = (ReactiveSubSystemSpy)system.subsystem; systems.Add(system); spy.didInitialize.should_be(0); systems.Initialize(); spy.didInitialize.should_be(1); spy.didExecute.should_be(0); systems.Execute(); systems.Execute(); spy.didExecute.should_be(1); spy.didCleanup.should_be(0); systems.Cleanup(); spy.didCleanup.should_be(1); spy.didTearDown.should_be(0); systems.TearDown(); spy.didTearDown.should_be(1); }; it["initializes, executes, cleans up and tears down systems recursively"] = () => { var system = createReactiveSystem(pool); var spy = (ReactiveSubSystemSpy)system.subsystem; systems.Add(system); var parentSystems = new Systems(); parentSystems.Add(systems); spy.didInitialize.should_be(0); parentSystems.Initialize(); spy.didInitialize.should_be(1); spy.didExecute.should_be(0); parentSystems.Execute(); parentSystems.Execute(); spy.didExecute.should_be(1); spy.didCleanup.should_be(0); parentSystems.Cleanup(); spy.didCleanup.should_be(1); spy.didTearDown.should_be(0); parentSystems.TearDown(); spy.didTearDown.should_be(1); }; it["clears reactive systems"] = () => { var system = createReactiveSystem(pool); var spy = (ReactiveSubSystemSpy)system.subsystem; systems.Add(system); systems.Initialize(); spy.didInitialize.should_be(1); systems.ClearReactiveSystems(); systems.Execute(); spy.didExecute.should_be(0); }; it["clears reactive systems recursively"] = () => { var system = createReactiveSystem(pool); var spy = (ReactiveSubSystemSpy)system.subsystem; systems.Add(system); var parentSystems = new Systems(); parentSystems.Add(systems); parentSystems.Initialize(); spy.didInitialize.should_be(1); parentSystems.ClearReactiveSystems(); parentSystems.Execute(); spy.didExecute.should_be(0); }; it["deactivates reactive systems"] = () => { var system = createReactiveSystem(pool); var spy = (ReactiveSubSystemSpy)system.subsystem; systems.Add(system); systems.Initialize(); spy.didInitialize.should_be(1); systems.DeactivateReactiveSystems(); systems.Execute(); spy.didExecute.should_be(0); }; it["deactivates reactive systems recursively"] = () => { var system = createReactiveSystem(pool); var spy = (ReactiveSubSystemSpy)system.subsystem; systems.Add(system); var parentSystems = new Systems(); parentSystems.Add(systems); parentSystems.Initialize(); spy.didInitialize.should_be(1); parentSystems.DeactivateReactiveSystems(); parentSystems.Execute(); spy.didExecute.should_be(0); }; it["activates reactive systems"] = () => { var system = createReactiveSystem(pool); var spy = (ReactiveSubSystemSpy)system.subsystem; systems.Add(system); systems.Initialize(); spy.didInitialize.should_be(1); systems.DeactivateReactiveSystems(); systems.ActivateReactiveSystems(); systems.Execute(); spy.didExecute.should_be(0); pool.CreateEntity().AddComponentA(); systems.Execute(); spy.didExecute.should_be(1); }; it["activates reactive systems recursively"] = () => { var system = createReactiveSystem(pool); var spy = (ReactiveSubSystemSpy)system.subsystem; systems.Add(system); var parentSystems = new Systems(); parentSystems.Add(systems); parentSystems.Initialize(); spy.didInitialize.should_be(1); parentSystems.DeactivateReactiveSystems(); parentSystems.ActivateReactiveSystems(); parentSystems.Execute(); spy.didExecute.should_be(0); pool.CreateEntity().AddComponentA(); systems.Execute(); spy.didExecute.should_be(1); }; }; }
private void Start() { lobbyUiStorage.Check(); uiLayersStorage.Check(); movingAwardsUiStorage.Check(); warshipsUiStorage.Check(); contexts = Contexts.sharedInstance; warshipSpawnerSystem = new WarshipSpawnerSystem(contexts, lobbyUiStorage.warshipsRoot); accountDtoComponentsCreatorSystem = new AccountDtoComponentsCreatorSystem(contexts); // startCancelMatchComponentsCreatorSystem = new StartCancelMatchComponentsCreatorSystem(contexts.lobbyUi); matchSearchDataUpdaterSystem = new MatchSearchDataUpdaterSystem(contexts); movingIconsDataCreationSystem = new MovingIconsDataCreationSystem(contexts, movingAwardsUiStorage.movingAwardImageParentRectTransform); movingAwardsMainSystem = new MovingAwardsMainSystem(contexts); lobbyLayoutSwitcher = new LobbyLayoutSwitcher(contexts.lobbyUi); systems = new Systems() //Движение наград .Add(movingAwardsMainSystem) //Движение текта .Add(new MovingAwardsTextCreationSystem(contexts)) .Add(new MovingAwardsTextSpawnSystem(contexts, movingAwardsUiStorage.movingAwardTextParentRectTransform)) .Add(new MovingAwardsTextDataUpdaterSystem(contexts)) .Add(new MovingAwardsTextGameObjectUpdaterSystem(contexts)) .Add(new MovingAwardsTextDeleteSystem(contexts)) //Движение наград .Add(movingIconsDataCreationSystem) .Add(new MovingIconInstantiatorSystem(contexts, movingAwardsUiStorage.movingAwardImageParentRectTransform)) .Add(new MovingIconDataUpdaterSystem(contexts)) .Add(new MovingIconsUpdaterSystem(contexts, movingAwardsUiStorage.movingAwardImageUpperObject)) .Add(new MovingIconDestroySystem(contexts)) //Поиск матча .Add(matchSearchDataUpdaterSystem) .Add(new MatchSearchTimeUpdaterSystem(contexts.lobbyUi, lobbyUiStorage.waitTimeText)) .Add(new MatchSearchMenuUpdaterSystem(contexts.lobbyUi, lobbyUiStorage.numberOfPlayersInQueueText, lobbyUiStorage.numberOfPlayersInBattlesText)) //Обработка start/stop .Add(new StartButtonHandler(contexts.lobbyUi, lobbyUiStorage, lobbyUiStorage.lobbySoundsManager)) .Add(new CancelButtonHandler(contexts.lobbyUi, lobbyUiStorage, lobbyUiStorage.lobbySoundsManager)) //Анимация кнопки START .Add(new StartButtonAnimationSystem(contexts.lobbyUi, lobbyUiStorage.startButtonSatellites)) //Обновление статистики в ui (валюты, рейтинг, сундуки) .Add(accountDtoComponentsCreatorSystem) .Add(new HardCurrencyChangingHandler(contexts.lobbyUi, lobbyUiStorage.hardCurrencyText)) .Add(new SoftCurrencyChangingHandler(contexts.lobbyUi, lobbyUiStorage.softCurrencyText)) .Add(new UsernameChangingHandler(contexts.lobbyUi, lobbyUiStorage.usernameText)) .Add(new LootboxPointsChangingHandler(contexts.lobbyUi, lobbyUiStorage.smallLootboxText, lobbyUiStorage.smallLootboxPinGameObject, lobbyUiStorage.smallLootboxPinText)) .Add(new LootboxSliderChangingHandler(contexts.lobbyUi, lobbyUiStorage.lootboxSlider)) .Add(new AccountRatingChangingHandler(contexts.lobbyUi, lobbyUiStorage.accountRatingText)) //Отрисовка кораблей .Add(warshipSpawnerSystem) .Add(new RenderSpriteSystem(contexts)) .Add(new RenderTransformSystem(contexts)) .Add(new SetAnimatorSystem(contexts)) //Заполненеи списка кораблей .Add(new WarshipListFillerSystem(contexts, warshipsUiStorage, this)) //Листание кораблей .Add(new WarshipsEnablingSystem(contexts)) //Обновление рейтинга и ранга для текущего корабля .Add(new WarshipDataUpdaterSystem(contexts, lobbyUiStorage.rankText, lobbyUiStorage.ratingText, lobbyUiStorage.ratingSlider)) //Переключение слоёв ui .Add(lobbyLayoutSwitcher) //Магазин .Add(new ShopUiLayerEnablingSystem(contexts.lobbyUi, uiLayersStorage, shopUiStorage, lobbyLayoutSwitcher, shopUiSpawner)) .Add(new ShopUiLayerDisablingSystem(contexts.lobbyUi, uiLayersStorage, lobbyLayoutSwitcher)) .Add(new PurchaseConfirmationWindowEnablingSystem(contexts.lobbyUi, this, inGameCurrencyPaymaster, shopUiStorage, lobbyLayoutSwitcher)) .Add(new PurchaseConfirmationWindowDisablingSystem(contexts.lobbyUi, shopUiStorage)) //Список кораблей .Add(new WarshipListEnablingSystem(contexts.lobbyUi, lobbyLayoutSwitcher, uiLayersStorage, warshipsUiStorage)) .Add(new WarshipListDisablingSystem(contexts.lobbyUi, lobbyLayoutSwitcher, uiLayersStorage)) //Обзор корабля .Add(new WarshipOverviewEnablingSystem(contexts, warshipsUiStorage, lobbyLayoutSwitcher, this, textTooltip)) .Add(new WarshipOverviewDisablingSystem(contexts.lobbyUi, warshipsUiStorage, lobbyLayoutSwitcher)) //Переключение скинов корабля .Add(new ShiftSkinRightSystem(contexts, lobbyUiStorage.lobbySoundsManager)) .Add(new ShiftSkinLeftSystem(contexts, lobbyUiStorage.lobbySoundsManager)) .Add(new SkinButtonsSwitcherSystem(contexts, warshipsUiStorage)) .Add(new SkinSwitcherSystem(contexts, warshipsUiStorage)) //Модальное окно с характеристиками корабля .Add(new WarshipOverviewModalWindowEnablingSystem(contexts.lobbyUi, warshipsUiStorage, lobbyLayoutSwitcher)) .Add(new WarshipOverviewModalWindowDisablingSystem(contexts.lobbyUi, warshipsUiStorage, lobbyLayoutSwitcher)) //Модальное окно улучшения корабля .Add(new WarshipImprovementModalWindowEnablingSystem(contexts.lobbyUi, warshipsUiStorage, lobbyLayoutSwitcher, lobbySceneSwitcher)) .Add(new WarshipImprovementModalWindowDisablingSystem(contexts.lobbyUi, warshipsUiStorage, lobbyLayoutSwitcher)) //Показ начисления наград .Add(new LobbySceneUiEnablingSystem(contexts, lobbyUiStorage)) .Add(new LobbySceneUiDisablingSystem(contexts.lobbyUi, lobbyUiStorage)) //Очистка // .Add(new ContextsClearSystem(contexts)) .Add(new ClearLobbyUiSystem(contexts.lobbyUi)) ; systems.ActivateReactiveSystems(); systems.Initialize(); contexts.lobbyUi.CreateEntity().messageDisableWarshipImprovementModalWindow = true; contexts.lobbyUi.CreateEntity().messageDisableWarshipOverviewModalWindow = true; contexts.lobbyUi.CreateEntity().messageDisableWarshipOverviewUiLayer = true; contexts.lobbyUi.CreateEntity().messageDisableWarshipListUiLayer = true; contexts.lobbyUi.CreateEntity().messageDisableShopUiLayer = true; }
void when_systems() { MyTestContext ctx = null; before = () => { ctx = new MyTestContext(); }; context["fixtures"] = () => { it["initializes InitializeSystemSpy"] = () => { var system = new InitializeSystemSpy(); system.didInitialize.should_be(0); system.Initialize(); system.didInitialize.should_be(1); }; it["executes ExecuteSystemSpy"] = () => { var system = new ExecuteSystemSpy(); system.didExecute.should_be(0); system.Execute(); system.didExecute.should_be(1); }; it["cleans up CleanupSystemSpy"] = () => { var system = new CleanupSystemSpy(); system.didCleanup.should_be(0); system.Cleanup(); system.didCleanup.should_be(1); }; it["tears down TearDownSystemSpy"] = () => { var system = new TearDownSystemSpy(); system.didTearDown.should_be(0); system.TearDown(); system.didTearDown.should_be(1); }; it["initializes, executes, cleans up and tears down system"] = () => { var system = new ReactiveSystemSpy(ctx.CreateCollector(Matcher <TestEntity> .AllOf(CID.ComponentA))); ctx.CreateEntity().AddComponentA(); system.didInitialize.should_be(0); system.Initialize(); system.didInitialize.should_be(1); system.didExecute.should_be(0); system.Execute(); system.didExecute.should_be(1); system.didCleanup.should_be(0); system.Cleanup(); system.didCleanup.should_be(1); system.didTearDown.should_be(0); system.TearDown(); system.didTearDown.should_be(1); }; it["executes ReactiveSystemSpy"] = () => { var system = createReactiveSystem(ctx); system.Execute(); system.entities.Length.should_be(1); }; }; context["systems"] = () => { Systems systems = null; before = () => { systems = new Systems(); }; it["returns systems when adding system"] = () => { systems.Add(new InitializeSystemSpy()).should_be_same(systems); }; it["initializes IInitializeSystem"] = () => { var system = new InitializeSystemSpy(); systems.Add(system); systems.Initialize(); system.didInitialize.should_be(1); }; it["executes IExecuteSystem"] = () => { var system = new ExecuteSystemSpy(); systems.Add(system); systems.Execute(); system.didExecute.should_be(1); }; it["wraps IReactiveSystem in a ReactiveSystem"] = () => { var system = new ReactiveSystemSpy(ctx.CreateCollector(Matcher <TestEntity> .AllOf(CID.ComponentA))); systems.Add(system); ctx.CreateEntity().AddComponentA(); systems.Execute(); system.didExecute.should_be(1); }; it["adds ReactiveSystem"] = () => { var system = new ReactiveSystemSpy(ctx.CreateCollector(Matcher <TestEntity> .AllOf(CID.ComponentA))); systems.Add(system); ctx.CreateEntity().AddComponentA(); systems.Execute(); system.didExecute.should_be(1); }; it["cleans up ICleanupSystem"] = () => { var system = new CleanupSystemSpy(); systems.Add(system); systems.Cleanup(); system.didCleanup.should_be(1); }; it["initializes, executes, cleans up and tears down InitializeExecuteCleanupTearDownSystemSpy"] = () => { var system = new ReactiveSystemSpy(ctx.CreateCollector(Matcher <TestEntity> .AllOf(CID.ComponentA))); ctx.CreateEntity().AddComponentA(); systems.Add(system); system.didInitialize.should_be(0); systems.Initialize(); system.didInitialize.should_be(1); system.didExecute.should_be(0); systems.Execute(); system.didExecute.should_be(1); system.didCleanup.should_be(0); systems.Cleanup(); system.didCleanup.should_be(1); system.didTearDown.should_be(0); systems.TearDown(); system.didTearDown.should_be(1); }; it["initializes, executes, cleans up and tears down ReactiveSystem"] = () => { var system = createReactiveSystem(ctx); systems.Add(system); system.didInitialize.should_be(0); systems.Initialize(); system.didInitialize.should_be(1); system.didExecute.should_be(0); systems.Execute(); systems.Execute(); system.didExecute.should_be(1); system.didCleanup.should_be(0); systems.Cleanup(); system.didCleanup.should_be(1); system.didTearDown.should_be(0); systems.TearDown(); system.didTearDown.should_be(1); }; it["initializes, executes, cleans up and tears down systems recursively"] = () => { var system = createReactiveSystem(ctx); systems.Add(system); var parentSystems = new Systems(); parentSystems.Add(systems); system.didInitialize.should_be(0); parentSystems.Initialize(); system.didInitialize.should_be(1); system.didExecute.should_be(0); parentSystems.Execute(); parentSystems.Execute(); system.didExecute.should_be(1); system.didCleanup.should_be(0); parentSystems.Cleanup(); system.didCleanup.should_be(1); system.didTearDown.should_be(0); parentSystems.TearDown(); system.didTearDown.should_be(1); }; it["clears reactive systems"] = () => { var system = createReactiveSystem(ctx); systems.Add(system); systems.Initialize(); system.didInitialize.should_be(1); systems.ClearReactiveSystems(); systems.Execute(); system.didExecute.should_be(0); }; it["clears reactive systems recursively"] = () => { var system = createReactiveSystem(ctx); systems.Add(system); var parentSystems = new Systems(); parentSystems.Add(systems); parentSystems.Initialize(); system.didInitialize.should_be(1); parentSystems.ClearReactiveSystems(); parentSystems.Execute(); system.didExecute.should_be(0); }; it["deactivates reactive systems"] = () => { var system = createReactiveSystem(ctx); systems.Add(system); systems.Initialize(); system.didInitialize.should_be(1); systems.DeactivateReactiveSystems(); systems.Execute(); system.didExecute.should_be(0); }; it["deactivates reactive systems recursively"] = () => { var system = createReactiveSystem(ctx); systems.Add(system); var parentSystems = new Systems(); parentSystems.Add(systems); parentSystems.Initialize(); system.didInitialize.should_be(1); parentSystems.DeactivateReactiveSystems(); parentSystems.Execute(); system.didExecute.should_be(0); }; it["activates reactive systems"] = () => { var system = createReactiveSystem(ctx); systems.Add(system); systems.Initialize(); system.didInitialize.should_be(1); systems.DeactivateReactiveSystems(); systems.ActivateReactiveSystems(); systems.Execute(); system.didExecute.should_be(0); ctx.CreateEntity().AddComponentA(); systems.Execute(); system.didExecute.should_be(1); }; it["activates reactive systems recursively"] = () => { var system = createReactiveSystem(ctx); systems.Add(system); var parentSystems = new Systems(); parentSystems.Add(systems); parentSystems.Initialize(); system.didInitialize.should_be(1); parentSystems.DeactivateReactiveSystems(); parentSystems.ActivateReactiveSystems(); parentSystems.Execute(); system.didExecute.should_be(0); ctx.CreateEntity().AddComponentA(); systems.Execute(); system.didExecute.should_be(1); }; }; }
private void InitSystems() { _systems.ActivateReactiveSystems(); _systems.Initialize(); }
public void Start() { systems.ActivateReactiveSystems(); systems.Initialize(); }