Example #1
0
        private static void OnHideBigClick()
        {
            var apiUser = ourUserInfoPage?.field_Private_APIUser_0;
            var userId  = apiUser?.id;

            if (userId == null)
            {
                return;
            }

            if (AvatarHiding.ourBlockedAvatarAuthors.ContainsKey(userId))
            {
                AvatarHiding.ourBlockedAvatarAuthors.Remove(userId);
            }
            else
            {
                AvatarHiding.ourBlockedAvatarAuthors[userId] = apiUser.displayName ?? "";
            }

            AvatarHiding.SaveBlockedAuthors();

            OnPageShown(ourUserInfoPage);

            ScanningReflectionCache.ReloadAllAvatars(true);
        }
Example #2
0
        private static void OnForceAllowBundleClick()
        {
            var apiAvatar = GetUserSelectedInQm()?.GetPlayer()?._vrcplayer?.prop_VRCAvatarManager_0?.field_Private_ApiAvatar_0;

            if (apiAvatar == null)
            {
                return;
            }

            if (BundleVerifierMod.BadBundleCache.Contains(apiAvatar.assetUrl))
            {
                BundleVerifierMod.ForceAllowedCache.Add(apiAvatar.assetUrl);
            }

            ScanningReflectionCache.ReloadAllAvatars(true);
        }
Example #3
0
        private static void OnHideAvatarClick()
        {
            var apiAvatar = GetUserSelectedInQm()?.GetPlayer()?._vrcplayer?.prop_VRCAvatarManager_0?.field_Private_ApiAvatar_0;

            if (apiAvatar == null)
            {
                return;
            }

            if (AvatarHiding.ourBlockedAvatars.ContainsKey(apiAvatar.id))
            {
                AvatarHiding.ourBlockedAvatars.Remove(apiAvatar.id);
            }
            else
            {
                AvatarHiding.ourBlockedAvatars[apiAvatar.id] = apiAvatar.name;
            }

            AvatarHiding.SaveBlockedAvatars();

            ScanningReflectionCache.ReloadAllAvatars(true);
        }
Example #4
0
        public static void OnApplicationStart()
        {
            ClassInjector.RegisterTypeInIl2Cpp <QuickMenuHideAvatarButtonHandler>();

            var hideAuthorButton       = ExpansionKitApi.GetExpandedMenu(ExpandedMenu.UserDetailsMenu).AddSimpleButton("Hide all avatars by this author", OnHideBigClick);
            var hideAvatarButton       = ExpansionKitApi.GetExpandedMenu(ExpandedMenu.UserQuickMenu).AddSimpleButton("Hide this avatar (on anyone)", OnHideAvatarClick);
            var forceAllowBundleButton = ExpansionKitApi.GetExpandedMenu(ExpandedMenu.UserQuickMenu).AddSimpleButton("Force allow this avatar bundle", OnForceAllowBundleClick);

            ourHideAuthorTextSink   = s => hideAuthorButton.Text = s;
            ourHideAvatarTextSink   = s => hideAvatarButton.Text = s;
            ourForceAllowBundleSink = b => forceAllowBundleButton.Visible = b;

            hideAvatarButton.OnInstanceCreated += obj => obj.AddComponent <QuickMenuHideAvatarButtonHandler>();

            ExpansionKitApi.GetExpandedMenu(ExpandedMenu.SettingsMenu).AddSimpleButton("Reload all avatars", () => ScanningReflectionCache.ReloadAllAvatars(false));

            ExpansionKitApi.GetSettingsCategory(BundleVerifierMod.SettingsCategory)
            .AddSimpleButton("Reset corrupted bundle cache", () => BundleVerifierMod.BadBundleCache.Clear());

            MelonCoroutines.Start(InitThings());
        }