Exemplo n.º 1
0
    SectionBase ISectionFactory.GetSectionController(SectionsController.SectionId id)
    {
        SectionBase result = null;

        switch (id)
        {
        case SectionsController.SectionId.SCENES_MAIN:
            result = new SectionScenesController();
            break;

        case SectionsController.SectionId.SCENES_DEPLOYED:
            break;

        case SectionsController.SectionId.SCENES_PROJECT:
            result = new SectionProjectScenesController();
            break;

        case SectionsController.SectionId.LAND:
            break;

        case SectionsController.SectionId.SETTINGS_PROJECT_GENERAL:
            result = new SectionSceneGeneralSettingsController();
            break;
        }

        return(result);
    }
Exemplo n.º 2
0
        public void ShowCardsInCorrectSortOrder()
        {
            const string prefabAssetPath =
                "Assets/Scripts/MainScripts/DCL/Controllers/HUD/BuilderProjectsPanel/Prefabs/SceneCardView.prefab";
            var prefab = AssetDatabase.LoadAssetAtPath <SceneCardView>(prefabAssetPath);

            Dictionary <string, SceneCardView> cardViews = new Dictionary <string, SceneCardView>();
            const int cardsCount = 10;

            for (int i = 0; i < cardsCount; i++)
            {
                var card = Object.Instantiate(prefab);
                card.Setup(new SceneData()
                {
                    size = new Vector2Int(i, i), id = i.ToString()
                });
                cardViews.Add(i.ToString(), card);
            }


            SectionProjectScenesController controller = new SectionProjectScenesController(view);

            controller.searchHandler.SetSortType(SceneSearchHandler.SIZE_SORT_TYPE);
            controller.searchHandler.SetSortOrder(true);

            ((IProjectSceneListener)controller).OnSetScenes(cardViews);

            Assert.AreEqual(cardsCount, view.scenesCardContainer.childCount);

            var prev = view.scenesCardContainer.GetChild(0).GetComponent <SceneCardView>();

            for (int i = 1; i < cardsCount; i++)
            {
                var current = view.scenesCardContainer.GetChild(i).GetComponent <SceneCardView>();
                Assert.LessOrEqual(current.sceneData.size.x * current.sceneData.size.y, prev.sceneData.size.x * prev.sceneData.size.y);
                prev = current;
            }

            foreach (var card in cardViews.Values)
            {
                Object.Destroy(card);
            }
            controller.Dispose();
        }
Exemplo n.º 3
0
    SectionBase ISectionFactory.GetSectionController(SectionId id)
    {
        SectionBase result = null;

        switch (id)
        {
        case SectionId.SCENES_MAIN:
            result = new SectionScenesController();
            break;

        case SectionId.SCENES_DEPLOYED:
            result = new SectionDeployedScenesController();
            break;

        case SectionId.SCENES_PROJECT:
            result = new SectionProjectScenesController();
            break;

        case SectionId.LAND:
            result = new SectionLandController();
            break;

        case SectionId.SETTINGS_PROJECT_GENERAL:
            result = new SectionSceneGeneralSettingsController();
            break;

        case SectionId.SETTINGS_PROJECT_CONTRIBUTORS:
            result = new SectionSceneContributorsSettingsController();
            break;

        case SectionId.SETTINGS_PROJECT_ADMIN:
            result = new SectionSceneAdminsSettingsController();
            break;
        }

        return(result);
    }