private static void OnRenderList(UiUserList __instance, Il2CppSystem.Collections.Generic.List <APIUser> __0)
        {
            if (__0.Count == 0)
            {
                return;
            }

            if (!Config.isAnyTypeHidden || !ShouldAdjustList(__instance))
            {
                if (listTitleTable.TryGetValue(__instance.GetInstanceID(), out string pastText))
                {
                    string text = __instance.field_Public_Text_0.text;

                    int indexOfLastText = text.LastIndexOf(pastText);
                    if (indexOfLastText != -1)
                    {
                        text = text.Remove(indexOfLastText, pastText.Length);
                    }

                    __instance.field_Public_Text_0.text = text;
                }
            }
            else
            {
                int hiddenCount = 0;
                int shownCount  = 0;
                for (int i = __0.Count - 1; i >= 0; i--)
                {
                    if (ShouldHideUser(__0[i]))
                    {
                        hiddenCount++;
                        __0.RemoveAt(i);
                    }
                    else
                    {
                        shownCount++;
                    }
                }

                string text       = __instance.field_Public_Text_0.text;
                string hiddenText = $" [{hiddenCount} hidden, {shownCount} shown]";

                if (!listTitleTable.TryGetValue(__instance.GetInstanceID(), out string pastText))
                {
                    listTitleTable.Add(__instance.GetInstanceID(), hiddenText);
                }
                else
                {
                    int indexOfLastText = text.LastIndexOf(pastText);
                    if (indexOfLastText != -1)
                    {
                        text = text.Remove(indexOfLastText, pastText.Length);
                    }
                }

                __instance.field_Public_Text_0.text        = text + hiddenText;
                listTitleTable[__instance.GetInstanceID()] = hiddenText;
            }
        }
Beispiel #2
0
 private static bool CanPlay(SongSelect select)
 {
     if (select is null)
     {
         MelonLogger.Warning("SongSelect not found");
         return(false);
     }
     songs = new Il2CppSystem.Collections.Generic.List <SongSelectItem>();
     songs = select.GetSongButtons();
     songs.RemoveAt(0);
     if (songs.Count == 0)
     {
         MelonLogger.Warning("No songs in playlist");
         return(false);
     }
     return(true);
 }
Beispiel #3
0
        private static void Update
        <T, TSelf>(IList <TSelf> cache, Il2CppSystem.Collections.Generic.List <T> colliders)
            where TSelf : class, IDisplay <T, TSelf>, new() where T : Collider
        {
            var j = 0;

            for (var i = colliders.Count - 1; i >= 0; i--)
            {
                if (colliders[i] == null || !colliders[i].enabled)
                {
                    colliders.RemoveAt(i);
                    cache[colliders.Count].Enabled = false;
                    continue;
                }

                cache[j++].Update(colliders[i]);
            }
        }