예제 #1
0
 // Token: 0x06005937 RID: 22839 RVA: 0x001EF820 File Offset: 0x001EDC20
 private void FetchWorldFromId(Action <ApiWorld, ApiWorld.WorldInstance> onSuccess = null)
 {
     if (string.IsNullOrEmpty(this.RoomId))
     {
         return;
     }
     ApiWorld.Fetch(this.RoomId, delegate(ApiWorld world)
     {
         if (this.isShutdown)
         {
             Debug.Log(this.name + " was shutdown, ignoring query.");
             return;
         }
         if (world == null)
         {
             Debug.LogError(this.name + " received a null query response.");
             return;
         }
         ApiWorld.WorldInstance arg = this.ConfigurePortal(world);
         if (onSuccess != null)
         {
             onSuccess(world, arg);
         }
     }, delegate(string msg)
     {
         this.isValidWorld = false;
         Debug.LogWarning(msg);
     });
 }
        void UserLoggedInCallback(APIUser user)
        {
            pipelineManager.user = user;

            ApiWorld model = new ApiWorld();

            model.id = pipelineManager.blueprintId;
            model.Fetch(null, false,
                        (c) =>
            {
                Debug.Log("<color=magenta>Updating an existing world.</color>");
                worldRecord = c.Model as ApiWorld;
                pipelineManager.completedSDKPipeline = !string.IsNullOrEmpty(worldRecord.authorId);
                GetUserUploadInformationAndSetupUI(model.id);
            },
                        (c) =>
            {
                Debug.Log("<color=magenta>World record not found, creating a new world.</color>");
                worldRecord = new ApiWorld {
                    capacity = 8
                };
                pipelineManager.completedSDKPipeline = false;
                worldRecord.id = pipelineManager.blueprintId;
                GetUserUploadInformationAndSetupUI(model.id);
            });
        }
예제 #3
0
 // Token: 0x06006039 RID: 24633 RVA: 0x0021DCAC File Offset: 0x0021C0AC
 private void SetupModButtons()
 {
     this.modButtons.SetActive(false);
     if (!this.isModerator && !this.isRoomAuthor && !this.isInstanceOwner)
     {
         return;
     }
     if (!string.IsNullOrEmpty(this.user.location) && this.user.location != "offline")
     {
         string text = this.user.location.Split(new char[]
         {
             ':'
         })[0];
         if (text != "local")
         {
             ApiWorld.Fetch(text, delegate(ApiWorld world)
             {
                 foreach (VRCUiButton vrcuiButton in this.modButtons.GetComponentsInChildren <VRCUiButton>(true))
                 {
                     if (vrcuiButton.Name == "Warn" || vrcuiButton.Name == "Kick" || vrcuiButton.Name == "MicOff")
                     {
                         if (this.isModerator || this.isRoomAuthor || this.isInstanceOwner)
                         {
                             vrcuiButton.gameObject.SetActive(true);
                         }
                         else
                         {
                             vrcuiButton.gameObject.SetActive(false);
                         }
                     }
                     else if (this.isModerator)
                     {
                         vrcuiButton.gameObject.SetActive(true);
                     }
                     else
                     {
                         vrcuiButton.gameObject.SetActive(false);
                     }
                 }
                 this.modButtons.SetActive(true);
             }, delegate(string obj)
             {
                 Debug.LogError(obj);
             });
         }
     }
 }
예제 #4
0
        protected override void OnPickerSelected(IPickerElement picker)
        {
            if (picker.Id == myLastRequestedWorld)
            {
                return;
            }

            PlaySound();

            myLastRequestedWorld = picker.Id;
            var world = new ApiWorld {
                id = picker.Id
            };

            world.Fetch(new Action <ApiContainer>(_ =>
            {
                myLastRequestedWorld = "";
                if (listsParent.gameObject.activeInHierarchy)
                {
                    ScanningReflectionCache.DisplayWorldInfoPage(world, null, false, null);
                }
            }), new Action <ApiContainer>(c =>
            {
                myLastRequestedWorld = "";
                if (MelonDebug.IsEnabled())
                {
                    MelonDebug.Msg("API request errored with " + c.Code + " - " + c.Error);
                }
                if (c.Code == 404 && listsParent.gameObject.activeInHierarchy)
                {
                    FavCatMod.Database.CompletelyDeleteWorld(picker.Id);
                    var menu = ExpansionKitApi.CreateCustomFullMenuPopup(LayoutDescription.WideSlimList);
                    menu.AddSpacer();
                    menu.AddSpacer();
                    menu.AddLabel("This world is not available anymore (deleted)");
                    menu.AddLabel("It has been removed from all favorite lists");
                    menu.AddSpacer();
                    menu.AddSpacer();
                    menu.AddSpacer();
                    menu.AddSimpleButton("Close", menu.Hide);
                    menu.Show();
                }
            }));
        }
예제 #5
0
        void UserLoggedInCallback(APIUser user)
        {
            pipelineManager.user = user;

            ApiWorld.Fetch(pipelineManager.blueprintId, false,
                           delegate(ApiWorld world)
            {
                worldRecord = world;
                pipelineManager.completedSDKPipeline = !string.IsNullOrEmpty(worldRecord.authorId);
                SetupUI();
            },
                           delegate(string message)
            {
                worldRecord = new ApiWorld {
                    capacity = 8
                };
                pipelineManager.completedSDKPipeline = false;
                worldRecord.id = pipelineManager.blueprintId;
                SetupUI();
            });
        }
예제 #6
0
    // Token: 0x060061D3 RID: 25043 RVA: 0x002283E8 File Offset: 0x002267E8
    public void ShowRoomDetails(ApiWorld w)
    {
        VRCUiPage page = VRCUiManager.Instance.GetPage("UserInterface/MenuContent/Screens/WorldInfo");

        VRCUiManager.Instance.ShowScreen(page);
        PageWorldInfo info = page.GetComponent <PageWorldInfo>();

        ApiWorld.WorldInstance winst = null;
        if (RoomManager.currentRoom != null && RoomManager.currentRoom.id == w.id)
        {
            int count = PlayerManager.GetAllPlayers().Length;
            winst = new ApiWorld.WorldInstance(RoomManager.currentRoom.currentInstanceIdWithTags, count);
        }
        info.SetupWorldInfo(w, winst, false, false);
        ApiWorld.Fetch(w.id, delegate(ApiWorld world)
        {
            info.SetupWorldInfo(world, winst, false, false);
        }, delegate(string error)
        {
            Debug.LogWarning("Could not join room: " + w.name);
        });
    }
        void UserLoggedInCallback(APIUser user)
        {
            pipelineManager.user = user;

            if (isUpdate)
            {
                ApiWorld.Fetch(pipelineManager.blueprintId,
                               delegate(ApiWorld world)
                {
                    worldRecord = world;
                    SetupUI();
                },
                               delegate(string message)
                {
                    pipelineManager.blueprintId = "";
                    SetupUI();
                });
            }
            else
            {
                SetupUI();
            }
        }
예제 #8
0
            internal void onSuccess(List <APIUser> apiUserList)
            {
                Cheat.CApiUser cApiUser = new Cheat.CApiUser();
                Cheat.CApiUser apiUser  = cApiUser;

                Func <APIUser, bool> predicate;

                if ((predicate = this.func_0) == null)
                {
                    predicate = (this.func_0 = this.method_1);
                }
                apiUser.apiuser_0 = apiUserList.Where(predicate).OrderBy(Cheat.MainClass.getDisplayNameLen).FirstOrDefault <APIUser>();
                if (cApiUser.apiuser_0 == null)
                {
                    System.Console.WriteLine("User not found!");
                    return;
                }
                if (cApiUser.apiuser_0.location == "offline")
                {
                    System.Console.WriteLine("User is offline!");
                    return;
                }
                if (cApiUser.apiuser_0.location.Split(':').Length > 1)
                {
                    Cheat.FollowUserHelper followUserHelper = new Cheat.FollowUserHelper();
                    followUserHelper.apiUser = cApiUser;

                    string id = followUserHelper.apiUser.apiuser_0.location.Split(':')[0];

                    followUserHelper.string_0 = followUserHelper.apiUser.apiuser_0.location.Split(':')[1];

                    ApiWorld.Fetch(id, followUserHelper.method_0, Cheat.MainClass.fetchWorldErr);
                    return;
                }
                System.Console.WriteLine("Could not parse user location \"{0}\"", cApiUser.apiuser_0.location);
            }
예제 #9
0
    void OnGUIScene(VRCSDK2.VRC_SceneDescriptor scene)
    {
        string lastUrl          = VRC_SdkBuilder.GetLastUrl();
        bool   lastBuildPresent = lastUrl != null;

        string worldVersion = "-1";

        PipelineManager[] pms = (PipelineManager[])VRC.Tools.FindSceneObjectsOfTypeAll <PipelineManager>();
        if (pms.Length == 1 && !string.IsNullOrEmpty(pms[0].blueprintId))
        {
            if (scene.apiWorld == null)
            {
                ApiWorld world = API.FromCacheOrNew <ApiWorld>(pms[0].blueprintId);
                world.Fetch(null, false,
                            (c) => scene.apiWorld = c.Model as ApiWorld,
                            (c) =>
                {
                    if (c.Code == 404)
                    {
                        Debug.LogErrorFormat("Could not load world {0} because it didn't exist.", pms[0].blueprintId);
                        ApiCache.Invalidate <ApiWorld>(pms[0].blueprintId);
                    }
                    else
                    {
                        Debug.LogErrorFormat("Could not load world {0} because {1}", pms[0].blueprintId, c.Error);
                    }
                });
                scene.apiWorld = world;
            }
            worldVersion = (scene.apiWorld as ApiWorld).version.ToString();
        }
        EditorGUILayout.LabelField("World Version: " + worldVersion);

        EditorGUILayout.Space();

        if (!UpdateLayers.AreLayersSetup() && GUILayout.Button("Setup Layers for VRChat"))
        {
            bool doIt = EditorUtility.DisplayDialog("Setup Layers for VRChat", "This adds all VRChat layers to your project and pushes any custom layers down the layer list. If you have custom layers assigned to gameObjects, you'll need to reassign them. Are you sure you want to continue?", "Do it!", "Don't do it");
            if (doIt)
            {
                UpdateLayers.SetupEditorLayers();
            }
        }

        if (UpdateLayers.AreLayersSetup() && !UpdateLayers.IsCollisionLayerMatrixSetup() && GUILayout.Button("Setup Collision Layer Matrix for VRChat"))
        {
            bool doIt = EditorUtility.DisplayDialog("Setup Collision Layer Matrix for VRChat", "This will setup the correct physics collisions in the PhysicsManager for VRChat layers. Are you sure you want to continue?", "Do it!", "Don't do it");
            if (doIt)
            {
                UpdateLayers.SetupCollisionLayerMatrix();
            }
        }

        scene.autoSpatializeAudioSources = EditorGUILayout.ToggleLeft("Apply 3D spatialization to AudioSources automatically at runtime (override settings by adding an ONSPAudioSource component to game object)", scene.autoSpatializeAudioSources);
        if (GUILayout.Button("Enable 3D spatialization on all 3D AudioSources in scene now"))
        {
            bool doIt = EditorUtility.DisplayDialog("Enable Spatialization", "This will add an ONSPAudioSource script to every 3D AudioSource in the current scene, and enable default settings for spatialization.  Are you sure you want to continue?", "Do it!", "Don't do it");
            if (doIt)
            {
                if (_EnableSpatialization != null)
                {
                    _EnableSpatialization();
                }
                else
                {
                    Debug.LogError("VrcSdkControlPanel: EnableSpatialization callback not found!");
                }
            }
        }

        GUI.enabled = (GUIErrors.Count == 0 && checkedForIssues);
        EditorGUILayout.Space();
        EditorGUILayout.BeginVertical();
        EditorGUILayout.LabelField("Test", EditorStyles.boldLabel);
        numClients = EditorGUILayout.IntField("Number of Clients", numClients);
        if (lastBuildPresent == false)
        {
            GUI.enabled = false;
        }
        if (GUILayout.Button("Last Build"))
        {
            VRC_SdkBuilder.shouldBuildUnityPackage = false;
            VRC_SdkBuilder.numClientsToLaunch      = numClients;
            VRC_SdkBuilder.RunLastExportedSceneResource();
        }
        if (APIUser.CurrentUser.hasSuperPowers)
        {
            if (GUILayout.Button("Copy Test URL"))
            {
                TextEditor te = new TextEditor();
                te.text = lastUrl;
                te.SelectAll();
                te.Copy();
            }
        }
        if (lastBuildPresent == false)
        {
            GUI.enabled = true;
        }
        if (GUILayout.Button("New Build"))
        {
            EnvConfig.ConfigurePlayerSettings();
            VRC_SdkBuilder.shouldBuildUnityPackage = false;
            VRC.AssetExporter.CleanupUnityPackageExport();  // force unity package rebuild on next publish
            VRC_SdkBuilder.numClientsToLaunch = numClients;
            VRC_SdkBuilder.PreBuildBehaviourPackaging();
            VRC_SdkBuilder.ExportSceneResourceAndRun();
        }
        EditorGUILayout.EndVertical();
        EditorGUILayout.Space();
        EditorGUILayout.BeginVertical();
        EditorGUILayout.LabelField("Publish", EditorStyles.boldLabel);
        if (lastBuildPresent == false)
        {
            GUI.enabled = false;
        }
        if (GUILayout.Button("Last Build"))
        {
            if (APIUser.CurrentUser.canPublishWorlds)
            {
                VRC_SdkBuilder.shouldBuildUnityPackage = VRC.AccountEditorWindow.FutureProofPublishEnabled;
                VRC_SdkBuilder.UploadLastExportedSceneBlueprint();
            }
            else
            {
                ShowContentPublishPermissionsDialog();
            }
        }
        if (lastBuildPresent == false)
        {
            GUI.enabled = true;
        }
        if (GUILayout.Button("New Build"))
        {
            if (APIUser.CurrentUser.canPublishWorlds)
            {
                EnvConfig.ConfigurePlayerSettings();
                VRC_SdkBuilder.shouldBuildUnityPackage = VRC.AccountEditorWindow.FutureProofPublishEnabled;
                VRC_SdkBuilder.PreBuildBehaviourPackaging();
                VRC_SdkBuilder.ExportAndUploadSceneBlueprint();
            }
            else
            {
                ShowContentPublishPermissionsDialog();
            }
        }
        EditorGUILayout.EndVertical();
        GUI.enabled = true;
    }
예제 #10
0
 static void smethod_3(string string_1, Action <ApiWorld> action_0, Action <string> action_1)
 {
     ApiWorld.Fetch(string_1, action_0, action_1);
 }
예제 #11
0
        // Token: 0x0600603A RID: 24634 RVA: 0x0021DD74 File Offset: 0x0021C174
        public void SetupUserInfo(APIUser u, PageUserInfo.InfoType infoType, UiUserList.ListType listType = UiUserList.ListType.None)
        {
            this.SetUserRelationshipState(infoType);
            this.ClearRoomInfo();
            this.user          = u;
            this.userName.text = this.user.displayName;
            if (!string.IsNullOrEmpty(this.user.currentAvatarImageUrl))
            {
                Downloader.DownloadImage(this.user.currentAvatarImageUrl, delegate(string downloadedUrl, Texture2D obj)
                {
                    this.avatarImage.texture = obj;
                }, string.Empty);
            }
            this.SetupModButtons();
            this.onlineStatusText.text = string.Empty;
            switch (this.state)
            {
            case PageUserInfo.InfoType.NotFriends:
            {
                this.worldImage.transform.parent.gameObject.SetActive(true);
                Player player = PlayerManager.GetPlayer(this.user.id);
                bool   flag   = player != null && player.vrcPlayer != null && player.vrcPlayer.isInvisible;
                if (listType == UiUserList.ListType.InWorld && !flag)
                {
                    if (RoomManager.currentRoom != null && !string.IsNullOrEmpty(RoomManager.currentRoom.imageUrl))
                    {
                        this.DownloadAndSetWorldImage(RoomManager.currentRoom.imageUrl);
                    }
                    this.onlineStatusText.text = "online in current world";
                }
                this.SetupFriendButton("Friend");
                break;
            }

            case PageUserInfo.InfoType.OnlineFriend:
                this.worldImage.transform.parent.gameObject.SetActive(true);
                this.worldList.ownerId = this.user.id;
                this.worldScroller.SetActive(true);
                this.SetIcon(QuickMenuSocialElement.IconType.Friend, u.id);
                this.SetupJoinButton("Join", false);
                this.SetupInviteButton("Invite", false);
                if (listType == UiUserList.ListType.InWorld)
                {
                    if (RoomManager.currentRoom != null && !string.IsNullOrEmpty(RoomManager.currentRoom.imageUrl))
                    {
                        this.DownloadAndSetWorldImage(RoomManager.currentRoom.imageUrl);
                    }
                    this.onlineStatusText.text = "online in current world";
                }
                else if (!string.IsNullOrEmpty(this.user.location))
                {
                    string text = this.user.location.Split(new char[]
                    {
                        ':'
                    })[0];
                    string instanceId = this.user.location.Split(new char[]
                    {
                        ':'
                    })[1];
                    if (text == "local")
                    {
                        this.onlineStatusText.text = "online in local test world";
                    }
                    else
                    {
                        ApiWorld.Fetch(text, delegate(ApiWorld world)
                        {
                            ApiWorld.WorldInstance worldInstance = new ApiWorld.WorldInstance(instanceId, 0);
                            bool flag2 = APIUser.CurrentUser.id == worldInstance.GetInstanceCreator();
                            ApiWorld.WorldInstance.AccessType accessType     = worldInstance.GetAccessType();
                            ApiWorld.WorldInstance.AccessDetail accessDetail = ApiWorld.WorldInstance.GetAccessDetail(accessType);
                            if (accessType == ApiWorld.WorldInstance.AccessType.Public)
                            {
                                this.DownloadAndSetWorldImage(world.imageUrl);
                                this.userLocation = world;
                                if (world.id == RoomManager.currentRoom.id && worldInstance.idWithTags == RoomManager.currentRoom.currentInstanceIdWithTags)
                                {
                                    this.onlineStatusText.text = "online in same world";
                                }
                                else
                                {
                                    this.onlineStatusText.text = string.Concat(new string[]
                                    {
                                        "online in ",
                                        world.name,
                                        "\n<i>",
                                        accessDetail.fullName.ToLower(),
                                        "</i>"
                                    });
                                    this.SetupJoinButton("Join", true);
                                    this.SetupInviteButton("Invite", this.CanInviteHere());
                                }
                            }
                            else if (accessType == ApiWorld.WorldInstance.AccessType.FriendsOfGuests)
                            {
                                this.DownloadAndSetWorldImage(world.imageUrl);
                                this.userLocation = world;
                                if (world.id == RoomManager.currentRoom.id && worldInstance.idWithTags == RoomManager.currentRoom.currentInstanceIdWithTags)
                                {
                                    this.onlineStatusText.text = "online in same world";
                                }
                                else
                                {
                                    this.onlineStatusText.text = string.Concat(new string[]
                                    {
                                        "online in ",
                                        world.name,
                                        "\n<i>",
                                        accessDetail.fullName.ToLower(),
                                        "</i>"
                                    });
                                    this.SetupJoinButton("Join", true);
                                    this.SetupInviteButton("Invite", this.CanInviteHere());
                                }
                            }
                            else if (accessType == ApiWorld.WorldInstance.AccessType.FriendsOnly)
                            {
                                this.DownloadAndSetWorldImage(world.imageUrl);
                                this.userLocation = world;
                                if (world.id == RoomManager.currentRoom.id && worldInstance.idWithTags == RoomManager.currentRoom.currentInstanceIdWithTags)
                                {
                                    this.onlineStatusText.text = "online in same world";
                                }
                                else
                                {
                                    this.onlineStatusText.text = string.Concat(new string[]
                                    {
                                        "online in ",
                                        world.name,
                                        "\n<i>",
                                        accessDetail.fullName.ToLower(),
                                        "</i>"
                                    });
                                    this.SetupJoinButton("Join", flag2 || this.user.id == worldInstance.GetInstanceCreator());
                                    this.SetupInviteButton("Invite", this.CanInviteHere());
                                }
                            }
                            else if (accessType == ApiWorld.WorldInstance.AccessType.InviteOnly)
                            {
                                if (flag2)
                                {
                                    this.DownloadAndSetWorldImage(world.imageUrl);
                                    this.userLocation = world;
                                }
                                else
                                {
                                    this.worldImage.texture = this.avatarImage.texture;
                                    this.userLocation       = null;
                                }
                                if (world.id == RoomManager.currentRoom.id && worldInstance.idWithTags == RoomManager.currentRoom.currentInstanceIdWithTags)
                                {
                                    this.onlineStatusText.text = "online in same world";
                                }
                                else
                                {
                                    this.onlineStatusText.text = "online in " + accessDetail.fullName.ToLower() + " world";
                                    if (flag2)
                                    {
                                        this.SetupJoinButton("Join", true);
                                    }
                                    else
                                    {
                                        this.SetupJoinButton("Req Invite", this.user.id == worldInstance.GetInstanceCreator());
                                    }
                                    this.SetupInviteButton("Invite", this.CanInviteHere());
                                }
                            }
                        }, delegate(string obj)
                        {
                            Debug.LogError(obj);
                        });
                    }
                }
                break;

            case PageUserInfo.InfoType.OfflineFriend:
                this.onlineStatusText.text = "offline";
                this.worldList.ownerId     = this.user.id;
                this.worldScroller.SetActive(true);
                this.SetIcon(QuickMenuSocialElement.IconType.Friend, u.id);
                break;

            case PageUserInfo.InfoType.ReceivedFriendRequest:
                this.notificationMessageText.text = this.user.displayName + " wants to be your friend";
                this.SetIcon(QuickMenuSocialElement.IconType.FriendRequest, u.id);
                break;

            case PageUserInfo.InfoType.ReceivedHelpRequest:
                this.notificationMessageText.text = this.user.displayName + " needs help";
                this.SetIcon(QuickMenuSocialElement.IconType.HelpRequest, u.id);
                break;
            }
            this.SetupBlockButton();
            this.SetupVoteToKickButton();
            this.SetupMuteButton();
        }