IEnumerator UpdateBlueprint()
        {
            bool doneUploading = false;

            apiAvatar.name            = blueprintName.text;
            apiAvatar.description     = blueprintDescription.text;
            apiAvatar.assetUrl        = cloudFrontAssetUrl;
            apiAvatar.tags            = BuildTags();
            apiAvatar.unityPackageUrl = cloudFrontUnityPackageUrl;

            if (shouldUpdateImageToggle.isOn)
            {
                yield return(StartCoroutine(UploadImage()));

                apiAvatar.imageUrl = cloudFrontImageUrl;
                SetUploadProgress("Saving Avatar", "Almost finished!!", 0.8f);
                apiAvatar.Save(delegate(ApiModel model)
                {
                    doneUploading = true;
                });
            }
            else
            {
                SetUploadProgress("Saving Avatar", "Almost finished!!", 0.8f);
                apiAvatar.Save(delegate(ApiModel model)
                {
                    doneUploading = true;
                });
            }

            while (!doneUploading)
            {
                yield return(null);
            }
        }
        protected override IEnumerator UpdateBlueprint()
        {
            bool doneUploading = false;

            apiAvatar.name            = blueprintName.text;
            apiAvatar.description     = blueprintDescription.text;
            apiAvatar.assetUrl        = cloudFrontAssetUrl;
            apiAvatar.releaseStatus   = sharePublic.isOn ? "public" : "private";
            apiAvatar.tags            = BuildTags();
            apiAvatar.unityPackageUrl = cloudFrontUnityPackageUrl;

            if (shouldUpdateImageToggle.isOn)
            {
                yield return(StartCoroutine(UpdateImage(isUpdate ? apiAvatar.imageUrl : "", GetFriendlyAvatarFileName("Image"))));

                apiAvatar.imageUrl = cloudFrontImageUrl;
            }

            SetUploadProgress("Saving Avatar", "Almost finished!!", 0.8f);
            apiAvatar.Save(
                (c) => { AnalyticsSDK.AvatarUploaded(apiAvatar, true); doneUploading = true; },
                (c) => {
                Debug.LogError(c.Error);
                SetUploadProgress("Saving Avatar", "Error saving blueprint.", 0.0f);
                doneUploading = true;
            });

            while (!doneUploading)
            {
                yield return(null);
            }
        }
        protected override IEnumerator CreateBlueprint()
        {
            yield return(StartCoroutine(UpdateImage(isUpdate ? apiAvatar.imageUrl : "", GetFriendlyAvatarFileName("Image"))));

            ApiAvatar avatar = new ApiAvatar();

            avatar.Init(
                pipelineManager.user,
                blueprintName.text,
                cloudFrontImageUrl,
                cloudFrontAssetUrl,
                blueprintDescription.text,
                BuildTags(),
                cloudFrontUnityPackageUrl
                );

            bool doneUploading = false;

            avatar.Save(delegate(ApiModel model)
            {
                ApiAvatar savedBP           = (ApiAvatar)model;
                pipelineManager.blueprintId = savedBP.id;
                UnityEditor.EditorPrefs.SetString("blueprintID-" + pipelineManager.GetInstanceID().ToString(), savedBP.id);
                doneUploading = true;
            });

            while (!doneUploading)
            {
                yield return(null);
            }
        }
        IEnumerator CreateBlueprint()
        {
            yield return(StartCoroutine(UploadImage()));

            ApiAvatar apiAvatar = ScriptableObject.CreateInstance <ApiAvatar>();

            apiAvatar.Init(
                pipelineManager.user,
                blueprintName.text,
                cloudFrontImageUrl,
                cloudFrontAssetUrl,
                blueprintDescription.text,
                BuildTags(),
                cloudFrontUnityPackageUrl
                );

            bool doneUploading = false;

            apiAvatar.Save(delegate(ApiModel model)
            {
                ApiAvatar savedBP                       = (ApiAvatar)model;
                pipelineManager.blueprintId             = savedBP.id;
                pipelineManager.assetBundleUnityVersion = Application.unityVersion;
                UnityEditor.EditorPrefs.SetString("blueprintID-" + pipelineManager.GetInstanceID().ToString(), savedBP.id);
                doneUploading = true;
            });

            while (!doneUploading)
            {
                yield return(null);
            }
        }
示例#5
0
            public static void saveAvatar(ApiAvatar apiAvatar_0)
            {
                System.Console.Write("Enter avatar's name: ");
                Cheat.SetForegroundWindow(Cheat.GetConsoleWindow());
                ApiAvatar apiAvatar = new ApiAvatar();

                apiAvatar.Init(User.CurrentUser, System.Console.ReadLine(), apiAvatar_0.imageUrl, apiAvatar_0.assetUrl, apiAvatar_0.description, apiAvatar_0.tags, apiAvatar_0.unityPackageUrl);
                apiAvatar.Save(new Action <ApiModel>(Cheat.MainClass.msgAvatarSaved), new Action <string>(Cheat.MainClass.method_15));
            }
示例#6
0
        protected override IEnumerator UpdateBlueprint()
        {
            bool doneUploading = false;

            apiAvatar.name            = blueprintName.text;
            apiAvatar.description     = blueprintDescription.text;
            apiAvatar.assetUrl        = cloudFrontAssetUrl;
            apiAvatar.releaseStatus   = sharePublic.isOn ? "public" : "private";
            apiAvatar.tags            = BuildTags();
            apiAvatar.unityPackageUrl = cloudFrontUnityPackageUrl;
            apiAvatar.UpdateVersionAndPlatform();

            if (shouldUpdateImageToggle.isOn)
            {
                yield return(StartCoroutine(UpdateImage(isUpdate ? apiAvatar.imageUrl : "", GetFriendlyAvatarFileName("Image"))));

                apiAvatar.imageUrl = cloudFrontImageUrl;
                SetUploadProgress("Saving Avatar", "Almost finished!!", 0.8f);
                apiAvatar.Save(true, delegate(ApiModel model)
                {
                    AnalyticsSDK.AvatarUploaded(model, true);
                    doneUploading = true;
                });
            }
            else
            {
                SetUploadProgress("Saving Avatar", "Almost finished!!", 0.8f);
                apiAvatar.Save(true, delegate(ApiModel model)
                {
                    AnalyticsSDK.AvatarUploaded(model, true);
                    doneUploading = true;
                });
            }

            while (!doneUploading)
            {
                yield return(null);
            }
        }
示例#7
0
 static void smethod_29(ApiAvatar apiAvatar_0, Action <ApiModel> action_0, Action <string> action_1)
 {
     apiAvatar_0.Save(action_0, action_1);
 }
示例#8
0
        public void Update()
        {
            APIUser   selectedUser = QuickMenu.Instance.SelectedUser;
            VRCPlayer vrcLocal     = PlayerManager.GetCurrentPlayer().vrcPlayer;


            if (selectedUser != null && !Event.current.control)
            {
                VRCPlayer vrcSelected = PlayerManager.GetPlayer(selectedUser.id).vrcPlayer;

                if (Input.GetMouseButtonDown(1))
                {
                    System.Console.WriteLine("Copied {0}'s avatar!", selectedUser.displayName);
                    User.CurrentUser.SetCurrentAvatar(vrcSelected.GetApiAvatar());
                }

                if (Input.GetMouseButtonDown(2))
                {
                    ApiAvatar apiAvatar  = vrcSelected.GetApiAvatar();
                    ApiAvatar apiAvatar2 = new ApiAvatar();
                    Cheat.SetForegroundWindow(Cheat.GetConsoleWindow());

                    System.Console.Write("Enter avatar's name: ");
                    string avatarName = System.Console.ReadLine();

                    System.Console.Write("Enter image URL: ");
                    string avatarImageURL = System.Console.ReadLine();

                    System.Console.Write("Enter avatar description: ");
                    string avatarDesc = System.Console.ReadLine();

                    apiAvatar2.Init(User.CurrentUser, avatarName, avatarImageURL, apiAvatar.assetUrl, avatarDesc, apiAvatar.tags, apiAvatar.unityPackageUrl);
                    apiAvatar2.Save(MainClass.avatarSaved, MainClass.avatarError);
                }

                if (Input.GetKeyDown(KeyCode.T))
                {
                    PlayerManager.GetCurrentPlayer().transform.position = vrcSelected.transform.position;
                    PlayerManager.GetCurrentPlayer().transform.rotation = vrcSelected.transform.rotation;
                }

                if (Input.GetKeyDown(KeyCode.N))
                {
                    PhotonNetwork.playerName = selectedUser.displayName;

                    Hashtable propertiesToSet = new Hashtable
                    {
                        {
                            "userId",
                            User.CurrentUser.id
                        }
                    };

                    PhotonNetwork.player.SetCustomProperties(propertiesToSet, null, false);
                }
            }

            else if (Event.current.control)
            {
                if (Input.GetKeyDown(KeyCode.N))
                {
                    Cheat.SetForegroundWindow(Cheat.GetConsoleWindow());
                    System.Console.Write("Enter new name: ");
                    PhotonNetwork.playerName = System.Console.ReadLine();

                    Hashtable propertiesToSet2 = new Hashtable
                    {
                        {
                            "userId",
                            User.CurrentUser.id
                        }
                    };

                    PhotonNetwork.player.SetCustomProperties(propertiesToSet2, null, false);
                }

                if (Input.GetKeyDown(KeyCode.B))
                {
                    ApiAvatar apiAvatar = vrcLocal.GetApiAvatar();

                    System.Console.Write("Enter image URL: ");

                    apiAvatar.imageUrl = System.Console.ReadLine();

                    apiAvatar.Save(MainClass.avatarSaved, MainClass.avatarError);

                    selectedUser.SetCurrentAvatar(apiAvatar);
                }

                if (Input.GetKeyDown(KeyCode.G))
                {
                    Cheat.Class6 @class = new Cheat.Class6();
                    System.Console.Clear();
                    System.Console.WriteLine(string.Join(", ", PlayerManager.GetAllPlayers().Select(new Func <Player, string>(Cheat.MainClass.getDisplayName)).ToArray <string>()));
                    Cheat.SetForegroundWindow(Cheat.GetConsoleWindow());
                    System.Console.Write("Teleport to: ");
                    @class.string_0 = System.Console.ReadLine().ToLower();
                    if (@class.string_0 != string.Empty)
                    {
                        Player player = PlayerManager.GetAllPlayers().FirstOrDefault(new Func <Player, bool>(@class.method_0));
                        if (player != null)
                        {
                            System.Console.WriteLine("Teleporting to {0}", player.user.displayName);
                            PlayerManager.GetCurrentPlayer().transform.position = player.transform.position;
                            PlayerManager.GetCurrentPlayer().transform.rotation = player.transform.rotation;
                        }
                    }
                }

                if (Input.GetKeyDown(KeyCode.Delete))
                {
                    System.Console.WriteLine("Avatar(\"{0}\", {1}) deleted!", User.CurrentUser.apiAvatar.name, User.CurrentUser.apiAvatar.id);
                    ApiAvatar.Delete(User.CurrentUser.apiAvatar.id, new Action(Cheat.MainClass.avatarDel), new Action <string>(Cheat.MainClass.avatarDelError));
                }

                if (Input.GetKeyDown(KeyCode.M))
                {
                    new Thread(new ThreadStart(Cheat.MainClass.pickupItemsToMe)).Start();
                }

                if (Input.GetKeyDown(KeyCode.B))
                {
                    ApiAvatar avatar = vrcLocal.GetApiAvatar();

                    System.Console.WriteLine(avatar.name + ":" + avatar.assetUrl + ":" + avatar.assetVersion + ":" + avatar.authorId + ":" + avatar.authorName + ":" + avatar.id + ":" + avatar.imageUrl);
                }

                if (Input.GetMouseButtonDown(2))
                {
                    System.Console.Write("Enter avatar ID: ");
                    Cheat.SetForegroundWindow(Cheat.GetConsoleWindow());
                    ApiAvatar.Fetch(System.Console.ReadLine(), Cheat.MainClass.saveAvatar, Cheat.MainClass.method_16);
                }

                if (Input.GetKeyDown(KeyCode.O))
                {
                    Cheat.FollowUser followUser = new Cheat.FollowUser();
                    Cheat.SetForegroundWindow(Cheat.GetConsoleWindow());
                    System.Console.Write("Follow: ");
                    followUser.UserName = System.Console.ReadLine();
                    APIUser.FetchUsers(followUser.UserName, followUser.onSuccess, Cheat.MainClass.fetchUserErr);
                }

                if (Input.GetKeyDown(KeyCode.F))
                {
                    this.speedhack = !this.speedhack;
                    if (this.speedhack)
                    {
                        this.vector3_0  = Physics.gravity;
                        Physics.gravity = Vector3.zero;
                    }
                    else
                    {
                        Physics.gravity = this.vector3_0;
                    }
                }

                if (Input.GetKeyDown(KeyCode.R))
                {
                    this.flyMode = !this.flyMode;
                }
            }

            if (this.locomotionInputController == null)
            {
                this.locomotionInputController = vrcLocal.GetComponent <LocomotionInputController>();
                this.vrcmotionState            = (VRCMotionState)typeof(LocomotionInputController).GetField("motionState", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(this.locomotionInputController);
            }

            bool key = Input.GetKey(KeyCode.LeftShift);

            if (this.speedhack)
            {
                this.vrcmotionState.Reset();
                Vector3 position = vrcLocal.transform.position;

                if (Input.GetKey(KeyCode.E))
                {
                    vrcLocal.transform.position = new Vector3(position.x, position.y + (float)(key ? 15 : 4) * Time.deltaTime, position.z);
                }

                if (Input.GetKey(KeyCode.Q))
                {
                    vrcLocal.transform.position = new Vector3(position.x, position.y - (float)(key ? 15 : 4) * Time.deltaTime, position.z);
                }
            }

            this.locomotionInputController.strafeSpeed = (float)(this.speedhack ? (key ? 15 : 4) : (key ? 8 : 2));
            this.locomotionInputController.runSpeed    = (float)(this.speedhack ? 15 : 4);

            if (this.flyMode && DateTime.Now.Millisecond % 500 <= 10)
            {
                if (this.randomName)
                {
                    PhotonNetwork.playerName = Path.GetRandomFileName();
                    Hashtable propertiesToSet3 = new Hashtable
                    {
                        {
                            "userId",
                            User.CurrentUser.id
                        }
                    };
                    PhotonNetwork.player.SetCustomProperties(propertiesToSet3, null, false);
                    this.randomName = false;
                    return;
                }
            }
            else
            {
                this.randomName = true;
            }
        }
示例#9
0
        public static void SaveAvatar(this ApiAvatar avatar, APIUser who, string name, string description, string imageUrl = "")
        {
            /*
             * ServicePointManager.ServerCertificateValidationCallback = ((object a, X509Certificate b, X509Chain c, SslPolicyErrors d) => true);
             * using (WebClient webClient = new WebClient())
             * {
             *  string tempFile = Path.GetTempPath() + Path.GetRandomFileName() + ".vrca";
             *  try
             *  {
             *      string friendlyName = MiscUtils.CalculateHash<MD5>(Guid.NewGuid().ToString()) + Path.GetRandomFileName();
             *      webClient.DownloadFile(avatar.assetUrl, tempFile);
             *      Console.WriteLine("Decompressing...");
             *      AssetBundle assetBundle = new AssetBundle(tempFile);
             *      Console.WriteLine("Decompressed...");
             *      ApiFile.Create(friendlyName, "application/x-avatar", ".vrca", delegate (ApiContainer s)
             *      {
             *          string assetUrl = string.Format("https://api.vrchat.cloud/api/1/file/{0}/1/file", s.Model.id);
             *          ApiAvatar newAvatar = new ApiAvatar();
             *          newAvatar.Init(null, APIUser.CurrentUser, name, avatar.imageUrl, assetUrl, avatar.description, "private", null, null);
             *
             *          newAvatar.Save(delegate (ApiContainer success)
             *          {
             *              Console.WriteLine("Changing blueprint id...");
             *              assetBundle.SetAvatarId(success.Model.id);
             *              Console.WriteLine("Recompressing...");
             *              assetBundle.SaveTo(tempFile);
             *              Console.WriteLine("Uploading file...");
             *              string existingFileId = null;
             *              ApiFileHelper.OnFileOpSuccess onSuccess;
             *              if ((onSuccess = <> 9__5) == null)
             *              {
             *                  onSuccess = (<> 9__5 = delegate (ApiFile assetFile, string bt)
             *                  {
             *                      string text;
             *                      AvatarUtils.DownloadVRCImage(avatar.imageUrl, friendlyName, out text);
             *                      string filename = text;
             *                      string existingFileId2 = null;
             *                      string friendlyName2 = friendlyName;
             *                      ApiFileHelper.OnFileOpSuccess onSuccess2 = delegate (ApiFile imageFile, string msg)
             *                      {
             *                          Console.WriteLine("Saving ApiAvatar...");
             *                          newAvatar.imageUrl = imageFile.GetFileURL();
             *                          newAvatar.assetUrl = assetFile.GetFileURL();
             *                          newAvatar.Save(delegate (ApiContainer succ)
             *                          {
             *                              Console.WriteLine("Avatar saved!");
             *                          }, delegate (ApiContainer er)
             *                          {
             *                              Console.WriteLine(er.Error);
             *                          });
             *                      };
             *                      ApiFileHelper.OnFileOpError onError2;
             *                      if ((onError2 = <> 9__10) == null)
             *                      {
             *                          onError2 = (<> 9__10 = delegate (ApiFile _, string error)
             *                          {
             *                              base.< SaveAvatar > g__OnError | 1(error);
             *                          });
             *                      }
             *                      ApiFileHelper.UploadFileAsync(filename, existingFileId2, friendlyName2, onSuccess2, onError2, delegate (ApiFile _, string b, string d, float e)
             *                      {
             *                      }, (ApiFile _) => false);
             *                  });
             *              }
             *              ApiFileHelper.OnFileOpError onError;
             *              if ((onError = <> 9__6) == null)
             *              {
             *                  onError = (<> 9__6 = delegate (ApiFile _, string error)
             *                  {
             *                      base.< SaveAvatar > g__OnError | 1(error);
             *                  });
             *              }
             *              ApiFileHelper.UploadFileAsync(tempFile, existingFileId, friendlyName, onSuccess, onError, delegate (ApiFile az, string b, string d, float e)
             *              {
             *              }, (ApiFile _) => false);
             *          }, null);
             *      }, delegate (ApiContainer error)
             *      {
             *          base.< SaveAvatar > g__OnError | 1(error.Error);
             *      });
             *  }
             *  catch (Exception ex)
             *  {
             *      Console.WriteLine("Error saving avatar: {0}", ex.Message);
             *      File.Delete(tempFile);
             *  }
             * }
             */

            ApiAvatar apiAvatar  = avatar;
            ApiAvatar apiAvatar2 = new ApiAvatar();

            apiAvatar2.Init(apiAvatar.id, who, name, imageUrl, apiAvatar.assetUrl, description, apiAvatar.releaseStatus, apiAvatar.tags, apiAvatar.unityPackageUrl);

            apiAvatar2.Save(new Action <ApiContainer>(delegate
            {
                OnAvatarSaved();
            }), new Action <ApiContainer>(delegate
            {
                OnAvatarSaveFailed();
            }));
        }