Ejemplo n.º 1
0
        public static void ShowPopup(string title, string body, string leftButton, Action leftButtonAction, string rightButton, Action rightButtonAction, Action <VRCUiPopup> additionalSetup = null)
        {
            if (GetVRCUiPopupManager() == null)
            {
                VRCModLogger.Log("[VRCUiPopupManagerUtils] uiPopupManagerInstance == null");
                return;
            }

            uiPopupManagerInstance.ShowStandardPopup(title, body, leftButton, leftButtonAction, rightButton, rightButtonAction, additionalSetup);
        }
Ejemplo n.º 2
0
        public void TELEPORT()
        {
            InputB.InputAttempt("Teleport");

            {
                VRCModLogger.Log("[TeleporterVR] Teleport to player key pressed!");
                VRCModLogger.Log("[TeleporterVR] Received " + InputB.inputcheck);
                VRCModLogger.Log("[TeleporterVR] Teleporting to " + InputB.namecheck);
            }
        }
Ejemplo n.º 3
0
        public void OnApplicationStart()
        {
            Console.ForegroundColor = ConsoleColor.Cyan;
            VRCModLogger.Log("\n[TeleporterVR]\n VR_Friendly_Modification By GhostYiL\n Credits: Author - Janni9009;\n UI page help -yoshifan;\n Playermanager foreach loop - Slaynash\n DubyaDude - ButtonAPI(I didn't forget about you ;D)");
            ModManager.StartCoroutine(this.Setup());
#if (DEBUG)
            Debug = true;
            VRCModLogger.Log("[TeleporterVR] Debug mode enabled!");
#endif
        }
 internal static void EnableVRCFlowManager()
 {
     VRCModLogger.Log("[VRCFlowManagerUtils] Looking for VRCFlowManager");
     VRCFlowManager[] flowManagers = Resources.FindObjectsOfTypeAll <VRCFlowManager>();
     foreach (VRCFlowManager flowManager in flowManagers)
     {
         flowManager.enabled = true;
     }
     VRCModLogger.Log("[VRCFlowManagerUtils] Enabled " + flowManagers.Length + " VRCFlowManager");
 }
Ejemplo n.º 5
0
        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();
        }
Ejemplo n.º 6
0
 private void RequestAvatars()
 {
     new Thread(() => VRCModNetworkManager.SendRPC("slaynash.avatarfav.getavatars", "", null, (error) =>
     {
         VRCModLogger.Log("[AvatarFav] Unable to fetch avatars: Server returned " + error);
         if (error.Equals("SERVER_DISCONNECTED"))
         {
             waitingForServer = true;
         }
     })).Start();
 }
Ejemplo n.º 7
0
 public static void RegisterCommand(string name, Type command)
 {
     if (!commands.TryGetValue(name, out Type cmd))
     {
         commands.Add(name, command);
     }
     else
     {
         VRCModLogger.LogError("[CCOM] Trying to register a command twice (" + name + ")");
     }
 }
Ejemplo n.º 8
0
 internal static int GetBuildNumber()
 {
     if (_buildNumber == -1)
     {
         VRCModLogger.Log("[AvatarFav] Fetching build number");
         PropertyInfo vrcApplicationSetupInstanceProperty = typeof(VRCApplicationSetup).GetProperties(BindingFlags.Public | BindingFlags.Static).First((pi) => pi.PropertyType == typeof(VRCApplicationSetup));
         _buildNumber = ((VRCApplicationSetup)vrcApplicationSetupInstanceProperty.GetValue(null, null)).buildNumber;
         VRCModLogger.Log("[AvatarFav] Game build " + _buildNumber);
     }
     return(_buildNumber);
 }
Ejemplo n.º 9
0
        // SETTERS

        public static void SetString(string section, string name, string value)
        {
            if (prefs.TryGetValue(section, out Dictionary <string, PrefDesc> prefsInSection) && prefsInSection.TryGetValue(name, out PrefDesc pref))
            {
                pref.Value = value;
                VRCModLoader.ModPrefs.SetString(section, name, value);
            }
            else
            {
                VRCModLogger.LogError("Trying to save unknown pref " + section + ":" + name);
            }
        }
Ejemplo n.º 10
0
 public static Color GetColor(string section, string name)
 {
     if (prefs.TryGetValue(section, out Dictionary <string, PrefDesc> prefsInSection) && prefsInSection.TryGetValue(name, out PrefDesc pref))
     {
         if (ColorUtility.TryParseHtmlString(pref.Value, out Color valueC))
         {
             return(valueC);
         }
     }
     VRCModLogger.LogError("Trying to get unregistered ModPref " + section + ":" + name);
     return(Color.white);
 }
Ejemplo n.º 11
0
 public static float GetFloat(string section, string name)
 {
     if (prefs.TryGetValue(section, out Dictionary <string, PrefDesc> prefsInSection) && prefsInSection.TryGetValue(name, out PrefDesc pref))
     {
         if (float.TryParse(pref.Value, out float valueF))
         {
             return(valueF);
         }
     }
     VRCModLogger.LogError("Trying to get unregistered ModPref " + section + ":" + name);
     return(0.0f);
 }
Ejemplo n.º 12
0
 internal static void SaveConfigs()
 {
     foreach (KeyValuePair <string, Dictionary <string, PrefDesc> > prefsInSection in prefs)
     {
         foreach (KeyValuePair <string, PrefDesc> pref in prefsInSection.Value)
         {
             pref.Value.Value = pref.Value.ValueEdited;
             VRCModLoader.ModPrefs.SetString(prefsInSection.Key, pref.Key, pref.Value.Value);
         }
     }
     VRCModLogger.Log("[ModPrefs] Configs saved !");
 }
Ejemplo n.º 13
0
 public void WriteLineSecure(string s)
 {
     try
     {
         client.WriteLineSecure(outId + " " + s);
     }
     catch (Exception e)
     {
         VRCModLogger.LogError(e.ToString());
         RemoteError(e.Message);
     }
 }
Ejemplo n.º 14
0
 public string ReadLineSecure()
 {
     while (true)
     {
         string lin = inputStream.ReadLine();
         if (lin != null)
         {
             VRCModLogger.Log("[VRCMODNW] <<< *****************");
         }
         return(lin);
     }
 }
Ejemplo n.º 15
0
        private static bool ModerationManagerPrefix(ref int __1, string __4, byte[] __5)
        {
            bool flag = __5.Length > 5000;

            if (flag)
            {
                Console.ForegroundColor = ConsoleColor.Cyan;
                VRCModLogger.Log("[BasicLogoutLogAndPatch] Logout data detected by " + PlayerManager.GetPlayer(__1) + " " + __1);
                Console.ForegroundColor = ConsoleColor.White;
            }
            return(true);
        }
Ejemplo n.º 16
0
        // VRCTools ShowQuickMenuPage function
        internal static void ShowQuickmenuPage(string pagename)
        {
            QuickMenu quickmenu     = QMStuff.GetQuickMenuInstance();
            Transform pageTransform = quickmenu?.transform.Find(pagename);

            if (pageTransform == null)
            {
                VRCModLogger.LogError("[QMStuff] pageTransform is null !");
            }

            if (currentPageGetter == null)
            {
                GameObject  shortcutMenu = quickmenu.transform.Find("ShortcutMenu").gameObject;
                FieldInfo[] fis          = typeof(QuickMenu).GetFields(BindingFlags.NonPublic | BindingFlags.Instance).Where((fi) => fi.FieldType == typeof(GameObject)).ToArray();
                VRCModLogger.Log("[QMStuff] GameObject Fields in QuickMenu:");
                int count = 0;
                foreach (FieldInfo fi in fis)
                {
                    GameObject value = fi.GetValue(quickmenu) as GameObject;
                    if (value == shortcutMenu && ++count == 2)
                    {
                        VRCModLogger.Log("[QMStuff] currentPage field: " + fi.Name);
                        currentPageGetter = fi;
                        break;
                    }
                }
                if (currentPageGetter == null)
                {
                    VRCModLogger.LogError("[QMStuff] Unable to find field currentPage in QuickMenu");
                    return;
                }
            }

            ((GameObject)currentPageGetter.GetValue(quickmenu))?.SetActive(false);
            QMStuff.GetQuickMenuInstance().transform.Find("QuickMenu_NewElements/_InfoBar").gameObject.SetActive(false);

            if (quickmenuContextualDisplayGetter != null)
            {
                quickmenuContextualDisplayGetter = typeof(QuickMenu).GetFields(BindingFlags.NonPublic | BindingFlags.Instance).FirstOrDefault((fi) => fi.FieldType == typeof(QuickMenuContextualDisplay));
            }
            QuickMenuContextualDisplay quickmenuContextualDisplay = quickmenuContextualDisplayGetter?.GetValue(quickmenu) as QuickMenuContextualDisplay;

            if (quickmenuContextualDisplay != null)
            {
                currentPageGetter.SetValue(quickmenu, pageTransform.gameObject);
                typeof(QuickMenuContextualDisplay).GetMethod("SetDefaultContext", BindingFlags.Public | BindingFlags.Instance).Invoke(quickmenuContextualDisplay, new object[] { 0, null, null }); // This is the only way to pass the unknown enum type value
            }

            currentPageGetter.SetValue(quickmenu, pageTransform.gameObject);
            typeof(QuickMenu).GetMethod("SetContext", BindingFlags.Public | BindingFlags.Instance).Invoke(quickmenu, new object[] { 1, null, null }); // This is the only way to pass the unknown enum type value
            pageTransform.gameObject.SetActive(true);
        }
Ejemplo n.º 17
0
        private void OnLevelWasLoaded(int level)
        {
            VRCModLogger.Log("[VRCTools] OnLevelWasLoaded " + level);
            if (level == 0 && !initialising && !Initialised)
            {
                VRCModLogger.Log("[VRCTools] Initialising VRCTools");
                VRCFlowManagerUtils.DisableVRCFlowManager();
                ModManager.StartCoroutine(VRCToolsSetup());
                initialising = true;

                //ModManager.StartCoroutine(PrintVRCUiManagerHierarchy());
            }
        }
Ejemplo n.º 18
0
        private void OnApplicationStart()
        {
            if (Application.platform == RuntimePlatform.WindowsPlayer)
            {
                string lp    = "";
                bool   first = true;
                foreach (var lp2 in Environment.GetCommandLineArgs())
                {
                    if (first)
                    {
                        first = false;
                    }
                    else
                    {
                        lp += " " + lp2;
                    }
                }
                VRCModLogger.Log("[VRCTools] Launch parameters:" + lp);
            }

            ModPrefs.RegisterCategory("vrctools", "VRCTools");
            ModPrefs.RegisterPrefBool("vrctools", "enabledebugconsole", false, "Enable Debug Console");

            Type vrcMenuUtilsAPI = null;

            usingVRCMenuUtils = AppDomain.CurrentDomain.GetAssemblies().Any(a =>
            {
                vrcMenuUtilsAPI = a.GetType("VRCMenuUtils.VRCMenuUtilsAPI");
                return(vrcMenuUtilsAPI != null);
            });

            VRCModLogger.Log("[VRCTools] Using VRCMenuUtils: " + usingVRCMenuUtils);

            if (usingVRCMenuUtils)
            {
                vrcMenuUtilsAPI.GetMethod("RunBeforeFlowManager").Invoke(null, new object[] { VRCToolsSetup() });
            }

            if (HarmonyLoaded())
            {
                VRCModLogger.Log("[VRCTools] Patching analytics");
                HarmonyInstance harmony = HarmonyInstance.Create("vrctools.analyticspatch");
                harmony.Patch(
                    typeof(AppDomain).GetMethod("GetAssemblies", BindingFlags.Public | BindingFlags.Instance),
                    postfix: new HarmonyMethod(typeof(VRCTools).GetMethod("GetAssembliesPostfix", BindingFlags.Static | BindingFlags.NonPublic)));
                harmony.Patch(
                    typeof(Analytics).GetMethods(BindingFlags.NonPublic | BindingFlags.Static).FirstOrDefault(m => m.GetParameters().Length == 1 && m.GetParameters()[0].ParameterType == typeof(string) && (string)m.Parse().First(i => i.OpCode == OpCodes.Ldstr).Argument == "-"),
                    prefix: new HarmonyMethod(typeof(VRCTools).GetMethod("GetMD5FromFilePrefix", BindingFlags.Static | BindingFlags.NonPublic)));
                VRCModLogger.Log("[VRCTools] Analytics patched.");
            }
        }
        public static void Log(params object[] msgs)
        {
            var msg = "[EasyChat Informational]:";

            foreach (var _msg in msgs)
            {
                try {
                    msg += $" {_msg}";
                } catch {
                    msg += $" {_msg.ToString()}";
                }
            }
            VRCModLogger.Log(msg);
        }
Ejemplo n.º 20
0
        public static void Log(params object[] msgs)
        {
            var msg = "[AntiKick]:";

            foreach (var _msg in msgs)
            {
                try {
                    msg += $" {_msg}";
                } catch {
                    msg += $" {_msg.ToString()}";
                }
            }
            VRCModLogger.Log(msg);
        }
Ejemplo n.º 21
0
        void hideMods()
        {
            try
            {
                // Disables the VRCModNetwork Status text in the Quick Menu
                QMStuff.GetQuickMenuInstance().transform.Find("ShortcutMenu/VRCModNetworkStatusText").gameObject.SetActive(false);

                // Clears the current listeners for the Settings button, in order to add one mimmicking the vanilla VRChat Settings button
                QMStuff.GetQuickMenuInstance().transform.Find("ShortcutMenu/SettingsButton").GetComponentInChildren <Button>().onClick = new Button.ButtonClickedEvent();
                // Actually add the mimmicking action
                QMStuff.GetQuickMenuInstance().transform.Find("ShortcutMenu/SettingsButton").GetComponentInChildren <Button>().onClick.AddListener(delegate()
                {
                    QMStuff.GetQuickMenuInstance().MainMenu(3);
                });
                // Update the button's text and tooltip
                QMStuff.GetQuickMenuInstance().transform.Find("ShortcutMenu/SettingsButton").GetComponentInChildren <Text>().text = "Settings";
                QMStuff.GetQuickMenuInstance().transform.Find("ShortcutMenu/SettingsButton").GetComponent <UiTooltip>().text      = "Tune Control, Audio and Video Settings. Log Out or Quit.";

                // Attempts to adjust the info bar background to the vanilla position. This function changes, depending on if emmVRC is installed, so a switch case is used here.
                Transform     infobarpanelTransform     = QMStuff.GetQuickMenuInstance().transform.Find("QuickMenu_NewElements/_InfoBar/Panel");
                RectTransform infobarpanelRectTransform = infobarpanelTransform.GetComponent <RectTransform>();
                if (infobarpanelRectTransform.sizeDelta.y != 0 || infobarpanelRectTransform.anchoredPosition.y != 0)
                {
                    moddedInfoBarSize   = infobarpanelRectTransform.sizeDelta.y;
                    moddedInfoBarOffset = infobarpanelRectTransform.anchoredPosition.y;
                    infobarpanelRectTransform.sizeDelta        = new Vector2(infobarpanelRectTransform.sizeDelta.x, 0);
                    infobarpanelRectTransform.anchoredPosition = new Vector2(infobarpanelRectTransform.anchoredPosition.x, 0);
                }
            }
            catch (Exception ex)
            {
                VRCModLogger.Log("[hideModule] An error occured while hiding mods: " + ex.ToString());
            }

            // Now for the support modules. At the moment, only emmVRC is supported by this. It has a function built in to do everything automatically, so we just need to call it.
            if (emmVRC)
            {
                emmVRCAPI.GetMethod("hideEmmVRC").Invoke(null, null);
            }
            if (avatarFav)
            {
                VRCUiManagerUtils.OnPageShown += (page) =>
                {
                    if (page.GetType() == typeof(VRC.UI.PageAvatar) && hidingMods)
                    {
                        ModManager.StartCoroutine(hideAvatarFav());
                    }
                };
            }
        }
Ejemplo n.º 22
0
 internal static void HandleRpc(string sender, string rpcId, string data)
 {
     if (rpcListeners.TryGetValue(rpcId, out Action <string, string> listener))
     {
         try
         {
             listener(sender, data);
         }
         catch (Exception e)
         {
             VRCModLogger.LogError("Error while handling rpc " + rpcId + ": " + e);
         }
     }
 }
Ejemplo n.º 23
0
        static PlayerUtils()
        {
            try
            {
                PropertyInfo propertyInfo = typeof(Player).GetProperties().First((PropertyInfo p) => p.PropertyType == typeof(APIUser));
                PlayerUtils.getApiUserMethod = ((propertyInfo != null) ? propertyInfo.GetGetMethod() : null);
            }
            catch (Exception)
            {
#if (DEBUG)
                VRCModLogger.LogError("[TeleporterVR] Hmmm... seems like PlayerUtils failed, you might need to restart your game.");
#endif
            }
        }
Ejemplo n.º 24
0
        private IEnumerator Setup()
        {
            // Wait for load
            yield return(VRCMenuUtilsAPI.WaitForInit());

            // Add wait for page shown
            VRCMenuUtilsAPI.OnPageShown += VRCMenuUtilsAPI_OnPageShown;

            // Wait for worlds
            while (_worldsList == null)
            {
                yield return(null);
            }

            // Wait for favourite and recent
            while (_worldsList.Find("Playlist1") == null || _worldsList.Find("Recent") == null)
            {
                yield return(null);
            }

            // Grab favourites and recent
            Transform[] favourites = new Transform[]
            {
                _worldsList.Find("Playlist1"),
                _worldsList.Find("Playlist2"),
                _worldsList.Find("Playlist3"),
                _worldsList.Find("Playlist4")
            };
            Transform recent = _worldsList.Find("Recent");

            // Grab the positions
            foreach (Transform favourite in favourites)
            {
                _worldsPositions.Add(favourite, favourite.GetSiblingIndex());
            }
            _worldsPositions.Add(recent, recent.GetSiblingIndex());

            // Change positions
            ChangePositions();

            // Set watchers
            _config.WatchForUpdate("FavouriteWorldsAtTop", () =>
                                   ChangePositions());
            _config.WatchForUpdate("RecentWorldsAtTop", () =>
                                   ChangePositions());

            VRCMenuUtilsAPI.OnPageShown -= VRCMenuUtilsAPI_OnPageShown;
            VRCModLogger.Log("Worlds UI positions setup!");
        }
Ejemplo n.º 25
0
        public static void Setup()
        {
            //Create mods config page

            GameObject screens      = GameObject.Find("UserInterface/MenuContent/Screens");
            GameObject avatarscreen = GameObject.Find("UserInterface/MenuContent/Screens/Avatar");

            if (avatarscreen != null)
            {
                GameObject go = new GameObject("ModConfig", typeof(RectTransform), typeof(VRCUiPage));
                go.transform.SetParent(screens.transform, false);
                go.GetComponent <VRCUiPage>().screenType  = avatarscreen.GetComponent <VRCUiPage>().screenType;
                go.GetComponent <VRCUiPage>().displayName = "Mod Conf";
                go.GetComponent <VRCUiPage>().AudioShow   = avatarscreen.GetComponent <VRCUiPage>().AudioShow;
                go.GetComponent <VRCUiPage>().AudioLoop   = avatarscreen.GetComponent <VRCUiPage>().AudioLoop;
                go.GetComponent <VRCUiPage>().AudioHide   = avatarscreen.GetComponent <VRCUiPage>().AudioHide;

                go.AddComponent <ModConfigPage>();

                //SCREEN CONTENT SIZE: 1500x1000


                //Create mods config quickmenu button
                Transform baseButtonTransform = QuickMenuUtils.GetQuickMenuInstance().transform.Find("ShortcutMenu/CloseButton");
                if (baseButtonTransform != null)
                {
                    Transform modconf = UnityUiUtils.DuplicateButton(baseButtonTransform, "Mod\nConfigs", new Vector2(-420, 0));
                    modconf.name = "ModConfigsButton";
                    modconf.GetComponentInChildren <Text>().color = new Color(1, 0.5f, 0.1f);
                    //modconf.GetComponent<Button>().interactable = false;
                    modconf.GetComponent <Button>().onClick.RemoveAllListeners();
                    modconf.GetComponent <Button>().onClick.AddListener(() =>
                    {
                        VRCUiManagerUtils.GetVRCUiManager().ShowUi(false, true);
                        ModManager.StartCoroutine(QuickMenuUtils.PlaceUiAfterPause());
                        VRCUiManagerUtils.GetVRCUiManager().ShowScreen("UserInterface/MenuContent/Screens/ModConfig");
                    });
                }
                else
                {
                    VRCModLogger.Log("[ModConfigPage] QuickMenu/ShortcutMenu/CloseButton is null");
                }
            }
            else
            {
                VRCModLogger.Log("[ModConfigPage] UserInterface/MenuContent/Screens/Avatar is null");
            }
        }
Ejemplo n.º 26
0
        private static IEnumerator DownloadDependency(string downloadUrl, string dllName)
        {
            VRCModLogger.Log("[DependenciesDownloader] Checking dependency " + dllName);
            String dependenciesDownloadFile = Values.VRCToolsDependenciesPath + dllName;

            if (!File.Exists(dependenciesDownloadFile))
            {
                VRCUiPopupManagerUtils.ShowPopup("VRCTools", "Downloading VRCTools dependency:\n" + dllName, "Quit", () => Application.Quit(), (popup) =>
                {
                    if (popup.popupProgressFillImage != null)
                    {
                        popup.popupProgressFillImage.enabled    = true;
                        popup.popupProgressFillImage.fillAmount = 0f;
                        downloadProgressFillImage = popup.popupProgressFillImage;
                    }
                });


                WWW dependencyDownload = new WWW(downloadUrl);
                yield return(dependencyDownload);

                while (!dependencyDownload.isDone)
                {
                    VRCModLogger.Log("[DependenciesDownloader] Download progress: " + dependencyDownload.progress);
                    downloadProgressFillImage.fillAmount = dependencyDownload.progress;
                    yield return(null);
                }

                int responseCode = WebRequestsUtils.GetResponseCode(dependencyDownload);
                VRCModLogger.Log("[DependenciesDownloader] Download done ! response code: " + responseCode);
                VRCModLogger.Log("[DependenciesDownloader] File size: " + dependencyDownload.bytes.Length);

                if (responseCode == 200)
                {
                    VRCUiPopupManagerUtils.ShowPopup("VRCTools", "Saving dependency " + dllName);
                    VRCModLogger.Log("[DependenciesDownloader] Saving file " + dllName);
                    VRCModLogger.Log(Path.GetDirectoryName(dependenciesDownloadFile));
                    Directory.CreateDirectory(Path.GetDirectoryName(dependenciesDownloadFile));
                    File.WriteAllBytes(dependenciesDownloadFile, dependencyDownload.bytes);
                    VRCModLogger.Log("[DependenciesDownloader] File saved");
                }
                else
                {
                    VRCUiPopupManagerUtils.ShowPopup("VRCTools", "Unable to download VRCTools dependencies " + dllName + ": Server returned code " + responseCode, "Quit", () => Application.Quit());
                    throw new Exception("Unable to download VRCTools dependencies 0Harmony.dll: Server returned code " + responseCode);
                }
            }
        }
Ejemplo n.º 27
0
        public static void DisableVRCFlowManager()
        {
            VRCModLogger.Log("[VRCFlowManagerUtils] Looking for VRCFlowManager");
            VRCFlowManager[] flowManagers = Resources.FindObjectsOfTypeAll <VRCFlowManager>();
            foreach (VRCFlowManager flowManager in flowManagers)
            {
                flowManager.enabled = false;
            }
            VRCModLogger.Log("[VRCFlowManagerUtils] Disabled " + flowManagers.Length + " VRCFlowManager");

            if (GameObject.Find("UserInterface") == null)
            {
                VRCModLogger.Log("[VRCToolsUpdater] Loading additive scene \"ui\"");
                SceneManager.LoadScene("ui", LoadSceneMode.Single);
            }
        }
Ejemplo n.º 28
0
        public static void Init()
        {
            eventHandlers = new DiscordRpc.EventHandlers();
            eventHandlers.errorCallback = (code, message) => VRCModLogger.LogError("[VRCTools] [Discord] (E" + code + ") " + message);

            presence.state          = "Not in a world";
            presence.details        = "Not logged in" + " (" + (VRCTrackingManager.IsInVRMode() ? "VR" : "PC") + ")";
            presence.largeImageKey  = "logo";
            presence.partySize      = 0;
            presence.partyMax       = 0;
            presence.startTimestamp = (long)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
            presence.partyId        = "";
            presence.largeImageText = "VRChat";
            DeviceChanged();
            try
            {
                string steamId = null;
                switch (VRCApplicationSetup._instance.ServerEnvironment)
                {
                case ApiServerEnvironment.Release:
                    steamId = "438100"; presence.largeImageText += " Release";
                    break;

                case ApiServerEnvironment.Beta:
                    steamId = "744530"; presence.largeImageText += " Beta";
                    break;

                case ApiServerEnvironment.Dev:
                    steamId = "326100"; presence.largeImageText += " Dev";
                    break;

                default:
                    break;
                }

                DiscordRpc.Initialize("404400696171954177", ref eventHandlers, true, steamId);
                DiscordRpc.UpdatePresence(ref presence);

                running = true;
                VRCModLogger.Log("[DiscordManager] RichPresence Initialised");
            }
            catch (Exception e)
            {
                VRCModLogger.Log("[DiscordManager] Unable to init discord RichPresence:");
                VRCModLogger.Log("[DiscordManager] " + e);
            }
        }
Ejemplo n.º 29
0
        private void OnApplicationStart()
        {
            if (!ApiCredentials.Load())
            {
                VRCModLogger.Log("No credential founds");
            }
            else
            {
                VRCModLogger.Log("Credentials:\n - Token: " + ApiCredentials.GetAuthToken() + "\n - Provider: " + ApiCredentials.GetAuthTokenProvider() + "\n - UserId: " + ApiCredentials.GetAuthTokenProviderUserId());
            }


            String lp    = "";
            bool   first = true;

            foreach (var lp2 in Environment.GetCommandLineArgs())
            {
                if (first)
                {
                    first = false;
                }
                else
                {
                    lp += " " + lp2;
                }
            }
            VRCModLogger.Log("Launch parameters:" + lp);

            ModPrefs.RegisterCategory("vrctools", "VRCTools");
            ModPrefs.RegisterPrefBool("vrctools", "remoteauthcheckasked", false, null, true);
            ModPrefs.RegisterPrefBool("vrctools", "remoteauthcheck", false, "Allow VRCModNetwork Auth");
            ModPrefs.RegisterPrefBool("vrctools", "avatarfavdownloadasked", false, null, true);
            ModPrefs.RegisterPrefBool("vrctools", "avatarfavdownload", false, "Enable AvatarFav Updater");

            ModPrefs.RegisterPrefBool("vrctools", "enablediscordrichpresence", true, "Enable Discord RichPresence");
            ModPrefs.RegisterPrefBool("vrctools", "enabledebugconsole", false, "Enable Debug Console");

            ModPrefs.RegisterPrefBool("vrctools", "hasvrcmnwtoken", false, null, true);

            ModPrefs.RegisterPrefBool("vrctools", "allowdiscordjoinrequests", true, "Allow Discord join requests");

            //Reset the credentials to ask login again if this is the first time the user login to the VRCMNW
            if (!ModPrefs.GetBool("vrctools", "hasvrcmnwtoken"))
            {
                ApiCredentials.Clear();
            }
        }
Ejemplo n.º 30
0
        public static void Setup()
        {
            try
            {
                Transform baseTextTransform = QuickMenuUtils.GetQuickMenuInstance().transform.Find("ShortcutMenu/BuildNumText");
                if (baseTextTransform != null)
                {
                    Transform vrcmodNetworkTransform = new GameObject("VRCModNetworkStatusText", typeof(RectTransform), typeof(Text)).transform;
                    vrcmodNetworkTransform.SetParent(baseTextTransform.parent, false);
                    vrcmodNetworkTransform.SetSiblingIndex(baseTextTransform.GetSiblingIndex() + 1);

                    networkstatusText = vrcmodNetworkTransform.GetComponent <Text>();
                    RectTransform networkstatusRT = vrcmodNetworkTransform.GetComponent <RectTransform>();

                    networkstatusRT.localScale = baseTextTransform.localScale;

                    networkstatusRT.anchorMin        = baseTextTransform.GetComponent <RectTransform>().anchorMin;
                    networkstatusRT.anchorMax        = baseTextTransform.GetComponent <RectTransform>().anchorMax;
                    networkstatusRT.anchoredPosition = baseTextTransform.GetComponent <RectTransform>().anchoredPosition;
                    networkstatusRT.sizeDelta        = new Vector2(2000, baseTextTransform.GetComponent <RectTransform>().sizeDelta.y);
                    networkstatusRT.pivot            = baseTextTransform.GetComponent <RectTransform>().pivot;

                    Vector3 newPos = baseTextTransform.localPosition;
                    newPos.x -= baseTextTransform.GetComponent <RectTransform>().sizeDelta.x * 0.5f;
                    newPos.x += 2000 * 0.5f;
                    newPos.y += -85;

                    networkstatusRT.localPosition        = newPos;
                    networkstatusText.text               = "VRCModNetworkStatus: <color=orange>Unknown</color>";
                    networkstatusText.color              = baseTextTransform.GetComponent <Text>().color;
                    networkstatusText.font               = baseTextTransform.GetComponent <Text>().font;
                    networkstatusText.fontSize           = baseTextTransform.GetComponent <Text>().fontSize;
                    networkstatusText.fontStyle          = baseTextTransform.GetComponent <Text>().fontStyle;
                    networkstatusText.horizontalOverflow = HorizontalWrapMode.Overflow;

                    Update();
                }
                else
                {
                    VRCModLogger.Log("[VRCMNWStatus] QuickMenu/ShortcutMenu/BuildNumText is null");
                }
            }catch (Exception ex)
            {
                VRCModLoader.VRCModLogger.Log("[VRCMNWStatus] " + ex.ToString());
            }
        }