Exemple #1
0
        public static void UpdateEntry(PlayerNet playerNet, PlayerEntry entry, bool bypassActive = false)
        {
            entry.timeSinceLastUpdate.Restart();

            // Update values but not text even if playerlist not active and before decode
            entry.distance = (entry.player.transform.position - Player.prop_Player_0.transform.position).magnitude;
            entry.fps      = MelonUtils.Clamp((int)(1000f / playerNet.field_Private_Byte_0), -99, 999);
            entry.ping     = playerNet.prop_VRCPlayer_0.prop_Int16_0;

            if (!(MenuManager.playerList.active || bypassActive))
            {
                return;
            }

            StringBuilder tempString = new StringBuilder();

            try
            {
                updateDelegate?.Invoke(playerNet, entry, ref tempString);
            }
            catch (Exception ex)
            {
                MelonLogger.Error($"Errored while updating {entry.apiUser.displayName}'s entry:\n{ex}");
            }

            entry.textComponent.text = entry.TrimExtra(tempString.ToString());
        }
        protected override void ProcessText(object[] parameters)
        {
            /*
             * List<PlayerEntry> playerEntries = PlayerListMod.playerEntries.Values.ToList();
             * // Get blocked things
             * foreach (ApiPlayerModeration moderation in ModerationManager.prop_ModerationManager_0.field_Private_List_1_ApiPlayerModeration_0)
             * {
             *  if (moderation.moderationType != ApiPlayerModeration.ModerationType.Block) continue;
             *
             *  foreach (PlayerEntry playerEntry in playerEntries)
             *  {
             *      if (playerEntry.youBlocked) continue;
             *
             *      if (playerEntry.player == null)
             *      {
             *          playerEntry.Remove();
             *          continue;
             *      }
             *
             *      if (playerEntry.userID == moderation.targetUserId)
             *      {
             *          playerEntry.youBlocked = true;
             *          MelonLoader.MelonLogger.Msg($"You have blocked {moderation.targetDisplayName}");
             *          break;
             *      }
             *  }
             * }
             */
            StringBuilder tempString = new StringBuilder();

            player = Player.prop_Player_0;
            updateDelegate?.Invoke(player, this, ref tempString);

            textComponent.text = TrimExtra(tempString.ToString());
        }