Beispiel #1
0
            private static void Postfix(Panel_CustomXPSetup __instance, ref int index)
            {
                GameObject setting = __instance.m_CustomXPMenuItemOrder[index];

                if (setting == null)
                {
                    return;
                }

                DescriptionHolder description = setting.GetComponent <DescriptionHolder>();

                if (description != null)
                {
                    __instance.m_TooltipLabel.text = description.Text;
                }
            }
            private static void Postfix(Panel_CustomXPSetup __instance)
            {
                int selectedIndex = __instance.m_CustomXPSelectedButtonIndex;

                Il2Cpp.List <GameObject> menuItems = __instance.m_CustomXPMenuItemOrder;

                ConsoleSlider slider = menuItems[selectedIndex].GetComponentInChildren <ConsoleSlider>();

                if (!slider || !slider.m_Slider)
                {
                    return;                     // Not a slider
                }
                bool  isStepless = (slider.m_Slider.numberOfSteps <= 1);
                float movement   = isStepless ? GetRawMenuInputHorizontal() : GetTimeredMenuInputHorizontal();

                MoveSlider(slider, movement);
            }
        private static void ResizeScrollBar(Panel_CustomXPSetup panel, UIGrid uiGrid)
        {
            UISlider slider      = panel.m_Scrollbar.GetComponentInChildren <UISlider>(true);
            float    viewHeight  = panel.m_ScrollPanel.height;
            float    absoluteVal = slider.value * (panel.m_ScrollPanelHeight - viewHeight);
            int      childCount  = uiGrid.GetChildList().Count;

            float height = childCount * gridCellHeight;

            panel.m_ScrollPanelHeight = height;

            ScrollbarThumbResizer thumbResizer = slider.GetComponent <ScrollbarThumbResizer>();

            thumbResizer.SetNumSteps((int)panel.m_ScrollPanel.height, (int)height);

            slider.value = Mathf.Clamp01(absoluteVal / Mathf.Max(1, panel.m_ScrollPanelHeight - viewHeight));
            panel.OnScrollbarChange();
        }
Beispiel #4
0
        private GameObject CreateScrollBar(UIPanel scrollPanel)
        {
            // Terrible code in this method. I've given up trying to fix their scroll bar layout
            Panel_CustomXPSetup xpModePanel     = InterfaceManager.LoadPanel <Panel_CustomXPSetup>();
            GameObject          scrollbarParent = xpModePanel.m_Scrollbar;
            GameObject          scrollbarPrefab = scrollbarParent.transform.GetChild(0).gameObject;
            GameObject          scrollbar       = NGUITools.AddChild(gameObject, scrollbarPrefab);

            scrollbar.name = "Scrollbar";
            scrollbar.transform.localPosition = new Vector2(415, -40);

            int      height = (int)scrollPanel.height;
            UISlider slider = scrollbar.GetComponentInChildren <UISlider>(true);

            slider.backgroundWidget.GetComponent <UISprite>().height          = height;
            slider.foregroundWidget.GetComponent <UISprite>().height          = height;
            scrollbar.transform.Find("glow").GetComponent <UISprite>().height = height + 44;

            EventDelegate.Set(slider.onChange, new System.Action(() => OnScroll(slider, true)));

            return(scrollbar);
        }