예제 #1
0
        private static void OnUiUserListAwake(UiUserList __instance)
        {
            if (!ShouldAdjustList(__instance))
            {
                return;
            }

            GameObject         pickerPrefab = (GameObject)pickerPrefabProp.GetValue(__instance);
            VRCUiContentButton picker       = pickerPrefab.GetComponent <VRCUiContentButton>();

            if (picker.field_Public_VRCUiDynamicOverlayIcons_0.field_Public_ArrayOf_GameObject_0.Any(iconCheck => iconCheck.name == "PrivateInstanceIcon"))
            {
                return;
            }

            GameObject[] newArr = new GameObject[picker.field_Public_VRCUiDynamicOverlayIcons_0.field_Public_ArrayOf_GameObject_0.Length + 1];
            picker.field_Public_VRCUiDynamicOverlayIcons_0.field_Public_ArrayOf_GameObject_0.CopyTo(newArr, 0);

            GameObject icon = GameObject.Instantiate(picker.transform.Find("Icons/OverlayIcons/iconUserOnPC").gameObject);

            icon.name = "PrivateInstanceIcon";
            icon.transform.SetParent(picker.transform.Find("Icons/OverlayIcons"));
            icon.SetActive(false);

            newArr[newArr.Length - 1] = icon;

            picker.field_Public_VRCUiDynamicOverlayIcons_0.field_Public_ArrayOf_GameObject_0 = newArr;
        }
예제 #2
0
        private static void OnSetPickerContentFromApiModel(UiUserList __instance, VRCUiContentButton __0, Il2CppSystem.Object __1)
        {
            if (!ShouldAdjustList(__instance))
            {
                return;
            }

            APIUser user = __1.TryCast <APIUser>();

            if (user == null)
            {
                return;
            }

            GameObject icon = __0.field_Public_VRCUiDynamicOverlayIcons_0.field_Public_ArrayOf_GameObject_0.First(gameObject => gameObject.name == "PrivateInstanceIcon");

            if (UserInstanceSprite(user) is Sprite sprite)
            {
                icon.GetComponent <Image>().sprite = sprite;
                icon.SetActive(true);
            }
            else
            {
                icon.SetActive(false);
            }
        }
예제 #3
0
        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;
            }
        }
예제 #4
0
        private static bool ShouldAdjustList(UiUserList list)
        {
            int enumValue = (int)listEnum.GetValue(list);

            if (Config.IncludeFavoritesList && enumValue != 3 && enumValue != 7)
            {
                return(false);
            }
            else if (!Config.IncludeFavoritesList && enumValue != 3)
            {
                return(false);
            }
            return(true);
        }
예제 #5
0
        private static void SetupRefreshButton()
        {
            GameObject gameObject = GameObject.Find("Screens/Social/Current Status/StatusButton");

            if (gameObject != null)
            {
                GameObject gameObject2 = Object.Instantiate(gameObject.transform.GetComponentInChildren <Button>().gameObject);
                gameObject2.gameObject.name          = "SocialRefreshButton";
                gameObject2.transform.localPosition += new Vector3(250f, 0f, 0f);
                gameObject2.GetComponentInChildren <Text>().text      = "Refresh";
                gameObject2.GetComponentInChildren <Button>().onClick = new Button.ButtonClickedEvent();
                gameObject2.GetComponentInChildren <Button>().onClick.AddListener((System.Action) delegate
                {
                    if (Time.time > LastRefreshTime)
                    {
                        LastRefreshTime = Time.time + 30f;
                        Il2CppArrayBase <UiUserList> il2CppArrayBase = Resources.FindObjectsOfTypeAll <UiUserList>();
                        if (il2CppArrayBase != null)
                        {
                            for (int i = 0; i < il2CppArrayBase.Count; i++)
                            {
                                UiUserList uiUserList = il2CppArrayBase[i];
                                if (!(uiUserList == null))
                                {
                                    uiUserList.Method_Public_Void_1();
                                    uiUserList.Method_Public_Void_0();
                                    uiUserList.Method_Public_Void_3();
                                }
                            }
                        }
                    }
                    else
                    {
                        float num = LastRefreshTime - Time.time;
                        Popup("API Call Is On Cooldown!", "Please Wait " + Math.Floor(num) + " Seconds Before Trying Again!");
                    }
                });

                GameObject gameObject3 = GameObject.Find("Screens/Social/Current Status");
                gameObject2.transform.SetParent(gameObject3.transform, worldPositionStays: false);
                GameObject.Find("Screens/Social/Current Status/StatusText").GetComponent <Text>().transform.localPosition += new Vector3(250f, 0f, 0f);
                GameObject.Find("Screens/Social/Current Status/StatusIcon").transform.localPosition += new Vector3(250f, 0f, 0f);

                SocialRefreshButtonHasBeenMade = true;
            }
        }