private void Update()
        {
#if UNITY_EDITOR
            if (_clicked || APIUser.CurrentUser == null)
            {
                return;
            }
            try
            {
                RuntimeWorldCreation worldCreation = FindObjectOfType <RuntimeWorldCreation>();
                if (worldCreation == null || string.IsNullOrWhiteSpace(worldCreation.blueprintName.text))
                {
                    return;
                }
                PipelineManager pipelineManager = worldCreation.pipelineManager;
                if (!pipelineManager.completedSDKPipeline || !APIUser.Exists(pipelineManager.user))
                {
                    return;
                }
                _clicked = true;
                worldCreation.uploadButton.onClick.Invoke();
            }
            catch (Exception e)
            {
                _clicked = true;
                GotoLog.Exception("Failed automated publish", e);
            }
#endif
        }
        void SetupUI()
        {
            if (!ValidateAssetBundleBlueprintID(apiAvatar.id))
            {
                blueprintPanel.SetActive(false);
                errorPanel.SetActive(true);
                OnSDKPipelineError("The asset bundle is out of date.  Please rebuild the scene using 'New Build'.", "The blueprint ID in the scene does not match the id in the asset bundle.");
                return;
            }

            if (APIUser.Exists(pipelineManager.user))
            {
                waitingPanel.SetActive(false);
                blueprintPanel.SetActive(true);
                errorPanel.SetActive(false);

                if (isUpdate)
                {
                    // bp update
                    if (apiAvatar.authorId == pipelineManager.user.id)
                    {
                        titleText.text = "Update Avatar";
                        // apiAvatar = pipelineManager.user.GetBlueprint(pipelineManager.blueprintId) as ApiAvatar;
                        blueprintName.text                   = apiAvatar.name;
                        contentSex.isOn                      = apiAvatar.tags.Contains("content_sex");
                        contentViolence.isOn                 = apiAvatar.tags.Contains("content_violence");
                        contentGore.isOn                     = apiAvatar.tags.Contains("content_gore");
                        contentOther.isOn                    = apiAvatar.tags.Contains("content_other");
                        developerAvatar.isOn                 = apiAvatar.tags.Contains("developer");
                        sharePrivate.isOn                    = apiAvatar.releaseStatus.Contains("private");
                        sharePublic.isOn                     = apiAvatar.releaseStatus.Contains("public");
                        blueprintDescription.text            = apiAvatar.description;
                        shouldUpdateImageToggle.interactable = true;
                        shouldUpdateImageToggle.isOn         = false;
                        liveBpImage.enabled                  = false;
                        bpImage.enabled                      = true;

                        ImageDownloader.DownloadImage(apiAvatar.imageUrl, delegate(Texture2D obj) {
                            bpImage.texture = obj;
                        });
                    }
                    else // user does not own apiAvatar id associated with descriptor
                    {
                        Debug.LogErrorFormat("{0} is not an owner of {1}", apiAvatar.authorId, pipelineManager.user.id);
                        blueprintPanel.SetActive(false);
                        errorPanel.SetActive(true);
                    }
                }
                else
                {
                    titleText.text = "New Avatar";
                    shouldUpdateImageToggle.interactable = false;
                    shouldUpdateImageToggle.isOn         = true;
                    liveBpImage.enabled = true;
                    bpImage.enabled     = false;
                }
            }
            else
            {
                waitingPanel.SetActive(true);
                blueprintPanel.SetActive(false);
                errorPanel.SetActive(false);
            }

            if (APIUser.CurrentUser != null && APIUser.CurrentUser.hasSuperPowers)
            {
                developerAvatar.gameObject.SetActive(true);
            }
            else
            {
                developerAvatar.gameObject.SetActive(false);
            }
        }
        void SetupUI()
        {
            if (APIUser.Exists(pipelineManager.user))
            {
                waitingPanel.SetActive(false);
                blueprintPanel.SetActive(true);
                errorPanel.SetActive(false);

                if (isUpdate)
                {
                    // bp update
                    if (apiAvatar.authorId == pipelineManager.user.id)
                    {
                        titleText.text = "Update Avatar";
                        // apiAvatar = pipelineManager.user.GetBlueprint(pipelineManager.blueprintId) as ApiAvatar;
                        blueprintName.text                   = apiAvatar.name;
                        contentSex.isOn                      = apiAvatar.tags.Contains("content_sex");
                        contentViolence.isOn                 = apiAvatar.tags.Contains("content_violence");
                        contentGore.isOn                     = apiAvatar.tags.Contains("content_gore");
                        contentOther.isOn                    = apiAvatar.tags.Contains("content_other");
                        developerAvatar.isOn                 = apiAvatar.tags.Contains("developer");
                        sharePrivate.isOn                    = apiAvatar.releaseStatus.Contains("private");
                        sharePublic.isOn                     = apiAvatar.releaseStatus.Contains("public");
                        blueprintDescription.text            = apiAvatar.description;
                        shouldUpdateImageToggle.interactable = true;
                        shouldUpdateImageToggle.isOn         = false;
                        liveBpImage.enabled                  = false;
                        bpImage.enabled                      = true;

                        ImageDownloader.DownloadImage(apiAvatar.imageUrl, delegate(Texture2D obj) {
                            bpImage.texture = obj;
                        });
                    }
                    else // user does not own apiAvatar id associated with descriptor
                    {
                        blueprintPanel.SetActive(false);
                        errorPanel.SetActive(true);
                    }
                }
                else
                {
                    titleText.text = "New Avatar";
                    shouldUpdateImageToggle.interactable = false;
                    shouldUpdateImageToggle.isOn         = true;
                    liveBpImage.enabled = true;
                    bpImage.enabled     = false;
                }
            }
            else
            {
                waitingPanel.SetActive(true);
                blueprintPanel.SetActive(false);
                errorPanel.SetActive(false);
            }

            if (APIUser.CurrentUser != null && APIUser.CurrentUser.developerType > APIUser.DeveloperType.None)
            {
                developerAvatar.gameObject.SetActive(true);
            }
            else
            {
                developerAvatar.gameObject.SetActive(false);
            }
        }
        void SetupUI(bool hasEnoughTrustToPublishToCL = false, bool hasExceededWeeklyPublishLimit = false)
        {
#if COMMUNITY_LABS_SDK
            // do not display community labs panel if updating an existing CL world or updating a public world
            publishToCommunityLabsPanel.gameObject.SetActive(!IsCurrentWorldUploaded);
#endif

            if (!ValidateAssetBundleBlueprintID(worldRecord.id))
            {
                blueprintPanel.SetActive(false);
                errorPanel.SetActive(true);
                OnSDKPipelineError("The asset bundle is out of date.  Please rebuild the scene using 'New Build'.", "The blueprint ID in the scene does not match the id in the asset bundle.");
                return;
            }

            contentFeatured.gameObject.SetActive(APIUser.CurrentUser.hasSuperPowers);
            contentSDKExample.gameObject.SetActive(APIUser.CurrentUser.hasSuperPowers);

            if (APIUser.Exists(pipelineManager.user))
            {
                waitingPanel.SetActive(false);
                blueprintPanel.SetActive(true);
                errorPanel.SetActive(false);

                if (string.IsNullOrEmpty(worldRecord.authorId) || worldRecord.authorId == pipelineManager.user.id)
                {
                    titleText.text = "Configure World";
                    blueprintName.text = worldRecord.name;
                    worldCapacity.text = worldRecord.capacity.ToString();
                    contentSex.isOn = worldRecord.tags.Contains("content_sex");
                    contentViolence.isOn = worldRecord.tags.Contains("content_violence");
                    contentGore.isOn = worldRecord.tags.Contains("content_gore");
                    contentOther.isOn = worldRecord.tags.Contains("content_other");
                    shouldUpdateImageToggle.interactable = isUpdate;
                    shouldUpdateImageToggle.isOn = !isUpdate;
                    liveBpImage.enabled = !isUpdate;
                    bpImage.enabled = isUpdate;

                    if (!APIUser.CurrentUser.hasSuperPowers)
                    {
                        releasePublic.gameObject.SetActive(false);
                        releasePublic.isOn = false;
                        releasePublic.interactable = false;

                        contentFeatured.isOn = contentSDKExample.isOn = false;
                    }
                    else
                    {
                        contentFeatured.isOn = worldRecord.tags.Contains("content_featured");
                        contentSDKExample.isOn = worldRecord.tags.Contains("content_sdk_example");

                        releasePublic.isOn = worldRecord.releaseStatus == "public";
                        releasePublic.gameObject.SetActive(true);
                    }

                    // "show in worlds menu"
                    if (APIUser.CurrentUser.hasSuperPowers)
                    {
                        showInWorldsMenuGroup.gameObject.SetActive(true);
                        showInActiveWorlds.isOn = !worldRecord.tags.Contains("admin_hide_active");
                        showInPopularWorlds.isOn = !worldRecord.tags.Contains("admin_hide_popular");
                        showInNewWorlds.isOn = !worldRecord.tags.Contains("admin_hide_new");
                    }
                    else
                    {
                        showInWorldsMenuGroup.gameObject.SetActive(false);
                    }

                    blueprintDescription.text = worldRecord.description;

                    userTags.text = "";
                    foreach (var tag in worldRecord.publicTags)
                    {
                        userTags.text = userTags.text + tag.Replace("author_tag_", "");
                        userTags.text = userTags.text + " ";
                    }

                    ImageDownloader.DownloadImage(worldRecord.imageUrl, 0, delegate (Texture2D obj) {
                        bpImage.texture = obj;
                    });
                }
                else // user does not own world id associated with descriptor
                {
                    Debug.LogErrorFormat("{0} is not an owner of {1}", worldRecord.authorId, pipelineManager.user.id);
                    blueprintPanel.SetActive(false);
                    errorPanel.SetActive(true);
                }
            }
            else
            {
                waitingPanel.SetActive(true);
                blueprintPanel.SetActive(false);
                errorPanel.SetActive(false);

                if (!APIUser.CurrentUser.hasSuperPowers)
                {
                    releasePublic.gameObject.SetActive(false);
                    releasePublic.isOn = false;
                    releasePublic.interactable = false;
                }
                else
                {
                    releasePublic.gameObject.SetActive(true);
                    releasePublic.isOn = false;
                }
            }

            // set up publish to Community Labs checkbox and text
            int worldsPublishedThisWeek = hasExceededWeeklyPublishLimit ? 1 : 0;
            int maximumWorldsAllowedToPublishPerWeek = 1;
            publishToCommLabsToggle = publishToCommunityLabsPanel.GetComponentInChildren<Toggle>();

            if (null != publishToCommLabsToggle)
            {
                // disable publishing to CL checkbox if not enough trust or exceeded publish limit 
                publishToCommLabsToggle.interactable = hasEnoughTrustToPublishToCL && !hasExceededWeeklyPublishLimit;

                Text publishText = publishToCommLabsToggle.gameObject.GetComponentInChildren<Text>();
                if (null != publishText)
                {
                    if (!hasEnoughTrustToPublishToCL)
                    {
                        publishText.text = "Not enough Trust to Publish to Community Labs";
                    }
                    else
                    {
                        if (hasExceededWeeklyPublishLimit)
                        {
                            publishText.text = "Publish limit for Community Labs Exceeded\n" + "(" + worldsPublishedThisWeek + "/" + maximumWorldsAllowedToPublishPerWeek + " Published this week)";
                        }
                        else
                        {
                            publishText.text = "Publish to Community Labs\n" + "(" + worldsPublishedThisWeek + "/" + maximumWorldsAllowedToPublishPerWeek + " Published this week)";
                        }
                    }
                }
            }
        }
        void SetupUI()
        {
            if (APIUser.CurrentUser.developerType < APIUser.DeveloperType.Trusted)
            {
                contentFeatured.gameObject.SetActive(false);
                contentSDKExample.gameObject.SetActive(false);
            }
            else
            {
                contentFeatured.gameObject.SetActive(true);
                contentSDKExample.gameObject.SetActive(true);
            }

            if (APIUser.Exists(pipelineManager.user) && pipelineManager.user.isFresh)
            {
                waitingPanel.SetActive(false);
                blueprintPanel.SetActive(true);
                errorPanel.SetActive(false);

                if (isUpdate)
                {
                    // bp update
                    if (worldRecord.authorId == pipelineManager.user.id)
                    {
                        titleText.text       = "Update World";
                        blueprintName.text   = worldRecord.name;
                        worldCapacity.text   = worldRecord.capacity.ToString();
                        contentSex.isOn      = worldRecord.tags.Contains("content_sex");
                        contentViolence.isOn = worldRecord.tags.Contains("content_violence");
                        contentGore.isOn     = worldRecord.tags.Contains("content_gore");
                        contentOther.isOn    = worldRecord.tags.Contains("content_other");

                        if (APIUser.CurrentUser.developerType < APIUser.DeveloperType.Trusted)
                        {
                            releasePublic.isOn         = false;
                            releasePublic.interactable = false;

                            contentFeatured.isOn = contentSDKExample.isOn = false;
                        }
                        else
                        {
                            contentFeatured.isOn   = worldRecord.tags.Contains("content_featured");
                            contentSDKExample.isOn = worldRecord.tags.Contains("content_sdk_example");
                            releasePublic.isOn     = worldRecord.releaseStatus == "public";
                        }
                        blueprintDescription.text            = worldRecord.description;
                        shouldUpdateImageToggle.interactable = true;
                        shouldUpdateImageToggle.isOn         = false;
                        liveBpImage.enabled = false;
                        bpImage.enabled     = true;

                        ImageDownloader.DownloadImage(worldRecord.imageUrl, delegate(Texture2D obj) {
                            bpImage.texture = obj;
                        });
                    }
                    else // user does not own world id associated with descriptor
                    {
                        blueprintPanel.SetActive(false);
                        errorPanel.SetActive(true);
                    }
                }
                else
                {
                    titleText.text = "New World";
                    shouldUpdateImageToggle.interactable = false;
                    shouldUpdateImageToggle.isOn         = true;
                    liveBpImage.enabled = true;
                    bpImage.enabled     = false;
                }
            }
            else
            {
                waitingPanel.SetActive(true);
                blueprintPanel.SetActive(false);
                errorPanel.SetActive(false);

                if (APIUser.CurrentUser.developerType < APIUser.DeveloperType.Trusted)
                {
                    releasePublic.isOn         = false;
                    releasePublic.interactable = false;
                }
                else
                {
                    releasePublic.isOn = false;
                }
            }
        }
Beispiel #6
0
        void SetupUI()
        {
            if (!ValidateAssetBundleBlueprintID(apiAvatar.id))
            {
                blueprintPanel.SetActive(false);
                errorPanel.SetActive(true);
                OnSDKPipelineError("The asset bundle is out of date.  Please rebuild the scene using 'New Build'.", "The blueprint ID in the scene does not match the id in the asset bundle.");
                return;
            }

            if (APIUser.Exists(pipelineManager.user))
            {
                waitingPanel.SetActive(false);
                blueprintPanel.SetActive(true);
                errorPanel.SetActive(false);

                if (isUpdate)
                {
                    // bp update
                    if (apiAvatar.authorId == pipelineManager.user.id)
                    {
                        titleText.text = "Update Avatar";
                        // apiAvatar = pipelineManager.user.GetBlueprint(pipelineManager.blueprintId) as ApiAvatar;
                        blueprintName.text   = apiAvatar.name;
                        contentSex.isOn      = apiAvatar.tags.Contains("content_sex");
                        contentViolence.isOn = apiAvatar.tags.Contains("content_violence");
                        contentGore.isOn     = apiAvatar.tags.Contains("content_gore");
                        contentOther.isOn    = apiAvatar.tags.Contains("content_other");
                        developerAvatar.isOn = apiAvatar.tags.Contains("developer");
                        sharePrivate.isOn    = apiAvatar.releaseStatus.Contains("private");
                        sharePublic.isOn     = apiAvatar.releaseStatus.Contains("public");

                        tagFallback.isOn = apiAvatar.tags.Contains("author_quest_fallback");
                        tagFallback.transform.parent.gameObject.SetActive(true);

                        switch (pipelineManager.fallbackStatus)
                        {
                        case PipelineManager.FallbackStatus.Valid:
#if UNITY_ANDROID
                            tagFallback.interactable = true;
                            tagFallback.GetComponentInChildren <Text>().text = "Use for Fallback";
#else
                            tagFallback.interactable = false;
                            tagFallback.GetComponentInChildren <Text>().text = "Use for Fallback (change only with Android upload)";
#endif
                            break;

                        case PipelineManager.FallbackStatus.InvalidPerformance:
                        case PipelineManager.FallbackStatus.InvalidRig:
                            tagFallback.isOn         = false; // need to remove tag on this upload, the updated version is not up-to-spec
                            tagFallback.interactable = false;
                            tagFallback.GetComponentInChildren <Text>().text = "Use for Fallback (avatar not valid, tag will be cleared)";
                            break;
                        }

                        blueprintDescription.text            = apiAvatar.description;
                        shouldUpdateImageToggle.interactable = true;
                        shouldUpdateImageToggle.isOn         = false;
                        liveBpImage.enabled = false;
                        bpImage.enabled     = true;

                        ImageDownloader.DownloadImage(apiAvatar.imageUrl, 0, (Texture2D obj) => bpImage.texture = obj, null);
                    }
                    else // user does not own apiAvatar id associated with descriptor
                    {
                        Debug.LogErrorFormat("{0} is not an owner of {1}", apiAvatar.authorId, pipelineManager.user.id);
                        blueprintPanel.SetActive(false);
                        errorPanel.SetActive(true);
                    }
                }
                else
                {
                    titleText.text = "New Avatar";
                    shouldUpdateImageToggle.interactable = false;
                    shouldUpdateImageToggle.isOn         = true;
                    liveBpImage.enabled = true;
                    bpImage.enabled     = false;
                    tagFallback.isOn    = false;

                    // Janky fix for an avatar's blueprint image not showing up the very first time you press publish in a project until you resize the window
                    // can remove if we fix the underlying issue or move publishing out of Play Mode
                    string firstTimeResize = $"{Application.identifier}-firstTimeResize";
                    if (!PlayerPrefs.HasKey(firstTimeResize))
                    {
                        GameViewMethods.ResizeGameView();
                        PlayerPrefs.SetInt(firstTimeResize, 1);
                    }

                    tagFallback.transform.parent.gameObject.SetActive(true);
                    switch (pipelineManager.fallbackStatus)
                    {
                    case PipelineManager.FallbackStatus.Valid:
#if UNITY_ANDROID
                        tagFallback.interactable = true;
                        tagFallback.GetComponentInChildren <Text>().text = "Use for Fallback";
#else
                        tagFallback.interactable = false;
                        tagFallback.GetComponentInChildren <Text>().text = "Use for Fallback (change only with Android upload)";
#endif
                        break;

                    case PipelineManager.FallbackStatus.InvalidPerformance:
                    case PipelineManager.FallbackStatus.InvalidRig:
                        tagFallback.transform.parent.gameObject.SetActive(true);
                        tagFallback.interactable = false;
                        tagFallback.GetComponentInChildren <Text>().text = "Use for Fallback (avatar not valid, tag will be cleared)";
                        break;
                    }
                }
            }
            else
            {
                waitingPanel.SetActive(true);
                blueprintPanel.SetActive(false);
                errorPanel.SetActive(false);
            }

            if (APIUser.CurrentUser != null && APIUser.CurrentUser.hasSuperPowers)
            {
                developerAvatar.gameObject.SetActive(true);
            }
            else
            {
                developerAvatar.gameObject.SetActive(false);
            }
        }
Beispiel #7
0
        void SetupUI()
        {
            if (APIUser.CurrentUser.developerType < APIUser.DeveloperType.Trusted)
            {
                contentFeatured.gameObject.SetActive(false);
                contentSDKExample.gameObject.SetActive(false);
            }
            else
            {
                contentFeatured.gameObject.SetActive(true);
                contentSDKExample.gameObject.SetActive(true);
            }

            if (APIUser.Exists(pipelineManager.user))
            {
                waitingPanel.SetActive(false);
                blueprintPanel.SetActive(true);
                errorPanel.SetActive(false);

                if (string.IsNullOrEmpty(worldRecord.authorId) || worldRecord.authorId == pipelineManager.user.id)
                {
                    titleText.text       = "Configure World";
                    blueprintName.text   = worldRecord.name;
                    worldCapacity.text   = worldRecord.capacity.ToString();
                    contentSex.isOn      = worldRecord.tags.Contains("content_sex");
                    contentViolence.isOn = worldRecord.tags.Contains("content_violence");
                    contentGore.isOn     = worldRecord.tags.Contains("content_gore");
                    contentOther.isOn    = worldRecord.tags.Contains("content_other");
                    shouldUpdateImageToggle.interactable = isUpdate;
                    shouldUpdateImageToggle.isOn         = !isUpdate;
                    liveBpImage.enabled = !isUpdate;
                    bpImage.enabled     = isUpdate;

                    if (APIUser.CurrentUser.developerType < APIUser.DeveloperType.Trusted)
                    {
                        releasePublic.gameObject.SetActive(false);
                        releasePublic.isOn         = false;
                        releasePublic.interactable = false;

                        contentFeatured.isOn = contentSDKExample.isOn = false;
                    }
                    else
                    {
                        contentFeatured.isOn   = worldRecord.tags.Contains("content_featured");
                        contentSDKExample.isOn = worldRecord.tags.Contains("content_sdk_example");
                        releasePublic.isOn     = worldRecord.releaseStatus == "public";
                        releasePublic.gameObject.SetActive(true);
                    }

                    // "show in worlds menu"
                    if (APIUser.CurrentUser.developerType == APIUser.DeveloperType.Internal)
                    {
                        showInWorldsMenuGroup.gameObject.SetActive(true);
                        showInActiveWorlds.isOn  = !worldRecord.tags.Contains("admin_hide_active");
                        showInPopularWorlds.isOn = !worldRecord.tags.Contains("admin_hide_popular");
                        showInNewWorlds.isOn     = !worldRecord.tags.Contains("admin_hide_new");
                    }
                    else
                    {
                        showInWorldsMenuGroup.gameObject.SetActive(false);
                    }

                    blueprintDescription.text = worldRecord.description;

                    ImageDownloader.DownloadImage(worldRecord.imageUrl, delegate(Texture2D obj) {
                        bpImage.texture = obj;
                    });
                }
                else // user does not own world id associated with descriptor
                {
                    Debug.LogErrorFormat("{0} is not an owner of {1}", worldRecord.authorId, pipelineManager.user.id);
                    blueprintPanel.SetActive(false);
                    errorPanel.SetActive(true);
                }
            }
            else
            {
                waitingPanel.SetActive(true);
                blueprintPanel.SetActive(false);
                errorPanel.SetActive(false);

                if (APIUser.CurrentUser.developerType < APIUser.DeveloperType.Trusted)
                {
                    releasePublic.gameObject.SetActive(false);
                    releasePublic.isOn         = false;
                    releasePublic.interactable = false;
                }
                else
                {
                    releasePublic.gameObject.SetActive(true);
                    releasePublic.isOn = false;
                }
            }
        }
Beispiel #8
0
        void SetupUI()
        {
            if (!ValidateAssetBundleBlueprintID(apiAvatar.id))
            {
                blueprintPanel.SetActive(false);
                errorPanel.SetActive(true);
                OnSDKPipelineError("The asset bundle is out of date.  Please rebuild the scene using 'New Build'.", "The blueprint ID in the scene does not match the id in the asset bundle.");
                return;
            }

            if (APIUser.Exists(pipelineManager.user))
            {
                waitingPanel.SetActive(false);
                blueprintPanel.SetActive(true);
                errorPanel.SetActive(false);

                if (isUpdate)
                {
                    // bp update
                    if (apiAvatar.authorId == pipelineManager.user.id)
                    {
                        titleText.text = "Update Avatar";
                        // apiAvatar = pipelineManager.user.GetBlueprint(pipelineManager.blueprintId) as ApiAvatar;
                        blueprintName.text   = apiAvatar.name;
                        contentSex.isOn      = apiAvatar.tags.Contains("content_sex");
                        contentViolence.isOn = apiAvatar.tags.Contains("content_violence");
                        contentGore.isOn     = apiAvatar.tags.Contains("content_gore");
                        contentOther.isOn    = apiAvatar.tags.Contains("content_other");
                        developerAvatar.isOn = apiAvatar.tags.Contains("developer");
                        sharePrivate.isOn    = apiAvatar.releaseStatus.Contains("private");
                        sharePublic.isOn     = apiAvatar.releaseStatus.Contains("public");

                        tagFallback.isOn = apiAvatar.tags.Contains("author_quest_fallback");
                        switch (pipelineManager.fallbackStatus)
                        {
                        case PipelineManager.FallbackStatus.Valid:
                            tagFallback.transform.parent.gameObject.SetActive(true);
                            tagFallback.interactable = true;
                            tagFallback.GetComponentInChildren <Text>().text = "Use for Fallback";
                            break;

                        case PipelineManager.FallbackStatus.InvalidPerformance:
                        case PipelineManager.FallbackStatus.InvalidRig:
                            tagFallback.transform.parent.gameObject.SetActive(true);
                            tagFallback.isOn         = false; // need to remove tag on this upload, the updated version is not up-to-spec
                            tagFallback.interactable = false;
                            tagFallback.GetComponentInChildren <Text>().text = "(Not valid for Fallback use)";
                            break;

                        default:
                            tagFallback.transform.parent.gameObject.SetActive(false);
                            break;
                        }

                        blueprintDescription.text            = apiAvatar.description;
                        shouldUpdateImageToggle.interactable = true;
                        shouldUpdateImageToggle.isOn         = false;
                        liveBpImage.enabled = false;
                        bpImage.enabled     = true;

                        ImageDownloader.DownloadImage(apiAvatar.imageUrl, 0, (Texture2D obj) => bpImage.texture = obj, null);
                    }
                    else // user does not own apiAvatar id associated with descriptor
                    {
                        Debug.LogErrorFormat("{0} is not an owner of {1}", apiAvatar.authorId, pipelineManager.user.id);
                        blueprintPanel.SetActive(false);
                        errorPanel.SetActive(true);
                    }
                }
                else
                {
                    titleText.text = "New Avatar";
                    shouldUpdateImageToggle.interactable = false;
                    shouldUpdateImageToggle.isOn         = true;
                    liveBpImage.enabled = true;
                    bpImage.enabled     = false;
                    tagFallback.isOn    = false;

                    switch (pipelineManager.fallbackStatus)
                    {
                    case PipelineManager.FallbackStatus.Valid:
                        tagFallback.transform.parent.gameObject.SetActive(true);
                        tagFallback.interactable = true;
                        tagFallback.GetComponentInChildren <Text>().text = "Use for Fallback";
                        break;

                    case PipelineManager.FallbackStatus.InvalidPerformance:
                    case PipelineManager.FallbackStatus.InvalidRig:
                        tagFallback.transform.parent.gameObject.SetActive(true);
                        tagFallback.interactable = false;
                        tagFallback.GetComponentInChildren <Text>().text = "(Not valid for Fallback use)";
                        break;

                    default:
                        tagFallback.transform.parent.gameObject.SetActive(false);
                        break;
                    }
                }
            }
            else
            {
                waitingPanel.SetActive(true);
                blueprintPanel.SetActive(false);
                errorPanel.SetActive(false);
            }

            if (APIUser.CurrentUser != null && APIUser.CurrentUser.hasSuperPowers)
            {
                developerAvatar.gameObject.SetActive(true);
            }
            else
            {
                developerAvatar.gameObject.SetActive(false);
            }
        }
Beispiel #9
0
        void SetupUI()
        {
            if (!ValidateAssetBundleBlueprintID(worldRecord.id))
            {
                blueprintPanel.SetActive(false);
                errorPanel.SetActive(true);
                OnSDKPipelineError("The asset bundle is out of date.  Please rebuild the scene using 'New Build'.", "The blueprint ID in the scene does not match the id in the asset bundle.");
                return;
            }

            contentFeatured.gameObject.SetActive(APIUser.CurrentUser.hasSuperPowers);
            contentSDKExample.gameObject.SetActive(APIUser.CurrentUser.hasSuperPowers);

            if (APIUser.Exists(pipelineManager.user))
            {
                waitingPanel.SetActive(false);
                blueprintPanel.SetActive(true);
                errorPanel.SetActive(false);

                if (string.IsNullOrEmpty(worldRecord.authorId) || worldRecord.authorId == pipelineManager.user.id)
                {
                    titleText.text       = "Configure World";
                    blueprintName.text   = worldRecord.name;
                    worldCapacity.text   = worldRecord.capacity.ToString();
                    contentSex.isOn      = worldRecord.tags.Contains("content_sex");
                    contentViolence.isOn = worldRecord.tags.Contains("content_violence");
                    contentGore.isOn     = worldRecord.tags.Contains("content_gore");
                    contentOther.isOn    = worldRecord.tags.Contains("content_other");
                    shouldUpdateImageToggle.interactable = isUpdate;
                    shouldUpdateImageToggle.isOn         = !isUpdate;
                    liveBpImage.enabled = !isUpdate;
                    bpImage.enabled     = isUpdate;

                    if (!APIUser.CurrentUser.hasSuperPowers)
                    {
                        releasePublic.gameObject.SetActive(false);
                        releasePublic.isOn         = false;
                        releasePublic.interactable = false;

                        contentFeatured.isOn = contentSDKExample.isOn = false;
                    }
                    else
                    {
                        contentFeatured.isOn   = worldRecord.tags.Contains("content_featured");
                        contentSDKExample.isOn = worldRecord.tags.Contains("content_sdk_example");
                        releasePublic.isOn     = worldRecord.releaseStatus == "public";
                        releasePublic.gameObject.SetActive(true);
                    }

                    // "show in worlds menu"
                    if (APIUser.CurrentUser.hasSuperPowers)
                    {
                        showInWorldsMenuGroup.gameObject.SetActive(true);
                        showInActiveWorlds.isOn  = !worldRecord.tags.Contains("admin_hide_active");
                        showInPopularWorlds.isOn = !worldRecord.tags.Contains("admin_hide_popular");
                        showInNewWorlds.isOn     = !worldRecord.tags.Contains("admin_hide_new");
                    }
                    else
                    {
                        showInWorldsMenuGroup.gameObject.SetActive(false);
                    }

                    blueprintDescription.text = worldRecord.description;

                    userTags.text = "";
                    foreach (var tag in worldRecord.publicTags)
                    {
                        userTags.text = userTags.text + tag.Replace("author_tag_", "");
                        userTags.text = userTags.text + " ";
                    }

                    ImageDownloader.DownloadImage(worldRecord.imageUrl, delegate(Texture2D obj) {
                        bpImage.texture = obj;
                    });
                }
                else // user does not own world id associated with descriptor
                {
                    Debug.LogErrorFormat("{0} is not an owner of {1}", worldRecord.authorId, pipelineManager.user.id);
                    blueprintPanel.SetActive(false);
                    errorPanel.SetActive(true);
                }
            }
            else
            {
                waitingPanel.SetActive(true);
                blueprintPanel.SetActive(false);
                errorPanel.SetActive(false);

                if (!APIUser.CurrentUser.hasSuperPowers)
                {
                    releasePublic.gameObject.SetActive(false);
                    releasePublic.isOn         = false;
                    releasePublic.interactable = false;
                }
                else
                {
                    releasePublic.gameObject.SetActive(true);
                    releasePublic.isOn = false;
                }
            }
        }