コード例 #1
0
ファイル: PlayerEntry.cs プロジェクト: loukylor/VRC-Mods
        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());
        }