示例#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();
        }