Example #1
0
 private void OnUiManagerInit()
 {
     ExpansionKitApi.GetExpandedMenu(ExpandedMenu.QuickMenu).AddSimpleButton("Video\nLibrary", () =>
     {
         videoLibrary.getMainButton().getGameObject().GetComponent <Button>().onClick?.Invoke();
     });
 }
Example #2
0
        public override void OnApplicationStart()
        {
            hideCams      = MelonPreferences.CreateEntry(catagory, nameof(hideCams), false, "Hide Camera Indicators");
            shrinkCams    = MelonPreferences.CreateEntry(catagory, nameof(shrinkCams), false, "Shrink Indicators to .25x, Do not hide entirely");
            hideNameplate = MelonPreferences.CreateEntry(catagory, nameof(hideNameplate), false, "Hide Camera Nameplates");

            hideCamTex  = MelonPreferences.CreateEntry(catagory, nameof(hideCamTex), false, "Hide Camera Texture");
            recolorCams = MelonPreferences.CreateEntry(catagory, nameof(recolorCams), false, "Recolor Cameras");
            noGloss     = MelonPreferences.CreateEntry(catagory, nameof(noGloss), false, "Less glossiness on Cameras");

            noUIXButt = MelonPreferences.CreateEntry(catagory, nameof(noUIXButt), true, "UIX Button in 'Camera' Quick Menu");

            camColor         = MelonPreferences.CreateEntry(catagory, nameof(camColor), Color.black, "", "", true);
            colorList["Red"] = camColor.Value.r * 100; colorList["Green"] = camColor.Value.g * 100; colorList["Blue"] = camColor.Value.b * 100;


            hideCams.OnValueChanged      += UpdateAll;
            shrinkCams.OnValueChanged    += UpdateAll;
            hideNameplate.OnValueChanged += UpdateAll;
            recolorCams.OnValueChanged   += UpdateAll;
            hideCamTex.OnValueChanged    += UpdateAll;
            noGloss.OnValueChanged       += UpdateAll;

            NetworkEvents.OnAvatarInstantiated += OnAvatarInstantiated;
            NetworkEvents.OnPlayerLeft         += OnPlayerLeft;

            ExpansionKitApi.GetExpandedMenu(ExpandedMenu.CameraQuickMenu).AddSimpleButton("Other User's Camera Indicators", () =>
            {
                CamSettingsMenu();
            }, (button) => { UIXButt = button; UIXButt.SetActive(noUIXButt.Value); });
        }
Example #3
0
        private void MainMenu()
        {
            var settings_menu = ExpansionKitApi.CreateCustomQuickMenuPage(LayoutDescription.WideSlimList);

            settings_menu.AddHeader("World Cleanup");

            /* Light shadows */
            if (s_Lights.Count() > 0)
            {
                settings_menu.AddButtonToggleListItem("Shadows", $"Lights: {s_Lights.Count()}", () =>
                {
                    var shadows_menu = ExpansionKitApi.CreateCustomQuickMenuPage(LayoutDescription.WideSlimList);
                    foreach (var light in s_Lights)
                    {
                        shadows_menu.AddDropdownListItem(light.Item1.name, typeof(LightShadows), (state) => { light.Item1.shadows = (LightShadows)state; }, (int)light.Item1.shadows);
                    }
                    shadows_menu.AddSimpleButton("Back", MainMenu);
                    shadows_menu.Show();
                }, (restore) =>
                {
                    foreach (var(light, original) in s_Lights)
                    {
                        light.shadows = restore ? original : LightShadows.None;
                    }
                    Settings.s_DisableLights.Value = !restore;
                }, () => !Settings.s_DisableLights.Value, false);
Example #4
0
        private static void ShowRotationMenu()
        {
            if (_rotationMenu == null)
            {
                _rotationMenu = ExpansionKitApi.CreateCustomQuickMenuPage(LayoutDescription.QuickMenu4Columns);

                _rotationMenu.AddSpacer();
                _rotationMenu.AddSimpleButton("Forward", () => Move(Transform.right));
                _rotationMenu.AddSpacer();
                _rotationMenu.AddSpacer();

                _rotationMenu.AddSimpleButton("Tilt Left", () => Move(Transform.forward));
                _rotationMenu.AddSimpleButton("Reset", () => CameraTransform.localRotation = OriginalRotation);
                _rotationMenu.AddSimpleButton("Tilt Right", () => Move(-Transform.forward));
                _rotationMenu.AddSpacer();

                _rotationMenu.AddSpacer();
                _rotationMenu.AddSimpleButton("Backward", () => Move(-Transform.right));
                _rotationMenu.AddSimpleButton("Left", () => Move(-Transform.up));
                _rotationMenu.AddSimpleButton("Right", () => Move(Transform.up));

                _rotationMenu.AddToggleButton("High precision", b => HighPrecision = b, () => HighPrecision);
                _rotationMenu.AddSpacer();
                _rotationMenu.AddSpacer();
                _rotationMenu.AddSimpleButton("Back", _rotationMenu.Hide);
            }
            _rotationMenu.Show();
        }
Example #5
0
        public AvatarModule() : base(ExpandedMenu.AvatarMenu, FavCatMod.Database.AvatarFavorites, GetListsParent(), false, false)
        {
            myCurrentAnnoyingMessage = CanPerformAdditiveActions ? "WillBeObsolete" : (CanShowExistingLists ? "CantAddWithCanny" : "NoFavorites");

            MelonLogger.Msg("Adding button to UI - Looking up for Change Button");
            var foundAvatarPage = Resources.FindObjectsOfTypeAll <PageAvatar>()?.FirstOrDefault(p => p.transform.Find("Change Button") != null);

            if (foundAvatarPage == null)
            {
                throw new ApplicationException("No avatar page, can't initialize extended favorites");
            }

            myPageAvatar = foundAvatarPage;

            ExpansionKitApi.GetExpandedMenu(ExpandedMenu.UserDetailsMenu).AddSimpleButton("Search known public avatars", DoSearchKnownAvatars);

            var expandEnforcer = new GameObject(ExpandEnforcerGameObjectName, new[] { Il2CppType.Of <RectTransform>(), Il2CppType.Of <LayoutElement>() });

            expandEnforcer.transform.SetParent(GetListsParent(), false);
            var layoutElement = expandEnforcer.GetComponent <LayoutElement>();

            layoutElement.minWidth  = 1534;
            layoutElement.minHeight = 0;

            myPageAvatar.gameObject.AddComponent <EnableDisableListener>().OnEnabled += () =>
            {
                if (FavCatSettings.DontShowAnnoyingMessage == myCurrentAnnoyingMessage || myHasShownAnnoyingMessageThisRun)
                {
                    return;
                }
                ShowAnnoyingMessage();
            };

            myInitialised = true;
        }
Example #6
0
 public override void OnApplicationStart()
 {
     ExpansionKitApi.RegisterSimpleMenuButton(ExpandedMenu.SettingsMenu, "Nearplane-0.01", (() => ChangeNearClipPlane(.01f)));
     ExpansionKitApi.RegisterSimpleMenuButton(ExpandedMenu.SettingsMenu, "Nearplane-0.001", (() => ChangeNearClipPlane(.001f)));
     ExpansionKitApi.RegisterSimpleMenuButton(ExpandedMenu.SettingsMenu, "Nearplane-0.0001", (() => ChangeNearClipPlane(.0001f)));
     MelonLogger.Log("Near Plane Adjust Init");
 }
Example #7
0
        public override void Init()
        {
            AvatarInfoMenuButton = MelonPreferences.CreateEntry("UserInfoExtensionsSettings", nameof(AvatarInfoMenuButton), true, "Show \"Avatar Info Menu\" button in Avatar Menu");

            ExpansionKitApi.GetExpandedMenu(ExpandedMenu.AvatarMenu).AddSimpleButton("Avatar Info Menu", new Action(() => { avatarInfoMenu?.Show(); OnMenuShown(); }), new Action <GameObject>((go) =>
            {
                avatarInfoMenuButtonGameObject = go;
                GetAvatarAuthor.avatarPage.GetComponent <EnableDisableListener>().OnDisabled += new Action(() => avatarInfoMenu?.Hide());
            }));

            avatarInfoMenu = ExpansionKitApi.CreateCustomFullMenuPopup(new LayoutDescription()
            {
                RowHeight  = 80,
                NumColumns = 3,
                NumRows    = 5
            });
            avatarInfoMenu.AddLabel("Avatar information:");
            avatarInfoMenu.AddSpacer();
            avatarInfoMenu.AddSimpleButton("Back", new Action(() => avatarInfoMenu.Hide()));
            avatarInfoMenu.AddSimpleButton("", new Action(() => { }), new Action <GameObject>((gameObject) => authorNameLabel = gameObject.transform.GetChild(0).GetComponent <Text>()));
            avatarInfoMenu.AddSimpleButton("Show Avatar Description", new Action(() => { avatarInfoMenu.Hide(); UiManager.OpenSmallPopup("Description:", avatar.description == null ? "" : avatar.description, "Close", UiManager.ClosePopup); }));
            avatarInfoMenu.AddSimpleButton("", new Action(() => { }), new Action <GameObject>((gameObject) => avatarNameLabel  = gameObject.transform.GetChild(0).GetComponent <Text>()));
            avatarInfoMenu.AddSimpleButton("", new Action(() => { }), new Action <GameObject>((gameObject) => platformLabel    = gameObject.transform.GetChild(0).GetComponent <Text>()));
            avatarInfoMenu.AddSimpleButton("", new Action(() => { }), new Action <GameObject>((gameObject) => releaseTypeLabel = gameObject.transform.GetChild(0).GetComponent <Text>()));
            avatarInfoMenu.AddSimpleButton("", new Action(() => { }), new Action <GameObject>((gameObject) => lastUpdatedLabel = gameObject.transform.GetChild(0).GetComponent <Text>()));
            avatarInfoMenu.AddSimpleButton("", new Action(() => { }), new Action <GameObject>((gameObject) => VersionLabel     = gameObject.transform.GetChild(0).GetComponent <Text>()));
        }
Example #8
0
File: Main.cs Project: VRCMG/VRMods
        public override void OnApplicationStart()
        {
            var toggleChairsMenu = ExpansionKitApi.CreateCustomFullMenuPopup(LayoutDescription.WideSlimList);

            ExpansionKitApi.GetExpandedMenu(ExpandedMenu.WorldMenu).AddSimpleButton("Toggle Chairs", () => toggleChairsMenu.Show());
            toggleChairsMenu.AddSimpleButton("Disable Active Chairs", (() => {
                int countChange = 0;
                var objects = Resources.FindObjectsOfTypeAll <VRCStation>();
                foreach (var item in objects)
                {
                    if (item.gameObject.active) //Only disable active chairs
                    {
                        countChange++;
                        objectsDisabled.Add(item);
                        item.gameObject.SetActive(false); // item.gameObject finds the parent gameObject of the VRCStation
                    }
                }
                MelonLogger.Log("Disabled " + countChange + " chair objects");
            }));
            toggleChairsMenu.AddSimpleButton("Re-enable Chairs", (() => {
                int countChange = 0;
                foreach (var item in objectsDisabled)
                {
                    if (item is null)
                    {
                        continue;
                    }
                    countChange++;
                    item.gameObject.SetActive(true);
                }
                MelonLogger.Log("Enabled " + countChange + " chair objects");
                objectsDisabled.Clear();
            }));
            toggleChairsMenu.AddSimpleButton("Close", () => toggleChairsMenu.Hide());
        }
 private void CreateButton()
 {
     ExpansionKitApi.GetExpandedMenu(ExpandedMenu.UserQuickMenu).AddSimpleButton("Get\nToys", () => {
         string name = GameObject.Find("UserInterface/Canvas_QuickMenu(Clone)/Container/Window/QMParent/Menu_SelectedUser_Local").GetComponent <VRC.UI.Elements.Menus.SelectedUserMenuQM>().field_Private_IUser_0.prop_String_0;
         VRCWSIntegration.SendMessage(new VibratorControllerMessage(name, Commands.GetToys));
     });
 }
Example #10
0
        public static void ColorMenu()
        {
            var colorsList = new Dictionary <string, Color> {
                { "Black", Color.black },
                { "Grey", Color.grey },
                { "White", Color.white },//
                { "Red", Color.red },
                { "Green", Color.green },
                { "Blue", Color.blue },//
                { "Cyan", Color.cyan },
                { "Magenta", Color.magenta },
                { "Yellow", Color.yellow }//
            };

            ICustomShowableLayoutedMenu Menu = null;

            Menu = ExpansionKitApi.CreateCustomQuickMenuPage(LayoutDescriptionCustom.QuickMenu3Column4Row);

            foreach (KeyValuePair <string, Color> entry in colorsList)
            {
                if (entry.Key == "x")
                {
                    Menu.AddSpacer(); continue;
                }                                                    //If desc is x, then skip
                Menu.AddSimpleButton(entry.Key, () => {
                    colorList["Red"]   = entry.Value.r * 100;
                    colorList["Green"] = entry.Value.g * 100;
                    colorList["Blue"]  = entry.Value.b * 100;
                    ColorMenuAdj();
                });
            }
            //
            Menu.AddSimpleButton("<-Back", () => { ColorMenuAdj(); });
            Menu.Show();
        }
Example #11
0
        private static void StoredColorsMenu()
        {//type T|F - Pos|Rot
            var storedMenu = ExpansionKitApi.CreateCustomQuickMenuPage(LayoutDescriptionCustom.QuickMenu3ColumnsSlim);

            foreach (KeyValuePair <int, System.Tuple <float, float, float> > slot in SaveSlots.GetSavedColors())
            {
                string label = $"Slot: {slot.Key}\nR:{Utils.NumFormat(slot.Value.Item1)}\nG:{Utils.NumFormat(slot.Value.Item2)}\nB:{Utils.NumFormat(slot.Value.Item3)}";
                storedMenu.AddLabel(label);
                storedMenu.AddSimpleButton($"Load", () =>
                {
                    colorList["Red"]   = slot.Value.Item1;
                    colorList["Green"] = slot.Value.Item2;
                    colorList["Blue"]  = slot.Value.Item3;
                    storedMenu.Hide();
                    ColorMenuAdj(); //Return to previous on load
                });
                storedMenu.AddSimpleButton($"Save", () =>
                {
                    SaveSlots.Store(slot.Key, new System.Tuple <float, float, float>(colorList["Red"], colorList["Green"], colorList["Blue"]));
                    storedMenu.Hide();
                    StoredColorsMenu();
                });
            }
            storedMenu.AddSimpleButton("<-Back", (() =>
            {
                ColorMenuAdj();
            }));
            string current = $"Current:\nR:{Utils.NumFormat(colorList["Red"])}\nG:{Utils.NumFormat(colorList["Green"])}\nB:{Utils.NumFormat(colorList["Blue"])}";

            storedMenu.AddLabel(current);

            storedMenu.Show();
        }
Example #12
0
        public static void SetName(bool cas)
        {
            var chars = "abcdefghijklmnopqrstuvwxyz-_ ".ToCharArray();
            var menu  = ExpansionKitApi.CreateCustomQuickMenuPage(LayoutDescriptionCustom.QuickMenu3Column10Row);

            menu.AddSimpleButton("<-Back", () => { LightDetailsMenu(); });
            menu.AddLabel(Main.Config.name, (button) => butt = button.transform);;
            menu.AddSimpleButton("BackSpace", () => {
                if (Main.Config.name.Length > 0)
                {
                    Main.Config.name = Main.Config.name.Remove(Main.Config.name.Length - 1, 1);
                }
                butt.GetComponentInChildren <Text>().text = Main.Config.name;
            });

            foreach (char c in chars)
            {
                var s = cas ? c.ToString().ToUpper() : c.ToString();
                menu.AddSimpleButton(s, () => {
                    Main.Config.name += s;
                    butt.GetComponentInChildren <Text>().text = Main.Config.name;
                });
            }

            menu.AddSimpleButton("Toggle Case", () => { SetName(!cas); });
            menu.Show();
        }
Example #13
0
        public static void Initialize()
        {
            Page = ExpansionKitApi.CreateCustomFullMenuPopup(LayoutDescription.WideSlimList);

            Page.AddLabel("Title", new Action <GameObject>((obj) => { titleObject = obj; }));
            Page.AddLabel("Waiting for key...", new Action <GameObject>((obj) => { textObject = obj; }));

            Page.AddSimpleButton("Clear", new Action(() =>
            {
                selectedKeys.Clear();
            }));

            Page.AddSimpleButton("Accept", new Action(() =>
            {
                AcceptAction?.Invoke(selectedKeys);
                fetchingKeys = false;
                Page.Hide();
            }));

            Page.AddSimpleButton("Cancel", new Action(() =>
            {
                CancelAction?.Invoke();
                fetchingKeys = false;
                Page.Hide();
            }));
        }
Example #14
0
 public static void SetupUI()
 {
     ExpansionKitApi.GetExpandedMenu(ExpandedMenu.CameraQuickMenu).AddSimpleButton("Camera Flash Settings", () =>
     {
         LightDetailsMenu();
     }, (button) => { UIXButt = button; UIXButt.SetActive(Main.UIXbuttEn.Value); });
 }
Example #15
0
        public void ColorMenu(bool useBigMenu)
        {
            var colorList = new Dictionary <string, Color> {
                { "Black", Color.black },
                { "Grey", Color.grey },
                { "White", Color.white },//
                { "Red", Color.red },
                { "Green", Color.green },
                { "Blue", Color.blue },//
                { "Cyan", Color.cyan },
                { "Magenta", Color.magenta },
                { "Yellow", Color.yellow }//
            };

            ICustomShowableLayoutedMenu Menu = null;

            Menu = useBigMenu ? ExpansionKitApi.CreateCustomFullMenuPopup(LayoutDescriptionCustom.QuickMenu3Column4Row) : ExpansionKitApi.CreateCustomQuickMenuPage(LayoutDescriptionCustom.QuickMenu3Column4Row);

            foreach (KeyValuePair <string, Color> entry in colorList)
            {
                if (entry.Key == "x")
                {
                    Menu.AddSpacer(); continue;
                }                                                    //If desc is x, then skip
                Menu.AddSimpleButton(entry.Key, () => {
                    category.GetEntry <float>("CubeColorR").Value = entry.Value.r * 100;
                    category.GetEntry <float>("CubeColorG").Value = entry.Value.g * 100;
                    category.GetEntry <float>("CubeColorB").Value = entry.Value.b * 100;
                    OnPreferencesSaved();
                });
            }
            //
            Menu.AddSimpleButton("Color Menu\n----\nBack", () => { CubeMenu(useBigMenu); });
            Menu.Show();
        }
Example #16
0
        public static void Initialize()
        {
            // Quickmenu
            ICustomLayoutedMenu userQuickMenuPage = ExpansionKitApi.GetExpandedMenu(ExpandedMenu.UserQuickMenu);

            userQuickMenuPage.AddSimpleButton("AdvancedInvites\nBlacklist", () => BlacklistUser(CurrentSelectedUser));
            userQuickMenuPage.AddSimpleButton("AdvancedInvites\nWhitelist", () => WhitelistUser(CurrentSelectedUser));

            // User Details menu
            ICustomLayoutedMenu userDetailsMenuPage = ExpansionKitApi.GetExpandedMenu(ExpandedMenu.UserDetailsMenu);

            userDetailsMenuPage.AddSimpleButton("AdvancedInvites\nBlacklist", () => BlacklistUser(CurrentSocialUser));
            userDetailsMenuPage.AddSimpleButton("AdvancedInvites\nWhitelist", () => WhitelistUser(CurrentSocialUser));

            // Social menu
            ExpansionKitApi.GetExpandedMenu(ExpandedMenu.SocialMenu).AddSimpleButton("AdvancedInvites\nRemove...", ShowUsers);

            // Worlds Menu
            ExpansionKitApi.GetExpandedMenu(ExpandedMenu.WorldMenu).AddSimpleButton("AdvancedInvites\nRemove...", ShowWorlds);

            // World Details menu
            ExpansionKitApi.GetExpandedMenu(ExpandedMenu.WorldDetailsMenu).AddSimpleButton("AdvancedInvites\nBlacklist", BlacklistWorld);

            // Settings Menu
            ExpansionKitApi.GetExpandedMenu(ExpandedMenu.SettingsMenu).AddSimpleButton(
                "AdvancedInvites\nReload Sounds",
                () => MelonCoroutines.Start(SoundPlayer.LoadNotificationSounds()));
        }
Example #17
0
        public void ColorMenuAdj(bool useBigMenu)
        {
            ICustomShowableLayoutedMenu Menu = null;

            Menu = useBigMenu ? ExpansionKitApi.CreateCustomFullMenuPopup(LayoutDescriptionCustom.QuickMenu3Column4Row) : ExpansionKitApi.CreateCustomQuickMenuPage(LayoutDescriptionCustom.QuickMenu3Column4Row);

            string[] colorList = { "Red", "Green", "Blue" };
            for (int i = 0; i < colorList.GetLength(0); i++)
            {
                string c = colorList[i].Substring(0, 1);
                Menu.AddSimpleButton($"{(colorList[i])} -", () => {
                    category.GetEntry <float>($"CubeColor{c}").Value = Clamp(category.GetEntry <float>($"CubeColor{c}").Value - 10, 0, 100);
                    OnPreferencesSaved();
                    Menu.Hide(); ColorMenuAdj(useBigMenu);
                });
                Menu.AddSimpleButton($"{(colorList[i])} -0-", () => {
                    category.GetEntry <float>($"CubeColor{c}").Value = 0f;
                    OnPreferencesSaved();
                    Menu.Hide(); ColorMenuAdj(useBigMenu);
                });
                Menu.AddSimpleButton($"{(colorList[i])} +", () => {
                    category.GetEntry <float>($"CubeColor{c}").Value = Clamp(category.GetEntry <float>($"CubeColor{c}").Value + 10, 0, 100);
                    OnPreferencesSaved();
                    Menu.Hide(); ColorMenuAdj(useBigMenu);
                });
            }

            Menu.AddSimpleButton("Color Adj\n----\nBack", () => { CubeMenu(useBigMenu); });
            Menu.AddLabel($"R:{category.GetEntry<float>("CubeColorR").Value}\nG:{category.GetEntry<float>("CubeColorG").Value}\nB:{category.GetEntry<float>("CubeColorB").Value}");

            Menu.Show();
        }
Example #18
0
        private static void ShowWorlds()
        {
            ICustomShowableLayoutedMenu worldsPermissionsPopup = ExpansionKitApi.CreateCustomFullMenuPopup(LayoutDescription.WideSlimList);

            if (WorldPermissionHandler.BlacklistedWorlds.Count > 0)
            {
                worldsPermissionsPopup.AddLabel("Blacklisted Worlds");
                foreach (WorldPermissionHandler.PermissionEntry blacklistedWorld in WorldPermissionHandler.BlacklistedWorlds)
                {
                    worldsPermissionsPopup.AddSimpleButton(
                        blacklistedWorld.WorldName,
                        () =>
                    {
                        worldsPermissionsPopup.Hide();
                        WorldPermissionHandler.RemoveFromBlacklist(blacklistedWorld.WorldId);
                        WorldPermissionHandler.SaveSettings();
                        ShowWorlds();
                    });
                }

                worldsPermissionsPopup.AddSpacer();
            }

            worldsPermissionsPopup.AddSimpleButton("Close", () => worldsPermissionsPopup.Hide());
            worldsPermissionsPopup.Show();
        }
 public override void OnApplicationStart()
 {
     MelonLogger.Log("Joystick Camera Control, by Slayer, Started.");
     ExpansionKitApi.GetExpandedMenu(ExpandedMenu.QuickMenu).AddSimpleButton("Toggle Camera Movement", toggleCameraMovement);
     ExpansionKitApi.GetExpandedMenu(ExpandedMenu.CameraQuickMenu).AddSimpleButton("Switch Turn Mode", switchTurnMode);
     ExpansionKitApi.GetExpandedMenu(ExpandedMenu.CameraQuickMenu).AddSimpleButton("Local Camera Mode", swapMode);
 }
Example #20
0
        public override void OnApplicationStart()
        {
            ExpansionKitApi.GetExpandedMenu(ExpandedMenu.QuickMenu).AddSimpleButton("Clear VRAM", () =>
            {
                var currentAvatars = (from player in PlayerManager.prop_PlayerManager_0.prop_ArrayOf_Player_0 where player != null select player.prop_ApiAvatar_0 into apiAvatar where apiAvatar != null select apiAvatar.assetUrl).ToList();

                var dict = new Dictionary <string, Il2CppSystem.Object>();
                var abdm = AssetBundleDownloadManager.prop_AssetBundleDownloadManager_0;
                foreach (var key in abdm.field_Private_Dictionary_2_String_Object_0.Keys)
                {
                    dict.Add(key, abdm.field_Private_Dictionary_2_String_Object_0[key]);
                }

                foreach (var key in dict.Keys.Where(key => !abdm.field_Private_Dictionary_2_String_Object_0[key].name.Contains("vrcw") && !currentAvatars.Contains(key)))
                {
                    abdm.field_Private_Dictionary_2_String_AssetBundleDownload_0.Remove(key);
                    abdm.field_Private_Dictionary_2_String_Object_0.Remove(key);
                }
                dict.Clear();

                GC.Collect(GC.MaxGeneration, GCCollectionMode.Forced, true, true);
                Il2CppSystem.GC.Collect(GC.MaxGeneration, Il2CppSystem.GCCollectionMode.Forced, true, true);
                Resources.UnloadUnusedAssets();
            });
        }
Example #21
0
        public override void OnApplicationStart()
        {
            Instance = this;

            Directory.CreateDirectory("./UserData/FavCatImport");

            ClassInjector.RegisterTypeInIl2Cpp <CustomPickerList>();
            ClassInjector.RegisterTypeInIl2Cpp <CustomPicker>();

            ApiSnifferPatch.DoPatch();

            FavCatSettings.RegisterSettings();

            MelonLogger.Log("Creating database");
            Database = new LocalStoreDatabase(FavCatSettings.DatabasePath, FavCatSettings.ImageCachePath);

            Database.ImageHandler.TrimCache(FavCatSettings.MaxCacheSizeBytes).NoAwait();

            ExpansionKitApi.RegisterWaitConditionBeforeDecorating(WaitForInitDone());

            foreach (var methodInfo in typeof(AvatarPedestal).GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public).Where(it => it.Name.StartsWith("Method_Private_Void_ApiContainer_") && it.GetParameters().Length == 1))
            {
                Harmony.Patch(methodInfo, new HarmonyMethod(typeof(FavCatMod), nameof(AvatarPedestalPatch)));
            }
        }
Example #22
0
        public override void OnApplicationStart()
        {
            ICustomLayoutedMenu settingsPage = ExpansionKitApi.GetExpandedMenu(ExpandedMenu.SettingsMenu);

            settingsPage.AddSimpleButton("Unblock unpack queue", Utilities.UnblockUnPackQueue);
            ExpansionKitApi.OnUiManagerInit += OnUiManagerInit;
        }
Example #23
0
        public override void OnApplicationStart()
        {
            MelonPreferences.CreateCategory("ReloadAvatars", "ReloadAvatars Settings");
            reloadAvatarPref     = (MelonPreferences_Entry <bool>)MelonPreferences.CreateEntry("ReloadAvatars", "ReloadAvatar", true, "Enable/Disable Reload Avatar Button");
            reloadAllAvatarsPref = (MelonPreferences_Entry <bool>)MelonPreferences.CreateEntry("ReloadAvatars", "ReloadAllAvatars", true, "Enable/Disable Reload All Avatars Button");

            MethodInfo reloadAvatarMethod     = typeof(VRCPlayer).GetMethods().First(mi => mi.Name.StartsWith("Method_Private_Void_Boolean_") && mi.Name.Length < 31 && mi.GetParameters().Any(pi => pi.IsOptional));
            MethodInfo reloadAllAvatarsMethod = typeof(VRCPlayer).GetMethods().Where(mi => mi.Name.StartsWith("Method_Public_Void_Boolean_") && mi.Name.Length < 30 && mi.GetParameters().Any(pi => pi.IsOptional)).First(); // Both methods seem to do the same thing

            ExpansionKitApi.GetExpandedMenu(ExpandedMenu.UserQuickMenu).AddSimpleButton("Reload Avatar", new Action(() =>
            {
                try
                {
                    reloadAvatarMethod.Invoke(QuickMenu.prop_QuickMenu_0.field_Private_Player_0.field_Internal_VRCPlayer_0, new object[] { true });
                }
                catch (Exception ex)
                {
                    MelonLogger.Error("Error while reloading single avatar:\n" + ex.ToString());
                } // Ignore
            }), new Action <GameObject>((gameObject) => { reloadAvatarButton = gameObject; reloadAvatarButton.SetActive(reloadAllAvatarsPref.Value); }));

            ExpansionKitApi.GetExpandedMenu(ExpandedMenu.QuickMenu).AddSimpleButton("Reload All Avatars", new Action(() =>
            {
                try
                {
                    reloadAllAvatarsMethod.Invoke(VRCPlayer.field_Internal_Static_VRCPlayer_0, new object[] { true });
                }
                catch (Exception ex)
                {
                    MelonLogger.Error("Error while reloading all avatars:\n" + ex.ToString());
                } // Ignore
            }), new Action <GameObject>((gameObject) => { reloadAllAvatarsButton = gameObject; reloadAllAvatarsButton.SetActive(reloadAvatarPref.Value); }));
            MelonLogger.Msg("Initialized!");
        }
Example #24
0
        internal static void RegisterSettings()
        {
            var avatarSearchModeName = "AvatarSearchMode";

            var category = MelonPreferences.CreateCategory(SettingsCategory, "FavCat");

            DatabasePath        = category.CreateEntry("DatabasePath", "./UserData", "Database directory path", is_hidden: true, dont_save_default: false);
            ImageCachePath      = category.CreateEntry("ImageCachePath", "./UserData", "Image cache directory path", is_hidden: true, dont_save_default: false);
            AnnoyingMessageSeen = category.CreateEntry("AnnoyingMessageSeen", "", is_hidden: true);

            EnableAvatarFavs = category.CreateEntry("EnableAvatarFavs", true, "Enable avatar favorites (restart required)");
            EnableWorldFavs  = category.CreateEntry("EnableWorldFavs", true, "Enable world favorites (restart required)");
            EnablePlayerFavs = category.CreateEntry("EnablePlayerFavs", true, "Enable player favorites (restart required)");

            ImageCacheMode    = category.CreateEntry("ImageCachingMode", "full", "Image caching mode");
            ImageCacheMaxSize = category.CreateEntry("ImageCacheMaxSize", 4096, "Image cache max size (MB)");
            HidePopupAfterFav = category.CreateEntry("HidePopupAfterFav", true, "Hide favorite popup after (un)favoriting a world or a player");

            MakeClickSounds     = category.CreateEntry("MakeClickSounds", true, "Click sounds");
            AvatarSearchMode    = category.CreateEntry(avatarSearchModeName, "select", "Avatar search result action");
            SortPlayersByOnline = category.CreateEntry(nameof(SortPlayersByOnline), true, "Show offline players at the end of the list");

            SortPlayersByJoinable = category.CreateEntry(nameof(SortPlayersByJoinable), true, "Show players in private instances at the end of the list");

            ExpansionKitApi.RegisterSettingAsStringEnum(SettingsCategory, "ImageCachingMode", new [] { ("full", "Full local image cache (fastest, safest)"), ("fast", "Fast, use more RAM"), ("builtin", "Preserve RAM, more API requests") });
Example #25
0
        private static void ColorMenuAdj()
        {
            ICustomShowableLayoutedMenu Menu = null;

            Menu = ExpansionKitApi.CreateCustomQuickMenuPage(LayoutDescriptionCustom.QuickMenu3Column4Row);
            foreach (KeyValuePair <string, float> entry in colorList)
            {
                string c = entry.Key;
                Menu.AddSimpleButton($"{(c)} -", () => {
                    colorList[c] = Clamp(entry.Value - 10, 0, 100);
                    Menu.Hide(); ColorMenuAdj();
                });
                Menu.AddSimpleButton($"{(c)} - 0/100", () => {
                    if (colorList[c] != 0f)
                    {
                        colorList[c] = 0f;
                    }
                    else
                    {
                        colorList[c] = 100f;
                    }
                    Menu.Hide(); ColorMenuAdj();
                });
                Menu.AddSimpleButton($"{(c)} +", () => {
                    colorList[c] = Clamp(colorList[c] + 10, 0, 100);
                    Menu.Hide(); ColorMenuAdj();
                });
            }
            Menu.AddSimpleButton($"<-Back", () => { CamSettingsMenu(); });
            Menu.AddLabel($"R:{colorList["Red"]}\nG:{colorList["Green"]}\nB:{colorList["Blue"]}");
            camColor.Value = new Color(colorList["Red"] / 100, colorList["Green"] / 100, colorList["Blue"] / 100);
            Menu.Show();
        }
Example #26
0
        public void CubeMenu(bool useBigMenu)
        {
            ICustomShowableLayoutedMenu cubeMenu = null;

            cubeMenu = useBigMenu ? ExpansionKitApi.CreateCustomFullMenuPopup(LayoutDescriptionCustom.QuickMenu3Column4Row) : ExpansionKitApi.CreateCustomQuickMenuPage(LayoutDescriptionCustom.QuickMenu3Column4Row);
            cubeMenu.AddSimpleButton($"Destroy Cube", () => { DestroyCube(); cubeState = 0; });
            cubeMenu.AddSimpleButton($"Create Custom Cube", () => { CreateCube(customCubeHeight, customCubeWidth, customCubeLength, cubeHeightOffset); cubeState = 10; });
            cubeMenu.AddSimpleButton($"Settings", () => { SettMenu(useBigMenu); });
            ///
            cubeMenu.AddSimpleButton($"Create Small Cube", () => { CreateCube(5, 5, 5, .1f); cubeState = 1; });
            cubeMenu.AddSimpleButton($"Create Medium Cube", () => { CreateCube(15, 15, 15, .05f); cubeState = 2; });
            cubeMenu.AddSimpleButton($"Create Large Cube", () => { CreateCube(30, 30, 30, .05f); cubeState = 3; });
            /////
            cubeMenu.AddSimpleButton($"Wall Visibility Menu", () => { WallMenu(useBigMenu); });
            cubeMenu.AddSimpleButton($"Color Menu", () => { ColorMenu(useBigMenu); });
            cubeMenu.AddSimpleButton($"Color Menu Adjust", () => { ColorMenuAdj(useBigMenu); });
            /////
            cubeMenu.AddSimpleButton($"--Exit--", () => { cubeMenu.Hide(); });
            cubeMenu.AddToggleButton("Pickupable", (action) =>
            {
                category.GetEntry <bool>("WallsPickupable").Value = !category.GetEntry <bool>("WallsPickupable").Value;
                OnPreferencesSaved();
            }, () => category.GetEntry <bool>("WallsPickupable").Value);
            cubeMenu.AddToggleButton("Pickups snap to hand", (action) =>
            {
                category.GetEntry <bool>("PickupOrient").Value = !category.GetEntry <bool>("PickupOrient").Value;
                OnPreferencesSaved();
            }, () => category.GetEntry <bool>("PickupOrient").Value);
            //cubeMenu.AddSpacer();

            cubeMenu.Show();
        }
Example #27
0
        //private IEnumerator SetupUI()//I want the button to be last on the list
        //{
        //    while (QuickMenu.prop_QuickMenu_0 == null) yield return null;
        //    yield return new WaitForSeconds(10f);
        //    MelonLogger.Msg($"Adding QM button late and reloading the menu");
        //    ExpansionKitApi.GetExpandedMenu(ExpandedMenu.QuickMenu).AddSimpleButton("Local Camera", () => ToggleCamMenu());
        //    MelonPreferences.Save();
        //}

        public void ToggleCamMenu()
        {
            var localcamMenu = ExpansionKitApi.CreateCustomQuickMenuPage(LayoutDescriptionCustom.QuickMenu);

            buttonList.Clear();
            localcamMenu.AddSimpleButton("Local Camera\n-----\nClose menu", () => localcamMenu.Hide());
            localcamMenu.AddSimpleButton($"Camera is\n{(_localCam != null ? "Enabled" : "Disabled") }", (() => ToggleCamera()), (button) => buttonList["toggleBut"] = button.transform);
            localcamMenu.AddToggleButton($"Hide Camera", ((action) => HideMesh()), () => hideCam);

            localcamMenu.AddSimpleButton("Larger", (() => CamScale(1)));
            localcamMenu.AddSimpleButton("Smaller", (() => CamScale(-1)));
            localcamMenu.AddSimpleButton("Reset", (() => CamScale(0)));

            localcamMenu.AddSimpleButton("Zoom+", (() => CamFov(-1)));
            localcamMenu.AddSimpleButton("Zoom-", (() => CamFov(1)));
            localcamMenu.AddSimpleButton("Reset", (() => CamFov(0)));

            localcamMenu.AddSimpleButton("Selfie Stick", (() => Stick(true)));
            localcamMenu.AddSimpleButton("Rotate to Head", (() => RotateHead()));
            localcamMenu.AddToggleButton($"Follow Tracking Space", ((action) => TrackingSpace()), () => parentTracking.Value);

            localcamMenu.AddToggleButton($"Pickupable", ((action) => CamPickup()), () => _pickupable);

            localcamMenu.Show();
        }
Example #28
0
        public override void OnApplicationStart()
        {
            category.CreateEntry <bool>("CubeQMButt", false, "Cube Button on QuickMenu");
            category.CreateEntry <bool>("CubeBigButt", true, "Cube Button on World Big Menu");
            category.CreateEntry <bool>("CubeRepawn", false, "Cube Respawns on world join");

            category.CreateEntry <float>("CubeColorR", 0, "Color: Red (0-100)");
            category.CreateEntry <float>("CubeColorG", 0, "Color: Green (0-100)");
            category.CreateEntry <float>("CubeColorB", 0, "Color: Blue (0-100)");

            category.CreateEntry <float>("CustomCubeHeight", 3f, "Custom Cube Height");
            category.CreateEntry <float>("customCubeWidth", 2f, "Custom Cube Width");
            category.CreateEntry <float>("customCubeLength", 4f, "Custom Cube Length");

            category.CreateEntry <float>("CubeHeightOffset", 10f, "Cube Height Offset (0-100) 0=None, 100=-1/2 Height");
            category.CreateEntry <bool>("UseStandard", false, "Use Standard Shader vs Unlit Color");
            category.CreateEntry <bool>("WallsPickupable", false, "Can Pickup Walls");
            category.CreateEntry <bool>("PickupOrient", false, "Pickups snap to hand");
            category.CreateEntry <bool>("DestroyCol", false, "Destroy Collidors on box", "", true);

            OnPreferencesSaved();

            ExpansionKitApi.GetExpandedMenu(ExpandedMenu.QuickMenu).AddSimpleButton("Local Cube", () => { CubeMenu(false); },
                                                                                    (button) => { cubeQMbtn = button.transform; button.gameObject.SetActive(cubeQMButt); });
            ExpansionKitApi.GetExpandedMenu(ExpandedMenu.WorldMenu).AddSimpleButton("Local Cube", () => { CubeMenu(true); },
                                                                                    (button) => { cubeBigbtn = button.transform; button.gameObject.SetActive(cubeBigButt); });
        }
Example #29
0
        public override void OnApplicationStart()
        {
            Logger = new MelonLogger.Instance("DisableControllerOverlay", ConsoleColor.DarkYellow);

            cat = MelonPreferences.CreateCategory("DisableControllerOverlay", "DisableControllerOverlay");
            disableToolTipsOnLoad = MelonPreferences.CreateEntry("DisableControllerOverlay", nameof(disableToolTipsOnLoad), true, "Disable Controller Tooltips on Game Load");
            disableToolTips       = MelonPreferences.CreateEntry("DisableControllerOverlay", nameof(disableToolTips), true, "Disable Controller Tooltips");
            disableMeshOnly       = MelonPreferences.CreateEntry("DisableControllerOverlay", nameof(disableMeshOnly), true, "Disable Controller Mesh Only");

            disableToolTips.OnValueChanged += disableChange;
            disableMeshOnly.OnValueChanged += disableChange;

            var toolTipsMenu = ExpansionKitApi.CreateCustomQuickMenuPage(LayoutDescriptionCustom.QuickMenu1Column5Row);

            ExpansionKitApi.GetExpandedMenu(ExpandedMenu.UiElementsQuickMenu).AddSimpleButton("Controller Tooltips", () => toolTipsMenu.Show());
            toolTipsMenu.AddLabel("Controller Tooltips");
            toolTipsMenu.AddToggleButton("Disable Controller Tooltips", (action) =>
            {
                disableToolTips.Value = !disableToolTips.Value;
            }, () => disableToolTips.Value);
            toolTipsMenu.AddToggleButton("Disable Controller Mesh Only", (action) =>
            {
                disableMeshOnly.Value = !disableMeshOnly.Value;
            }, () => disableMeshOnly.Value);
            toolTipsMenu.AddToggleButton("Disable on Game Load", (action) =>
            {
                disableToolTipsOnLoad.Value = !disableToolTipsOnLoad.Value;
            }, () => disableToolTipsOnLoad.Value);
            toolTipsMenu.AddSimpleButton("Close", () => toolTipsMenu.Hide());
        }
Example #30
0
        public void DefaultsMenu(bool useBigMenu)
        {
            ICustomShowableLayoutedMenu mirrorLayerMenu = null;

            mirrorLayerMenu = useBigMenu ? ExpansionKitApi.CreateCustomFullMenuPopup(LayoutDescriptionCustom.QuickMenu3Column) : ExpansionKitApi.CreateCustomQuickMenuPage(LayoutDescriptionCustom.QuickMenu3Column_Longer);

            mirrorLayerMenu.AddLabel("Set Default Layer Mask On World Join");
            mirrorLayerMenu.AddToggleButton("Set on Join", b => setMaskOnJoin.Value = b, () => setMaskOnJoin.Value);
            //mirrorLayerMenu.AddLabel($"Mask: {defaultMask.Value}");
            mirrorLayerMenu.AddSpacer();

            mirrorLayerMenu.AddSpacer();
            mirrorLayerMenu.AddSimpleButton($"Enable All", () => { defaultMask.Value = -1; UpdateButtons(defaultMask.Value); });
            mirrorLayerMenu.AddSimpleButton($"Disable All", () => { defaultMask.Value = 0; UpdateButtons(defaultMask.Value); });

            foreach (KeyValuePair <int, string> entry in layerList)
            {
                mirrorLayerMenu.AddLabel($"Layer #{entry.Key} {(IsLayerEnabled(defaultMask.Value, entry.Key) ? "++++++++" : "-----------")} \n{entry.Value}", (button) => buttonList[entry.Key] = button.transform);
                mirrorLayerMenu.AddSimpleButton($"Enable", () => { defaultMask.Value = defaultMask.Value | (1 << entry.Key); UpdateButtons(defaultMask.Value); });   //Remove Layer
                mirrorLayerMenu.AddSimpleButton($"Disable", () => { defaultMask.Value = defaultMask.Value & ~(1 << entry.Key); UpdateButtons(defaultMask.Value); }); //Add Layer
            }

            mirrorLayerMenu.AddSimpleButton($"Close", () => { mirrorLayerMenu.Hide(); });
            mirrorLayerMenu.AddSimpleButton($"Back", () => { EditMirrorLayersMenu(useBigMenu, null); });

            mirrorLayerMenu.Show();
        }