Пример #1
0
        public override GameObject CreateObject(Transform parent)
        {
            ModalView yoinkFromView = Resources.FindObjectsOfTypeAll <ModalView>().First(x => x.name == "DropdownTableView");
            ModalView modalView     = GameObject.Instantiate(yoinkFromView, parent);

            modalView.SetField("_presentPanelAnimations", yoinkFromView.GetField <PanelAnimationSO, ModalView>("_presentPanelAnimations"));
            modalView.SetField("_dismissPanelAnimation", yoinkFromView.GetField <PanelAnimationSO, ModalView>("_dismissPanelAnimation"));
            modalView.SetField("_container", BeatSaberUI.DiContainer);
            modalView.GetComponent <VRGraphicRaycaster>().SetField("_physicsRaycaster", BeatSaberUI.PhysicsRaycasterWithCache);

            GameObject.Destroy(modalView.GetComponent <TableView>());
            GameObject.Destroy(modalView.GetComponent <TableViewScroller>());
            GameObject.Destroy(modalView.GetComponent <ScrollRect>());

            foreach (RectTransform child in modalView.transform)
            {
                if (child.name == "BG")
                {
                    child.anchoredPosition = Vector2.zero;
                    child.sizeDelta        = Vector2.zero;
                }
                else
                {
                    GameObject.Destroy(child.gameObject);
                }
            }

            RectTransform rectTransform = modalView.transform as RectTransform;

            rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
            rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
            rectTransform.sizeDelta = new Vector2(0, 0);

            return(modalView.gameObject);
        }
Пример #2
0
        public override GameObject CreateObject(Transform parent)
        {
            if (modalViewTemplate == null)
            {
                modalViewTemplate = Resources.FindObjectsOfTypeAll <ModalView>().First(x => x.name == "DropdownTableView");
            }
            ModalView modalView = Object.Instantiate(modalViewTemplate, parent);

            modalView.SetField("_presentPanelAnimations", modalViewTemplate.GetField <PanelAnimationSO, ModalView>("_presentPanelAnimations"));
            modalView.SetField("_dismissPanelAnimation", modalViewTemplate.GetField <PanelAnimationSO, ModalView>("_dismissPanelAnimation"));
            modalView.SetField("_container", BeatSaberUI.DiContainer);
            modalView.GetComponent <VRGraphicRaycaster>().SetField("_physicsRaycaster", BeatSaberUI.PhysicsRaycasterWithCache);

            Object.DestroyImmediate(modalView.GetComponent <TableView>());
            Object.DestroyImmediate(modalView.GetComponent <ScrollRect>());
            Object.DestroyImmediate(modalView.GetComponent <ScrollView>());
            Object.DestroyImmediate(modalView.GetComponent <EventSystemListener>());
            //GameObject.DestroyImmediate(modalView.GetComponent<Touchable>());
            //modalView.gameObject.AddComponent<CurvedCanvasSettings>();
            //modalView.gameObject.AddComponent<EventSystemListener>();

            foreach (RectTransform child in modalView.transform)
            {
                if (child.name == "BG")
                {
                    child.anchoredPosition = Vector2.zero;
                    child.sizeDelta        = Vector2.zero;
                }
                else
                {
                    Object.Destroy(child.gameObject);
                }
            }

            RectTransform rectTransform = modalView.transform as RectTransform;

            rectTransform.anchorMin = new Vector2(0.5f, 0.5f);
            rectTransform.anchorMax = new Vector2(0.5f, 0.5f);
            rectTransform.sizeDelta = new Vector2(0, 0);

            return(modalView.gameObject);
        }
Пример #3
0
        static void Postfix(ModalView __instance, GameObject ____blockerGO)
        {
            var cb = ____blockerGO.GetComponent <Canvas>();

            var h = (__instance.transform.parent.GetComponentInParent <HMUI.Screen>()
                     ?.GetComponentsInChildren <Canvas>()
                     .Where(x => x.sortingLayerID == cb.sortingLayerID)
                     .Select(x => x.sortingOrder)
                     .DefaultIfEmpty(0)
                     .Max() ?? 0) + 1;

            cb.overrideSorting = true;
            cb.sortingOrder    = h;

            cb = __instance.GetComponent <Canvas>();
            cb.overrideSorting = true;
            cb.sortingOrder    = h + 1;
        }