Ejemplo n.º 1
0
        public void SetUp()
        {
            const string sectionPrefabPath =
                "Assets/Scripts/MainScripts/DCL/Controllers/HUD/BuilderProjectsPanel/Prefabs/SectionScenesView.prefab";
            var sectionPrefab = AssetDatabase.LoadAssetAtPath <GameObject>(sectionPrefabPath);

            const string sceneCardPrefabPath =
                "Assets/Scripts/MainScripts/DCL/Controllers/HUD/BuilderProjectsPanel/Prefabs/SceneCardView.prefab";
            var sceneCardPrefab = AssetDatabase.LoadAssetAtPath <SceneCardView>(sceneCardPrefabPath);

            sectionController = new SectionScenesController();
            scenesController  = new ScenesViewController(sceneCardPrefab);

            IDeployedSceneListener deployedSceneListener = sectionController;
            IProjectSceneListener  projectSceneListener  = sectionController;

            scenesController.OnDeployedSceneAdded   += deployedSceneListener.OnSceneAdded;
            scenesController.OnDeployedSceneRemoved += deployedSceneListener.OnSceneRemoved;
            scenesController.OnDeployedScenesSet    += deployedSceneListener.OnSetScenes;
            scenesController.OnProjectSceneAdded    += projectSceneListener.OnSceneAdded;
            scenesController.OnProjectSceneRemoved  += projectSceneListener.OnSceneRemoved;
            scenesController.OnProjectScenesSet     += projectSceneListener.OnSetScenes;

            deployedSceneListener.OnSetScenes(scenesController.deployedScenes);
            projectSceneListener.OnSetScenes(scenesController.projectScenes);
        }
        public void SetSectionStateCorrectly()
        {
            SectionDeployedScenesController controller = new SectionDeployedScenesController(view);
            IDeployedSceneListener          listener   = controller;

            controller.SetFetchingDataState(true);
            listener.OnSetScenes(new Dictionary <string, ISceneCardView>());
            Assert.IsTrue(view.loadingAnimationContainer.activeSelf);

            controller.SetFetchingDataState(false);
            listener.OnSetScenes(new Dictionary <string, ISceneCardView>());
            Assert.IsTrue(view.emptyContainer.activeSelf);

            listener.OnSetScenes(new Dictionary <string, ISceneCardView>()
            {
                { "1", Substitute.For <ISceneCardView>() }, { "2", Substitute.For <ISceneCardView>() }
            });
            Assert.IsTrue(view.contentContainer.activeSelf);

            listener.OnSetScenes(new Dictionary <string, ISceneCardView>()
            {
                { "1", Substitute.For <ISceneCardView>() }
            });
            Assert.IsTrue(view.contentContainer.activeSelf);

            controller.Dispose();
        }
 void IScenesViewController.AddListener(IDeployedSceneListener listener)
 {
     OnDeployedSceneAdded   += listener.OnSceneAdded;
     OnDeployedSceneRemoved += listener.OnSceneRemoved;
     OnDeployedScenesSet    += listener.OnSetScenes;
     listener.OnSetScenes(deployedScenes);
 }
 void IScenesViewController.RemoveListener(IDeployedSceneListener listener)
 {
     OnDeployedSceneAdded   -= listener.OnSceneAdded;
     OnDeployedSceneRemoved -= listener.OnSceneRemoved;
     OnDeployedScenesSet    -= listener.OnSetScenes;
 }