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
            {
                id              = pipelineManager.blueprintId,
                authorName      = pipelineManager.user.displayName,
                authorId        = pipelineManager.user.id,
                name            = blueprintName.text,
                imageUrl        = cloudFrontImageUrl,
                assetUrl        = cloudFrontAssetUrl,
                description     = blueprintDescription.text,
                tags            = BuildTags(),
                unityPackageUrl = cloudFrontUnityPackageUrl,
                releaseStatus   = sharePublic.isOn ? "public" : "private"
            };

            bool doneUploading = false;
            bool wasError      = false;

            avatar.Post(
                (c) =>
            {
                ApiAvatar savedBP           = (ApiAvatar)c.Model;
                pipelineManager.blueprintId = savedBP.id;
                UnityEditor.EditorPrefs.SetString("blueprintID-" + pipelineManager.GetInstanceID().ToString(), savedBP.id);

                AnalyticsSDK.AvatarUploaded(savedBP, false);
                doneUploading = true;
            },
                (c) =>
            {
                Debug.LogError(c.Error);
                SetUploadProgress("Saving Avatar", "Error saving blueprint.", 0.0f);
                doneUploading = true;
                wasError      = true;
            });

            while (!doneUploading)
            {
                yield return(null);
            }

            if (wasError)
            {
                yield return(new WaitUntil(() => UnityEditor.EditorUtility.DisplayDialog("VRChat SDK", "Error saving blueprint.", "Okay")));
            }
        }
Esempio n. 3
0
        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,
                sharePublic.isOn ? "public" : "private",
                BuildTags(),
                cloudFrontUnityPackageUrl
                );
            avatar.id = pipelineManager.blueprintId;

            bool doneUploading = false;

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

                AnalyticsSDK.AvatarUploaded(model, false);
                doneUploading = true;
            },
                        delegate(string error)
            {
                Debug.LogError(error);
                doneUploading = true;
            });

            while (!doneUploading)
            {
                yield return(null);
            }
        }
Esempio n. 4
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);
            }
        }