Esempio n. 1
0
 private void GUIShareData()
 {
     is_data_share_expanded = Foldout(Locale.editor.Get("header_user_data_collection"), is_data_share_expanded);
     if (is_data_share_expanded)
     {
         EditorGUI.indentLevel += 2;
         Toggle("share_user_data", EditorStyles.boldLabel);
         EditorGUILayout.LabelField(Locale.editor.Get("share_data_info_message"));
         if (Config.Get().share_user_data)
         {
             Toggle("share_installed_unity_version");
             Toggle("share_installed_editor_version");
             Toggle("share_used_shaders");
             GUILayout.BeginHorizontal();
             GUILayout.Space(EditorGUI.indentLevel * 15);
             if (GUILayout.Button(Locale.editor.Get("button_get_my_data"), GUILayout.ExpandWidth(false)))
             {
                 WebHelper2.DownloadStringASync(URL.DATA_SHARE_GET_MY_DATA + "?hash=" + WebHelper.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(Locale.editor.Get("your_data"));
                     popup.text         = s;
                     popup.ShowUtility();
                 });
             }
             GUILayout.EndHorizontal();
         }
         EditorGUI.indentLevel -= 2;
     }
 }
        public async static void DownloadAndInstallVRCSDK(VRC_SDK_Type type)
        {
            RemoteConfig remoteConfig = await LoadRemoteConfig();

            string url;

            if (type == VRC_SDK_Type.SDK_2)
            {
                url = remoteConfig.sdk2;
            }
            else if (type == VRC_SDK_Type.SDK_3_Avatar)
            {
                url = remoteConfig.sdk3_avatars;
            }
            else if (type == VRC_SDK_Type.SDK_3_World)
            {
                url = remoteConfig.sdk3_worlds;
            }
            else
            {
                return;
            }
            if (File.Exists(PATH.TEMP_VRC_SDK_PACKAGE))
            {
                File.Delete(PATH.TEMP_VRC_SDK_PACKAGE);
            }
            PersistentData.Set("vrc_sdk_version", UrlToVersion(url));
            WebHelper2.DownloadFileASync(url, PATH.TEMP_VRC_SDK_PACKAGE, VRCSDKUpdateCallback);
        }
 private void LoadRemoteConfig(Action callback)
 {
     WebHelper2.DownloadStringASync("https://api.vrchat.cloud/api/1/config", delegate(string s)
     {
         Dictionary <object, object> remoteC = (Dictionary <object, object>)Parser.ParseJson(s);
         Dictionary <object, object> urls    = (Dictionary <object, object>)remoteC["downloadUrls"];
         remoteConfig              = new RemoteConfig();
         remoteConfig.sdk2         = (string)urls["sdk2"];
         remoteConfig.sdk3_worlds  = (string)urls["sdk3-worlds"];
         remoteConfig.sdk3_avatars = (string)urls["sdk3-avatars"];
         callback();
     });
 }
        private static Task <RemoteConfig> LoadRemoteConfig()
        {
            return(Task.Run(() =>
            {
                var t = new TaskCompletionSource <RemoteConfig>();

                WebHelper2.DownloadStringASync("https://api.vrchat.cloud/api/1/config", delegate(string s)
                {
                    Dictionary <string, object> remoteC = (Dictionary <string, object>)Parser.ParseJson(s);
                    Dictionary <string, object> urls = (Dictionary <string, object>)remoteC["downloadUrls"];
                    RemoteConfig remoteConfig = new RemoteConfig();
                    remoteConfig.sdk2 = (string)urls["sdk2"];
                    remoteConfig.sdk3_worlds = (string)urls["sdk3-worlds"];
                    remoteConfig.sdk3_avatars = (string)urls["sdk3-avatars"];
                    t.TrySetResult(remoteConfig);
                });
                return t.Task;
            }));
        }
Esempio n. 5
0
        public static void DownloadAndInstallVRCSDK(VRC_SDK_Type type)
        {
            string url;

            if (type == VRC_SDK_Type.SDK_2)
            {
                url = SDK2_URL;
            }
            else if (type == VRC_SDK_Type.SDK_3)
            {
                url = SDK3_URL;
            }
            else
            {
                return;
            }
            if (File.Exists(PATH.TEMP_VRC_SDK_PACKAGE))
            {
                File.Delete(PATH.TEMP_VRC_SDK_PACKAGE);
            }
            WebHelper2.DownloadFileASync(url, PATH.TEMP_VRC_SDK_PACKAGE, VRCSDKUpdateCallback);
        }