void OnProjectOpenButtonClick(Project project)
        {
            var projectData = UIStateManager.current.projectStateData;

            if (projectData.activeProject == project)
            {
                Dispatcher.Dispatch(Payload <ActionTypes> .From(ActionTypes.OpenDialog, DialogType.None));
                //if the project already opened, just close landing screen
                return;
            }

            var navigationState = UIStateManager.current.stateData.navigationState;

            if (navigationState.navigationMode == NavigationMode.Walk)
            {
                UIStateManager.current.walkStateData.instruction.Cancel();
            }

            projectData.activeProject          = project;
            projectData.activeProjectThumbnail = ThumbnailController.LoadThumbnailForProject(project);

            if (UIStateManager.current.projectStateData.activeProject != Project.Empty)
            {
                // first close current Project if open
                Dispatcher.Dispatch(Payload <ActionTypes> .From(ActionTypes.SetStatusMessage, "Closing {UIStateManager.current.projectStateData.activeProject.name}..."));
                Dispatcher.Dispatch(Payload <ActionTypes> .From(ActionTypes.CloseProject, UIStateManager.current.projectStateData.activeProject));
            }
            Dispatcher.Dispatch(Payload <ActionTypes> .From(ActionTypes.SetStatusMessage, $"Opening {projectData.activeProject.name}..."));
            Dispatcher.Dispatch(Payload <ActionTypes> .From(ActionTypes.CloseAllDialogs, null));
            Dispatcher.Dispatch(Payload <ActionTypes> .From(ActionTypes.OpenProject, projectData));
            Dispatcher.Dispatch(Payload <ActionTypes> .From(ActionTypes.SetMeasureToolOptions, MeasureToolStateData.defaultData));
        }
Esempio n. 2
0
        void InstantiateProjectItems(Project[] projects)
        {
            ClearProjectListItem();
            m_ScrollRect.verticalNormalizedPosition = 1;

            if (m_FetchingProjectsPanel.activeSelf)
            {
                m_FetchingProjectsPanel.SetActive(false);
            }

            Array.Sort(projects, (project1, project2) => project2.lastPublished.CompareTo(project1.lastPublished));
            foreach (var project in projects)
            {
                var listItem = Instantiate(m_ProjectListItemPrefab, m_ScrollViewContent.transform);
                listItem.gameObject.SetActive(true);
                listItem.InitProjectItem(project, ThumbnailController.LoadThumbnailForProject(project));

                listItem.projectItemClicked  += OnProjectOpenButtonClick;
                listItem.optionButtonClicked += OnProjectOptionButtonClick;
                m_ProjectListItems.Add(listItem);
            }

            m_ProjectListItemPrefab.gameObject.SetActive(false);

            FilterProjectList(m_CurrentFilterData);
        }
Esempio n. 3
0
        void OnProjectOpenButtonClick(Project project)
        {
            var projectData = UIStateManager.current.projectStateData;

            if (projectData.activeProject == project)
            {
                UIStateManager.current.Dispatcher.Dispatch(Payload <ActionTypes> .From(ActionTypes.OpenDialog, DialogType.None));
                //if the project already opened, just close landing screen

                return;
            }

            projectData.activeProject          = project;
            projectData.activeProjectThumbnail = ThumbnailController.LoadThumbnailForProject(project);

            if (UIStateManager.current.projectStateData.activeProject != Project.Empty)
            {
                // first close current Project if open
                UIStateManager.current.Dispatcher.Dispatch(Payload <ActionTypes> .From(ActionTypes.SetStatus, "Closing {UIStateManager.current.projectStateData.activeProject.name}..."));
                UIStateManager.current.Dispatcher.Dispatch(Payload <ActionTypes> .From(ActionTypes.CloseProject, UIStateManager.current.projectStateData.activeProject));
            }
            UIStateManager.current.Dispatcher.Dispatch(Payload <ActionTypes> .From(ActionTypes.SetStatus, $"Opening {projectData.activeProject.name}..."));
            UIStateManager.current.Dispatcher.Dispatch(Payload <ActionTypes> .From(ActionTypes.CloseAllDialogs, null));
            UIStateManager.current.Dispatcher.Dispatch(Payload <ActionTypes> .From(ActionTypes.OpenProject, projectData));
        }
        void InstantiateButtons(Project[] projects)
        {
            Array.Sort(projects, (project1, project2) => project2.lastPublished.CompareTo(project1.lastPublished));
            foreach (var project in projects)
            {
                var listItem = Instantiate(m_ProjectListItemPrefab, m_ScrollViewContent.transform);
                listItem.gameObject.SetActive(true);
                listItem.InitProjectItem(project, ThumbnailController.LoadThumbnailForProject(project));

                listItem.projectItemClicked  += OnProjectSelectButtonClick;
                listItem.optionButtonClicked += OnProjectOptionButtonClick;
            }
        }