void UserLoggedInCallback(APIUser user)
        {
            pipelineManager.user = user;

            if (isUpdate)
            {
                ApiWorld.Fetch(pipelineManager.blueprintId, false,
                               delegate(ApiWorld world)
                {
                    worldRecord = world;
                    SetupUI();
                },
                               delegate(string message)
                {
                    pipelineManager.blueprintId = "";
                    SetupUI();
                });
            }
            else
            {
                SetupUI();
            }
        }
Esempio n. 2
0
        private static void DropPortal()
        {
            const int  PlayerCount = 0;
            const bool ShowAlerts  = true;

            // Fetch the world to know it exists and also needed for the world tags during the portal creation stage
            API.Fetch <ApiWorld>(
                worldId,

                // On Success which it'll be if valid vanilla invite
                new Action <ApiContainer>(
                    container =>
            {
                Utilities.HideCurrentPopup();
                ApiWorld apiWorld = container.Model.Cast <ApiWorld>();
                ApiWorldInstance apiWorldInstance = new ApiWorldInstance(apiWorld, instanceIdWithTags, PlayerCount);

                Transform playerTransform = Utilities.GetLocalPlayerTransform();

                // CreatePortal (before il2cpp)
                bool created = Utilities.CreatePortal(apiWorld, apiWorldInstance, playerTransform.position, playerTransform.forward, ShowAlerts);
                if (created && DeleteNotifications)
                {
                    try
                    {
                        Utilities.DeleteNotification(currentNotification);
                    }
                    catch (Exception e)
                    {
                        MelonLogger.Error("Couldn't delete the notification:\n" + e);
                    }
                }
            }),

                // On Failure
                new Action <ApiContainer>(container => Utilities.ShowAlert("Error Fetching World", container.Error)));
        }
Esempio n. 3
0
        // Token: 0x060060A6 RID: 24742 RVA: 0x00220898 File Offset: 0x0021EC98
        public void SetupRoomInfo(ApiWorld world, PageWorldInfo worldInfo)
        {
            this.mWorld     = world;
            this.mWorldInfo = worldInfo;
            if (this.mWorld.releaseStatus == "private")
            {
                this.isPrivate = true;
            }
            else
            {
                this.isPrivate = false;
            }
            this.roomName.text = world.name;
            bool flag = ModerationManager.Instance.IsBannedFromPublicOnly(APIUser.CurrentUser.id);

            if (this.isPrivate || flag)
            {
                this.publicButton.gameObject.SetActive(false);
            }
            else
            {
                this.publicButton.gameObject.SetActive(true);
                this.publicButton.onClick.AddListener(new UnityAction(this.CreatePublicInstance));
            }
            if (flag)
            {
                this.fogButton.gameObject.SetActive(false);
            }
            else
            {
                this.fogButton.gameObject.SetActive(true);
                this.fogButton.onClick.AddListener(new UnityAction(this.CreateFriendsOfGuestsInstance));
            }
            this.friendsButton.onClick.AddListener(new UnityAction(this.CreateFriendsOnlyInstance));
            this.inviteButton.onClick.AddListener(new UnityAction(this.CreateInviteOnlyInstance));
        }
Esempio n. 4
0
        private static void BlacklistWorld()
        {
            ApiWorld currentWorld = Object.FindObjectOfType <PageWorldInfo>()?.field_Private_ApiWorld_0;

            if (currentWorld == null)
            {
                return;
            }

            if (WorldPermissionHandler.IsBlacklisted(currentWorld.id))
            {
                WorldPermissionHandler.RemoveFromBlacklist(currentWorld.id);
                MelonLogger.Msg($"{currentWorld.name} removed from blacklist");
                Utilities.QueueHudMessage($"{currentWorld.name} removed from blacklist");
            }
            else
            {
                WorldPermissionHandler.AddToBlacklist(currentWorld);
                MelonLogger.Msg($"{currentWorld.name} added to blacklist");
                Utilities.QueueHudMessage($"{currentWorld.name} added to blacklist");
            }

            WorldPermissionHandler.SaveSettings();
        }
Esempio n. 5
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);
            }
Esempio n. 6
0
        public static void Add(ApiWorld world, ApiWorldInstance instance)
        {
            instances.Insert(0, new WorldInstance(world.name, world.id, instance.instanceId));

            File.WriteAllText(instanceDatabasePath, JsonConvert.SerializeObject(instances, Formatting.Indented));
        }
Esempio n. 7
0
    // Token: 0x0600592E RID: 22830 RVA: 0x001EF104 File Offset: 0x001ED504
    public static bool CreatePortal(ApiWorld targetWorld, ApiWorld.WorldInstance targetInstance, Vector3 position, Vector3 forward, bool withUIErrors = false)
    {
        if (Time.time - PortalInternal.lastInstantiation <= Time.fixedDeltaTime)
        {
            return(false);
        }
        PortalInternal.lastInstantiation = Time.time;
        if (RoomManager.IsLockdown())
        {
            if (withUIErrors)
            {
                VRCUiPopupManager.Instance.ShowAlert("Cannot Create Portal", "Room is in lockdown.", 10f);
            }
            return(false);
        }
        if (RoomManager.IsUserPortalForbidden())
        {
            if (withUIErrors)
            {
                VRCUiPopupManager.Instance.ShowAlert("Cannot Create Portal", "User portals are forbidden in this world.", 10f);
            }
            return(false);
        }
        if (SpawnManager.Instance.IsCloseToSpawn(position, 3f))
        {
            if (withUIErrors)
            {
                VRCUiPopupManager.Instance.ShowAlert("Cannot Create Portal", "Portal too close to spawn.", 10f);
            }
            return(false);
        }
        position = position + forward * 2f + Vector3.up * 1f;
        if (PlayerManager.GetAllPlayersWithinRange(position, 1.75f).Count > 0)
        {
            if (withUIErrors)
            {
                VRCUiPopupManager.Instance.ShowAlert("Cannot Create Portal", "Portal too close to a player.", 10f);
            }
            return(false);
        }
        RaycastHit raycastHit;

        if (!Physics.Raycast(position, -Vector3.up, out raycastHit, 2f))
        {
            if (withUIErrors)
            {
                VRCUiPopupManager.Instance.ShowAlert("Cannot Create Portal", "Could not find surface on which to place it.", 10f);
            }
            return(false);
        }
        if (ModerationManager.Instance.IsPublicOnlyBannedFromWorld(APIUser.CurrentUser.id, targetWorld.id, targetInstance.idWithTags))
        {
            if (withUIErrors)
            {
                VRCUiPopupManager.Instance.ShowAlert("Cannot Create Portal", ModerationManager.Instance.GetPublicOnlyBannedUserMessage(), 10f);
            }
            return(false);
        }
        if (targetWorld.tags.Contains("admin_dont_allow_portals"))
        {
            if (withUIErrors)
            {
                VRCUiPopupManager.Instance.ShowAlert("Cannot Create Portal", "Creating portals to this world is not allowed.", 10f);
            }
            return(false);
        }
        GameObject targetObject = VRC.Network.Instantiate(VRC_EventHandler.VrcBroadcastType.Always, "PortalInternalDynamic", position + Vector3.down, Quaternion.FromToRotation(Vector3.forward, forward));

        VRC.Network.RPC(VRC_EventHandler.VrcTargetType.AllBufferOne, targetObject, "ConfigurePortal", new object[]
        {
            targetWorld.id,
            targetInstance.idWithTags,
            targetInstance.count
        });
        return(true);
    }
        IEnumerator UploadNew()
        {
            bool caughtInvalidInput = false;

            if (!ValidateNameInput(blueprintName))
            {
                caughtInvalidInput = true;
            }

            if (caughtInvalidInput)
            {
                yield break;
            }

            // upload unity package
            if (!string.IsNullOrEmpty(uploadUnityPackagePath))
            {
                yield return(StartCoroutine(UploadFile(uploadUnityPackagePath, isUpdate ? worldRecord.unityPackageUrl : "", GetFriendlyWorldFileName("Unity package"), "Unity package",
                                                       delegate(string fileUrl)
                {
                    cloudFrontUnityPackageUrl = fileUrl;
                }
                                                       )));
            }

            // upload plugin
            if (!string.IsNullOrEmpty(uploadPluginPath))
            {
                yield return(StartCoroutine(UploadFile(uploadPluginPath, isUpdate ? worldRecord.pluginUrl : "", GetFriendlyWorldFileName("Plugin"), "Plugin",
                                                       delegate(string fileUrl)
                {
                    cloudFrontPluginUrl = fileUrl;
                }
                                                       )));
            }

            // upload asset bundle
            if (!string.IsNullOrEmpty(uploadVrcPath))
            {
                yield return(StartCoroutine(UploadFile(uploadVrcPath, isUpdate ? worldRecord.assetUrl : "", GetFriendlyWorldFileName("Asset bundle"), "Asset bundle",
                                                       delegate(string fileUrl)
                {
                    cloudFrontAssetUrl = fileUrl;
                }
                                                       )));
            }

            if (isUpdate)
            {
                yield return(StartCoroutine(UpdateBlueprint()));
            }
            else
            {
                yield return(StartCoroutine(CreateBlueprint()));
            }

            if (publishingToCommunityLabs)
            {
                ApiWorld.PublishWorldToCommunityLabs(pipelineManager.blueprintId,
                                                     (world) => OnUploadedWorld(),
                                                     (err) =>
                {
                    Debug.LogError("PublishWorldToCommunityLabs error:" + err);
                    OnUploadedWorld();
                }
                                                     );
            }
            else
            {
                OnUploadedWorld();
            }
        }
Esempio n. 9
0
 public DownloadInfo(
     ApiWorld ApiWorld,
     string InstanceIDTags,
     DownloadType DownloadType,
     PageUserInfo PageUserInfo   = null !,
Esempio n. 10
0
 public override void OnInstanceChange(ApiWorld world, ApiWorldInstance instance)
 {
     MelonCoroutines.Start(GetInstanceCreator(instance));
 }
Esempio n. 11
0
    bool OnGUIUserInfo()
    {
        if (!RemoteConfig.IsInitialized())
        {
            RemoteConfig.Init();
        }

        if (APIUser.IsLoggedInWithCredentials && uploadedWorlds != null && uploadedAvatars != null)
        {
            EditorGUILayout.LabelField(string.Format(fetchingWorlds != null ? "Fetching Worlds... {0}" : "{0} Worlds", uploadedWorlds.Count.ToString()), EditorStyles.helpBox);
            EditorGUILayout.LabelField(string.Format(fetchingAvatars != null ? "Fetching Avatars... {0}" : "{0} Avatars", uploadedAvatars.Count.ToString()), EditorStyles.helpBox);

            scrollPos = EditorGUILayout.BeginScrollView(scrollPos);

            if (uploadedWorlds.Count > 0)
            {
                EditorGUILayout.Space();

                EditorGUILayout.LabelField("Worlds", EditorStyles.boldLabel);
                EditorGUILayout.Space();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Name", EditorStyles.boldLabel, GUILayout.Width(200));
                EditorGUILayout.LabelField("Image", EditorStyles.boldLabel, GUILayout.Width(75));
                EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50));
                //EditorGUILayout.LabelField("Version", EditorStyles.boldLabel, GUILayout.Width (75));
                EditorGUILayout.LabelField("Release Status", EditorStyles.boldLabel, GUILayout.Width(100));
                EditorGUILayout.EndHorizontal();

                List <ApiWorld> tmpWorlds = new List <ApiWorld>();

                if (uploadedWorlds.Count > 0)
                {
                    tmpWorlds = new List <ApiWorld>(uploadedWorlds);
                }

                foreach (ApiWorld w in tmpWorlds)
                {
                    if (justDeletedContents != null && justDeletedContents.Contains(w.id))
                    {
                        uploadedWorlds.Remove(w);
                        continue;
                    }

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField(w.name, GUILayout.Width(200));
                    if (ImageCache.ContainsKey(w.id))
                    {
                        if (GUILayout.Button(ImageCache[w.id], GUILayout.Height(100), GUILayout.Width(100)))
                        {
                            Application.OpenURL(w.imageUrl);
                        }
                    }
                    else
                    {
                        if (GUILayout.Button("", GUILayout.Height(100), GUILayout.Width(100)))
                        {
                            Application.OpenURL(w.imageUrl);
                        }
                    }
                    EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50));
                    EditorGUILayout.LabelField(w.releaseStatus, GUILayout.Width(100));
                    EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50));
                    if (GUILayout.Button("Copy ID", GUILayout.Width(75)))
                    {
                        TextEditor te = new TextEditor();
                        te.text = w.id;
                        te.SelectAll();
                        te.Copy();
                    }
                    if (GUILayout.Button("Delete", GUILayout.Width(75)))
                    {
                        if (EditorUtility.DisplayDialog("Delete " + w.name + "?", "Are you sure you want to delete " + w.name + "? This cannot be undone.", "Delete", "Cancel"))
                        {
                            ApiWorld.Delete(w.id, null, null);
                            uploadedWorlds.RemoveAll(world => world.id == w.id);
                            if (ImageCache.ContainsKey(w.id))
                            {
                                ImageCache.Remove(w.id);
                            }

                            if (justDeletedContents == null)
                            {
                                justDeletedContents = new List <string>();
                            }
                            justDeletedContents.Add(w.id);
                        }
                    }
                    EditorGUILayout.EndHorizontal();
                }
            }

            if (uploadedAvatars.Count > 0)
            {
                EditorGUILayout.Space();
                EditorGUILayout.LabelField("Avatars", EditorStyles.boldLabel);
                EditorGUILayout.Space();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Name", EditorStyles.boldLabel, GUILayout.Width(200));
                EditorGUILayout.LabelField("Image", EditorStyles.boldLabel, GUILayout.Width(75));
                EditorGUILayout.EndHorizontal();

                List <ApiAvatar> tmpAvatars = new List <ApiAvatar>();

                if (uploadedAvatars.Count > 0)
                {
                    tmpAvatars = new List <ApiAvatar>(uploadedAvatars);
                }

                if (justUpdatedAvatars != null)
                {
                    foreach (ApiAvatar a in justUpdatedAvatars)
                    {
                        int index = tmpAvatars.FindIndex((av) => av.id == a.id);
                        if (index != -1)
                        {
                            tmpAvatars[index] = a;
                        }
                    }
                }

                foreach (ApiAvatar a in tmpAvatars)
                {
                    if (justDeletedContents != null && justDeletedContents.Contains(a.id))
                    {
                        uploadedAvatars.Remove(a);
                        continue;
                    }

                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField(a.name, GUILayout.Width(200));
                    if (ImageCache.ContainsKey(a.id))
                    {
                        if (GUILayout.Button(ImageCache[a.id], GUILayout.Height(100), GUILayout.Width(100)))
                        {
                            Application.OpenURL(a.imageUrl);
                        }
                    }
                    else
                    {
                        if (GUILayout.Button("", GUILayout.Height(100), GUILayout.Width(100)))
                        {
                            Application.OpenURL(a.imageUrl);
                        }
                    }
                    EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50));
                    EditorGUILayout.LabelField(a.releaseStatus, GUILayout.Width(100));
                    EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50));

                    string oppositeReleaseStatus = a.releaseStatus == "public" ? "private" : "public";
                    if (GUILayout.Button("Make " + oppositeReleaseStatus, GUILayout.Width(100)))
                    {
                        a.releaseStatus = oppositeReleaseStatus;

                        a.Save(true, delegate(ApiModel model)
                        {
                            ApiAvatar savedBP = (ApiAvatar)model;

                            if (justUpdatedAvatars == null)
                            {
                                justUpdatedAvatars = new List <ApiAvatar>();
                            }
                            justUpdatedAvatars.Add(savedBP);

                            EditorUtility.DisplayDialog("Avatar Updated", "Avatar made " + savedBP.releaseStatus, "OK");
                        },
                               delegate(string error)
                        {
                            Debug.LogError(error);
                            EditorUtility.DisplayDialog("Avatar Updated", "Failed to change avatar release status", "OK");
                        });
                    }

                    if (GUILayout.Button("Copy ID", GUILayout.Width(75)))
                    {
                        TextEditor te = new TextEditor();
                        te.text = a.id;
                        te.SelectAll();
                        te.Copy();
                    }

                    if (GUILayout.Button("Delete", GUILayout.Width(75)))
                    {
                        if (EditorUtility.DisplayDialog("Delete " + a.name + "?", "Are you sure you want to delete " + a.name + "? This cannot be undone.", "Delete", "Cancel"))
                        {
                            ApiAvatar.Delete(a.id, null, null);
                            uploadedAvatars.RemoveAll(avatar => avatar.id == a.id);
                            if (ImageCache.ContainsKey(a.id))
                            {
                                ImageCache.Remove(a.id);
                            }

                            if (justDeletedContents == null)
                            {
                                justDeletedContents = new List <string>();
                            }
                            justDeletedContents.Add(a.id);
                        }
                    }
                    EditorGUILayout.EndHorizontal();
                }
            }

            EditorGUILayout.EndScrollView();

            return(true);
        }
        else
        {
            return(false);
        }
    }
Esempio n. 12
0
        // Token: 0x06000C5B RID: 3163 RVA: 0x0001FF5C File Offset: 0x0001E15C
        public static void OnThisUpdate()
        {
            bool flag = RoomManagerBase.currentRoom != null;

            if (flag)
            {
                ApiWorld currentRoom = RoomManagerBase.currentRoom;
                DiscordInfo.thisScene = default(Scene);
                bool flag2 = DiscordInfo.currentWorld != currentRoom;
                if (flag2)
                {
                    DiscordInfo.currentWorld = RoomManagerBase.currentRoom;
                    ApiWorldInstance            currentWorldInstance = RoomManagerBase.currentWorldInstance;
                    ApiWorldInstance.AccessType accessType           = currentWorldInstance.GetAccessType();
                    int  count = currentWorldInstance.users.Count;
                    bool flag3 = accessType == ApiWorldInstance.AccessType.Public;
                    if (flag3)
                    {       //info 1
                        DiscordInfo.ResetTime();
                        DiscordInfo.Presence.details        = DiscordInfo.GetWorldName();
                        DiscordInfo.Presence.state          = "In a " + DiscordInfo.GetWorldInstanceType(accessType) + " Lobby";
                        DiscordInfo.Presence.startTimestamp = DiscordInfo.timestamp;
                        DiscordInfo.Presence.largeImageKey  = "default_logo";
                        DiscordInfo.Presence.largeImageText = "VRChat";
                        DiscordInfo.Presence.smallImageKey  = "public_img";
                        DiscordInfo.Presence.smallImageText = "Using TurtleGangClient";
                        DiscordInfo.PlayerCount();
                        DiscordRich.UpdatePresence(DiscordInfo.Presence);
                        return;
                    }
                    bool flag4 = accessType == ApiWorldInstance.AccessType.InvitePlus;
                    if (flag4)
                    {       //info 2
                        DiscordInfo.ResetTime();
                        DiscordInfo.Presence.details        = DiscordInfo.GetWorldName();
                        DiscordInfo.Presence.state          = "In a " + DiscordInfo.GetWorldInstanceType(accessType) + " Lobby";
                        DiscordInfo.Presence.startTimestamp = DiscordInfo.timestamp;
                        DiscordInfo.Presence.largeImageKey  = "default_logo";
                        DiscordInfo.Presence.largeImageText = "VRChat";
                        DiscordInfo.Presence.smallImageKey  = "inviteplus_img";
                        DiscordInfo.Presence.smallImageText = "Using TurtleGangClient";
                        DiscordInfo.PlayerCount();
                        DiscordRich.UpdatePresence(DiscordInfo.Presence);
                        return;
                    }
                    bool flag5 = accessType == ApiWorldInstance.AccessType.InviteOnly;
                    if (flag5)
                    {       //info 3
                        DiscordInfo.ResetTime();
                        DiscordInfo.Presence.details        = DiscordInfo.GetWorldName();
                        DiscordInfo.Presence.state          = "In a " + DiscordInfo.GetWorldInstanceType(accessType) + " Lobby";
                        DiscordInfo.Presence.startTimestamp = DiscordInfo.timestamp;
                        DiscordInfo.Presence.largeImageKey  = "default_logo";
                        DiscordInfo.Presence.largeImageText = "VRChat";
                        DiscordInfo.Presence.smallImageKey  = "inviteonly_img";
                        DiscordInfo.Presence.smallImageText = "Using TurtleGangClient";
                        DiscordInfo.PlayerCount();
                        DiscordRich.UpdatePresence(DiscordInfo.Presence);
                        return;
                    }
                    bool flag6 = accessType == ApiWorldInstance.AccessType.FriendsOfGuests;
                    if (flag6)
                    {       //info 4
                        DiscordInfo.ResetTime();
                        DiscordInfo.Presence.details        = DiscordInfo.GetWorldName();
                        DiscordInfo.Presence.state          = "In a " + DiscordInfo.GetWorldInstanceType(accessType) + " Lobby";
                        DiscordInfo.Presence.startTimestamp = DiscordInfo.timestamp;
                        DiscordInfo.Presence.largeImageKey  = "default_logo";
                        DiscordInfo.Presence.largeImageText = "VRChat";
                        DiscordInfo.Presence.smallImageKey  = "friendofguests_img";
                        DiscordInfo.Presence.smallImageText = "Using TurtleGangClient";
                        DiscordInfo.PlayerCount();
                        DiscordRich.UpdatePresence(DiscordInfo.Presence);
                        return;
                    }
                    bool flag7 = accessType == ApiWorldInstance.AccessType.FriendsOnly;
                    if (flag7)
                    {       //info 5
                        DiscordInfo.ResetTime();
                        DiscordInfo.Presence.details        = DiscordInfo.GetWorldName();
                        DiscordInfo.Presence.state          = "In a " + DiscordInfo.GetWorldInstanceType(accessType) + " Lobby";
                        DiscordInfo.Presence.startTimestamp = DiscordInfo.timestamp;
                        DiscordInfo.Presence.largeImageKey  = "default_logo";
                        DiscordInfo.Presence.largeImageText = "VRChat";
                        DiscordInfo.Presence.smallImageKey  = "friendsonly_img";
                        DiscordInfo.Presence.smallImageText = "Using TurtleGangClient";
                        DiscordInfo.PlayerCount();
                        DiscordRich.UpdatePresence(DiscordInfo.Presence);
                        return;
                    }
                    bool flag8 = accessType == ApiWorldInstance.AccessType.Counter;
                    if (flag8)
                    {       //info 6
                        DiscordInfo.ResetTime();
                        DiscordInfo.Presence.details        = DiscordInfo.GetWorldName();
                        DiscordInfo.Presence.state          = "In a " + DiscordInfo.GetWorldInstanceType(accessType) + " Lobby";
                        DiscordInfo.Presence.startTimestamp = DiscordInfo.timestamp;
                        DiscordInfo.Presence.largeImageKey  = "default_logo";
                        DiscordInfo.Presence.largeImageText = "VRChat";
                        DiscordInfo.Presence.smallImageKey  = "counter_img";
                        DiscordInfo.Presence.smallImageText = "Using TurtleGangClient";
                        DiscordInfo.PlayerCount();
                        DiscordRich.UpdatePresence(DiscordInfo.Presence);
                        return;
                    }
                }
                bool flag9 = DiscordInfo.currentWorld != null;
                if (flag9)
                { //nb de gens la room ?
                    DiscordInfo.Presence.partySize = PlayerManager.GetAllPlayers().Length;
                    DiscordInfo.Presence.partyMax  = DiscordInfo.currentWorld.capacity;
                    DiscordRich.UpdatePresence(DiscordInfo.Presence);
                }
                else
                { //idk
                    DiscordInfo.Presence.partySize = 0;
                    DiscordInfo.Presence.partyMax  = 0;
                    DiscordRich.UpdatePresence(DiscordInfo.Presence);
                }
            }
            else
            {
                Scene activeScene = SceneManager.GetActiveScene();
                bool  flag10      = DiscordInfo.thisScene != activeScene;
                if (flag10)
                {
                    DiscordInfo.thisScene = activeScene;
                    Scene scene  = DiscordInfo.thisScene; //nom de scene idk ?
                    bool  flag11 = DiscordInfo.thisScene.name == "ui";
                    if (flag11)
                    {
                        //info 7
                        DiscordInfo.ResetTime();
                        DiscordInfo.Presence.details        = "In Loading Screen";
                        DiscordInfo.Presence.state          = string.Empty;
                        DiscordInfo.Presence.startTimestamp = DiscordInfo.timestamp;
                        DiscordInfo.Presence.partySize      = 0;
                        DiscordInfo.Presence.partyMax       = 0;
                        DiscordInfo.Presence.largeImageKey  = "default_logo";
                        DiscordInfo.Presence.largeImageText = "VRChat";
                        DiscordInfo.Presence.smallImageKey  = "loading_img";
                        DiscordInfo.Presence.smallImageText = "Using TurtleGangClient";
                        DiscordRich.UpdatePresence(DiscordInfo.Presence);
                        return;
                    }
                }
            }
            DiscordRich.RunCallbacks();
        }
Esempio n. 13
0
 public static void DownloadApiWorld(ApiWorld world, OnDownloadProgress onProgress, OnDownloadComplete onSuccess, OnDownloadError onError, bool bypassDownloadSizeLimit, UnpackType unpackType)
 {
     GetDownloadWorldDelegate(world, onProgress, onSuccess, onError, bypassDownloadSizeLimit, unpackType);
 }
Esempio n. 14
0
 public virtual void OnInstanceChange(ApiWorld world, ApiWorldInstance instance)
 {
 }
Esempio n. 15
0
 public static void OnEnterWorld(ApiWorld __0, ApiWorldInstance __1) => OnEnterWorldEvent.Invoke(__0, __1);
Esempio n. 16
0
 // Token: 0x060054A8 RID: 21672 RVA: 0x001D3620 File Offset: 0x001D1A20
 public static string GetLaunchUrl(ApiWorld world)
 {
     return("http://www.vrchat.net/launch.php?id=" + world.id);
 }
Esempio n. 17
0
 // Token: 0x0600549D RID: 21661 RVA: 0x001D3148 File Offset: 0x001D1548
 public static bool EnterWorld(ApiWorld world, string instanceId = "")
 {
     Debug.Log("Entering Room: " + world.name);
     if (VRCFlowNetworkManager.Instance == null || !VRCFlowNetworkManager.Instance.isConnected || !RoomManager.enterRoomReady)
     {
         string message = "Cannot join room. Connection not ready for join operations";
         UserMessage.SetMessage(message);
         Debug.LogError(message);
         return(false);
     }
     try
     {
         RoomManager.LockdownOverride = false;
         Analytics.Send(ApiAnalyticEvent.EventType.joinsWorld, world.id, null, null);
         ExitGames.Client.Photon.Hashtable hashtable = new ExitGames.Client.Photon.Hashtable();
         hashtable["scene"]     = "Custom";
         hashtable["url"]       = world.assetUrl;
         hashtable["name"]      = world.name;
         hashtable["blueprint"] = world;
         string[] customRoomPropertiesForLobby = new string[]
         {
             "scene",
             "url",
             "name"
         };
         RoomOptions roomOptions = new RoomOptions();
         roomOptions.IsOpen                       = true;
         roomOptions.IsVisible                    = true;
         roomOptions.MaxPlayers                   = (byte)((world.capacity * 2 >= 255) ? 255 : (world.capacity * 2));
         roomOptions.CustomRoomProperties         = hashtable;
         roomOptions.CustomRoomPropertiesForLobby = customRoomPropertiesForLobby;
         List <string> list = (from m in ModerationManager.Instance.GetModerationsOfType(ApiModeration.ModerationType.Kick)
                               where m.worldId == world.id
                               select m.instanceId).ToList <string>();
         if (world.capacity == 1)
         {
             instanceId = User.CurrentUser.id + ((!ModerationManager.Instance.IsBannedFromPublicOnly(APIUser.CurrentUser.id)) ? string.Empty : ApiWorld.WorldInstance.BuildAccessTags(ApiWorld.WorldInstance.AccessType.FriendsOnly, APIUser.CurrentUser.id));
         }
         else if (string.IsNullOrEmpty(instanceId) || list.Contains(instanceId))
         {
             instanceId = world.GetBestInstance(list, ModerationManager.Instance.IsBannedFromPublicOnly(APIUser.CurrentUser.id)).idWithTags;
         }
         string text = world.id + ":" + instanceId;
         Debug.Log("Joining " + text);
         Debug.Log("Joining or Creating Room: " + world.name);
         bool flag = PhotonNetwork.JoinOrCreateRoom(text, roomOptions, TypedLobby.Default);
         if (!flag)
         {
             RoomManager.currentRoom = null;
             RoomManager.ClearMetadata();
             throw new Exception("JoinOrCreateRoom failed!");
         }
         RoomManager.currentRoom = world;
         RoomManager.currentRoom.currentInstanceIdWithTags = instanceId;
         ApiWorld.WorldInstance worldInstance = new ApiWorld.WorldInstance(instanceId, 0);
         RoomManager.currentRoom.currentInstanceIdOnly = worldInstance.idOnly;
         RoomManager.currentRoom.currentInstanceAccess = worldInstance.GetAccessType();
         Debug.Log("Successfully joined room");
         RoomManager.lastMetadataFetchMinute = -1;
     }
     catch (Exception ex)
     {
         Debug.LogError("Something went entering room:\n" + ex.ToString() + "\n" + ex.StackTrace);
         return(false);
     }
     return(true);
 }
Esempio n. 18
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();
        }
Esempio n. 19
0
 static void smethod_3(string string_1, Action <ApiWorld> action_0, Action <string> action_1)
 {
     ApiWorld.Fetch(string_1, action_0, action_1);
 }
Esempio n. 20
0
 public static string GetInstanceIDWithTags(this ApiWorld apiWorld)
 {
     return(apiWorld.id.Split(':')[1]);
 }
Esempio n. 21
0
 static string smethod_1(ApiWorld apiWorld_0)
 {
     return(apiWorld_0.name);
 }
Esempio n. 22
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;
    }
Esempio n. 23
0
 // Token: 0x060061D9 RID: 25049 RVA: 0x00228848 File Offset: 0x00226C48
 private void ParseUrl(string url)
 {
     string[] array = url.Split(new char[]
     {
         '?'
     });
     if (url.ToLower().StartsWith(this.ProtocolName))
     {
         array = url.Remove(0, this.ProtocolName.Length).Split(new char[]
         {
             '?'
         });
     }
     if (array[0] == "launch" || array[0] == "launch/")
     {
         if (array.Length > 1)
         {
             string[] array2 = array[1].Split(new char[]
             {
                 '&'
             });
             foreach (string text in array2)
             {
                 string[] array4 = text.Split(new char[]
                 {
                     '='
                 });
                 if (array4[0] == "id")
                 {
                     this.launchId = array4[1];
                 }
             }
             if (!string.IsNullOrEmpty(this.launchId))
             {
                 this.CommandLineOperation = VRCFlowCommandLine.Operation.LaunchRoom;
             }
         }
     }
     else if (array[0] == "create" || array[0] == "create/")
     {
         this.launchId = "local:" + SessionManager.GetRandomDigits(10);
         string   text2     = string.Empty;
         string   pluginUrl = string.Empty;
         string[] array5    = array[1].Split(new char[]
         {
             '&'
         });
         foreach (string text3 in array5)
         {
             string[] array7 = text3.Split(new char[]
             {
                 '='
             });
             if (array7[0] == "url")
             {
                 text2 = array7[1];
             }
             else if (array7[0] == "pluginUrl")
             {
                 pluginUrl = array7[1];
             }
             else if (array7[0] == "roomId")
             {
                 this.launchId = "local:" + array7[1];
             }
         }
         if (!string.IsNullOrEmpty(text2))
         {
             this.CommandLineOperation = VRCFlowCommandLine.Operation.CreateRoom;
             this.world           = new ApiWorld();
             this.world.id        = this.launchId;
             this.world.assetUrl  = text2;
             this.world.pluginUrl = pluginUrl;
             this.world.name      = "Local Test";
             ApiWorld.AddLocal(this.world);
         }
     }
 }
Esempio n. 24
0
    IEnumerator FetchUploadedData()
    {
        if (!RemoteConfig.IsInitialized())
        {
            RemoteConfig.Init();
        }

        if (CheckLogin() == false)
        {
            yield break;
        }

        ApiModel.ClearReponseCache();

        int  indexPosition     = 0;
        int  lastResponseCount = 0;
        bool requestActive     = false;

        do
        {
            requestActive = true;
            ApiWorld.FetchList(
                delegate(List <ApiWorld> obj)
            {
                lastResponseCount = obj.Count;
                indexPosition    += obj.Count;
                requestActive     = false;
                SetupWorldData(obj);
            },
                delegate(string obj)
            {
                lastResponseCount = 0;
                requestActive     = false;
                Debug.LogError("Error fetching your uploaded worlds:\n" + obj);
                SetupWorldData(new List <ApiWorld>());
            },
                ApiWorld.SortHeading.Updated,
                ApiWorld.SortOwnership.Mine,
                ApiWorld.SortOrder.Descending,
                indexPosition,
                PageLimit,
                "",
                null,
                null,
                "",
                ApiWorld.ReleaseStatus.All,
                false,
                true
                );
            yield return(new WaitUntil(() => !requestActive));
        } while (lastResponseCount > 0);

        indexPosition = 0;

        do
        {
            requestActive = true;
            ApiAvatar.FetchList(
                delegate(List <ApiAvatar> obj)
            {
                lastResponseCount = obj.Count;
                indexPosition    += obj.Count;
                requestActive     = false;
                SetupAvatarData(obj);
            },
                delegate(string obj)
            {
                lastResponseCount = 0;
                requestActive     = false;
                Debug.LogError("Error fetching your uploaded avatars:\n" + obj);
                SetupAvatarData(new List <ApiAvatar>());
            },
                ApiAvatar.Owner.Mine,
                ApiAvatar.ReleaseStatus.All,
                null,
                PageLimit,
                indexPosition,
                ApiAvatar.SortHeading.None,
                ApiAvatar.SortOrder.Descending,
                false,
                true
                );
            yield return(new WaitUntil(() => !requestActive));
        } while (lastResponseCount > 0);
    }
 // Token: 0x06005118 RID: 20760 RVA: 0x001BAC50 File Offset: 0x001B9050
 public void DownloadAssetBundle(ApiWorld world, OnDownloadProgressDelegate onProgress, AssetBundleDownloadManager.OnDownloadCompleted onSuccess, AssetBundleDownloadManager.OnDownloadError onError, AssetBundleDownloadManager.UnpackType unpackType)
 {
     base.StartCoroutine(this.DownloadAndUnpackAssetBundleCoroutine(world.assetUrl, world.id, world.version, world.pluginUrl, onProgress, onSuccess, onError, unpackType, 0, 0, false));
 }
Esempio n. 26
0
 public static bool CreatePortal(ApiWorld apiWorld, ApiWorldInstance apiWorldInstance, Vector3 pos, Vector3 forward, Il2CppSystem.Action <string> someStrAction = null) =>
 (_createPortalDelegate ??= CreatePortalMethod.CreateDelegate <CreatePortalDelegate>())(apiWorld, apiWorldInstance, pos, forward, someStrAction);
Esempio n. 27
0
        void OnUpdate()
        {
            // VRCModLogger.Log("SingleInstance > OnUpdate");
            var clipboard = GetClipboardContent();

            if (clipboard == lastClipboard)
            {
                return;
            }

            /*try {
             *  string result = (string)lastMarcoInvite.Invoke(null, null);
             *  if (clipboard == result) return;
             * } catch (Exception) { }*/
            Log($"Clipboard changed to: \"{clipboard}\"");
            lastClipboard = clipboard;
            clipboard     = clipboard.Trim().ToLower();
            if (!clipboard.Contains("wrld_"))
            {
                return;
            }
            var match = Regex.Match(clipboard, world_pattern_private);

            if (!match.Success)
            {
                match = Regex.Match(clipboard, world_pattern);
                if (!match.Success)
                {
                    return;
                }
            }
            string world_id = match.Groups[1].Value; string instance_id = match.Groups[2].Value; bool is_private = match.Groups.Count > 3;
            string creator = ""; string nonce = ""; string instance_id_only = ""; bool force = clipboard.Contains("force=true");

            if (is_private)
            {
                instance_id_only = match.Groups[3].Value;
                creator          = match.Groups[4].Value;
                nonce            = match.Groups[5].Value;
            }
            Log($"Catched World: {match.Groups[0].Value}");
            Log($"Catched World ID: {world_id}");
            Log($"Catched Instance: {instance_id}");
            Log($"Catched Instance ID: {instance_id_only}");
            Log($"Catched Instance Creator: {creator}");
            Log($"Catched Instance Nonce: {nonce}");
            string           full_id  = $"{world_id}:{instance_id}";
            ApiWorldInstance instance = null;
            ApiWorld         apiWorld = new ApiWorld();
            var message = "";

            /*try {
             *  apiWorld.FetchInstance(world_id, (worldinstance) =>
             *  {
             *      Log("Instance: " + worldinstance);
             *      instance = worldinstance;
             *  });
             *  message = $"{instance.instanceWorld.name}\n Instance: {instance.idOnly} | Private: {(instance.isPublic ? "No" : "Yes")}";
             * } catch(Exception ex) {
             *  Log($"Exception: {ex.Message}\n{ex.StackTrace}\n{ex}");
             *  message = $"{world_id}\n Instance: {(is_private ? instance_id_only : instance_id)} | Private: {(is_private ? "Yes" : "No")}"; // .Replace("wrld_", "")
             * }*/
            if (force)
            {
                EnterWorld(full_id);
                return;
            }
            message = $"{world_id}\n Instance: {(is_private ? instance_id_only : instance_id)} | Private: {(is_private ? "Yes" : "No")}"; // .Replace("wrld_", "")
            VRCUiPopupManagerUtils.GetVRCUiPopupManager().ShowStandardPopup("URL Found", message,
                                                                            "Yes", () => {
                VRCUiPopupManagerUtils.GetVRCUiPopupManager().HideCurrentPopup();
                EnterWorld(full_id);
            },
                                                                            "Cancel", () =>
            {
                VRCUiPopupManagerUtils.GetVRCUiPopupManager().HideCurrentPopup();
            }
                                                                            );
        }
Esempio n. 28
0
        internal static System.Collections.IEnumerator CheckWorld()
        {
            if (alreadyCheckingWorld)
            {
                Main.Logger.Error("Attempted to check for world multiple times");
                yield break;
            }

            alreadyCheckingWorld     = true;
            Main.CurrentWorldChecked = true;

            // Wait for RoomManager to exist before continuing.
            ApiWorld currentWorld = null;

            while (currentWorld == null)
            {
                currentWorld = RoomManager.field_Internal_Static_ApiWorld_0;
                yield return(new WaitForSecondsRealtime(1));
            }
            var worldId = currentWorld.id;

            //Main.Logger.Error($"Checking World with Id {worldId}");

            // Check cache for world, so we keep the number of API calls lower.
            if (checkedWorlds.TryGetValue(worldId, out bool outres))
            {
                Main.WorldTypeGame = outres;
                //Main.Logger.Msg($"Using cached check {Main.WorldTypeGame} for world '{worldId}'");
                alreadyCheckingWorld = false;
                yield break;
            }

            // Check for Game Objects first, as it's the lowest cost check.
            if (GameObject.Find("eVRCRiskFuncEnable") != null || GameObject.Find("UniversalRiskyFuncEnable") != null || GameObject.Find("ModCompatRiskyFuncEnable ") != null)
            {
                Main.WorldTypeGame = false;
                checkedWorlds.Add(worldId, false);
                alreadyCheckingWorld = false;
                //Main.Logger.Msg($"GameObject allowed for world '{worldId}'");
                yield break;
            }

            // Check if whitelisted from EmmVRC - thanks Emilia and the rest of EmmVRC Staff
            var uwr = UnityWebRequest.Get($"https://dl.emmvrc.com/riskyfuncs.php?worldid={worldId}");

            uwr.SendWebRequest();
            while (!uwr.isDone)
            {
                yield return(new WaitForEndOfFrame());
            }

            var result = uwr.downloadHandler.text?.Trim().ToLower();

            uwr.Dispose();
            if (!string.IsNullOrWhiteSpace(result))
            {
                switch (result)
                {
                case "allowed":
                    Main.WorldTypeGame = false;
                    checkedWorlds.Add(worldId, false);
                    alreadyCheckingWorld = false;
                    //Main.Logger.Msg($"EmmVRC allows world '{worldId}'");
                    yield break;
                }
            }

            // Check tags then. should also be in cache as it just got downloaded
            API.Fetch <ApiWorld>(
                worldId,
                new Action <ApiContainer>(
                    container =>
            {
                ApiWorld apiWorld;
                if ((apiWorld = container.Model.TryCast <ApiWorld>()) != null)
                {
                    bool tagResult = false;
                    foreach (var worldTag in apiWorld.tags)
                    {
                        if (worldTag.IndexOf("game", StringComparison.OrdinalIgnoreCase) != -1 && worldTag.IndexOf("games", StringComparison.OrdinalIgnoreCase) == -1)
                        {
                            tagResult = true;
                            //Main.Logger.Msg($"Found game tag in world world '{worldId}'");
                            Main.Logger.Msg(ConsoleColor.Yellow, $"--Will not auto Immobilize due to game world--");
                            break;
                        }
                    }
                    Main.WorldTypeGame = tagResult;
                    checkedWorlds.Add(worldId, tagResult);
                    alreadyCheckingWorld = false;
                    //Main.Logger.Msg($"Tag search result: '{tagResult}' for '{worldId}'");
                }
                else
                {
                    Main.Logger.Error("Failed to cast ApiModel to ApiWorld");
                }
            }),
                disableCache: false);
        }
Esempio n. 29
0
        public void OnUpdate()
        {
            if (!initialised)
            {
                return;
            }

            lock (actions)
            {
                foreach (Action a in actions)
                {
                    try
                    {
                        a();
                    }
                    catch (Exception e)
                    {
                        VRCModLogger.Log("[AvatarFav] Error while calling action from main thread: " + e);
                    }
                }
                actions.Clear();
            }

            try
            {
                //Update list if element is active
                if (favList.gameObject.activeInHierarchy)
                {
                    lock (favoriteAvatarList)
                    {
                        if (avatarAvailables)
                        {
                            avatarAvailables = false;
                            favList.ClearSpecificList();

                            if (newAvatarsFirst)
                            {
                                List <string> favReversed = favoriteAvatarList.ToList();
                                favReversed.Reverse();
                                favList.specificListIds = favReversed.ToArray();
                            }
                            else
                            {
                                favList.specificListIds = favoriteAvatarList.ToArray();
                            }


                            favList.Refresh();

                            freshUpdate = true;
                        }
                    }
                }

                if (pageAvatar.avatar != null && pageAvatar.avatar.apiAvatar != null && CurrentUserUtils.GetGetCurrentUser().GetValue(null) != null && !currentUiAvatarId.Equals(pageAvatar.avatar.apiAvatar.id) || freshUpdate)
                {
                    currentUiAvatarId = pageAvatar.avatar.apiAvatar.id;

                    bool favorited = favoriteAvatarList.Contains(currentUiAvatarId);

                    if (favorited)
                    {
                        favButtonText.text = "Unfavorite";
                    }
                    else
                    {
                        favButtonText.text = "Favorite";
                    }

                    if ((!pageAvatar.avatar.apiAvatar.releaseStatus.Equals("public") && !favorited) || pageAvatar.avatar.apiAvatar.authorId == APIUser.CurrentUser.id)
                    {
                        favButton.gameObject.SetActive(false);
                        avatarModel.localPosition = baseAvatarModelPosition;
                    }
                    else
                    {
                        favButton.gameObject.SetActive(true);
                        avatarModel.localPosition = baseAvatarModelPosition + new Vector3(0, 60, 0);
                    }
                }

                //Show returned error if exists
                if (addError != null)
                {
                    VRCUiPopupManagerUtils.ShowPopup("Error", addError, "Close", () => VRCUiPopupManagerUtils.GetVRCUiPopupManager().HideCurrentPopup());
                    addError = null;
                }


                if (RoomManager.currentRoom != null && RoomManager.currentRoom.id != null && RoomManager.currentRoom.currentInstanceIdOnly != null)
                {
                    if (currentRoom == null)
                    {
                        currentRoom = RoomManager.currentRoom;

                        if (currentRoom.releaseStatus != "public")
                        {
                            VRCModLogger.Log("[AvatarFav] Current world release status isn't public. Pedestal scan disabled.");
                        }
                        else
                        {
                            VRC_AvatarPedestal[] pedestalsInWorld = GameObject.FindObjectsOfType <VRC_AvatarPedestal>();
                            VRCModLogger.Log("[AvatarFav] Found " + pedestalsInWorld.Length + " VRC_AvatarPedestal in current world");
                            string dataToSend = currentRoom.id;
                            foreach (VRC_AvatarPedestal p in pedestalsInWorld)
                            {
                                if (p.blueprintId == null || p.blueprintId == "")
                                {
                                    continue;
                                }

                                dataToSend += ";" + p.blueprintId;
                            }

                            VRCModNetworkManager.SendRPC("slaynash.avatarfav.avatarsinworld", dataToSend);
                        }
                    }
                }
                else
                {
                    currentRoom = null;
                }
            }
            catch (Exception e)
            {
                VRCModLogger.Log("[AvatarFav] [ERROR] " + e.ToString());
            }
            freshUpdate = false;
        }
    bool OnGUIUserInfo()
    {
        if (!RemoteConfig.IsInitialized())
        {
            RemoteConfig.Init();
        }

        CheckLogin();

        if (APIUser.IsLoggedInWithCredentials)
        {
            scrollPos = EditorGUILayout.BeginScrollView(scrollPos);

            EditorGUILayout.Space();

            if (uploadedWorlds == null)
            {
                EditorGUILayout.EndScrollView();
                return(true);
            }

            EditorGUILayout.LabelField("Worlds", EditorStyles.boldLabel);
            EditorGUILayout.Space();
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Name", EditorStyles.boldLabel, GUILayout.Width(200));
            EditorGUILayout.LabelField("Image", EditorStyles.boldLabel, GUILayout.Width(75));
            EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50));
            //EditorGUILayout.LabelField("Version", EditorStyles.boldLabel, GUILayout.Width (75));
            EditorGUILayout.LabelField("Release Status", EditorStyles.boldLabel, GUILayout.Width(100));
            EditorGUILayout.EndHorizontal();

            List <ApiWorld> tmpWorlds = new List <ApiWorld>();

            if (uploadedWorlds != null)
            {
                tmpWorlds = new List <ApiWorld>(uploadedWorlds);
            }

            foreach (ApiWorld w in tmpWorlds)
            {
                if (justDeletedContents != null && justDeletedContents.Contains(w.id))
                {
                    continue;
                }

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(w.name, GUILayout.Width(200));
                if (worldImages != null && worldImages.ContainsKey(w.id))
                {
                    if (GUILayout.Button(worldImages[w.id], GUILayout.Height(100), GUILayout.Width(100)))
                    {
                        Application.OpenURL(w.imageUrl);
                    }
                }
                else
                {
                    GUILayout.Label("No Image", GUILayout.Height(100), GUILayout.Width(100));
                }
                EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50));
                EditorGUILayout.LabelField(w.releaseStatus, GUILayout.Width(100));
                EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50));
                if (GUILayout.Button("Copy ID", GUILayout.Width(75)))
                {
                    TextEditor te = new TextEditor();
                    te.text = w.id;
                    te.SelectAll();
                    te.Copy();
                }
                if (GUILayout.Button("Delete", GUILayout.Width(75)))
                {
                    if (EditorUtility.DisplayDialog("Delete " + w.name + "?", "Are you sure you want to delete " + w.name + "? This cannot be undone.", "Delete", "Cancel"))
                    {
                        ApiWorld.Delete(w.id, null, null);
                        uploadedWorlds.RemoveAll(world => world.id == w.id);

                        if (justDeletedContents == null)
                        {
                            justDeletedContents = new List <string>();
                        }
                        justDeletedContents.Add(w.id);
                    }
                }
                EditorGUILayout.EndHorizontal();
            }

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Avatars", EditorStyles.boldLabel);
            EditorGUILayout.Space();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Name", EditorStyles.boldLabel, GUILayout.Width(200));
            EditorGUILayout.LabelField("Image", EditorStyles.boldLabel, GUILayout.Width(75));
            EditorGUILayout.EndHorizontal();

            List <ApiAvatar> tmpAvatars = new List <ApiAvatar>();

            if (uploadedAvatars != null)
            {
                tmpAvatars = new List <ApiAvatar>(uploadedAvatars);
            }

            foreach (ApiAvatar a in tmpAvatars)
            {
                if (justDeletedContents != null && justDeletedContents.Contains(a.id))
                {
                    continue;
                }

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(a.name, GUILayout.Width(200));
                if (avatarImages != null && avatarImages.ContainsKey(a.id))
                {
                    if (GUILayout.Button(avatarImages[a.id], GUILayout.Height(100), GUILayout.Width(100)))
                    {
                        Application.OpenURL(a.imageUrl);
                    }
                }
                else
                {
                    GUILayout.Label("No Image", GUILayout.Height(100), GUILayout.Width(100));
                }
                EditorGUILayout.LabelField("", EditorStyles.boldLabel, GUILayout.Width(50));

                if (GUILayout.Button("Copy ID", GUILayout.Width(75)))
                {
                    TextEditor te = new TextEditor();
                    te.text = a.id;
                    te.SelectAll();
                    te.Copy();
                }

                if (GUILayout.Button("Delete", GUILayout.Width(75)))
                {
                    if (EditorUtility.DisplayDialog("Delete " + a.name + "?", "Are you sure you want to delete " + a.name + "? This cannot be undone.", "Delete", "Cancel"))
                    {
                        ApiAvatar.Delete(a.id, null, null);
                        uploadedAvatars.RemoveAll(avatar => avatar.id == a.id);

                        if (justDeletedContents == null)
                        {
                            justDeletedContents = new List <string>();
                        }
                        justDeletedContents.Add(a.id);
                    }
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndScrollView();

            return(true);
        }
        else
        {
            return(false);
        }
    }