示例#1
0
        /// <summary>
        /// get collection of versions of scene
        /// </summary>
        /// <param name="refreshSceneVersionComplete"></param>
        public static void RefreshSceneVersion(System.Action refreshSceneVersionComplete)
        {
            Debug.Log("refresh scene version");
            //gets the scene version from api and sets it to the current scene
            string currentSceneName = UnityEditor.SceneManagement.EditorSceneManager.GetActiveScene().name;
            var    currentSettings  = CognitiveVR_Preferences.FindScene(currentSceneName);

            if (currentSettings != null)
            {
                if (!IsDeveloperKeyValid)
                {
                    Debug.Log("Developer key invalid"); return;
                }

                if (currentSettings == null)
                {
                    Debug.Log("SendSceneVersionRequest no scene settings!");
                    return;
                }
                if (string.IsNullOrEmpty(currentSettings.SceneId))
                {
                    if (refreshSceneVersionComplete != null)
                    {
                        refreshSceneVersionComplete.Invoke();
                    }
                    return;
                }

                RefreshSceneVersionComplete = refreshSceneVersionComplete;
                string url = Constants.GETSCENEVERSIONS(currentSettings.SceneId);

                Dictionary <string, string> headers = new Dictionary <string, string>();
                if (EditorCore.IsDeveloperKeyValid)
                {
                    headers.Add("Authorization", "APIKEY:DEVELOPER " + EditorCore.DeveloperKey);
                }

                EditorNetwork.Get(url, GetSceneVersionResponse, headers, true, "Get Scene Version");//AUTH
            }
            else
            {
                Debug.Log("No scene versions for scene: " + currentSceneName);
            }
        }