void statsubpanel_eventClick(UIComponent component, UIMouseEventParameter eventParam)
        {
            string[] mystring     = component.name.Split('|');
            bool     isStatActive = !CSLStatsPanelConfigSettings.isStatActive(mystring[0], mystring[1]);

            CSLStatsPanelConfigSettings.setStatActive(mystring[0], mystring[1], isStatActive);
            CSLStatsPanelConfigSettings.m_ConfigChanged.value = true;

            UIButton b = (UIButton)component;

            b.textColor        = (isStatActive) ? selectedcolor : deselectedcolor;
            b.focusedColor     = b.textColor;
            b.focusedTextColor = b.textColor;
            b.parent.Focus();

            component.color = (isStatActive) ? selectedcolor : deselectedcolor;
            //component.parent.color = component.color;
            //eventStatsConfigChanged(this, EventArgs.Empty);
        }
        UIPanel drawstatsconfigpanel(StatisticsCategoryWrapper scw)
        {
            UIPanel catsubpanel = this.AddUIComponent <UIPanel>();

            catpanels.Add(catsubpanel);
            catsubpanel.autoLayout          = true;
            catsubpanel.wrapLayout          = true;
            catsubpanel.autoLayoutDirection = LayoutDirection.Horizontal;
            catsubpanel.width            = this.width - 5;
            catsubpanel.backgroundSprite = "GenericPanel";
            //catsubpanel.height = 15;
            catsubpanel.autoLayoutPadding = new RectOffset(3, 3, 3, 3);

            bool     catisChecked = CSLStatsPanelConfigSettings.isCatActive(scw.m_category);
            UIButton catname      = catsubpanel.AddUIComponent <UIButton>();

            catname.textColor = (catisChecked) ? selectedcolor : deselectedcolor;
            setcommonbuttonprops(catname);
            catname.autoSize  = true;
            catname.text      = scw.m_category;
            catname.name      = scw.m_category;
            catsubpanel.color = (catisChecked) ? selectedcolor : deselectedcolor;

            catsubpanel.autoSize = true;
            catname.eventClick  += new MouseEventHandler(catsubpanel_eventClick);

            for (int x = 0; x < scw.m_scwlist.Count(); x++)
            {
                bool     isStatActive = CSLStatsPanelConfigSettings.isStatActive(scw.m_category, scw.m_scwlist[x].m_desc);
                UIButton statname     = catsubpanel.AddUIComponent <UIButton>();
                statname.name = scw.m_category + "|" + scw.m_scwlist[x].m_desc;

                statname.color     = (isStatActive) ? selectedcolor : deselectedcolor;
                statname.textColor = (isStatActive) ? selectedcolor : deselectedcolor;
                setcommonbuttonprops(statname);
                statname.text        = scw.m_scwlist[x].m_desc;
                statname.eventClick += new MouseEventHandler(statsubpanel_eventClick);
            }
            catsubpanel.FitChildrenVertically();


            return(catsubpanel);
        }