コード例 #1
0
        private IEnumerator VRCToolsSetup()
        {
            yield return(VRCUiManagerUtils.WaitForUiManagerInit());

            yield return(DependenciesDownloader.CheckDownloadFiles());

            yield return(VRCModLoaderUpdater.CheckVRCModLoaderHash());

            if (ModPrefs.GetBool("vrctools", "enablediscordrichpresence"))
            {
                DiscordManager.Init();
            }
            yield return(CheckForPermissions());

            if (ModPrefs.GetBool("vrctools", "enableramexploitpatch"))
            {
                RamExploitPatcher.Patch();
            }
            VRCModNetworkStatus.Setup();
            ModConfigPage.Setup();
            ModdedUsersManager.Init();
            if (ModPrefs.GetBool("vrctools", "enablestealerdetector"))
            {
                AvatarStealerChecker.Setup();
            }


            VRCFlowManagerUtils.EnableVRCFlowManager();

            initialising = false;
            Initialised  = true;
        }
コード例 #2
0
ファイル: VRCTools.cs プロジェクト: jb1361/VRCTools
        private IEnumerator VRCToolsSetup()
        {
            VRCModLogger.Log("[VRCTools] Waiting for UI Manager...");
            yield return(VRCUiManagerUtils.WaitForUiManagerInit());

            VRCModLogger.Log("[VRCTools] UIManager initialised ! Resuming setup");

            VRCModLogger.Log("[VRCTools] CheckDownloadFiles");
            yield return(DependenciesDownloader.CheckDownloadFiles());

            VRCModLogger.Log("[VRCTools] CheckVRCModLoaderHash");
            yield return(VRCModLoaderUpdater.CheckVRCModLoaderHash());

            if (ModPrefs.GetBool("vrctools", "enablediscordrichpresence"))
            {
                VRCModLogger.Log("[VRCTools] DiscordManager Init");
                DiscordManager.Init();
            }
            VRCModLogger.Log("[VRCTools] CheckForPermissions");
            yield return(CheckForPermissions());

            VRCModLogger.Log("[VRCTools] VRCModNetworkStatus Setup");
            VRCModNetworkStatus.Setup();
            VRCModLogger.Log("[VRCTools] ModConfigPage Setup");
            ModConfigPage.Setup();
            VRCModLogger.Log("[VRCTools] ModdedUsersManager Init");
            ModdedUsersManager.Init();

            VRCModLogger.Log("[VRCTools] Init done !");

            VRCFlowManagerUtils.EnableVRCFlowManager();

            initialising = false;
            Initialised  = true;
        }
コード例 #3
0
ファイル: VRCTools.cs プロジェクト: thetrueyoshifan/VRCTools
 private void OnUpdate()
 {
     if (!Initialised)
     {
         return;
     }
     VRCModNetworkManager.Update();
     VRCModNetworkStatus.Update();
     ModdedUsersManager.Update();
 }
コード例 #4
0
ファイル: VRCTools.cs プロジェクト: thetrueyoshifan/VRCTools
        private IEnumerator VRCToolsSetup()
        {
            VRCModLogger.Log("[VRCTools] Initialising VRCTools");

            yield return(VRCUiManagerUtils.WaitForUiManagerInit());

            VRCModLogger.Log("[VRCTools] Overwriting login button event");
            VRCUiPageAuthentication loginPage = Resources.FindObjectsOfTypeAll <VRCUiPageAuthentication>().FirstOrDefault((page) => page.gameObject.name == "LoginUserPass");

            if (loginPage != null)
            {
                Button loginButton = loginPage.transform.Find("ButtonDone (1)")?.GetComponent <Button>();
                if (loginButton != null)
                {
                    ButtonClickedEvent bce = loginButton.onClick;
                    loginButton.onClick = new ButtonClickedEvent();
                    loginButton.onClick.AddListener(() => {
                        VRCModNetworkManager.SetCredentials(GetTextFromUiInputField(loginPage.loginUserName) + ":" + GetTextFromUiInputField(loginPage.loginPassword));
                        bce?.Invoke();
                    });
                }
                else
                {
                    VRCModLogger.Log("[VRCTools] Unable to find login button in login page");
                }
            }
            else
            {
                VRCModLogger.Log("[VRCTools] Unable to find login page");
            }

            yield return(VRCModLoaderUpdater.CheckVRCModLoaderHash());

            try
            {
                VRCModNetworkStatus.Setup();
                ModConfigPage.Setup();
                ModdedUsersManager.Init();
            } catch (Exception ex)
            {
                VRCModLogger.Log("[VRCTools]" + ex.ToString());
            }
            VRCModLogger.Log("[VRCTools] Init done !");

            VRCUiPopupManagerUtils.GetVRCUiPopupManager().HideCurrentPopup();

            Initialised = true;

            if (!usingVRCMenuUtils)
            {
                VRCFlowManagerUtils.EnableVRCFlowManager();
            }

            VRCModNetworkManager.ConnectAsync();
        }
コード例 #5
0
ファイル: VRCTools.cs プロジェクト: VRCMG/VRCTools
        private void OnUpdate()
        {
            if (!Initialized)
            {
                return;
            }
            VRCModNetworkManager.Update();
            VRCModNetworkStatus.Update();
            ModdedUsersManager.Update();

            /*
             * if(Input.GetKeyDown(KeyCode.F2))
             * {
             *  VRCModLogger.Log(SteamUtils.GetSteamTicket());
             * }
             */
        }
コード例 #6
0
        private IEnumerator VRCToolsSetup()
        {
            initialising = true;
            VRCModLogger.Log("[VRCTools] Initialising VRCTools");
            try
            {
                OculusUtils.ApplyPatches();
            }
            catch (Exception e)
            {
                VRCModLogger.Log("[VRCTools] Error while applying Oculus patches: " + e);
            }
            yield return(VRCUiManagerUtils.WaitForUiManagerInit());

            VRCModLogger.Log("[VRCTools] Overwriting login button event");
            VRCUiPageAuthentication[] authpages = Resources.FindObjectsOfTypeAll <VRCUiPageAuthentication>();
            VRCUiPageAuthentication   loginPage = authpages.First((page) => page.gameObject.name == "LoginUserPass");

            if (loginPage != null)
            {
                Button loginButton = loginPage.transform.Find("ButtonDone (1)")?.GetComponent <Button>();
                if (loginButton != null)
                {
                    ButtonClickedEvent bce = loginButton.onClick;
                    loginButton.onClick = new ButtonClickedEvent();
                    loginButton.onClick.AddListener(() => {
                        VRCModNetworkManager.SetCredentials(GetTextFromUiInputField(loginPage.loginUserName) + ":" + GetTextFromUiInputField(loginPage.loginPassword));
                        bce?.Invoke();
                    });
                }
                else
                {
                    VRCModLogger.Log("[VRCTools] Unable to find login button in login page");
                }
            }
            else
            {
                VRCModLogger.Log("[VRCTools] Unable to find login page");
            }

            yield return(DependenciesDownloader.CheckDownloadFiles());

            yield return(VRCModLoaderUpdater.CheckVRCModLoaderHash());

            if (ModPrefs.GetBool("vrctools", "enablediscordrichpresence"))
            {
                DiscordManager.Init();
            }

            yield return(AvatarFavUpdater.CheckForAvatarFavUpdate());

            VRCModNetworkStatus.Setup();
            ModConfigPage.Setup();
            ModdedUsersManager.Init();

            /*
             * if (ApiCredentials.Load())
             * {
             *  VRCModLogger.Log("ApiCredentials.GetAuthTokenProviderUserId() => " + ApiCredentials.());
             *  if (!SecurePlayerPrefs.HasKey("vrcmnw_token_" + ApiCredentials.GetAuthTokenProviderUserId()))
             *  {
             *      ApiCredentials.Clear();
             *  }
             * }
             */
            ApiCredentials.Clear();


            VRCModLogger.Log("[VRCTools] Init done !");

            VRCUiPopupManagerUtils.GetVRCUiPopupManager().HideCurrentPopup();

            VRCFlowManagerUtils.EnableVRCFlowManager();

            initialising = false;
            Initialised  = true;

            VRCModNetworkManager.ConnectAsync();
        }
コード例 #7
0
ファイル: VRCTools.cs プロジェクト: VRCMG/VRCTools
        private IEnumerator VRCToolsSetup()
        {
            VRCModLogger.Log("[VRCTools] Initialising VRCTools");
            VRCModLogger.Log("[VRCTools] Current scene: " + SceneManager.GetActiveScene().name + "(index: " + SceneManager.GetActiveScene().buildIndex + ", path: " + SceneManager.GetActiveScene().path + ")");
            VRCModLogger.Log("[VRCTools] ModComponent Sibling index: " + ModComponent.Instance.transform.GetSiblingIndex());
            VRCModLogger.Log("[VRCTools] Root gameobjects:");
            foreach (GameObject g in SceneManager.GetActiveScene().GetRootGameObjects())
            {
                VRCModLogger.Log(" - " + g);
            }
            VRCModLogger.Log("[VRCTools] Call trace - THIS IS NOT AN ERROR:");
            VRCModLogger.Log(new System.Diagnostics.StackTrace().ToString());
            initializing = true;

            yield return(VRCUiManagerUtils.WaitForUiManagerInit());

            if (!HarmonyLoaded())
            {
                bool waitforpopup = true;
                VRCUiPopupManagerUtils.ShowPopup("VRCTools", "Missing library: Harmony. Please install it using the VRChat Mod Manager (see #how-to on discord.gg/rCqKSvR)", "Close game", () => Application.Quit(), "Ignore", () => waitforpopup = false);
                while (waitforpopup)
                {
                    yield return(null);
                }

                Initialized = true;
                if (!usingVRCMenuUtils)
                {
                    VRCFlowManagerUtils.EnableVRCFlowManager();
                }

                yield break;
            }

            VRCModLogger.Log("[VRCTools] Overwriting login button event");
            VRCUiPageAuthentication loginPage = Resources.FindObjectsOfTypeAll <VRCUiPageAuthentication>().FirstOrDefault((page) => page.gameObject.name == "LoginUserPass");

            if (loginPage != null)
            {
                Button loginButton = loginPage.transform.Find("ButtonDone (1)")?.GetComponent <Button>();
                if (loginButton != null)
                {
                    ButtonClickedEvent bce = loginButton.onClick;
                    loginButton.onClick = new ButtonClickedEvent();
                    loginButton.onClick.AddListener(() => {
                        VRCModNetworkManager.SetCredentials(Uri.EscapeDataString(GetTextFromUiInputField(loginPage.loginUserName)) + ":" + Uri.EscapeDataString(GetTextFromUiInputField(loginPage.loginPassword)));
                        bce?.Invoke();
                    });
                }
                else
                {
                    VRCModLogger.Log("[VRCTools] Unable to find login button in login page");
                }
            }
            else
            {
                VRCModLogger.Log("[VRCTools] Unable to find login page");
            }

            yield return(VRCModLoaderUpdater.CheckVRCModLoaderHash());

            yield return(VRCToolsAutoUpdater.CheckAndUpdate());

            try
            {
                VRCModNetworkStatus.Setup();
                VRCModNetworkLogin.SetupVRCModNetworkLoginPage();
                ModConfigPage.Setup();
                ModdedUsersManager.Init();
            } catch (Exception ex)
            {
                VRCModLogger.Log("[VRCTools]" + ex.ToString());
            }

            VRCModLogger.Log("[VRCTools] Injecting VRCModNetwork login page");
            VRCModNetworkLogin.InjectVRCModNetworkLoginPage();

            yield return(VRCModNetworkManager.ConnectInit());

            VRCUiPopupManagerUtils.GetVRCUiPopupManager().HideCurrentPopup();

            Initialized  = true;
            initializing = false;

            if (!usingVRCMenuUtils)
            {
                VRCFlowManagerUtils.EnableVRCFlowManager();
            }
        }
コード例 #8
0
ファイル: VRCTools.cs プロジェクト: rubybb/VRCTools
        private IEnumerator VRCToolsSetup()
        {
            VRCModLogger.Log("[VRCTools] Waiting for UI Manager...");
            yield return(VRCUiManagerUtils.WaitForUiManagerInit());

            VRCModLogger.Log("[VRCTools] UIManager initialised ! Resuming setup");

            VRCModLogger.Log("[VRCTools] Overwriting login button event");
            VRCUiPageAuthentication[] authpages = Resources.FindObjectsOfTypeAll <VRCUiPageAuthentication>();
            VRCUiPageAuthentication   loginPage = authpages.First((page) => page.gameObject.name == "LoginUserPass");

            if (loginPage != null)
            {
                Button loginButton = loginPage.transform.Find("ButtonDone (1)")?.GetComponent <Button>();
                if (loginButton != null)
                {
                    ButtonClickedEvent bce = loginButton.onClick;
                    loginButton.onClick = new ButtonClickedEvent();
                    loginButton.onClick.AddListener(() => {
                        VRCModNetworkManager.SetCredentials(GetTextFromUiInputField(loginPage.loginUserName) + ":" + GetTextFromUiInputField(loginPage.loginPassword));
                        bce?.Invoke();
                    });
                }
                else
                {
                    VRCModLogger.Log("[VRCTools] Unable to find login button in login page");
                }
            }
            else
            {
                VRCModLogger.Log("[VRCTools] Unable to find login page");
            }

            VRCModLogger.Log("[VRCTools] CheckDownloadFiles");
            yield return(DependenciesDownloader.CheckDownloadFiles());

            VRCModLogger.Log("[VRCTools] CheckVRCModLoaderHash");
            yield return(VRCModLoaderUpdater.CheckVRCModLoaderHash());

            if (ModPrefs.GetBool("vrctools", "enablediscordrichpresence"))
            {
                VRCModLogger.Log("[VRCTools] DiscordManager Init");
                DiscordManager.Init();
            }
            VRCModLogger.Log("[VRCTools] CheckForPermissions");
            yield return(CheckForPermissions());

            VRCModLogger.Log("[VRCTools] VRCModNetworkStatus Setup");
            VRCModNetworkStatus.Setup();
            VRCModLogger.Log("[VRCTools] ModConfigPage Setup");
            ModConfigPage.Setup();
            VRCModLogger.Log("[VRCTools] ModdedUsersManager Init");
            ModdedUsersManager.Init();

            VRCUiManagerUtils.OnPageShown += (page) => {
                VRCModLogger.Log("[VRCTools] OnPageShown: " + page.screenType + " " + (string.IsNullOrEmpty(page.displayName) ? "" : page.displayName + " ") + "(" + page.GetType() + ")");
            };

            VRCModLogger.Log("[VRCTools] Init done !");

            VRCFlowManagerUtils.EnableVRCFlowManager();

            initialising = false;
            Initialised  = true;

            //DebugUtils.PrintHierarchy(VRCUiManagerUtils.GetVRCUiManager().transform.root, 0);
        }