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; }
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; }
private void OnUpdate() { if (!Initialised) { return; } VRCModNetworkManager.Update(); ModdedUsersManager.Update(); DiscordManager.Update(); }
internal static IEnumerator CheckDownloadFiles() { string vrccedllPath = Values.VRCToolsDependenciesPath + "VRCCore-Editor.dll"; string oharmonydllPath = Values.VRCToolsDependenciesPath + "0Harmony.dll"; yield return(DownloadDependency(ModValues.discordrpcdependencyDownloadLink, "discord-rpc.dll")); yield return(DownloadDependency(ModValues.vrccoreeditordependencyDownloadLink, "VRCCore-Editor.dll")); yield return(DownloadDependency(ModValues.oharmonydependencyDownloadLink, "0Harmony.dll")); //yield return DownloadDependency(ModValues.vrcmnwclientdependencyDownloadLink, "VRCModNetworkClient.dll"); VRCModLogger.Log("[DependenciesDownloader] Initializing Discord RichPresence"); DiscordManager.Init(); Assembly.LoadFile(vrccedllPath); Assembly.LoadFile(oharmonydllPath); }
private void OnApplicationQuit() { DiscordManager.OnApplicationQuit(); }
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(); }
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); }