Exemple #1
0
        private void LoginToPublisher()
        {
            //Create a local sync service project.
            string           projectStr  = File.ReadAllText($"{importPath}/project.json");
            UnityProjectData projectData = JsonUtility.FromJson <UnityProjectData>(projectStr);
            UnityProject     project     = new UnityProject(projectData.ProjectId, projectData.ProjectName);

            //Create a Unity User
            string        userStr  = File.ReadAllText($"{importPath}/user.json");
            UnityUserData userData = JsonUtility.FromJson <UnityUserData>(userStr);
            UnityUser     user     = new UnityUser(userData.AccessToken, userData.DisplayName, userData.UserId);

            publisher = new MarkerPublisher();
            publisher.UpdateProject(project, user);
        }
        public void UpdateProject(UnityProject currentProject, UnityUser user)
        {
            if (currentProject.ProjectId == m_CurrentProject && currentProject.Host.ServerId == m_CurrentServer)
            {
                return;
            }

            m_Markers.Clear();
            OnUpdated?.Invoke(new Delta <Marker>());
            if (currentProject == (UnityProject)Project.Empty)
            {
                m_CurrentProject = m_CurrentServer = null;
                m_Publisher.Disconnect();
                return;
            }
            m_CurrentProject = currentProject.ProjectId;
            m_CurrentServer  = currentProject.Host.ServerId;
            m_Publisher.UpdateProject(currentProject, user);
        }