private void ApplyToIconPanel(UIPanel groupPanel, IconPanelModifier modifier, bool verticalScroll)
 {
     if (groupPanel == null)
     {
         return;
     }
     if (modifier == null)
     {
         return;
     }
     try{                                                      //seperator panels do not have UIScrollablePanels nor UIScrollbars
         UITabContainer tabContainer = groupPanel.GetComponentInChildren <UITabContainer>();
         foreach (UIComponent comp in tabContainer.components) //for each displayable panel of icons
         {
             if (comp is UIPanel)
             {
                 UIPanel           panel = comp as UIPanel;
                 UIScrollablePanel sp    = panel.GetComponentInChildren <UIScrollablePanel>();
                 UIScrollbar       sb    = panel.GetComponentInChildren <UIScrollbar>();
                 modifier.Invoke(panel, sp, sb, verticalScroll);
                 panel.Invalidate();
                 sp.Invalidate();
                 sb.Invalidate();
             }
         }
         tabContainer.Invalidate();
     }catch (Exception e) {
         //Debug.Print(groupPanel,e);
     }
 }
Beispiel #2
0
        private UIScrollablePanel CreateScrollablePanel(UIPanel panel) {
            panel.autoLayout = true;
            panel.autoLayoutDirection = LayoutDirection.Horizontal;

            UIScrollablePanel scrollablePanel = panel.AddUIComponent<UIScrollablePanel>();
            scrollablePanel.autoLayout = true;
            scrollablePanel.autoLayoutPadding = new RectOffset(10, 10, 0, 16);
            scrollablePanel.autoLayoutStart = LayoutStart.TopLeft;
            scrollablePanel.wrapLayout = true;
            scrollablePanel.size = new Vector2(panel.size.x - V_SCROLLBAR_WIDTH, panel.size.y);
            scrollablePanel.autoLayoutDirection = LayoutDirection.Horizontal; //Vertical does not work but why?

            UIScrollbar verticalScrollbar = CreateVerticalScrollbar(panel, scrollablePanel);
            verticalScrollbar.Show();
            verticalScrollbar.Invalidate();
            scrollablePanel.Invalidate();

            return scrollablePanel;
        }