public abstract IEnumerator ApplyPerformanceFilter(
     GameObject avatarObject,
     AvatarPerformanceStats perfStats,
     PerformanceRating ratingLimit,
     AvatarPerformance.IgnoreDelegate shouldIgnoreComponent,
     AvatarPerformance.FilterBlockCallback onBlock
     );
    void OnGUIPerformanceInfo(Object avatar, AvatarPerformanceStats perfStats, AvatarPerformanceCategory perfCategory)
    {
        string text;
        PerformanceInfoDisplayLevel displayLevel;
        PerformanceRating           rating = perfStats.GetPerformanceRatingForCategory(perfCategory);

        perfStats.GetSDKPerformanceInfoText(out text, out displayLevel, perfCategory, rating);

        if (displayLevel == PerformanceInfoDisplayLevel.None || string.IsNullOrEmpty(text))
        {
            return;
        }

        if (displayLevel == PerformanceInfoDisplayLevel.Verbose && showAvatarPerformanceDetails)
        {
            OnGUIStat(avatar, text, rating);
        }
        if (displayLevel == PerformanceInfoDisplayLevel.Info)
        {
            OnGUIStat(avatar, text, rating);
        }
        if (displayLevel == PerformanceInfoDisplayLevel.Warning)
        {
            OnGUIStat(avatar, text, rating);
        }
        if (displayLevel == PerformanceInfoDisplayLevel.Error)
        {
            OnGUIStat(avatar, text, rating);
            OnGUIError(avatar, text);
        }
    }
 public Issue(string text, System.Action show, System.Action fix, PerformanceRating rating = PerformanceRating.None)
 {
     issueText         = text;
     showThisIssue     = show;
     fixThisIssue      = fix;
     performanceRating = rating;
 }
        public IEnumerator ApplyPerformanceFilters(
            GameObject avatarObject,
            AvatarPerformanceStats perfStats,
            PerformanceRating ratingLimit,
            AvatarPerformance.IgnoreDelegate shouldIgnoreComponent,
            AvatarPerformance.FilterBlockCallback onBlock
            )
        {
            foreach (AbstractPerformanceFilter performanceFilter in performanceFilters)
            {
                if (performanceFilter == null)
                {
                    continue;
                }

                bool avatarBlocked = false;
                yield return(performanceFilter.ApplyPerformanceFilter(avatarObject, perfStats, ratingLimit, shouldIgnoreComponent, () => { avatarBlocked = true; }));

                if (!avatarBlocked)
                {
                    continue;
                }

                onBlock();
                break;
            }
        }
Beispiel #5
0
        public static AvatarPerformanceStatsLevel GetStatLevelForRating(PerformanceRating rating)
        {
            switch (rating)
            {
            case PerformanceRating.None:
                return(_performanceStatsLevelSet.excellent);

            case PerformanceRating.Excellent:
                return(_performanceStatsLevelSet.excellent);

            case PerformanceRating.Good:
                return(_performanceStatsLevelSet.good);

            case PerformanceRating.Medium:
                return(_performanceStatsLevelSet.medium);

            case PerformanceRating.Poor:
                return(_performanceStatsLevelSet.poor);

            case PerformanceRating.VeryPoor:
                return(_performanceStatsLevelSet.poor);

            default:
                return(_performanceStatsLevelSet.excellent);
            }
        }
Beispiel #6
0
        public static string ParsePerformanceText(PerformanceRating rating)
        {
            switch (rating)
            {
            case PerformanceRating.VeryPoor:
                return("Awful".PadRight(5));

            case PerformanceRating.Poor:
                return("Poor".PadRight(5));

            case PerformanceRating.Medium:
                return("Med".PadRight(5));

            case PerformanceRating.Good:
                return("Good".PadRight(5));

            case PerformanceRating.Excellent:
                return("Great".PadRight(5));

            case PerformanceRating.None:
                return("?¿?¿?".PadRight(5));

            // TODO: add load percentage??
            default:
                return(rating.ToString().PadRight(5));
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            PerformanceRating performanceRating = db.PerformanceRatings.Find(id);

            db.PerformanceRatings.Remove(performanceRating);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
            public Snapshot(AvatarPerformanceStats avatarPerformanceStats)
            {
                avatarName                     = avatarPerformanceStats.avatarName;
                polyCount                      = avatarPerformanceStats.polyCount;
                aabb                           = avatarPerformanceStats.aabb;
                skinnedMeshCount               = avatarPerformanceStats.skinnedMeshCount;
                meshCount                      = avatarPerformanceStats.meshCount;
                materialCount                  = avatarPerformanceStats.materialCount;
                animatorCount                  = avatarPerformanceStats.animatorCount;
                boneCount                      = avatarPerformanceStats.boneCount;
                lightCount                     = avatarPerformanceStats.lightCount;
                particleSystemCount            = avatarPerformanceStats.particleSystemCount;
                particleTotalCount             = avatarPerformanceStats.particleTotalCount;
                particleMaxMeshPolyCount       = avatarPerformanceStats.particleMaxMeshPolyCount;
                particleTrailsEnabled          = avatarPerformanceStats.particleTrailsEnabled;
                particleCollisionEnabled       = avatarPerformanceStats.particleCollisionEnabled;
                trailRendererCount             = avatarPerformanceStats.trailRendererCount;
                lineRendererCount              = avatarPerformanceStats.lineRendererCount;
                dynamicBoneComponentCount      = avatarPerformanceStats.dynamicBoneComponentCount;
                dynamicBoneSimulatedBoneCount  = avatarPerformanceStats.dynamicBoneSimulatedBoneCount;
                dynamicBoneColliderCount       = avatarPerformanceStats.dynamicBoneColliderCount;
                dynamicBoneCollisionCheckCount = avatarPerformanceStats.dynamicBoneCollisionCheckCount;
                clothCount                     = avatarPerformanceStats.clothCount;
                clothMaxVertices               = avatarPerformanceStats.clothMaxVertices;
                physicsColliderCount           = avatarPerformanceStats.physicsColliderCount;
                physicsRigidbodyCount          = avatarPerformanceStats.physicsRigidbodyCount;
                audioSourceCount               = avatarPerformanceStats.audioSourceCount;
                downloadSize                   = avatarPerformanceStats.downloadSize;

                overallRating                        = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.Overall);
                polyCountRating                      = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.PolyCount);
                aabbRating                           = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.AABB);
                skinnedMeshCountRating               = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.SkinnedMeshCount);
                meshCountRating                      = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.MeshCount);
                materialCountRating                  = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.MaterialCount);
                animatorCountRating                  = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.AnimatorCount);
                boneCountRating                      = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.BoneCount);
                lightCountRating                     = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.LightCount);
                particleSystemCountRating            = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.ParticleSystemCount);
                particleTotalCountRating             = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.ParticleTotalCount);
                particleMaxMeshPolyCountRating       = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.ParticleMaxMeshPolyCount);
                particleTrailsEnabledRating          = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.ParticleTrailsEnabled);
                particleCollisionEnabledRating       = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.ParticleCollisionEnabled);
                trailRendererCountRating             = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.TrailRendererCount);
                lineRendererCountRating              = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.LineRendererCount);
                dynamicBoneComponentCountRating      = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.DynamicBoneComponentCount);
                dynamicBoneSimulatedBoneCountRating  = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.DynamicBoneSimulatedBoneCount);
                dynamicBoneColliderCountRating       = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.DynamicBoneColliderCount);
                dynamicBoneCollisionCheckCountRating = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.DynamicBoneCollisionCheckCount);
                clothCountRating                     = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.ClothCount);
                clothMaxVerticesRating               = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.ClothMaxVertices);
                physicsColliderCountRating           = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.PhysicsColliderCount);
                physicsRigidbodyCountRating          = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.PhysicsRigidbodyCount);
                audioSourceCountRating               = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.AudioSourceCount);
                downloadSizeRating                   = avatarPerformanceStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.DownloadSize);
            }
 public ActionResult Edit([Bind(Include = "Id,UserId,Rating,Comments,IsPublic,PerformanceId")] PerformanceRating performanceRating)
 {
     if (ModelState.IsValid)
     {
         db.Entry(performanceRating).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.PerformanceId = new SelectList(db.Performances, "Id", "Id", performanceRating.PerformanceId);
     return(View(performanceRating));
 }
 public void OnGUIStat(Object subject, string output, PerformanceRating rating, System.Action show, System.Action fix)
 {
     if (subject == null)
     {
         subject = this;
     }
     if (!GUIStats.ContainsKey(subject))
     {
         GUIStats.Add(subject, new List <Issue>());
     }
     GUIStats[subject].Add(new Issue(output, show, fix, rating));
 }
        public ActionResult RatePerformance([Bind(Include = "Rating,Comments,IsPublic,PerformanceId")] PerformanceRating performanceRating)
        {
            if (ModelState.IsValid)
            {
                performanceRating.UserId      = User.Identity.GetUserId();
                performanceRating.Performance = db.Performances.Where(p => p.Id == performanceRating.PerformanceId).FirstOrDefault();
                db.PerformanceRatings.Add(performanceRating);
                db.SaveChanges();
                return(RedirectToAction("Index", "Performances"));
            }

            return(View(performanceRating));
        }
 public ActionResult DeleteConfirmed(int id)
 {
     if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin")
     {
         PerformanceRating performanceRating = db.PerformanceRating.Find(id);
         db.PerformanceRating.Remove(performanceRating);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     else
     {
         return(RedirectToAction("Login", "Account"));
     }
 }
        // GET: PerformanceRatings/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PerformanceRating performanceRating = db.PerformanceRatings.Find(id);

            if (performanceRating == null)
            {
                return(HttpNotFound());
            }
            return(View(performanceRating));
        }
Beispiel #14
0
        public override void Init(object[] parameters)
        {
            player  = (Player)parameters[0];
            apiUser = player.prop_APIUser_0;
            userId  = apiUser.id;

            platform   = platform = PlayerUtils.GetPlatform(player).PadRight(2);
            perf       = PerformanceRating.None;
            perfString = "<color=#" + ColorUtility.ToHtmlStringRGB(VRCUiAvatarStatsPanel.Method_Private_Static_Color_AvatarPerformanceCategory_PerformanceRating_0(AvatarPerformanceCategory.Overall, perf)) + ">" + PlayerUtils.ParsePerformanceText(perf) + "</color>";

            gameObject.GetComponent <UnityEngine.UI.Button>().onClick.AddListener(new Action(() => UiManager.OpenUserInQuickMenu(player)));

            isFriend = APIUser.IsFriendsWith(apiUser.id);
            GetPlayerColor(false);
        }
        // GET: PerformanceRatings/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            PerformanceRating performanceRating = db.PerformanceRatings.Find(id);

            if (performanceRating == null)
            {
                return(HttpNotFound());
            }
            ViewBag.PerformanceId = new SelectList(db.Performances, "Id", "Id", performanceRating.PerformanceId);
            return(View(performanceRating));
        }
Beispiel #16
0
        public override void OnAvatarDownloadProgressed(AvatarLoadingBar loadingBar, float downloadPercentage, long fileSize)
        {
            if (loadingBar.field_Public_PlayerNameplate_0.field_Private_VRCPlayer_0.prop_Player_0.prop_APIUser_0?.id != userId)
            {
                return;
            }

            perf = PerformanceRating.None;
            if (downloadPercentage < 1)
            {
                perfString = ((downloadPercentage * 100).ToString("N1") + "%").PadRight(5);
            }
            else
            {
                perfString = "100% ";
            }
        }
    void OnGUIStat(Object subject, string output, PerformanceRating rating)
    {
        if (checkedForIssues)
        {
            return;
        }

        if (subject == null)
        {
            subject = this;
        }
        if (!GUIStats.ContainsKey(subject))
        {
            GUIStats.Add(subject, new List <KeyValuePair <string, PerformanceRating> >());
        }
        GUIStats[subject].Add(new KeyValuePair <string, PerformanceRating>(output, rating));
    }
    private Texture GetPerformanceIconForRating(PerformanceRating value)
    {
        if (_perfIcon_VeryGood == null)
        {
            _perfIcon_VeryGood = Resources.Load <Texture>("PerformanceIcons/Perf_Great_32");
        }
        if (_perfIcon_Good == null)
        {
            _perfIcon_Good = Resources.Load <Texture>("PerformanceIcons/Perf_Good_32");
        }
        if (_perfIcon_Medium == null)
        {
            _perfIcon_Medium = Resources.Load <Texture>("PerformanceIcons/Perf_Medium_32");
        }
        if (_perfIcon_Bad == null)
        {
            _perfIcon_Bad = Resources.Load <Texture>("PerformanceIcons/Perf_Poor_32");
        }
        if (_perfIcon_VeryBad == null)
        {
            _perfIcon_VeryBad = Resources.Load <Texture>("PerformanceIcons/Perf_Horrible_32");
        }

        switch (value)
        {
        case PerformanceRating.None:
        case PerformanceRating.VeryGood:
            return(_perfIcon_VeryGood);

        case PerformanceRating.Good:
            return(_perfIcon_Good);

        case PerformanceRating.Medium:
            return(_perfIcon_Medium);

        case PerformanceRating.Bad:
            return(_perfIcon_Bad);

        case PerformanceRating.VeryBad:
            return(_perfIcon_VeryBad);
        }

        return(_perfIcon_VeryGood);
    }
 public ActionResult Edit([Bind(Include = "Id,Rating,Date,EmployeeId,PerformanceIssueId")] PerformanceRating performanceRating)
 {
     if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin")
     {
         if (ModelState.IsValid)
         {
             db.Entry(performanceRating).State = EntityState.Modified;
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
         ViewBag.EmployeeId         = new SelectList(db.Employee, "Id", "Name", performanceRating.EmployeeId);
         ViewBag.PerformanceIssueId = new SelectList(db.PerformanceIssue, "Id", "Name", performanceRating.PerformanceIssueId);
         return(View(performanceRating));
     }
     else
     {
         return(RedirectToAction("Login", "Account"));
     }
 }
 // GET: PerformanceRatings/Details/5
 public ActionResult Details(int?id)
 {
     if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin")
     {
         if (id == null)
         {
             return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
         }
         PerformanceRating performanceRating = db.PerformanceRating.Find(id);
         if (performanceRating == null)
         {
             return(HttpNotFound());
         }
         return(View(performanceRating));
     }
     else
     {
         return(RedirectToAction("Login", "Account"));
     }
 }
Beispiel #21
0
        public override void OnAvatarInstantiated(VRCAvatarManager manager, ApiAvatar avatar, GameObject gameObject)
        {
            apiUser = player.prop_APIUser_0;
            userId  = apiUser.id;
            if (manager.field_Private_VRCPlayer_0.prop_Player_0.prop_APIUser_0?.id != userId)
            {
                return;
            }

            perf       = manager.prop_AvatarPerformanceStats_0.field_Private_ArrayOf_PerformanceRating_0[(int)AvatarPerformanceCategory.Overall];
            perfString = "<color=#" + ColorUtility.ToHtmlStringRGB(VRCUiAvatarStatsPanel.Method_Private_Static_Color_AvatarPerformanceCategory_PerformanceRating_0(AvatarPerformanceCategory.Overall, perf)) + ">" + PlayerUtils.ParsePerformanceText(perf) + "</color>";

            if (player.prop_PlayerNet_0 != null)
            {
                UpdateEntry(player.prop_PlayerNet_0, this, true);
            }

            if (EntrySortManager.IsSortTypeInUse(EntrySortManager.SortType.AvatarPerf))
            {
                EntrySortManager.SortPlayer(playerLeftPairEntry);
            }
        }
 // GET: PerformanceRatings/Edit/5
 public ActionResult Edit(int?id)
 {
     if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin")
     {
         if (id == null)
         {
             return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
         }
         PerformanceRating performanceRating = db.PerformanceRating.Find(id);
         if (performanceRating == null)
         {
             return(HttpNotFound());
         }
         ViewBag.EmployeeId         = new SelectList(db.Employee, "Id", "Name", performanceRating.EmployeeId);
         ViewBag.PerformanceIssueId = new SelectList(db.PerformanceIssue, "Id", "Name", performanceRating.PerformanceIssueId);
         return(View(performanceRating));
     }
     else
     {
         return(RedirectToAction("Login", "Account"));
     }
 }
        public ActionResult Create([Bind(Include = "Id,Rating,Date,EmployeeId,PerformanceIssueId")] PerformanceRating performanceRating)
        {
            if (Session["ADMIN"] != null || Session["ADMIN"].ToString() == "admin")
            {
                if (ModelState.IsValid)
                {
                    performanceRating.Date = DateTime.Now;
                    db.PerformanceRating.Add(performanceRating);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }

                List <Employee> employee = new List <Employee>();
                employee                   = db.Employee.Where(i => i.Status == true).ToList();
                ViewBag.EmployeeId         = new SelectList(employee, "Id", "Name");
                ViewBag.PerformanceIssueId = new SelectList(db.PerformanceIssue, "Id", "Name");
                return(View(performanceRating));
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
Beispiel #24
0
 public static string GetPerformanceRatingDisplayName(PerformanceRating rating)
 {
     return(_performanceRatingDisplayNames[rating]);
 }
Beispiel #25
0
        protected override void ProcessText(object[] parameters)
        {
            // TODO: Figure out how to figure out how to know when someone blcosk u

            /*
             * 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;
             *      }
             *  }
             * }
             */
            // Get highest photonId once per update
            int highestId = 0;

            foreach (int photonId in PlayerManager.prop_PlayerManager_0.field_Private_Dictionary_2_Int32_Player_0.Keys)
            {
                if (photonId > highestId)
                {
                    highestId = photonId;
                }
            }

            PlayerEntry.highestPhotonIdLength = highestId.ToString().Length;

            // Convert to byte as that's what's sent over network so if you spoof your ping you'll see what's actually sent over the network
            if (Config.pingToggle.Value)
            {
                short ping = (short)Photon.Pun.PhotonNetwork.field_Public_Static_LoadBalancingClient_0.prop_LoadBalancingPeer_0.RoundTripTime;
                AddColor(PlayerEntry.GetPingColor(ping));
                if (ping < 9999 && ping > -999)
                {
                    AddEndColor(ping.ToString().PadRight(4) + "ms");
                }
                else
                {
                    AddEndColor(((double)(ping / 1000)).ToString("N1").PadRight(5) + "s");
                }
                AddSpacer();
            }

            // I STG if I have to remove fps because skids start walking up to people saying poeple's fps im gonna murder someone
            if (Config.fpsToggle.Value)
            {
                int fps = Mathf.Clamp((int)(1f / Time.deltaTime), -99, 999); // Clamp between -99 and 999
                AddColoredText(PlayerEntry.GetFpsColor(fps), fps.ToString().PadRight(3));
                AddSpacer();
            }

            if (Config.platformToggle.Value)
            {
                AddText(PlayerEntry.ParsePlatform(Player.prop_Player_0).PadRight(2));
                AddSpacer();
            }

            if (Config.perfToggle.Value)
            {
                PerformanceRating rating = Player.prop_Player_0.field_Internal_VRCPlayer_0.prop_VRCAvatarManager_0.prop_AvatarPerformanceStats_0.field_Private_ArrayOf_PerformanceRating_0[(int)AvatarPerformanceCategory.Overall]; // Get from cache so it doesnt calculate perf all at once
                AddColoredText("#" + ColorUtility.ToHtmlStringRGB(VRCUiAvatarStatsPanel.Method_Private_Static_Color_AvatarPerformanceCategory_PerformanceRating_0(AvatarPerformanceCategory.Overall, rating)), PlayerEntry.ParsePerformanceText(rating).PadRight(5));
                AddSpacer();
            }

            if (Config.distanceToggle.Value)
            {
                AddText("0.0 m");
                AddSpacer();
            }

            if (Config.photonIdToggle.Value)
            {
                AddText(Player.prop_Player_0.field_Internal_VRCPlayer_0.field_Private_PhotonView_0.field_Private_Int32_0.ToString().PadRight(PlayerEntry.highestPhotonIdLength));
                AddSpacer();
            }

            if (Config.displayNameToggle.Value)
            {
                switch (Config.DisplayNameColorMode)
                {
                case PlayerListMod.DisplayNameColorMode.None:
                case PlayerListMod.DisplayNameColorMode.FriendsOnly:
                    AddText(APIUser.CurrentUser.displayName);
                    break;

                case PlayerListMod.DisplayNameColorMode.TrustAndFriends:
                case PlayerListMod.DisplayNameColorMode.TrustOnly:
                    AddColoredText("#" + ColorUtility.ToHtmlStringRGB(VRCPlayer.Method_Public_Static_Color_APIUser_0(APIUser.CurrentUser)), APIUser.CurrentUser.displayName);
                    break;
                }
                AddSpacer();
            }

            if (textComponent.text.Length > 0)
            {
                if (Config.condensedText.Value)
                {
                    textComponent.text = textComponent.text.Remove(textComponent.text.Length - 1, 1);
                }
                else
                {
                    textComponent.text = textComponent.text.Remove(textComponent.text.Length - 3, 3);
                }
            }

            if (!Config.numberedList.Value)
            {
                if (Config.condensedText.Value)
                {
                    AddTextToBeginning("-");
                }
                else
                {
                    AddTextToBeginning(" - ");
                }
            }
            else
            if (Config.condensedText.Value)
            {
                AddTextToBeginning("1.".PadRight((gameObject.transform.parent.childCount - 2).ToString().Length + 1));
            }
            else
            {
                AddTextToBeginning("1. ".PadRight((gameObject.transform.parent.childCount - 2).ToString().Length + 2));
            }
        }
Beispiel #26
0
        public static IEnumerator ApplyPerformanceFiltersEnumerator(GameObject avatarObject, AvatarPerformanceStats perfStats, PerformanceRating minPerfRating, FilterBlockCallback onBlock)
        {
            // Performance Filtering is disabled.
            if (minPerfRating == PerformanceRating.None)
            {
                yield break;
            }

            PerformanceFilterSet performanceFilterSet;

            if (VRC.ValidationHelpers.IsStandalonePlatform())
            {
                performanceFilterSet = Resources.Load <PerformanceFilterSet>("Validation/Performance/FilterSets/PerformanceFilterSet_Windows");
            }
            else
            {
                performanceFilterSet = Resources.Load <PerformanceFilterSet>("Validation/Performance/FilterSets/PerformanceFilterSet_Quest");
            }

            bool avatarBlocked = false;

            if (performanceFilterSet != null)
            {
                yield return(performanceFilterSet.ApplyPerformanceFilters(
                                 avatarObject,
                                 perfStats,
                                 minPerfRating,
                                 ShouldIgnoreComponentInternal,
                                 () => { avatarBlocked = true; }
                                 ));
            }

            if (!avatarBlocked)
            {
                yield break;
            }

            VRC.Core.Logger.LogFormat(
                "Avatar hidden due to low performance rating: [{0}] {1} - minimum setting: {2}",
                perfStats.avatarName,
                perfStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.Overall),
                minPerfRating
                );

            onBlock();
        }
        public static IEnumerator ApplyPerformanceFiltersEnumerator(GameObject avatarObject, AvatarPerformanceStats perfStats, PerformanceRating minPerfRating, FilterBlockCallback onBlock)
        {
            // Performance Filtering is disabled.
            if (minPerfRating == PerformanceRating.None)
            {
                yield break;
            }

            PerformanceFilterSet performanceFilterSet = GetPerformanceFilterSet();

            if (performanceFilterSet == null)
            {
                yield break;
            }

            bool avatarBlocked = false;

            yield return(performanceFilterSet.ApplyPerformanceFilters(
                             avatarObject,
                             perfStats,
                             minPerfRating,
                             ShouldIgnoreComponentInternal,
                             () => { avatarBlocked = true; }
                             ));

            if (!avatarBlocked)
            {
                yield break;
            }

            VRC.Core.Logger.LogFormat(
                "Avatar hidden due to low performance rating: [{0}] {1} - minimum setting: {2}",
                perfStats.avatarName,
                perfStats.GetPerformanceRatingForCategory(AvatarPerformanceCategory.Overall),
                minPerfRating
                );

            onBlock();
        }
Beispiel #28
0
        protected override void ProcessText(object[] parameters = null)
        {
            if (player == null)
            {
                Remove();                 // Sometimes ppl will desync causing the leave event to not call
            }
            if (playerNet != null)
            {
                if (Config.pingToggle.Value)
                {
                    short ping = playerNet.prop_Int16_0;
                    AddColor(GetPingColor(ping));
                    if (ping < 9999 && ping > -999)
                    {
                        AddEndColor(ping.ToString().PadRight(4) + "ms");
                    }
                    else
                    {
                        AddEndColor(((double)(ping / 1000)).ToString("N1").PadRight(5) + "s");
                    }
                    AddSpacer();
                }

                // I STG if I have to remove fps because skids start walking up to people saying poeple's fps im gonna murder someone
                if (Config.fpsToggle.Value)
                {
                    int fps = Mathf.Clamp((int)(1000f / playerNet.field_Private_Byte_0), -99, 999);

                    AddColor(GetFpsColor(fps));
                    if (playerNet.field_Private_Byte_0 == 0)
                    {
                        AddEndColor("?¿?");
                    }
                    else
                    {
                        AddEndColor(fps.ToString().PadRight(3));
                    }
                    AddSpacer();
                }
            }
            else
            {
                if (Config.pingToggle.Value)
                {
                    AddColoredText("#ff0000", "?¿?".PadRight(4));
                    AddSpacer();
                }

                // I STG if I have to remove fps because skids start walking up to people saying poeple's fps im gonna murder someone
                if (Config.fpsToggle.Value)
                {
                    AddColoredText("#ff0000", "?¿?".PadRight(3));
                    AddSpacer();
                }

                playerNet = player.GetComponent <PlayerNet>();
            }

            if (Config.platformToggle.Value)
            {
                AddText(ParsePlatform(player).PadRight(2));
                AddSpacer();
            }

            if (Config.perfToggle.Value)
            {
                PerformanceRating rating = player.field_Internal_VRCPlayer_0.prop_VRCAvatarManager_0.prop_AvatarPerformanceStats_0.field_Private_ArrayOf_PerformanceRating_0[(int)AvatarPerformanceCategory.Overall]; // Get from cache so it doesnt calculate perf all at once
                AddColoredText("#" + ColorUtility.ToHtmlStringRGB(VRCUiAvatarStatsPanel.Method_Private_Static_Color_AvatarPerformanceCategory_PerformanceRating_0(AvatarPerformanceCategory.Overall, rating)), ParsePerformanceText(rating));
                AddSpacer();
            }

            if (Config.distanceToggle.Value)
            {
                if (worldAllowed)
                {
                    float distance = (player.transform.position - Player.prop_Player_0.transform.position).magnitude;
                    if (distance < 100)
                    {
                        AddText(distance.ToString("N1").PadRight(4) + "m");
                    }
                    else if (distance < 10000)
                    {
                        AddText((distance / 1000).ToString("N1").PadRight(3) + "km");
                    }
                    else if (distance < 999900)
                    {
                        AddText((distance / 1000).ToString("N0").PadRight(3) + "km");
                    }
                    else
                    {
                        AddText((distance / 9.461e+15).ToString("N2").PadRight(3) + "ly"); // If its too large for kilometers ***just convert to light years***
                    }
                }
                else
                {
                    AddText("0.0 m");
                }
                AddSpacer();
            }

            if (Config.photonIdToggle.Value)
            {
                AddText(player.field_Internal_VRCPlayer_0.field_Private_PhotonView_0.field_Private_Int32_0.ToString().PadRight(highestPhotonIdLength));
                AddSpacer();
            }

            if (Config.displayNameToggle.Value) // Why?
            {
                switch (Config.DisplayNameColorMode)
                {
                case PlayerListMod.DisplayNameColorMode.TrustAndFriends:
                    AddColoredText("#" + ColorUtility.ToHtmlStringRGB(VRCPlayer.Method_Public_Static_Color_APIUser_0(player.field_Private_APIUser_0)), player.field_Private_APIUser_0.displayName);
                    break;

                case PlayerListMod.DisplayNameColorMode.None:
                    AddText(player.field_Private_APIUser_0.displayName);
                    break;

                case PlayerListMod.DisplayNameColorMode.TrustOnly:
                    // ty bono for this (https://github.com/ddakebono/)
                    spoofFriend = true;
                    AddColoredText("#" + ColorUtility.ToHtmlStringRGB(VRCPlayer.Method_Public_Static_Color_APIUser_0(player.field_Private_APIUser_0)), player.field_Private_APIUser_0.displayName);
                    break;

                case PlayerListMod.DisplayNameColorMode.FriendsOnly:
                    if (APIUser.IsFriendsWith(player.field_Private_APIUser_0.id))
                    {
                        AddColoredText("#" + ColorUtility.ToHtmlStringRGB(VRCPlayer.Method_Public_Static_Color_APIUser_0(player.field_Private_APIUser_0)), player.field_Private_APIUser_0.displayName);
                    }
                    else
                    {
                        AddText(player.field_Private_APIUser_0.displayName);
                    }
                    break;
                }
                AddSpacer();
            }

            if (textComponent.text.Length > 0)
            {
                if (Config.condensedText.Value)
                {
                    textComponent.text = textComponent.text.Remove(textComponent.text.Length - 1, 1);
                }
                else
                {
                    textComponent.text = textComponent.text.Remove(textComponent.text.Length - 3, 3);
                }
            }

            if (!Config.numberedList.Value)
            {
                if (Config.condensedText.Value)
                {
                    AddTextToBeginning("-");
                }
                else
                {
                    AddTextToBeginning(" - ");
                }
            }
            else
            if (Config.condensedText.Value)
            {
                AddTextToBeginning($"{gameObject.transform.GetSiblingIndex() - 1}.".PadRight((gameObject.transform.parent.childCount - 2).ToString().Length + 1));     // Pad by weird amount because we cant include the header and disabled template in total number of gameobjects
            }
            else
            {
                AddTextToBeginning($"{gameObject.transform.GetSiblingIndex() - 1}. ".PadRight((gameObject.transform.parent.childCount - 2).ToString().Length + 2));
            }
        }
Beispiel #29
0
        private PerformanceRating CalculatePerformanceRatingForCategory(AvatarPerformanceCategory perfCategory)
        {
            switch (perfCategory)
            {
            case AvatarPerformanceCategory.Overall:
            {
                PerformanceRating maxRating = PerformanceRating.None;

                foreach (AvatarPerformanceCategory category in Enum.GetValues(typeof(AvatarPerformanceCategory)))
                {
                    if (category == AvatarPerformanceCategory.None ||
                        category == AvatarPerformanceCategory.Overall ||
                        category == AvatarPerformanceCategory.AvatarPerformanceCategoryCount)
                    {
                        continue;
                    }

                    PerformanceRating rating = GetPerformanceRatingForCategory(category);
                    if (rating > maxRating)
                    {
                        maxRating = rating;
                    }
                }

                return(maxRating);
            }

            case AvatarPerformanceCategory.PolyCount:
            {
                if (!polyCount.HasValue)
                {
                    return(PerformanceRating.None);
                }

                return(CalculatePerformanceRating((x, y) => x.polyCount.GetValueOrDefault() - y.polyCount));
            }

            case AvatarPerformanceCategory.AABB:
            {
                if (!aabb.HasValue)
                {
                    return(PerformanceRating.None);
                }

                return(CalculatePerformanceRating(
                           (x, y) =>
                           ApproxLessOrEqual(y.aabb.extents.x, 0.0f) ||  // -1 extents means "no AABB limit"
                           (
                               ApproxLessOrEqual(x.aabb.GetValueOrDefault().extents.x, y.aabb.extents.x) &&
                               ApproxLessOrEqual(x.aabb.GetValueOrDefault().extents.y, y.aabb.extents.y) &&
                               ApproxLessOrEqual(x.aabb.GetValueOrDefault().extents.z, y.aabb.extents.z))
                                ? -1
                                : 1
                           ));
            }

            case AvatarPerformanceCategory.SkinnedMeshCount:
            {
                if (!skinnedMeshCount.HasValue)
                {
                    return(PerformanceRating.None);
                }

                return(CalculatePerformanceRating((x, y) => x.skinnedMeshCount.GetValueOrDefault() - y.skinnedMeshCount));
            }

            case AvatarPerformanceCategory.MeshCount:
            {
                if (!meshCount.HasValue)
                {
                    return(PerformanceRating.None);
                }

                return(CalculatePerformanceRating((x, y) => x.meshCount.GetValueOrDefault() - y.meshCount));
            }

            case AvatarPerformanceCategory.MaterialCount:
            {
                if (!materialCount.HasValue)
                {
                    return(PerformanceRating.None);
                }

                return(CalculatePerformanceRating((x, y) => x.materialCount.GetValueOrDefault() - y.materialCount));
            }

            case AvatarPerformanceCategory.AnimatorCount:
            {
                if (!animatorCount.HasValue)
                {
                    return(PerformanceRating.None);
                }

                return(CalculatePerformanceRating((x, y) => x.animatorCount.GetValueOrDefault() - y.animatorCount));
            }

            case AvatarPerformanceCategory.BoneCount:
            {
                if (!boneCount.HasValue)
                {
                    return(PerformanceRating.None);
                }

                return(CalculatePerformanceRating((x, y) => x.boneCount.GetValueOrDefault() - y.boneCount));
            }

            case AvatarPerformanceCategory.LightCount:
            {
                if (!lightCount.HasValue)
                {
                    return(PerformanceRating.None);
                }

                return(CalculatePerformanceRating((x, y) => x.lightCount.GetValueOrDefault() - y.lightCount));
            }

            case AvatarPerformanceCategory.ParticleSystemCount:
            {
                if (!particleSystemCount.HasValue)
                {
                    return(PerformanceRating.None);
                }

                return(CalculatePerformanceRating((x, y) => x.particleSystemCount.GetValueOrDefault() - y.particleSystemCount));
            }

            case AvatarPerformanceCategory.ParticleTotalCount:
            {
                if (!particleTotalCount.HasValue)
                {
                    return(PerformanceRating.None);
                }

                return(CalculatePerformanceRating((x, y) => x.particleTotalCount.GetValueOrDefault() - y.particleTotalCount));
            }

            case AvatarPerformanceCategory.ParticleMaxMeshPolyCount:
            {
                if (!particleMaxMeshPolyCount.HasValue)
                {
                    return(PerformanceRating.None);
                }

                return(CalculatePerformanceRating((x, y) => x.particleMaxMeshPolyCount.GetValueOrDefault() - y.particleMaxMeshPolyCount));
            }

            case AvatarPerformanceCategory.ParticleTrailsEnabled:
            {
                if (!particleTrailsEnabled.HasValue)
                {
                    return(PerformanceRating.None);
                }

                return(CalculatePerformanceRating(
                           (x, y) =>
                    {
                        if (x.particleTrailsEnabled == y.particleTrailsEnabled)
                        {
                            return 0;
                        }

                        return x.particleTrailsEnabled.GetValueOrDefault() ? 1 : -1;
                    }));
            }

            case AvatarPerformanceCategory.ParticleCollisionEnabled:
            {
                if (!particleCollisionEnabled.HasValue)
                {
                    return(PerformanceRating.None);
                }

                return(CalculatePerformanceRating(
                           (x, y) =>
                    {
                        if (x.particleCollisionEnabled == y.particleCollisionEnabled)
                        {
                            return 0;
                        }

                        return x.particleCollisionEnabled.GetValueOrDefault() ? 1 : -1;
                    }));
            }

            case AvatarPerformanceCategory.TrailRendererCount:
            {
                if (!trailRendererCount.HasValue)
                {
                    return(PerformanceRating.None);
                }

                return(CalculatePerformanceRating((x, y) => x.trailRendererCount.GetValueOrDefault() - y.trailRendererCount));
            }

            case AvatarPerformanceCategory.LineRendererCount:
            {
                if (!lineRendererCount.HasValue)
                {
                    return(PerformanceRating.None);
                }

                return(CalculatePerformanceRating((x, y) => x.lineRendererCount.GetValueOrDefault() - y.lineRendererCount));
            }

            case AvatarPerformanceCategory.DynamicBoneComponentCount:
            {
                if (!dynamicBoneComponentCount.HasValue)
                {
                    return(PerformanceRating.None);
                }

                return(CalculatePerformanceRating((x, y) => x.dynamicBoneComponentCount.GetValueOrDefault() - y.dynamicBoneComponentCount));
            }

            case AvatarPerformanceCategory.DynamicBoneSimulatedBoneCount:
            {
                if (!dynamicBoneSimulatedBoneCount.HasValue)
                {
                    return(PerformanceRating.None);
                }

                return(CalculatePerformanceRating((x, y) => x.dynamicBoneSimulatedBoneCount.GetValueOrDefault() - y.dynamicBoneSimulatedBoneCount));
            }

            case AvatarPerformanceCategory.DynamicBoneColliderCount:
            {
                if (!dynamicBoneColliderCount.HasValue)
                {
                    return(PerformanceRating.None);
                }

                return(CalculatePerformanceRating((x, y) => x.dynamicBoneColliderCount.GetValueOrDefault() - y.dynamicBoneColliderCount));
            }

            case AvatarPerformanceCategory.DynamicBoneCollisionCheckCount:
            {
                if (!dynamicBoneCollisionCheckCount.HasValue)
                {
                    return(PerformanceRating.None);
                }

                return(CalculatePerformanceRating((x, y) => x.dynamicBoneCollisionCheckCount.GetValueOrDefault() - y.dynamicBoneCollisionCheckCount));
            }

            case AvatarPerformanceCategory.ClothCount:
            {
                if (!clothCount.HasValue)
                {
                    return(PerformanceRating.None);
                }
                return(CalculatePerformanceRating((x, y) => x.clothCount.GetValueOrDefault() - y.clothCount));
            }

            case AvatarPerformanceCategory.ClothMaxVertices:
            {
                if (!clothMaxVertices.HasValue)
                {
                    return(PerformanceRating.None);
                }
                return(CalculatePerformanceRating((x, y) => x.clothMaxVertices.GetValueOrDefault() - y.clothMaxVertices));
            }

            case AvatarPerformanceCategory.PhysicsColliderCount:
            {
                if (!physicsColliderCount.HasValue)
                {
                    return(PerformanceRating.None);
                }

                return(CalculatePerformanceRating((x, y) => x.physicsColliderCount.GetValueOrDefault() - y.physicsColliderCount));
            }

            case AvatarPerformanceCategory.PhysicsRigidbodyCount:
            {
                if (!physicsRigidbodyCount.HasValue)
                {
                    return(PerformanceRating.None);
                }

                return(CalculatePerformanceRating((x, y) => x.physicsRigidbodyCount.GetValueOrDefault() - y.physicsRigidbodyCount));
            }

            case AvatarPerformanceCategory.AudioSourceCount:
            {
                if (!audioSourceCount.HasValue)
                {
                    return(PerformanceRating.None);
                }

                return(CalculatePerformanceRating((x, y) => x.audioSourceCount.GetValueOrDefault() - y.audioSourceCount));
            }

            case AvatarPerformanceCategory.DownloadSize:
            {
                if (!downloadSize.HasValue)
                {
                    return(PerformanceRating.None);
                }

                return(PerformanceRating.Excellent);
            }

            default:
            {
                return(PerformanceRating.None);
            }
            }
        }