Example #1
0
        private static void OnPlayerJoin(Player player)
        {
            if (player == null || player.prop_APIUser_0 == null) //player.prop_APIUser_0.id == APIUser.CurrentUser.id) // The apiuser in player will only be null on the first join of the first instance of the client, and only occasionally. So it can be garunteed to be local player
            {
                return;
            }

            int photonId = player.prop_VRCPlayer_0.prop_PlayerNet_0.prop_PhotonView_0.field_Private_Int32_0;

            if (players.ContainsKey(photonId))
            {
                return;
            }

            AvatarHiderPlayer playerProp = new AvatarHiderPlayer()
            {
                active   = true,
                photonId = photonId,
                userId   = player.prop_APIUser_0.id,
                player   = player,
                avatar   = player.prop_VRCPlayer_0.prop_VRCAvatarManager_0.prop_GameObject_0,
                isFriend = APIUser.IsFriendsWith(player.prop_APIUser_0.id),
                isShown  = VRCUtils.IsAvatarExplcitlyShown(player.prop_APIUser_0),
                isHidden = VRCUtils.IsAvatarExplcitlyHidden(player.prop_APIUser_0)
            };

            players.Add(playerProp.photonId, playerProp);
            HideOrShowAvatar(playerProp);
            RefreshFilteredList();
        }
Example #2
0
 public override void OnApplicationStart()
 {
     Instance = this;
     Config.RegisterSettings();
     OnPreferencesSaved();
     AvatarHiderPlayer.Init();
     PlayerManager.Init();
     RefreshManager.Init();
     Config.OnConfigChange();
 }
Example #3
0
        public static bool TryGetPlayerFromId(string userId, out AvatarHiderPlayer avatarHiderPlayer)
        {
            foreach (AvatarHiderPlayer loopedAvatarHiderPlayer in players.Values)
            {
                if (loopedAvatarHiderPlayer.userId == userId)
                {
                    avatarHiderPlayer = loopedAvatarHiderPlayer;
                    return(true);
                }
            }

            avatarHiderPlayer = null;
            return(false);
        }
Example #4
0
 public static void HideOrShowAvatar(AvatarHiderPlayer avatarHiderPlayer)
 {
     //if (avatarHiderPlayer.userId == APIUser.CurrentUser.id)
     //    return;
     if (Config.IncludeHiddenAvatars.Value && avatarHiderPlayer.isHidden)
     {
         avatarHiderPlayer.SetInActive();
     }
     else if ((Config.IgnoreFriends.Value && avatarHiderPlayer.isFriend) ||
              (Config.ExcludeShownAvatars.Value && avatarHiderPlayer.isShown))
     {
         avatarHiderPlayer.SetActive();
     }
 }
Example #5
0
 public static void RefreshPlayer(AvatarHiderPlayer playerProp, Vector3 myPos)
 {
     refreshDelegate?.Invoke(playerProp, myPos);
 }