private static void LoadModules()
 {
     modules_are_being_loaded = true;
     Helper.DownloadStringASync(THRY_MODULES_URL, delegate(string s) {
         modules = new List <ModuleHeader>();
         List <string> module_urls = Parser.ParseToObject <List <string> >(s);
         foreach (string url in module_urls)
         {
             Helper.DownloadStringASync(url, delegate(string data)
             {
                 ModuleHeader new_module     = new ModuleHeader();
                 new_module.url              = url;
                 new_module.available_module = Parser.ParseToObject <ModuleInfo>(data);
                 InitInstalledModule(new_module);
                 if (new_module.available_module.requirement != null)
                 {
                     new_module.available_requirement_fullfilled = new_module.available_module.requirement.Test();
                 }
                 modules.Add(new_module);
                 //Debug.Log(Parser.ObjectToString(new_module));
                 Helper.RepaintEditorWindow(typeof(Settings));
             });
         }
     });
 }
Beispiel #2
0
        //------------------Message Calls-------------------------

        public void OnDestroy()
        {
            if (isFirstPopop && Config.Get().share_user_data)
            {
                Helper.SendAnalytics();
            }
            if (!EditorPrefs.GetBool("thry_has_counted_user", false))
            {
                Helper.DownloadStringASync(URL.COUNT_USER, delegate(string s)
                {
                    if (s == "true")
                    {
                        EditorPrefs.SetBool("thry_has_counted_user", true);
                    }
                });
            }
            string projectPrefix = PlayerSettings.companyName + "." + PlayerSettings.productName;

            if (!EditorPrefs.GetBool(projectPrefix + "_thry_has_counted_project", false))
            {
                Helper.DownloadStringASync(URL.COUNT_PROJECT, delegate(string s)
                {
                    if (s == "true")
                    {
                        EditorPrefs.SetBool(projectPrefix + "_thry_has_counted_project", true);
                    }
                });
            }
        }
Beispiel #3
0
 private void GUIShareData()
 {
     is_data_share_expanded = Foldout("User Data Collection", is_data_share_expanded);
     if (is_data_share_expanded)
     {
         EditorGUI.indentLevel += 2;
         Toggle("share_user_data", "Share Anonomyous Data for usage statistics", "", EditorStyles.boldLabel);
         EditorGUILayout.LabelField("The data is identified by a hash of your macaddress. This is to make sure we don't log any user twice, while still keeping all data anonymous.");
         if (Config.Get().share_user_data)
         {
             Toggle("share_installed_unity_version", "Share my installed Unity Version", "");
             Toggle("share_installed_editor_version", "Share my installed Thry Editor Version", "");
             Toggle("share_used_shaders", "Share the names of installed shaders using thry editor", "");
             GUILayout.BeginHorizontal();
             GUILayout.Space(EditorGUI.indentLevel * 15);
             if (GUILayout.Button("Show all data collected about me", GUILayout.ExpandWidth(false)))
             {
                 Helper.DownloadStringASync(URL.DATA_SHARE_GET_MY_DATA + "?hash=" + Helper.GetMacAddress().GetHashCode(), delegate(string s){
                     TextPopup popup    = ScriptableObject.CreateInstance <TextPopup>();
                     popup.position     = new Rect(Screen.width / 2, Screen.height / 2, 512, 480);
                     popup.titleContent = new GUIContent("Your Data");
                     popup.text         = s;
                     popup.ShowUtility();
                 });
             }
             GUILayout.EndHorizontal();
         }
         EditorGUI.indentLevel -= 2;
     }
 }
Beispiel #4
0
        private void InitVariables()
        {
            is_changing_vrc_sdk = (Helper.LoadValueFromFile("delete_vrc_sdk", PATH.AFTER_COMPILE_DATA) == "true") || (Helper.LoadValueFromFile("update_vrc_sdk", PATH.AFTER_COMPILE_DATA) == "true");

            CheckAPICompatibility(); //check that Net_2.0 is ApiLevel
            CheckDrawingDll();       //check that drawing.dll is imported
            CheckVRCSDK();

            List <Type> subclasses = typeof(ModuleSettings).Assembly.GetTypes().Where(type => type.IsSubclassOf(typeof(ModuleSettings))).ToList <Type>();

            moduleSettings = new ModuleSettings[subclasses.Count];
            int i = 0;

            foreach (Type classtype in subclasses)
            {
                moduleSettings[i++] = (ModuleSettings)Activator.CreateInstance(classtype);
            }

            is_init = true;

            if (thry_message == null)
            {
                Helper.DownloadStringASync(Thry.URL.SETTINGS_MESSAGE_URL, delegate(string s) { thry_message = Parser.ParseToObject <ButtonData>(s); });
            }
        }
Beispiel #5
0
 private static void InstallModule(string url, string name)
 {
     EditorUtility.DisplayProgressBar(name + " download progress", "", 0);
     Helper.DownloadStringASync(url, delegate(string s)
     {
         if (s.StartsWith("404"))
         {
             Debug.LogWarning(s);
             return;
         }
         //Debug.Log(s);
         ModuleInfo module_info   = Parser.ParseToObject <ModuleInfo>(s);
         string thry_modules_path = ThryEditor.GetThryEditorDirectoryPath();
         string temp_path         = "temp_" + name;
         if (thry_modules_path == null)
         {
             thry_modules_path = "Assets";
         }
         thry_modules_path  += "/thry_modules";
         string install_path = thry_modules_path + "/" + name;
         string base_url     = url.RemoveFileName();
         Helper.WriteStringToFile(s, temp_path + "/module.json");
         int i = 0;
         foreach (string f in module_info.files)
         {
             //Debug.Log(base_url + f);
             Helper.DownloadFileASync(base_url + f, temp_path + "/" + f, delegate(string data)
             {
                 i++;
                 EditorUtility.DisplayProgressBar("Downloading files for " + name, "Downloaded " + base_url + f, (float)i / module_info.files.Count);
                 if (i == module_info.files.Count)
                 {
                     EditorUtility.ClearProgressBar();
                     if (!Directory.Exists(thry_modules_path))
                     {
                         Directory.CreateDirectory(thry_modules_path);
                     }
                     Directory.Move(temp_path, install_path);
                     AssetDatabase.Refresh();
                 }
             });
         }
     });
 }
Beispiel #6
0
        private void InitVariables()
        {
            is_changing_vrc_sdk = (Helper.LoadValueFromFile("delete_vrc_sdk", ".thry_after_compile_data") == "true") || (Helper.LoadValueFromFile("update_vrc_sdk", ".thry_after_compile_data") == "true");

            CheckAPICompatibility(); //check that Net_2.0 is ApiLevel
            CheckMCS();              //check that MCS is imported
            SetupStyle();            //setup styles
            CheckVRCSDK();

            List <Type> subclasses = typeof(ModuleSettings).Assembly.GetTypes().Where(type => type.IsSubclassOf(typeof(ModuleSettings))).ToList <Type>();

            moduleSettings = new ModuleSettings[subclasses.Count];
            int i = 0;

            foreach (Type classtype in subclasses)
            {
                moduleSettings[i++] = (ModuleSettings)Activator.CreateInstance(classtype);
            }

            if (thry_message == null)
            {
                Helper.DownloadStringASync(THRY_MESSAGE_URL, delegate(string s) { thry_message = Parser.ParseToObject <ButtonData>(s); });
            }
        }