Example #1
0
        /// <summary>
        /// Setup the scrollable panel
        /// </summary>
        private void SetupScrollablePanel()
        {
            // Gets the main toolbar
            var mainToolbar = ToolsModifierControl.mainToolbar.component as UITabstrip;

            // Gets the main group panel
            var groupPanel = mainToolbar.GetComponentInContainer(m_toolbarButton, typeof(UIGroupPanel)) as UIGroupPanel;

            groupPanel.name    = UIGroupPanel.Name;
            groupPanel.enabled = true;
            groupPanel.component.isInteractive   = true;
            groupPanel.m_OptionsBar              = m_optionPanel;
            groupPanel.m_DefaultInfoTooltipAtlas = ToolsModifierControl.mainToolbar.m_DefaultInfoTooltipAtlas;
            if (ToolsModifierControl.mainToolbar.enabled)
            {
                groupPanel.RefreshPanel();
            }

            // Gets scrollable toolbar
            m_scrollablePanel = groupPanel.GetComponentInChildren <UIScrollablePanel>();
            UIGeneratorOptionPanel.SetupInstance(m_scrollablePanel);
            m_scrollablePanel.eventVisibilityChanged += OnChangeVisibilityPanel;
            m_scrollablePanel.eventMouseEnter        += OnMouseEnterScrollablePanel;
            m_scrollablePanel.eventMouseLeave        += OnMouseLeaveScrollablePanel;
        }
 private void Awake()
 {
     instance                      = this;
     mainPanel                     = GetComponentInChildren <UIScrollablePanel>();
     mainPanel.autoLayout          = true;
     mainPanel.autoLayoutDirection = LayoutDirection.Vertical;
 }
Example #3
0
        private IEnumerator <object> DoClick(UIScrollablePanel scrollablePanel, UIButton networkButton)
        {
            yield return(new WaitForSeconds(0.02f));

            networkButton.SimulateClick();
            scrollablePanel.ScrollIntoView(networkButton);
        }
        public void OnSettingsUI(UIHelperBase helper)
        {
            var tabTemplate = Resources
                .FindObjectsOfTypeAll<UITabstrip>()[0]
                .GetComponentInChildren<UIButton>();

            _optionsPanel = ((UIHelper)helper).self as UIScrollablePanel;
            _optionsPanel.autoLayout = false;

            UITabstrip strip = _optionsPanel.AddUIComponent<UITabstrip>();
            strip.relativePosition = new Vector3(0, 0);
            strip.size = new Vector2(744, 40);

            UITabContainer container = _optionsPanel.AddUIComponent<UITabContainer>();
            container.relativePosition = new Vector3(0, 40);
            container.size = new Vector3(744, 713);
            strip.tabPages = container;

            int tabIndex = 0;
            foreach (IModule module in Modules)
            {
                strip.AddTab(module.Name, tabTemplate, true);
                strip.selectedIndex = tabIndex;

                // Get the current container and use the UIHelper to have something in there
                UIPanel stripRoot = strip.tabContainer.components[tabIndex++] as UIPanel;
                stripRoot.autoLayout = true;
                stripRoot.autoLayoutDirection = LayoutDirection.Vertical;
                stripRoot.autoLayoutPadding.top = 5;
                stripRoot.autoLayoutPadding.left = 10;
                UIHelper stripHelper = new UIHelper(stripRoot);
                
                module.OnSettingsUI(stripHelper);
            }
        }
Example #5
0
        public UIHelper AddTabPage(string name, bool scrollBars = true)
        {
            UIButton tabButton = base.AddTab(name);

            tabButton.normalBgSprite   = "SubBarButtonBase";
            tabButton.disabledBgSprite = "SubBarButtonBaseDisabled";
            tabButton.focusedBgSprite  = "SubBarButtonBaseFocused";
            tabButton.hoveredBgSprite  = "SubBarButtonBaseHovered";
            tabButton.pressedBgSprite  = "SubBarButtonBasePressed";
            tabButton.textPadding      = new RectOffset(10, 10, 10, 6);
            tabButton.autoSize         = true;

            selectedIndex = tabCount - 1;
            UIPanel currentPanel = tabContainer.components[selectedIndex] as UIPanel;

            currentPanel.autoLayout = true;

            UIHelper panelHelper;

            if (scrollBars)
            {
                UIScrollablePanel scrollablePanel = CreateScrollablePanel(currentPanel);
                panelHelper = new UIHelper(scrollablePanel);
            }
            else
            {
                currentPanel.autoLayoutDirection = LayoutDirection.Vertical;
                panelHelper = new UIHelper(currentPanel);
            }
            return(panelHelper);
        }
        public ColumnSortingMode CurrentSortingMode = ColumnSortingMode.TimestampDescending; // default

        // runs only once, do internal init here
        public override void Awake()
        {
            base.Awake();

            // Note - parent may not be set yet

            SaveNameLabel  = AddUIComponent <UILabel>();
            CityNameLabel  = AddUIComponent <UILabel>();
            TimestampLabel = AddUIComponent <UILabel>();

            SortAsc_SaveName = AddUIComponent <UIButton>();
            //SortDesc_SaveName = AddUIComponent<UIButton>();

            SortAsc_CityName = AddUIComponent <UIButton>();
            //SortDesc_CityName = AddUIComponent<UIButton>();

            SortAsc_Timestamp = AddUIComponent <UIButton>();
            //SortDesc_Timestamp = AddUIComponent<UIButton>();

            //ListOfSaves = AddUIComponent<UIMultipartListBox>();

            SavesPanel = AddUIComponent <UIScrollablePanel>();

            // sortable list of row structs


            //// some defaults
            //this.height = 400;
            //this.width = 750;
        }
        private void ExpandIconPanel(UIPanel panel, UIScrollablePanel scrollablePanel, UIScrollbar horizontalScrollbar, bool verticalScroll)
        {
            panel.height *= defaultSize.y * rows;
            horizontalScrollbar.value = 0;


            //adjust layout of UIScollablePanel
            scrollablePanel.autoLayout      = true;
            scrollablePanel.autoLayoutStart = LayoutStart.TopLeft;
            scrollablePanel.wrapLayout      = true;
            scrollablePanel.width++;

            UIScrollbar verticalScrollbar;

            try{
                verticalScrollbar = m_verticalScrollbars[panel];
            }catch {
                verticalScrollbar           = CreateVerticalScrollbar(panel, scrollablePanel);
                m_verticalScrollbars[panel] = verticalScrollbar;
            }

            if (verticalScroll)
            {
                scrollablePanel.autoLayoutDirection = LayoutDirection.Horizontal;
                verticalScrollbar.Show();
            }
            else
            {
                verticalScrollbar.Hide();
                scrollablePanel.autoLayoutDirection = LayoutDirection.Vertical;
                horizontalScrollbar.decrementButton.relativePosition = new Vector3(defaultPositionDecrementButton.x, panel.height / 2.0f - 21.5f);
                horizontalScrollbar.incrementButton.relativePosition = new Vector3(defaultPositionIncrementButton.x, panel.height / 2.0f - 21.5f);
            }
        }
        private void addSlider(UIScrollablePanel panel, Vector3 position, float width, OnValueChanged eventCallback, IDifficultyParameter param)
        {
            UISlider slider = panel.AddUIComponent <UISlider>();

            slider.size             = new Vector2(width, 8);
            slider.relativePosition = position;
            slider.minValue         = 0;
            slider.maxValue         = param.MaxIndex;
            slider.stepSize         = 1;
            slider.value            = param.SelectedIndex;
            slider.backgroundSprite = "TextFieldPanel"; // TextFieldPanel, GenericProgressBar

            UISprite thumb = slider.AddUIComponent <UISprite>();

            thumb.size         = new Vector2(16, 16);
            thumb.spriteName   = "InfoIconBaseFocused"; // SliderBudget, InfoIconBaseFocused
            slider.thumbObject = thumb;

            UILabel label = panel.AddUIComponent <UILabel>();

            label.textScale        = textScaleSmall;
            label.text             = param.GetValueStr((int)slider.value);
            label.relativePosition = new Vector3(position.x + width + 10, position.y);

            slider.eventValueChanged += delegate(UIComponent c, float val)
            {
                label.text = param.GetValueStr((int)val);
                eventCallback(val);
            };

            sliders.Add(slider, param);
        }
Example #9
0
        private static UIHelper CreateTab(UIScrollablePanel mainPanel, string name)
        {
            TabStrip.AddTab(name, 1.25f);

            var tabPanel = mainPanel.AddUIComponent <UIPanel>();

            SetTabSize(tabPanel, mainPanel);
            tabPanel.isVisible = false;
            TabPanels.Add(tabPanel);

            var panel = tabPanel.AddUIComponent <UIScrollablePanel>();

            tabPanel.AddScrollbar(panel);
            panel.verticalScrollbar.eventVisibilityChanged += ScrollbarVisibilityChanged;

            panel.size                 = tabPanel.size;
            panel.relativePosition     = Vector2.zero;
            panel.autoLayout           = true;
            panel.autoLayoutDirection  = LayoutDirection.Vertical;
            panel.clipChildren         = true;
            panel.scrollWheelDirection = UIOrientation.Vertical;

            return(new UIHelper(panel));

            void ScrollbarVisibilityChanged(UIComponent component, bool value)
            {
                panel.width = tabPanel.width - (panel.verticalScrollbar.isVisible ? panel.verticalScrollbar.width : 0);
            }
        }
 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);
     }
 }
Example #11
0
 public void DrawPanels(UIScrollablePanel panel, string name)
 {
     panel                  = UIView.GetAView().FindUIComponent("PloppableBuildingPanel").AddUIComponent <UIScrollablePanel>();
     panel.size             = new Vector2(763, 109);
     panel.relativePosition = new Vector2(50, 0);
     panel.Reset();
 }
Example #12
0
        void TabClicked(UIComponent component, UIMouseEventParameter eventParam, UIScrollablePanel panel, UIButton button, UISprite sprite)
        {
            foreach (UIScrollablePanel pan in BuildingPanels)
            {
                pan.isVisible = false;
            }

            panel.isVisible = true;

            for (int i = 0; i <= types; i++)
            {
                if (i <= 5)
                {
                    TabSprites [i].spriteName = "Zoning" + Names[i];
                }
                else
                {
                    TabSprites[i].spriteName = "IconPolicy" + Names[i];
                }
            }

            if (sprite.spriteName != "IconPolicyLeisure" || sprite.spriteName != "IconPolicyTourist") //There are no focused AD special com sprites
            {
                sprite.spriteName = sprite.spriteName + "Focused";
            }
        }
        /// <summary>
        /// Creates a panel representing the mod and adds it to the <paramref name="parent"/> UI component.
        /// </summary>
        ///
        /// <param name="parent">The parent UI component that the panel will be added to.</param>
        /// <param name="modName">The name of the mod, which is displayed to user.</param>
        /// <param name="mod">The <see cref="PluginInfo"/> instance of the incompatible mod.</param>
        private void CreateEntry(ref UIScrollablePanel parent, string modName, PluginInfo mod)
        {
            string caption = mod.publishedFileID.AsUInt64 == LOCAL_MOD
                                 ? Translation.GetString("Delete")
                                 : Translation.GetString("Unsubscribe");

            UIPanel panel = parent.AddUIComponent <UIPanel>();

            panel.size             = new Vector2(560, 50);
            panel.backgroundSprite = "ContentManagerItemBackground";

            UILabel label = panel.AddUIComponent <UILabel>();

            label.text             = modName;
            label.textAlignment    = UIHorizontalAlignment.Left;
            label.relativePosition = new Vector2(10, 15);

            CreateButton(
                panel,
                caption,
                (int)panel.width - 170,
                10,
                delegate(UIComponent component, UIMouseEventParameter param) {
                UnsubscribeClick(component, param, mod);
            });
        }
Example #14
0
        public void Awake()
        {
            m_bg = component as UIScrollablePanel;

            PublicTransportWorldInfoPanel ptwip = UVMPublicTransportWorldInfoPanel.m_obj.origInstance;

            AddNewStopTemplate();

            ptwip.component.width = 800;

            BindComponents(ptwip);
            AdjustLineStopsPanel(ptwip);

            KlyteMonoUtils.CreateUIElement(out m_panelModeSelector, m_bg.parent.transform);
            m_panelModeSelector.autoFitChildrenHorizontally = true;
            m_panelModeSelector.autoFitChildrenVertically   = true;
            m_panelModeSelector.autoLayout          = true;
            m_panelModeSelector.autoLayoutDirection = LayoutDirection.Horizontal;
            m_mapModeDropDown = UIHelperExtension.CloneBasicDropDownNoLabel(Enum.GetNames(typeof(MapMode)).Select(x => Locale.Get("K45_TLM_LINEAR_MAP_VIEW_MODE", x)).ToArray(), (int idx) =>
            {
                m_currentMode = (MapMode)idx;
                RefreshVehicleButtons(GetLineID());
            }, m_panelModeSelector);
            m_mapModeDropDown.textScale  = 0.75f;
            m_mapModeDropDown.size       = new Vector2(200, 25);
            m_mapModeDropDown.itemHeight = 16;

            UICheckBox unscaledCheck = UIHelperExtension.AddCheckboxLocale(m_panelModeSelector, "K45_TLM_LINEAR_MAP_SHOW_UNSCALED", m_unscaledMode, (val) => m_unscaledMode = val);

            KlyteMonoUtils.LimitWidthAndBox(unscaledCheck.label, 165);

            InstanceManagerOverrides.EventOnBuildingRenamed += (x) => m_dirtyNames = true;
        }
Example #15
0
        private void Awake()
        {
            SVMServiceBuildingDetailPanel.eventOnDistrictSelectionChanged += onDistrictChanged;


            mainPanel            = GetComponentInChildren <UIScrollablePanel>();
            mainPanel.autoLayout = false;
            m_uiHelper           = new UIHelperExtension(mainPanel);

            SVMUtils.createUIElement(out UILabel lbl, mainPanel.transform, "DistrictColorLabel", new Vector4(5, 5, 250, 40));

            allowColorChange = SVMConfigWarehouse.allowColorChanging(extension.ConfigIndexKey);
            if (allowColorChange)
            {
                SVMUtils.LimitWidth(lbl, 250);
                lbl.autoSize = true;
                lbl.localeID = "SVM_DISTRICT_COLOR_LABEL";

                m_districtColor = KlyteUtils.CreateColorField(mainPanel);
                m_districtColor.eventSelectedColorChanged += onChangeDistrictColor;

                SVMUtils.createUIElement(out UIButton resetColor, mainPanel.transform, "DistrictColorReset", new Vector4(290, 0, 0, 0));
                SVMUtils.initButton(resetColor, false, "ButtonMenu");
                SVMUtils.LimitWidth(resetColor, 200);
                resetColor.textPadding = new RectOffset(5, 5, 5, 2);
                resetColor.autoSize    = true;
                resetColor.localeID    = "SVM_RESET_COLOR";
                resetColor.eventClick += onResetColor;
            }


            SVMUtils.createElement(out m_assetSelectorWindow, mainPanel.transform);
            m_assetSelectorWindow.setTabContent(this);
        }
Example #16
0
 private static void TabStripSizeChanged(UIScrollablePanel mainPanel)
 {
     foreach (var tab in TabPanels)
     {
         SetTabSize(tab, mainPanel);
     }
 }
Example #17
0
        private void Awake()
        {
            if (m_instance != null)
            {
                throw new Exception("MULTIPLE INSTANTIATION!!!!!!!!");
            }
            m_instance                    = this;
            mainPanel                     = GetComponentInChildren <UIScrollablePanel>();
            mainPanel.autoLayout          = true;
            mainPanel.autoLayoutDirection = LayoutDirection.Vertical;
            m_uiHelper                    = new UIHelperExtension(mainPanel);

            TLMUtils.doLog("PrefixDD");

            m_prefixSelector = m_uiHelper.AddDropdownLocalized("TLM_PREFIX", new string[0], -1, onChangePrefix);

            ReloadPrefixOptions();
            TLMUtils.doLog("PrefixDD Panel");
            var ddPanel = m_prefixSelector.GetComponentInParent <UIPanel>();

            ConfigComponentPanel(m_prefixSelector);


            TLMUtils.doLog("SubPanel");
            TLMUtils.createUIElement(out UIPanel subpanel, mainPanel.transform, "Subpanel", new Vector4(0, 0, 500, 180));
            subpanel.autoLayout          = true;
            subpanel.autoLayoutDirection = LayoutDirection.Vertical;
            subpanel.autoSize            = true;
            m_subpanel = new UIHelperExtension(subpanel);

            TLMUtils.doLog("AssetSelector");
            TLMUtils.createUIElement(out m_panelAssetSelector, mainPanel.transform, "AssetSelector", new Vector4(0, 0, 0, 0.0001f));
            m_assetSelectorWindow = TLMUtils.createElement(ImplClassChildren, m_panelAssetSelector.transform).GetComponent <TLMAssetSelectorWindowPrefixTab <T> >();

            m_subpanel.self.isVisible = false;
            m_assetSelectorWindow.mainPanel.isVisible = false;

            TLMUtils.doLog("Name");
            m_prefixName = m_subpanel.AddTextField(Locale.Get("TLM_PREFIX_NAME"), null, "", onPrefixNameChange);
            ConfigComponentPanel(m_prefixName);

            TLMUtils.doLog("Price");
            m_prefixTicketPrice = m_subpanel.AddTextField(Locale.Get("TLM_TICKET_PRICE_LABEL"), null, "", onTicketChange);
            ConfigComponentPanel(m_prefixTicketPrice);

            TLMUtils.doLog("ColorForModel");
            m_useColorForModel = m_subpanel.AddCheckboxLocale("TLM_USE_PREFIX_COLOR_FOR_VEHICLE", false, onUseColorVehicleChange);
            TLMUtils.LimitWidth(m_useColorForModel.label, 420, true);

            TLMUtils.doLog("ColorSel");
            CreateColorSelector();

            TLMUtils.doLog("Budget");
            TLMUtils.createUIElement(out UIPanel m_budgetPanel, subpanel.transform, "BudgetPanel", new Vector4(0, 0, 460, 180));
            CreateBudgetSliders(m_budgetPanel);
            CreateToggleBudgetButtons(m_budgetPanel);

            GetComponent <UIComponent>().eventVisibilityChanged += (x, y) => forceRefresh();
            TLMConfigWarehouse.eventOnPropertyChanged           += OnWarehouseChange;
        }
Example #18
0
        public void OnSettingsUI(UIHelperBase helper)
        {
            _optionsPanel            = ((UIHelper)helper).self as UIScrollablePanel;
            _optionsPanel.autoLayout = false;

            UITabstrip strip = _optionsPanel.AddUIComponent <UITabstrip>();

            strip.relativePosition = new Vector3(0, 0);
            strip.size             = new Vector2(744, 40);

            UITabContainer container = _optionsPanel.AddUIComponent <UITabContainer>();

            container.relativePosition = new Vector3(0, 40);
            container.size             = new Vector3(744, 713);
            strip.tabPages             = container;

            foreach (IModule module in Modules)
            {
                if (module.Name == "Roads")
                {
                    addTab(strip, strip.tabCount, module, "Tiny", "RoadsTiny");
                    addTab(strip, strip.tabCount, module, "Small", "RoadsSmall");
                    addTab(strip, strip.tabCount, module, "Sml Hvy", "RoadsSmallHV");
                    addTab(strip, strip.tabCount, module, "Medium", "RoadsMedium");
                    addTab(strip, strip.tabCount, module, "Large", "RoadsLarge");
                    addTab(strip, strip.tabCount, module, "Highway", "RoadsHighway");
                    addTab(strip, strip.tabCount, module, "Ped", "RoadsPedestrians");
                    addTab(strip, strip.tabCount, module, "Bus", "RoadsBusways");
                }
                else if (module.Name == "Tools")
                {
                    addTab(strip, strip.tabCount, module);
                }
            }
        }
Example #19
0
        private IEnumerator <object> ShowInPanelProcess(UIScrollablePanel scrollablePanel, UIButton button)
        {
            yield return(new WaitForSeconds(0.10f));

            button.SimulateClick();
            scrollablePanel.ScrollIntoView(button);
        }
Example #20
0
        private static void CreateTabStrip(UIScrollablePanel mainPanel)
        {
            TabPanels = new List <UIPanel>();

            TabStrip = mainPanel.AddUIComponent <CustomUITabstrip>();
            TabStrip.eventSelectedIndexChanged += TabStripSelectedIndexChanged;
            TabStrip.selectedIndex              = -1;
        }
        private void Start()
        {
            m_Container = (UIScrollablePanel)typeof(DecorationPropertiesPanel).GetField("m_Container", BindingFlags.GetField | BindingFlags.SetField | BindingFlags.NonPublic | BindingFlags.Instance)
                .GetValue(UIView.Find<UIPanel>("DecorationProperties").GetComponent<DecorationPropertiesPanel>());

            m_SizePanel = (UIPanel)typeof(DecorationPropertiesPanel).GetField("m_SizePanel", BindingFlags.GetField | BindingFlags.SetField | BindingFlags.NonPublic | BindingFlags.Instance)
                .GetValue(UIView.Find<UIPanel>("DecorationProperties").GetComponent<DecorationPropertiesPanel>());
        }
Example #22
0
        private static void FitScrollablePanelToParent(UIScrollablePanel sc, float relX)
        {
            // offset by scroll button margin
            sc.parent.size = sc.parent.parent.size;

            sc.relativePosition = new Vector2(relX, sc.relativePosition.y);
            sc.size             = new Vector2(sc.parent.size.x - sc.relativePosition.x * 2, sc.parent.size.y);
        }
        private void addLabel(UIScrollablePanel panel, string text, Vector3 position, float scale)
        {
            UILabel label = panel.AddUIComponent <UILabel>();

            label.text             = text;
            label.textScale        = scale;
            label.relativePosition = position;
        }
Example #24
0
        public static UIScrollablePanel CreateScrollablePanel(UIComponent parent, string name)
        {
            UIScrollablePanel scrollablePanel = parent.AddUIComponent <UIScrollablePanel>();

            scrollablePanel.name = name;

            return(scrollablePanel);
        }
Example #25
0
        public static UIScrollablePanel CreateScrollablePanel(string name)
        {
            UIScrollablePanel scrollablePanel = UIView.GetAView().AddUIComponent(typeof(UIScrollablePanel)) as UIScrollablePanel;

            scrollablePanel.name = name;

            return(scrollablePanel);
        }
        public static void Postfix(
            object ___m_Target,
            UIScrollablePanel ___m_Container)
        {
            var button = ___m_Container.AddUIComponent <EditorButon>();

            button.text        = "Dump mesh as fbx";
            button.eventClick += (_, __) => Dump2(___m_Target);
        }
Example #27
0
        public TextList(UIComponent parent, Dictionary <T, string> initiaItemList, int width, int height, string name)
        {
            this.name = name;
            m_parent  = parent;
            ((UIPanel)parent).autoFitChildrenVertically = true;
            ((UIPanel)parent).padding = new RectOffset(20, 20, 20, 20);
            UIPanel panelListing = m_parent.AttachUIComponent(UITemplateManager.GetAsGameObject(UIHelperExtension.kDropdownTemplate)) as UIPanel;

            panelListing.name   = "TextList";
            panelListing.height = height;
            panelListing.width  = width;
            panelListing.autoLayoutDirection       = LayoutDirection.Vertical;
            panelListing.autoLayoutStart           = LayoutStart.TopLeft;
            panelListing.autoFitChildrenVertically = true;
            panelListing.wrapLayout       = true;
            panelListing.padding          = new RectOffset(0, 0, 0, 0);
            panelListing.clipChildren     = true;
            panelListing.pivot            = UIPivotPoint.MiddleCenter;
            panelListing.relativePosition = Vector2.zero;
            foreach (Transform t in panelListing.transform)
            {
                GameObject.Destroy(t.gameObject);
            }

            GameObject scrollObj = new GameObject("Lines Listing Scroll", new Type[] { typeof(UIScrollablePanel) });

            //			DebugOutputPanel.AddMessage (PluginManager.MessageType.Message, "SCROLL LOADED");
            linesListPanel                     = scrollObj.GetComponent <UIScrollablePanel>();
            linesListPanel.autoLayout          = false;
            linesListPanel.width               = width;
            linesListPanel.height              = height;
            linesListPanel.useTouchMouseScroll = true;
            linesListPanel.scrollWheelAmount   = 20;
            linesListPanel.eventMouseWheel    += (UIComponent component, UIMouseEventParameter eventParam) =>
            {
                linesListPanel.scrollPosition -= new Vector2(0, eventParam.wheelDelta * linesListPanel.scrollWheelAmount);
            };
            panelListing.AttachUIComponent(linesListPanel.gameObject);
            linesListPanel.autoLayout          = true;
            linesListPanel.autoLayoutDirection = LayoutDirection.Vertical;

            linesListPanel.useTouchMouseScroll = true;
            linesListPanel.scrollWheelAmount   = 20;
            linesListPanel.eventMouseWheel    += (UIComponent component, UIMouseEventParameter eventParam) =>
            {
                linesListPanel.scrollPosition -= new Vector2(0, eventParam.wheelDelta * linesListPanel.scrollWheelAmount);
                eventParam.Use();
            };

            foreach (Transform t in linesListPanel.transform)
            {
                GameObject.Destroy(t.gameObject);
            }

            itemsList = initiaItemList;
        }
Example #28
0
        private static void CreateTabStrip(UIScrollablePanel mainPanel)
        {
            TabPanels = new List <UIPanel>();

            TabStrip = mainPanel.AddUIComponent <TabStrip>();
            TabStrip.SelectedTabChanged += OnSelectedTabChanged;
            TabStrip.SelectedTab         = -1;
            TabStrip.width             = mainPanel.width - mainPanel.autoLayoutPadding.horizontal - mainPanel.scrollPadding.horizontal;
            TabStrip.eventSizeChanged += (UIComponent component, Vector2 value) => TabStripSizeChanged(mainPanel);
        }
Example #29
0
        // runs only once, do internal init here
        public override void Awake()
        {
            base.Awake();

            // Note - parent may not be set yet
            ScrollPanel = AddUIComponent <UIScrollablePanel>();
            ScrollBar   = AddUIComponent <UIScrollbar>();
            TrackSprite = ScrollBar.AddUIComponent <UISlicedSprite>();
            ThumbSprite = TrackSprite.AddUIComponent <UISlicedSprite>();
        }
        public static bool IsFullyClippedFromParent(UIComponent component)
        {
            if ((Object)component.parent == (Object)null || (Object)component.parent == (Object)component)
            {
                return(false);
            }
            UIScrollablePanel parent = component.parent as UIScrollablePanel;

            return((Object)parent != (Object)null && parent.clipChildren && ((double)component.relativePosition.x < 0.0 - (double)component.size.x - 1.0 || (double)component.relativePosition.x + (double)component.size.x > (double)component.parent.size.x + (double)component.size.x + 1.0 || ((double)component.relativePosition.y < 0.0 - (double)component.size.y - 1.0 || (double)component.relativePosition.y + (double)component.size.y > (double)component.parent.size.y + (double)component.size.y + 1.0)));
        }
Example #31
0
        public override void Start()
        {
            base.Start();
            this.autoLayoutDirection     = LayoutDirection.Horizontal;
            this.autoLayoutStart         = LayoutStart.TopLeft;
            this.autoLayoutPadding       = new RectOffset(0, 0, 0, 0);
            this.autoLayout              = true;
            this._scrollablePanel        = this.AddUIComponent <UIScrollablePanel>();
            this._scrollablePanel.width  = this.width - 10f;
            this._scrollablePanel.height = this.height;
            this._scrollablePanel.autoLayoutDirection = LayoutDirection.Vertical;
            this._scrollablePanel.autoLayoutStart     = LayoutStart.TopLeft;
            this._scrollablePanel.autoLayoutPadding   = new RectOffset(0, 0, 0, 0);
            this._scrollablePanel.autoLayout          = true;
            this._scrollablePanel.clipChildren        = true;
            this._scrollablePanel.backgroundSprite    = "UnlockingPanel";
            this._scrollablePanel.color = (Color32)Color.black;
            UIPanel uiPanel = this.AddUIComponent <UIPanel>();

            uiPanel.width  = 10f;
            uiPanel.height = this.height;
            uiPanel.autoLayoutDirection = LayoutDirection.Horizontal;
            uiPanel.autoLayoutStart     = LayoutStart.TopLeft;
            uiPanel.autoLayoutPadding   = new RectOffset(0, 0, 0, 0);
            uiPanel.autoLayout          = true;
            UIScrollbar scrollbar = uiPanel.AddUIComponent <UIScrollbar>();

            scrollbar.width       = 10f;
            scrollbar.height      = scrollbar.parent.height;
            scrollbar.orientation = UIOrientation.Vertical;
            scrollbar.pivot       = UIPivotPoint.BottomLeft;
            scrollbar.AlignTo((UIComponent)uiPanel, UIAlignAnchor.TopRight);
            scrollbar.minValue        = 0.0f;
            scrollbar.value           = 0.0f;
            scrollbar.incrementAmount = 27f;
            this._scrollbar           = scrollbar;
            UISlicedSprite uiSlicedSprite1 = scrollbar.AddUIComponent <UISlicedSprite>();

            uiSlicedSprite1.relativePosition = (Vector3)Vector2.zero;
            uiSlicedSprite1.autoSize         = true;
            uiSlicedSprite1.size             = uiSlicedSprite1.parent.size;
            uiSlicedSprite1.fillDirection    = UIFillDirection.Vertical;
            uiSlicedSprite1.spriteName       = "ScrollbarTrack";
            scrollbar.trackObject            = (UIComponent)uiSlicedSprite1;
            UISlicedSprite uiSlicedSprite2 = uiSlicedSprite1.AddUIComponent <UISlicedSprite>();

            uiSlicedSprite2.relativePosition        = (Vector3)Vector2.zero;
            uiSlicedSprite2.fillDirection           = UIFillDirection.Vertical;
            uiSlicedSprite2.autoSize                = true;
            uiSlicedSprite2.width                   = uiSlicedSprite2.parent.width - 4f;
            uiSlicedSprite2.spriteName              = "ScrollbarThumb";
            scrollbar.thumbObject                   = (UIComponent)uiSlicedSprite2;
            this._scrollablePanel.verticalScrollbar = scrollbar;
            this._scrollablePanel.eventMouseWheel  += (MouseEventHandler)((component, param) => this._scrollablePanel.scrollPosition += new Vector2(0.0f, Mathf.Sign(param.wheelDelta) * -1f * scrollbar.incrementAmount));
        }
Example #32
0
        public static UIHelperExtension CreateScrollPanel(UIComponent parent, out UIScrollablePanel scrollablePanel, out UIScrollbar scrollbar, float width, float height, Vector3 relativePosition = default)
        {
            CreateUIElement(out scrollablePanel, parent?.transform);
            scrollablePanel.width  = width;
            scrollablePanel.height = height;
            scrollablePanel.autoLayoutDirection = LayoutDirection.Vertical;
            scrollablePanel.autoLayoutStart     = LayoutStart.TopLeft;
            scrollablePanel.autoLayoutPadding   = new RectOffset(0, 0, 0, 0);
            scrollablePanel.autoLayout          = true;
            scrollablePanel.clipChildren        = true;
            scrollablePanel.relativePosition    = relativePosition;

            CreateUIElement(out UIPanel trackballPanel, parent?.transform);
            trackballPanel.width  = 10f;
            trackballPanel.height = scrollablePanel.height;
            trackballPanel.autoLayoutDirection = LayoutDirection.Horizontal;
            trackballPanel.autoLayoutStart     = LayoutStart.TopLeft;
            trackballPanel.autoLayoutPadding   = new RectOffset(0, 0, 0, 0);
            trackballPanel.autoLayout          = true;
            trackballPanel.relativePosition    = new Vector3(relativePosition.x + width + 5, relativePosition.y);


            CreateUIElement(out scrollbar, trackballPanel.transform);
            scrollbar.width       = 10f;
            scrollbar.height      = scrollbar.parent.height;
            scrollbar.orientation = UIOrientation.Vertical;
            scrollbar.pivot       = UIPivotPoint.BottomLeft;
            scrollbar.AlignTo(trackballPanel, UIAlignAnchor.TopRight);
            scrollbar.minValue        = 0f;
            scrollbar.value           = 0f;
            scrollbar.incrementAmount = 25f;

            CreateUIElement(out UISlicedSprite scrollBg, scrollbar.transform);
            scrollBg.relativePosition = Vector2.zero;
            scrollBg.autoSize         = true;
            scrollBg.size             = scrollBg.parent.size;
            scrollBg.fillDirection    = UIFillDirection.Vertical;
            scrollBg.spriteName       = "ScrollbarTrack";
            scrollbar.trackObject     = scrollBg;

            CreateUIElement(out UISlicedSprite scrollFg, scrollBg.transform);
            scrollFg.relativePosition         = Vector2.zero;
            scrollFg.fillDirection            = UIFillDirection.Vertical;
            scrollFg.autoSize                 = true;
            scrollFg.width                    = scrollFg.parent.width - 4f;
            scrollFg.spriteName               = "ScrollbarThumb";
            scrollbar.thumbObject             = scrollFg;
            scrollablePanel.verticalScrollbar = scrollbar;
            scrollablePanel.eventMouseWheel  += delegate(UIComponent component, UIMouseEventParameter param)
            {
                ((UIScrollablePanel)component).scrollPosition += new Vector2(0f, Mathf.Sign(param.wheelDelta) * -1f * ((UIScrollablePanel)component).verticalScrollbar.incrementAmount);
            };

            return(new UIHelperExtension(scrollablePanel));
        }
 private void Awake()
 {
     this.m_atlas = UIUtils.LoadThumbnailsTextureAtlas("UIThumbnails");
     this.m_scrollablePanel = GetComponentInChildren<UIScrollablePanel>();
     this.m_scrollablePanel.autoLayoutStart = LayoutStart.TopLeft;
     UIScrollbar scrollbar = this.GetComponentInChildren<UIScrollbar>();
     if (scrollbar != null)
         scrollbar.incrementAmount = 109;
     this.m_objectIndex = m_selectedIndex = 0;
     this.m_panelType = Panel.Unset;
 }
        private void addSlider(UIScrollablePanel panel, Vector3 position, float width, OnValueChanged eventCallback, IDifficultyParameter param)
        {
            UISlider slider = panel.AddUIComponent<UISlider>();
            slider.size = new Vector2(width, 8);
            slider.relativePosition = position;
            slider.minValue = 0;
            slider.maxValue = param.MaxIndex;
            slider.stepSize = 1;
            slider.value = param.SelectedIndex;
            slider.backgroundSprite = "TextFieldPanel"; // TextFieldPanel, GenericProgressBar

            UISprite thumb = slider.AddUIComponent<UISprite>();
            thumb.size = new Vector2(16, 16);
            thumb.spriteName = "InfoIconBaseFocused"; // SliderBudget, InfoIconBaseFocused
            slider.thumbObject = thumb;

            UILabel label = panel.AddUIComponent<UILabel>();
            label.textScale = textScaleSmall;
            label.text = param.GetValueStr((int)slider.value);
            label.relativePosition = new Vector3(position.x + width + 10, position.y);

            slider.eventValueChanged += delegate (UIComponent c, float val)
            {
                label.text = param.GetValueStr((int)val);
                eventCallback(val);
            };

            sliders.Add(slider, param);
        }
 private void addLabel(UIScrollablePanel panel, string text, Vector3 position, float scale)
 {
     UILabel label = panel.AddUIComponent<UILabel>();
     label.text = text;
     label.textScale = scale;
     label.relativePosition = position;
 }
        private void CollapseIconPanel(UIPanel panel, UIScrollablePanel scrollablePanel, UIScrollbar horizontalScrollbar, bool verticalScroll)
        {
            panel.height = defaultSize.y;
            panel.width = defaultSize.x;

            try{
                m_verticalScrollbars[panel].Hide();
            }catch{}

            //adjust layout of UIScollablePanel
            scrollablePanel.autoLayout = true;
            scrollablePanel.autoLayoutStart = LayoutStart.BottomLeft;
            scrollablePanel.wrapLayout = false;
            scrollablePanel.autoLayoutDirection = LayoutDirection.Horizontal;
            scrollablePanel.width = 763.0f;
            //adjust position of Scollbar buttons
            horizontalScrollbar.decrementButton.relativePosition = defaultPositionDecrementButton;
            horizontalScrollbar.incrementButton.relativePosition = defaultPositionIncrementButton;
        }
        private void ExpandIconPanel(UIPanel panel, UIScrollablePanel scrollablePanel, UIScrollbar horizontalScrollbar, bool verticalScroll)
        {
            panel.height *= defaultSize.y * rows;
            horizontalScrollbar.value = 0;

            //adjust layout of UIScollablePanel
            scrollablePanel.autoLayout = true;
            scrollablePanel.autoLayoutStart = LayoutStart.TopLeft;
            scrollablePanel.wrapLayout = true;
            scrollablePanel.width++;

            UIScrollbar verticalScrollbar;
            try{
                verticalScrollbar = m_verticalScrollbars[panel];
            }catch{
                verticalScrollbar = CreateVerticalScrollbar(panel,scrollablePanel);
                m_verticalScrollbars[panel] = verticalScrollbar;
            }

            if(verticalScroll){
                scrollablePanel.autoLayoutDirection = LayoutDirection.Horizontal;
                verticalScrollbar.Show();
            } else{
                verticalScrollbar.Hide();
                scrollablePanel.autoLayoutDirection = LayoutDirection.Vertical;
                horizontalScrollbar.decrementButton.relativePosition = new Vector3(defaultPositionDecrementButton.x, panel.height / 2.0f - 21.5f);
                horizontalScrollbar.incrementButton.relativePosition = new Vector3(defaultPositionIncrementButton.x, panel.height / 2.0f - 21.5f);
            }
        }
        private static UIScrollbar CreateVerticalScrollbar(UIPanel panel, UIScrollablePanel scrollablePanel)
        {
            UIScrollbar verticalScrollbar = panel.AddUIComponent<UIScrollbar>();
            verticalScrollbar.name = "VerticalScrollbar";
            verticalScrollbar.width = 20f;
            verticalScrollbar.height = panel.height;
            verticalScrollbar.orientation = UIOrientation.Vertical;
            verticalScrollbar.pivot = UIPivotPoint.BottomLeft;
            verticalScrollbar.AlignTo(panel, UIAlignAnchor.TopRight);
            verticalScrollbar.minValue = 0;
            verticalScrollbar.value = 0;
            verticalScrollbar.incrementAmount = 50;
            verticalScrollbar.autoHide = true;

            UISlicedSprite trackSprite = verticalScrollbar.AddUIComponent<UISlicedSprite>();
            trackSprite.relativePosition = Vector2.zero;
            trackSprite.autoSize = true;
            trackSprite.size = trackSprite.parent.size;
            trackSprite.fillDirection = UIFillDirection.Vertical;
            trackSprite.spriteName = "ScrollbarTrack";

            verticalScrollbar.trackObject = trackSprite;

            UISlicedSprite thumbSprite = trackSprite.AddUIComponent<UISlicedSprite>();
            thumbSprite.relativePosition = Vector2.zero;
            thumbSprite.fillDirection = UIFillDirection.Vertical;
            thumbSprite.autoSize = true;
            thumbSprite.width = thumbSprite.parent.width - 8;
            thumbSprite.spriteName = "ScrollbarThumb";

            verticalScrollbar.thumbObject = thumbSprite;

            verticalScrollbar.eventValueChanged += (component, value) => {
                scrollablePanel.scrollPosition = new Vector2(0,value);
            };

            panel.eventMouseWheel += (component, eventParam) => {
                verticalScrollbar.value -= (int)eventParam.wheelDelta * verticalScrollbar.incrementAmount;
            };

            scrollablePanel.eventMouseWheel += (component, eventParam) =>{
                verticalScrollbar.value -= (int)eventParam.wheelDelta * verticalScrollbar.incrementAmount;
            };

            scrollablePanel.verticalScrollbar = verticalScrollbar;

            return verticalScrollbar;
        }
        private void SetupScrollPanel()
        {
            ModLogger.Debug("Setting up scroll panel");

            // Create the main panel hosting the scrollable panel
            _mainPanel = AddUIComponent<UIPanel>();
            _mainPanel.gameObject.AddComponent<UICustomControl>();
            _mainPanel.width = width - UIConstants.MainWindowMainPanelWidthOffset;
            int[] offsettingItems = new int[] { UIConstants.TitlePanelHeight, UIConstants.CaptionPanelLabelOffset, UIConstants.CaptionPanelHeight, UIConstants.FilterPanelHeight, autoLayoutPadding.bottom * 4, autoLayoutPadding.top * 4 };
            _mainPanel.height = height - offsettingItems.Sum();

            // taken from http://www.reddit.com/r/CitiesSkylinesModding/comments/2zrz0k/extended_public_transport_ui_provides_addtional/cpnet5q
            _scrollablePanel = _mainPanel.AddUIComponent<UIScrollablePanel>();
            _scrollablePanel.width = _scrollablePanel.parent.width - UIConstants.MainWindowScrollablePanelWidthOffset - 10;
            _scrollablePanel.height = _scrollablePanel.parent.height;
            _scrollablePanel.autoLayout = true;
            _scrollablePanel.autoLayoutDirection = LayoutDirection.Vertical;
            _scrollablePanel.autoLayoutStart = LayoutStart.TopLeft;
            _scrollablePanel.autoLayoutPadding = UIConstants.AutoLayoutPadding;
            _scrollablePanel.clipChildren = true;
            _scrollablePanel.pivot = UIPivotPoint.TopLeft;
            _scrollablePanel.AlignTo(_scrollablePanel.parent, UIAlignAnchor.TopLeft);
            _scrollablePanel.relativePosition = new Vector3(5, 0);

            UIScrollbar scrollbar = _mainPanel.AddUIComponent<UIScrollbar>();
            scrollbar.width = scrollbar.parent.width - _scrollablePanel.width;
            scrollbar.height = scrollbar.parent.height;
            scrollbar.orientation = UIOrientation.Vertical;
            scrollbar.pivot = UIPivotPoint.BottomLeft;
            scrollbar.AlignTo(scrollbar.parent, UIAlignAnchor.TopRight);
            scrollbar.minValue = 0;
            scrollbar.value = 0;
            scrollbar.incrementAmount = UIConstants.ScrollbarIncrementCount;

            UISlicedSprite trackSprite = scrollbar.AddUIComponent<UISlicedSprite>();
            trackSprite.relativePosition = Vector2.zero;
            trackSprite.autoSize = true;
            trackSprite.size = trackSprite.parent.size;
            trackSprite.fillDirection = UIFillDirection.Vertical;
            trackSprite.spriteName = UIConstants.ScrollbarTrackSprite;

            scrollbar.trackObject = trackSprite;

            UISlicedSprite thumbSprite = trackSprite.AddUIComponent<UISlicedSprite>();
            thumbSprite.relativePosition = Vector2.zero;
            thumbSprite.fillDirection = UIFillDirection.Vertical;
            thumbSprite.autoSize = true;
            thumbSprite.width = thumbSprite.parent.width;
            thumbSprite.spriteName = UIConstants.ScrollbarThumbSprite;

            scrollbar.thumbObject = thumbSprite;

            _scrollablePanel.verticalScrollbar = scrollbar;
            _scrollablePanel.eventMouseWheel += (component, param) =>
            {
                var sign = Math.Sign(param.wheelDelta);
                _scrollablePanel.scrollPosition += new Vector2(0, sign * (-1) * UIConstants.ScrollbarMouseWheelOffset);
            };

            ModLogger.Debug("Scroll panel set up");
        }
        //public void ButtonEnabler(UITextureSprite sPrite) {
        //if (sPrite == FavCimsCBMenuSprite) {
        //FavCimsCBMenuSprite.texture = FavCimsCBETexture;
        //FavCimsBBMenuSprite.texture = FavCimsBBDTexture;
        //FavCimsSBMenuSprite.texture = FavCimsSBDTexture;
        //} else if (sPrite == FavCimsBBMenuSprite) {
        //FavCimsCBMenuSprite.texture = FavCimsCBDTexture;
        //FavCimsBBMenuSprite.texture = FavCimsBBETexture;
        //FavCimsSBMenuSprite.texture = FavCimsSBDTexture;
        //} else if (sPrite == FavCimsSBMenuSprite) {
        //FavCimsCBMenuSprite.texture = FavCimsCBDTexture;
        //FavCimsBBMenuSprite.texture = FavCimsBBDTexture;
        //FavCimsSBMenuSprite.texture = FavCimsSBETexture;
        //}
        //return;
        //}
        public override void Start()
        {
            var uiView = UIView.GetAView();

            this.name = "FavCimsPanel";
            this.width = 1200;
            this.height = 700;
            this.opacity = 0.95f;
            this.eventVisibilityChanged += (component, value) => change_visibility_event ();

            //Main Panel BG Texture
            Texture FavCimsMainBGTexture = ResourceLoader.loadTexture ((int)this.width, (int)this.height, "UIMainPanel.mainbg.png");
            FavCimsMainBGTexture.wrapMode = TextureWrapMode.Clamp;
            FavCimsMainBGTexture.filterMode = FilterMode.Bilinear;
            //FavCimsMainBGTexture.anisoLevel = 9; Set 1 Bad to 9 Very God
            FavCimsMainBGTexture.name = "FavCimsMainBGTexture";
            UITextureSprite FavCimsMainBGSprite;
            FavCimsMainBGSprite = this.AddUIComponent<UITextureSprite> ();
            FavCimsMainBGSprite.name = "FavCimsMainBGSprite";
            FavCimsMainBGSprite.texture = FavCimsMainBGTexture;
            FavCimsMainBGSprite.relativePosition = new Vector3 (0, 0);

            FavCimsMainBGSprite.eventMouseDown += delegate {
                if (Input.GetMouseButton (0)) {
                    if (this.GetComponentInChildren<WindowController> () != null) {
                        this.PanelMover = this.GetComponentInChildren<WindowController> ();
                        this.PanelMover.ComponentToMove = this;
                        this.PanelMover.Stop = false;
                        this.PanelMover.Start ();
                    } else {
                        this.PanelMover = this.AddUIComponent (typeof(WindowController)) as WindowController;
                        this.PanelMover.ComponentToMove = this;
                    }
                    this.opacity = 0.5f;
                }
            };

            FavCimsMainBGSprite.eventMouseUp += delegate {
                if (this.PanelMover != null) {
                    this.PanelMover.Stop = true;
                    this.PanelMover.ComponentToMove = null;
                    this.PanelMover = null;
                }
                this.opacity = 1f;
            };

            //Main Panel Title Texture
            Texture FavCimsTitleTexture;
            FavCimsTitleTexture = ResourceLoader.loadTexture ((int)this.width, 58, "UIMainPanel.favcimstitle.png");

            FavCimsTitleTexture.wrapMode = TextureWrapMode.Clamp;
            FavCimsTitleTexture.filterMode = FilterMode.Bilinear;
            FavCimsTitleTexture.mipMapBias = -0.5f;
            //FavCimsTitleTexture.anisoLevel = 9; // Set 1 Bad to 9 Very God

            FavCimsTitleTexture.name = "FavCimsTitleTexture";
            FavCimsTitleSprite = FavCimsMainBGSprite.AddUIComponent<UITextureSprite> ();
            FavCimsTitleSprite.name = "FavCimsTitleSprite";
            FavCimsTitleSprite.texture = FavCimsTitleTexture;
            float FavCimsTitleSpriteRelPosX = ((this.width / 2) - (float)FavCimsTitleTexture.width / 2);
            FavCimsTitleSprite.relativePosition = new Vector3 (FavCimsTitleSpriteRelPosX, 0);

            ///////////////////////////////////////////////
            //Game Default Close Button
            //////////////////////////////////////////////

            UIButton FavCimsMenuCloseButton = this.AddUIComponent<UIButton> ();
            FavCimsMenuCloseButton.name = "FavCimsMenuCloseButton";
            FavCimsMenuCloseButton.width = 32;
            FavCimsMenuCloseButton.height = 32;
            FavCimsMenuCloseButton.normalBgSprite = "buttonclose";
            FavCimsMenuCloseButton.hoveredBgSprite = "buttonclosehover";
            FavCimsMenuCloseButton.pressedBgSprite = "buttonclosepressed";
            FavCimsMenuCloseButton.opacity = 1;
            FavCimsMenuCloseButton.useOutline = true;
            FavCimsMenuCloseButton.playAudioEvents = true;

            FavCimsMenuCloseButton.eventClick += (component, eventParam) => FavoritesCimsButton.FavCimsPanelToggle ();

            //Printing
            FavCimsMenuCloseButton.relativePosition = new Vector3 (this.width - (FavCimsMenuCloseButton.width * 1.5f), ((float)FavCimsTitleTexture.height / 2) - FavCimsMenuCloseButton.height / 2);

            ///////////////////////////////////////////////
            //Main Panel Menu Background Texture
            ///////////////////////////////////////////////

            Texture FavCimsBGMenuTexture;
            FavCimsBGMenuTexture = ResourceLoader.loadTexture ((int)this.width - 10, 70, "UIMainPanel.submenubar.png");

            FavCimsBGMenuTexture.wrapMode = TextureWrapMode.Clamp;
            FavCimsBGMenuTexture.filterMode = FilterMode.Bilinear;
            FavCimsBGMenuTexture.name = "FavCimsBGMenuTexture";
            UITextureSprite FavCimsBGMenuSprite = FavCimsMainBGSprite.AddUIComponent<UITextureSprite> ();
            FavCimsBGMenuSprite.name = "FavCimsBGMenuSprite";
            FavCimsBGMenuSprite.texture = FavCimsBGMenuTexture;
            float FavCimsBGMenuSpriteRelPosX = ((this.width / 2) - (float)FavCimsBGMenuTexture.width / 2);
            FavCimsBGMenuSprite.relativePosition = new Vector3 (FavCimsBGMenuSpriteRelPosX, 58);

            //Citizen Button Texture (Enabled & Disabled)
            FavCimsCBETexture = ResourceLoader.loadTexture (200, 59, "UIMainPanel.citizenbuttonenabled.png");
            FavCimsCBDTexture = ResourceLoader.loadTexture (200, 59, "UIMainPanel.citizenbuttondisabled.png");

            FavCimsCBETexture.wrapMode = TextureWrapMode.Clamp;
            FavCimsCBETexture.filterMode = FilterMode.Bilinear;
            FavCimsCBETexture.name = "FavCimsCBETexture";
            FavCimsCBETexture.mipMapBias = -0.5f;
            FavCimsCBDTexture.wrapMode = TextureWrapMode.Clamp;
            FavCimsCBDTexture.filterMode = FilterMode.Bilinear;
            FavCimsCBDTexture.name = "FavCimsCBDTexture";
            FavCimsCBDTexture.mipMapBias = -0.5f;

            FavCimsCBMenuSprite = FavCimsMainBGSprite.AddUIComponent<UITextureSprite> ();
            FavCimsCBMenuSprite.name = "FavCimsBGMenuSprite";
            FavCimsCBMenuSprite.texture = FavCimsCBETexture;

            //Citizens Transparent Button (For Easy Text Change)
            FavCimsBCMenuButton = this.AddUIComponent<UIButton> ();
            FavCimsBCMenuButton.name = "FavCimsBCMenuButton";
            FavCimsBCMenuButton.width = FavCimsCBMenuSprite.width;
            FavCimsBCMenuButton.height = FavCimsCBMenuSprite.height;
            FavCimsBCMenuButton.useOutline = true;
            FavCimsBCMenuButton.playAudioEvents = true;
            FavCimsBCMenuButton.font = UIDynamicFont.FindByName ("OpenSans-Regular");
            FavCimsBCMenuButton.textScale = 1.8f;
            FavCimsBCMenuButton.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a
            FavCimsBCMenuButton.hoveredTextColor = new Color32 (204, 102, 0, 20);
            FavCimsBCMenuButton.pressedTextColor = new Color32 (153, 0, 0, 0);
            FavCimsBCMenuButton.focusedTextColor = new Color32 (102, 153, 255, 147);
            FavCimsBCMenuButton.textPadding.left = 15;
            FavCimsBCMenuButton.useDropShadow = true;
            FavCimsBCMenuButton.tooltipBox = uiView.defaultTooltipBox;

            //Printing
            FavCimsCBMenuSprite.relativePosition = new Vector3 (27, 69);
            FavCimsBCMenuButton.relativePosition = new Vector3 (27, 69);

            ///////////////////////////////////////////////
            //Buildings Button Texture (Enabled & Disabled)
            //////////////////////////////////////////////
            /*
            FavCimsBBETexture = ResourceLoader.loadTexture (200, 59, "UIMainPanel.buildingsbuttonenabled.png");
            FavCimsBBDTexture = ResourceLoader.loadTexture (200, 59, "UIMainPanel.buildingsbuttondisabled.png");

            FavCimsBBETexture.wrapMode = TextureWrapMode.Clamp;
            FavCimsBBETexture.filterMode = FilterMode.Bilinear;
            FavCimsBBETexture.name = "FavCimsBBETexture";
            FavCimsBBETexture.mipMapBias = -0.5f;
            FavCimsBBDTexture.wrapMode = TextureWrapMode.Clamp;
            FavCimsBBDTexture.filterMode = FilterMode.Bilinear;
            FavCimsBBDTexture.name = "FavCimsBBETexture";
            FavCimsBBDTexture.mipMapBias = -0.5f;
            FavCimsBBMenuSprite = FavCimsMainBGSprite.AddUIComponent<UITextureSprite> ();
            FavCimsBBMenuSprite.name = "FavCimsBBMenuSprite";
            FavCimsBBMenuSprite.texture = FavCimsBBDTexture;

            //Buildings Transparent Button (For Easy Text Change)
            FavCimsBBMenuButton = this.AddUIComponent<UIButton> ();
            FavCimsBBMenuButton.name = "FavCimsBBMenuButton";
            FavCimsBBMenuButton.width = FavCimsBBETexture.width;
            FavCimsBBMenuButton.height = FavCimsBBETexture.height;
            FavCimsBBMenuButton.useOutline = true;
            FavCimsBBMenuButton.playAudioEvents = true;
            FavCimsBBMenuButton.font = UIDynamicFont.FindByName ("OpenSans-Regular");
            FavCimsBBMenuButton.textScale = 1.8f;
            FavCimsBBMenuButton.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a
            FavCimsBBMenuButton.hoveredTextColor = new Color32 (204, 102, 0, 20);
            FavCimsBBMenuButton.pressedTextColor = new Color32 (153, 0, 0, 0);
            FavCimsBBMenuButton.focusedTextColor = new Color32 (102, 153, 255, 147);
            FavCimsBBMenuButton.textPadding.left = 20;
            FavCimsBBMenuButton.useDropShadow = true;
            FavCimsBBMenuButton.tooltipBox = uiView.defaultTooltipBox;

            //Printing
            //FavCimsBBMenuSprite.relativePosition = new Vector3 (FavCimsCBMenuSprite.position.x + FavCimsBBMenuSprite.width + 21, 69); //html => margin-left:21px;
            //FavCimsBBMenuButton.relativePosition = new Vector3 (FavCimsBCMenuButton.position.x + FavCimsBBMenuButton.width + 35, 69);

            ///////////////////////////////////////////////
            //Stats Button Texture (Enabled & Disabled)
            //////////////////////////////////////////////

            FavCimsSBETexture = ResourceLoader.loadTexture (200, 59, "UIMainPanel.statsbuttonenabled.png");
            FavCimsSBDTexture = ResourceLoader.loadTexture (200, 59, "UIMainPanel.statsbuttondisabled.png");

            FavCimsSBETexture.wrapMode = TextureWrapMode.Clamp;
            FavCimsSBETexture.filterMode = FilterMode.Bilinear;
            FavCimsSBETexture.name = "FavCimsSBETexture";
            FavCimsSBETexture.mipMapBias = -0.5f;
            FavCimsSBDTexture.wrapMode = TextureWrapMode.Clamp;
            FavCimsSBDTexture.filterMode = FilterMode.Bilinear;
            FavCimsSBDTexture.name = "FavCimsSBETexture";
            FavCimsSBDTexture.mipMapBias = -0.5f;
            FavCimsSBMenuSprite = FavCimsMainBGSprite.AddUIComponent<UITextureSprite> ();
            FavCimsSBMenuSprite.name = "FavCimsSBMenuSprite";
            FavCimsSBMenuSprite.texture = FavCimsSBDTexture;

            //Stats Transparent Button (For Easy Text Change)
            FavCimsBSMenuButton = this.AddUIComponent<UIButton> ();
            FavCimsBSMenuButton.name = "FavCimsBSMenuButton";
            FavCimsBSMenuButton.width = FavCimsSBETexture.width;
            FavCimsBSMenuButton.height = FavCimsSBETexture.height;
            FavCimsBSMenuButton.useOutline = true;
            FavCimsBSMenuButton.playAudioEvents = true;
            FavCimsBSMenuButton.font = UIDynamicFont.FindByName ("OpenSans-Regular");
            FavCimsBSMenuButton.textScale = 1.8f;
            FavCimsBSMenuButton.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a
            FavCimsBSMenuButton.hoveredTextColor = new Color32 (204, 102, 0, 20);
            FavCimsBSMenuButton.pressedTextColor = new Color32 (153, 0, 0, 0);
            FavCimsBSMenuButton.focusedTextColor = new Color32 (102, 153, 255, 147);
            FavCimsBSMenuButton.textPadding.left = 0;
            FavCimsBSMenuButton.useDropShadow = true;
            FavCimsBSMenuButton.tooltipBox = uiView.defaultTooltipBox;

            //Printing
            //FavCimsSBMenuSprite.relativePosition = new Vector3 (FavCimsBBMenuSprite.position.x + FavCimsSBMenuSprite.width + 21, 69); //html => margin-left:21px;
            //FavCimsBSMenuButton.relativePosition = new Vector3 (FavCimsBBMenuButton.position.x + FavCimsBSMenuButton.width + 21, 69); //html => margin-left:21px;

            ///////////////////////////////////////////////
            //Click Operation for Main Buttons
            //////////////////////////////////////////////

            //FavCimsBCMenuButton.eventClick += (component, eventParam) => ButtonEnabler (FavCimsCBMenuSprite);
            //FavCimsBBMenuButton.eventClick += (component, eventParam) => ButtonEnabler (FavCimsBBMenuSprite);
            //FavCimsBSMenuButton.eventClick += (component, eventParam) => ButtonEnabler (FavCimsSBMenuSprite);
            */

            ///////////////////////////////////////////////
            //Citizens Panel
            //////////////////////////////////////////////

            CitizensPanel = this.AddUIComponent<UIPanel> ();
            CitizensPanel.name = "CitizensPanel";
            CitizensPanel.width = 1190;
            CitizensPanel.height = 558;
            CitizensPanel.relativePosition = new Vector3 (((this.width / 2) - (float)CitizensPanel.width / 2), 128);

            ///////////////////////////////////////////////
            //Citizens Panel Body Background
            //////////////////////////////////////////////

            FavCimsMainBodyTexture = ResourceLoader.loadTexture (1190, 558, "UIMainPanel.bodybg.png");

            FavCimsMainBodyTexture.wrapMode = TextureWrapMode.Clamp;
            FavCimsMainBodyTexture.filterMode = FilterMode.Bilinear;
            FavCimsMainBodyTexture.name = "FavCimsMainBodyTexture";

            FavCimsBodySprite = CitizensPanel.AddUIComponent<UITextureSprite> ();
            FavCimsBodySprite.name = "FavCimsCBGBodySprite";
            FavCimsBodySprite.texture = FavCimsMainBodyTexture;
            //Printing
            FavCimsBodySprite.relativePosition = Vector3.zero;

            ///////////////////////////////////////////////
            //Index Column Background
            //////////////////////////////////////////////

            Texture FavCimsIndexBgBar = ResourceLoader.loadTexture (1146, 26, "UIMainPanel.indexerbgbar.png");

            FavCimsIndexBgBar.wrapMode = TextureWrapMode.Clamp;
            FavCimsIndexBgBar.filterMode = FilterMode.Bilinear;
            FavCimsIndexBgBar.name = "FavCimsIndexBgBar";
            FavCimsIndexBgBar.mipMapBias = -0.5f;
            UITextureSprite FavCimsIndexBgBarSprite = CitizensPanel.AddUIComponent<UITextureSprite> ();
            FavCimsIndexBgBarSprite.name = "FavCimsIndexBgBarSprite";
            FavCimsIndexBgBarSprite.texture = FavCimsIndexBgBar;

            //Printing
            FavCimsIndexBgBarSprite.relativePosition = new Vector3 (21, 7);

            ////////////////////////////////////////////////
            //Index Columns (Button for future sort order...)
            ////////////////////////////////////////////////

            //Status
            FavCimsHappinesColText = CitizensPanel.AddUIComponent<UIButton> ();
            FavCimsHappinesColText.name = "FavCimsHappinesColText";
            FavCimsHappinesColText.width = 60;
            FavCimsHappinesColText.height = FavCimsIndexBgBar.height;
            FavCimsHappinesColText.textVerticalAlignment = UIVerticalAlignment.Middle;
            FavCimsHappinesColText.textHorizontalAlignment = UIHorizontalAlignment.Center;
            FavCimsHappinesColText.playAudioEvents = true;
            FavCimsHappinesColText.font = UIDynamicFont.FindByName ("OpenSans-Regular");
            FavCimsHappinesColText.textScale = 0.7f;
            FavCimsHappinesColText.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a
            FavCimsHappinesColText.hoveredTextColor = new Color32 (204, 102, 0, 20);
            FavCimsHappinesColText.pressedTextColor = new Color32 (153, 0, 0, 0);
            FavCimsHappinesColText.focusedTextColor = new Color32 (102, 153, 255, 147);
            FavCimsHappinesColText.textPadding.left = 0;
            FavCimsHappinesColText.tooltipBox = uiView.defaultTooltipBox;

            //Printing Status
            FavCimsHappinesColText.relativePosition = new Vector3 (FavCimsIndexBgBarSprite.relativePosition.x + 6, FavCimsIndexBgBarSprite.relativePosition.y + 1);

            //Name
            FavCimsNameColText = CitizensPanel.AddUIComponent<UIButton> ();
            FavCimsNameColText.name = "FavCimsNameColText";
            FavCimsNameColText.width = 180;
            FavCimsNameColText.height = FavCimsIndexBgBar.height;
            FavCimsNameColText.textVerticalAlignment = UIVerticalAlignment.Middle;
            FavCimsNameColText.textHorizontalAlignment = UIHorizontalAlignment.Center;
            FavCimsNameColText.playAudioEvents = true;
            FavCimsNameColText.font = UIDynamicFont.FindByName ("OpenSans-Regular");
            FavCimsNameColText.textScale = 0.7f;
            FavCimsNameColText.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a
            FavCimsNameColText.hoveredTextColor = new Color32 (204, 102, 0, 20);
            FavCimsNameColText.pressedTextColor = new Color32 (153, 0, 0, 0);
            FavCimsNameColText.focusedTextColor = new Color32 (102, 153, 255, 147);
            FavCimsNameColText.textPadding.left = 0;
            FavCimsNameColText.tooltipBox = uiView.defaultTooltipBox;

            //Printing Name
            FavCimsNameColText.relativePosition = new Vector3 (FavCimsHappinesColText.relativePosition.x + FavCimsHappinesColText.width, FavCimsIndexBgBarSprite.relativePosition.y + 1);

            //Age Phase
            FavCimsAgePhaseColText = CitizensPanel.AddUIComponent<UIButton> ();
            FavCimsAgePhaseColText.name = "FavCimsAgePhaseColText";
            FavCimsAgePhaseColText.width = 120;
            FavCimsAgePhaseColText.height = FavCimsIndexBgBar.height;
            FavCimsAgePhaseColText.textVerticalAlignment = UIVerticalAlignment.Middle;
            FavCimsAgePhaseColText.textHorizontalAlignment = UIHorizontalAlignment.Center;
            FavCimsAgePhaseColText.playAudioEvents = true;
            FavCimsAgePhaseColText.font = UIDynamicFont.FindByName ("OpenSans-Regular");
            FavCimsAgePhaseColText.textScale = 0.7f;
            FavCimsAgePhaseColText.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a
            FavCimsAgePhaseColText.hoveredTextColor = new Color32 (204, 102, 0, 20);
            FavCimsAgePhaseColText.pressedTextColor = new Color32 (153, 0, 0, 0);
            FavCimsAgePhaseColText.focusedTextColor = new Color32 (102, 153, 255, 147);
            FavCimsAgePhaseColText.textPadding.left = 0;
            FavCimsAgePhaseColText.tooltipBox = uiView.defaultTooltipBox;

            //Printing Age Phase
            FavCimsAgePhaseColText.relativePosition = new Vector3 (FavCimsNameColText.relativePosition.x + FavCimsNameColText.width, FavCimsIndexBgBarSprite.relativePosition.y + 1);

            //Age
            FavCimsAgeColText = CitizensPanel.AddUIComponent<UIButton> ();
            FavCimsAgeColText.name = "FavCimsAgeColText";
            FavCimsAgeColText.width = 40;
            FavCimsAgeColText.height = FavCimsIndexBgBar.height;
            FavCimsAgeColText.textVerticalAlignment = UIVerticalAlignment.Middle;
            FavCimsAgeColText.textHorizontalAlignment = UIHorizontalAlignment.Center;
            FavCimsAgeColText.playAudioEvents = true;
            FavCimsAgeColText.font = UIDynamicFont.FindByName ("OpenSans-Regular");
            FavCimsAgeColText.textScale = 0.7f;
            FavCimsAgeColText.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a
            FavCimsAgeColText.hoveredTextColor = new Color32 (204, 102, 0, 20);
            FavCimsAgeColText.pressedTextColor = new Color32 (153, 0, 0, 0);
            FavCimsAgeColText.focusedTextColor = new Color32 (102, 153, 255, 147);
            FavCimsAgeColText.textPadding.left = 0;
            FavCimsAgeColText.tooltipBox = uiView.defaultTooltipBox;

            //Printing Age
            FavCimsAgeColText.relativePosition = new Vector3 (FavCimsAgePhaseColText.relativePosition.x + FavCimsAgePhaseColText.width, FavCimsIndexBgBarSprite.relativePosition.y + 1);

            //Education
            FavCimsEduColText = CitizensPanel.AddUIComponent<UIButton> ();
            FavCimsEduColText.name = "FavCimsEduColText";
            FavCimsEduColText.width = 140;
            FavCimsEduColText.height = FavCimsIndexBgBar.height;
            FavCimsEduColText.textVerticalAlignment = UIVerticalAlignment.Middle;
            FavCimsEduColText.textHorizontalAlignment = UIHorizontalAlignment.Center;
            FavCimsEduColText.playAudioEvents = true;
            FavCimsEduColText.font = UIDynamicFont.FindByName ("OpenSans-Regular");
            FavCimsEduColText.textScale = 0.7f;
            FavCimsEduColText.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a
            FavCimsEduColText.hoveredTextColor = new Color32 (204, 102, 0, 20);
            FavCimsEduColText.pressedTextColor = new Color32 (153, 0, 0, 0);
            FavCimsEduColText.focusedTextColor = new Color32 (102, 153, 255, 147);
            FavCimsEduColText.textPadding.left = 0;
            FavCimsEduColText.tooltipBox = uiView.defaultTooltipBox;

            //Printing Education
            FavCimsEduColText.relativePosition = new Vector3 (FavCimsAgeColText.relativePosition.x + FavCimsAgeColText.width, FavCimsIndexBgBarSprite.relativePosition.y + 1);

            //Home
            FavCimsHomeColText = CitizensPanel.AddUIComponent<UIButton> ();
            FavCimsHomeColText.name = "FavCimsHomeColText";
            FavCimsHomeColText.width = 184;
            FavCimsHomeColText.height = FavCimsIndexBgBar.height;
            FavCimsHomeColText.textVerticalAlignment = UIVerticalAlignment.Middle;
            FavCimsHomeColText.textHorizontalAlignment = UIHorizontalAlignment.Center;
            FavCimsHomeColText.playAudioEvents = true;
            FavCimsHomeColText.font = UIDynamicFont.FindByName ("OpenSans-Regular");
            FavCimsHomeColText.textScale = 0.7f;
            FavCimsHomeColText.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a
            FavCimsHomeColText.hoveredTextColor = new Color32 (204, 102, 0, 20);
            FavCimsHomeColText.pressedTextColor = new Color32 (153, 0, 0, 0);
            FavCimsHomeColText.focusedTextColor = new Color32 (102, 153, 255, 147);
            FavCimsHomeColText.textPadding.left = 0;
            FavCimsHomeColText.tooltipBox = uiView.defaultTooltipBox;

            //Printing Home
            FavCimsHomeColText.relativePosition = new Vector3 (FavCimsEduColText.relativePosition.x + FavCimsEduColText.width, FavCimsIndexBgBarSprite.relativePosition.y + 1);

            //Working Place
            FavCimsWorkingPlaceColText = CitizensPanel.AddUIComponent<UIButton> ();
            FavCimsWorkingPlaceColText.name = "FavCimsWorkingPlaceColText";
            FavCimsWorkingPlaceColText.width = 180;
            FavCimsWorkingPlaceColText.height = FavCimsIndexBgBar.height;
            FavCimsWorkingPlaceColText.textVerticalAlignment = UIVerticalAlignment.Middle;
            FavCimsWorkingPlaceColText.textHorizontalAlignment = UIHorizontalAlignment.Center;
            FavCimsWorkingPlaceColText.playAudioEvents = true;
            FavCimsWorkingPlaceColText.font = UIDynamicFont.FindByName ("OpenSans-Regular");
            FavCimsWorkingPlaceColText.textScale = 0.7f;
            FavCimsWorkingPlaceColText.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a
            FavCimsWorkingPlaceColText.hoveredTextColor = new Color32 (204, 102, 0, 20);
            FavCimsWorkingPlaceColText.pressedTextColor = new Color32 (153, 0, 0, 0);
            FavCimsWorkingPlaceColText.focusedTextColor = new Color32 (102, 153, 255, 147);
            FavCimsWorkingPlaceColText.textPadding.left = 0;
            FavCimsWorkingPlaceColText.tooltipBox = uiView.defaultTooltipBox;

            //Printing Working Place
            FavCimsWorkingPlaceColText.relativePosition = new Vector3 (FavCimsHomeColText.relativePosition.x + FavCimsHomeColText.width, FavCimsIndexBgBarSprite.relativePosition.y + 1);

            //Last Activity
            FavCimsLastActColText = CitizensPanel.AddUIComponent<UIButton> ();
            FavCimsLastActColText.name = "FavCimsLastActColText";
            FavCimsLastActColText.width = 180;
            FavCimsLastActColText.height = FavCimsIndexBgBar.height;
            FavCimsLastActColText.textVerticalAlignment = UIVerticalAlignment.Middle;
            FavCimsLastActColText.textHorizontalAlignment = UIHorizontalAlignment.Center;
            FavCimsLastActColText.playAudioEvents = true;
            FavCimsLastActColText.font = UIDynamicFont.FindByName ("OpenSans-Regular");
            FavCimsLastActColText.textScale = 0.7f;
            FavCimsLastActColText.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a
            FavCimsLastActColText.hoveredTextColor = new Color32 (204, 102, 0, 20);
            FavCimsLastActColText.pressedTextColor = new Color32 (153, 0, 0, 0);
            FavCimsLastActColText.focusedTextColor = new Color32 (102, 153, 255, 147);
            FavCimsLastActColText.textPadding.left = 0;
            FavCimsLastActColText.tooltipBox = uiView.defaultTooltipBox;

            //Printing Last Activity
            FavCimsLastActColText.relativePosition = new Vector3 (FavCimsWorkingPlaceColText.relativePosition.x + FavCimsWorkingPlaceColText.width, FavCimsIndexBgBarSprite.relativePosition.y + 1);

            //Close Button
            FavCimsCloseButtonCol = CitizensPanel.AddUIComponent<UIButton> ();
            FavCimsCloseButtonCol.name = "FavCimsCloseButtonCol";
            FavCimsCloseButtonCol.width = 50;
            FavCimsCloseButtonCol.height = FavCimsIndexBgBar.height;
            FavCimsCloseButtonCol.textVerticalAlignment = UIVerticalAlignment.Middle;
            FavCimsCloseButtonCol.textHorizontalAlignment = UIHorizontalAlignment.Center;
            FavCimsCloseButtonCol.playAudioEvents = true;
            FavCimsCloseButtonCol.font = UIDynamicFont.FindByName ("OpenSans-Regular");
            FavCimsCloseButtonCol.textScale = 0.7f;
            FavCimsCloseButtonCol.textColor = new Color32 (204, 204, 51, 40); //r,g,b,a
            FavCimsCloseButtonCol.hoveredTextColor = new Color32 (204, 102, 0, 20);
            FavCimsCloseButtonCol.pressedTextColor = new Color32 (153, 0, 0, 0);
            FavCimsCloseButtonCol.focusedTextColor = new Color32 (102, 153, 255, 147);
            FavCimsCloseButtonCol.textPadding.right = 6;
            FavCimsCloseButtonCol.tooltipBox = uiView.defaultTooltipBox;

            //Printing Close Button
            FavCimsCloseButtonCol.relativePosition = new Vector3 (FavCimsLastActColText.relativePosition.x + FavCimsLastActColText.width, FavCimsIndexBgBarSprite.relativePosition.y + 1);

            ///////////////////////////////////////////////
            /////Rows Panel Body
            ///////////////////////////////////////////////

            FavCimsCitizenRowsPanel = CitizensPanel.AddUIComponent<UIScrollablePanel> ();
            FavCimsCitizenRowsPanel.name = "FavCimsCitizenRowsPanel";
            FavCimsCitizenRowsPanel.width = FavCimsIndexBgBarSprite.width - 12;
            FavCimsCitizenRowsPanel.height = 500;

            FavCimsCitizenRowsPanel.autoLayoutDirection = LayoutDirection.Vertical;
            FavCimsCitizenRowsPanel.autoLayout = true;
            FavCimsCitizenRowsPanel.clipChildren = true;
            FavCimsCitizenRowsPanel.autoLayoutPadding = new RectOffset (0, 0, 0, 0);
            FavCimsCitizenRowsPanel.relativePosition = new Vector3 (FavCimsIndexBgBarSprite.relativePosition.x + 6, FavCimsIndexBgBarSprite.relativePosition.y + FavCimsIndexBgBarSprite.height);

            //Damn ScrollBar
            UIScrollablePanel FavCimsCitizenRowsPanelScrollBar = CitizensPanel.AddUIComponent<UIScrollablePanel> ();
            FavCimsCitizenRowsPanelScrollBar.name = "FavCimsCitizenRowsPanelScrollBar";
            FavCimsCitizenRowsPanelScrollBar.width = 10;
            FavCimsCitizenRowsPanelScrollBar.height = 500;
            FavCimsCitizenRowsPanelScrollBar.relativePosition = new Vector3 (FavCimsIndexBgBarSprite.relativePosition.x + FavCimsIndexBgBarSprite.width, FavCimsCitizenRowsPanel.relativePosition.y);

            UIScrollbar FavCimsMainPanelScrollBar = FavCimsCitizenRowsPanelScrollBar.AddUIComponent<UIScrollbar> ();
            FavCimsMainPanelScrollBar.width = 10;
            FavCimsMainPanelScrollBar.height = FavCimsCitizenRowsPanel.height;
            FavCimsMainPanelScrollBar.orientation = UIOrientation.Vertical;
            FavCimsMainPanelScrollBar.pivot = UIPivotPoint.TopRight;
            FavCimsMainPanelScrollBar.AlignTo (FavCimsMainPanelScrollBar.parent, UIAlignAnchor.TopRight);
            FavCimsMainPanelScrollBar.minValue = 0;
            FavCimsMainPanelScrollBar.value = 0;
            FavCimsMainPanelScrollBar.incrementAmount = 40;

            UISlicedSprite FavCimsMainPanelTrackSprite = FavCimsMainPanelScrollBar.AddUIComponent<UISlicedSprite> ();
            FavCimsMainPanelTrackSprite.relativePosition = FavCimsMainPanelScrollBar.relativePosition;
            FavCimsMainPanelTrackSprite.autoSize = true;
            FavCimsMainPanelTrackSprite.size = FavCimsMainPanelTrackSprite.parent.size;
            FavCimsMainPanelTrackSprite.fillDirection = UIFillDirection.Vertical;
            FavCimsMainPanelTrackSprite.spriteName = "ScrollbarTrack";

            FavCimsMainPanelScrollBar.trackObject = FavCimsMainPanelTrackSprite;

            UISlicedSprite thumbSprite = FavCimsMainPanelScrollBar.AddUIComponent<UISlicedSprite> ();
            thumbSprite.relativePosition = FavCimsMainPanelScrollBar.relativePosition;
            thumbSprite.autoSize = true;
            thumbSprite.width = thumbSprite.parent.width;
            thumbSprite.fillDirection = UIFillDirection.Vertical;
            thumbSprite.spriteName = "ScrollbarThumb";
            FavCimsMainPanelScrollBar.thumbObject = thumbSprite;
            FavCimsCitizenRowsPanel.verticalScrollbar = FavCimsMainPanelScrollBar;

            /* Thx to CNightwing for this piece of code */
            FavCimsCitizenRowsPanel.eventMouseWheel += (component, eventParam) => {
                var sign = Math.Sign (eventParam.wheelDelta);
                FavCimsCitizenRowsPanel.scrollPosition += new Vector2 (0, sign * (-1) * FavCimsMainPanelScrollBar.incrementAmount);
            };
            /* End */

            FavCimsCitizenRowsPanel.eventComponentAdded += (component, eventParam) => ReorderRowsBackgrounds ();
            FavCimsCitizenRowsPanel.eventComponentRemoved += (component, eventParam) => ReorderRowsBackgrounds ();

            ///////////////////////////////////////////////
            /////Rows Panel Footer
            ///////////////////////////////////////////////

            UITextureSprite FavCimsFooterBgBarSprite = CitizensPanel.AddUIComponent<UITextureSprite> ();
            FavCimsFooterBgBarSprite.name = "FavCimsFooterBgBarSprite";
            FavCimsFooterBgBarSprite.width = FavCimsIndexBgBarSprite.width;
            FavCimsFooterBgBarSprite.height = 15;
            FavCimsFooterBgBarSprite.texture = FavCimsIndexBgBar;

            //Printing
            FavCimsFooterBgBarSprite.relativePosition = new Vector3 (21, FavCimsCitizenRowsPanel.relativePosition.y + FavCimsCitizenRowsPanel.height);
            //Row End

            //Load Initial Row (People Renamed)
            foreach(KeyValuePair<InstanceID, string> FavCitizen in FavCimsCore.FavoriteCimsList())
            {
                if(FavCitizen.Key.Type == InstanceType.Citizen) { // || FavCitizen.Key.Type == InstanceType.CitizenInstance
                    CitizenRow FavCimsCitizenSingleRowPanel = FavCimsCitizenRowsPanel.AddUIComponent(typeof(CitizenRow)) as CitizenRow;
                    FavCimsCitizenSingleRowPanel.MyInstanceID = FavCitizen.Key;
                    FavCimsCitizenSingleRowPanel.MyInstancedName = FavCitizen.Value;
                }
            }
        }
        public void CreateButtons()
        {
            UIView uiView = UIView.GetAView();

            UIComponent refButton = uiView.FindUIComponent("Policies");
            UIComponent tsBar = uiView.FindUIComponent("TSBar");
            if (btLevel == null)
            {
                terraformPanel = UIView.GetAView().FindUIComponent<UITabContainer>("TSContainer").AddUIComponent<UIScrollablePanel>();
                terraformPanel.backgroundSprite = "SubcategoriesPanel";
                terraformPanel.isVisible = false;
                terraformPanel.name = "TerraformPanel";
                terraformPanel.autoLayoutPadding = new RectOffset(25, 0, 20, 20);
                terraformPanel.autoLayout = true;

                btToggle = UIView.GetAView().FindUIComponent<UITabstrip>("MainToolstrip").AddUIComponent<UIButton>();

                InitButton(btToggle, "ToolbarIconTerrain", new Vector2(43, 49));
                btToggle.focusedFgSprite = "ToolbarIconGroup6Focused";
                btToggle.hoveredFgSprite = "ToolbarIconGroup6Hovered";
                btToggle.name = "TerrainButton";

                var btSizeLarge = new Vector2(109, 75);

                btPoint = (UIButton)terraformPanel.AddUIComponent(typeof(UIButton));
                InitButton(btPoint, "TerrainDitch", btSizeLarge);

                btShift = (UIButton)terraformPanel.AddUIComponent(typeof(UIButton));
                InitButton(btShift, "TerrainShift", btSizeLarge);

                btSoften = (UIButton)terraformPanel.AddUIComponent(typeof(UIButton));
                InitButton(btSoften, "TerrainSoften", btSizeLarge);

                btLevel = (UIButton)terraformPanel.AddUIComponent(typeof(UIButton));
                InitButton(btLevel, "TerrainLevel", btSizeLarge);

                btSlope = (UIButton)terraformPanel.AddUIComponent(typeof(UIButton));
                InitButton(btSlope, "TerrainSlope", btSizeLarge);

                btSand = (UIButton)terraformPanel.AddUIComponent(typeof(UIButton));
                InitButton(btSand, "ResourceSand", btSizeLarge);

                terraformPanel.Reset();

            }
        }
 private void OnDestroy()
 {
     m_Container = null;
 }
        private void SetupScrollPanel()
        {
            //this probably needs to exist, otherwise the autoLayout of this UITransportPanel places the scrollbar weird
            _panelForScrollPanel = AddUIComponent<UIPanel> ();
            // needed so that the colorpicker finds the right parent
            _panelForScrollPanel.gameObject.AddComponent<UICustomControl>();

            _panelForScrollPanel.width = width - 6;
            //_captions reporting 450 height? fixed value of 20
            _panelForScrollPanel.height = height - _title.height - _buttons.height - 20 - autoLayoutPadding.bottom * 4 - autoLayoutPadding.top * 4;

            // taken from http://www.reddit.com/r/CitiesSkylinesModding/comments/2zrz0k/extended_public_transport_ui_provides_addtional/cpnet5q
            _scrollablePanel = _panelForScrollPanel.AddUIComponent<UIScrollablePanel> ();
            _scrollablePanel.width = _scrollablePanel.parent.width - 5f;
            _scrollablePanel.height = _scrollablePanel.parent.height;

            _scrollablePanel.autoLayout = true;
            _scrollablePanel.autoLayoutDirection = LayoutDirection.Vertical;
            _scrollablePanel.autoLayoutStart = LayoutStart.TopLeft;
            _scrollablePanel.autoLayoutPadding = new RectOffset (0, 0, 1, 1);
            _scrollablePanel.clipChildren = true;

            _scrollablePanel.pivot = UIPivotPoint.TopLeft;
            _scrollablePanel.AlignTo (_scrollablePanel.parent, UIAlignAnchor.TopLeft);

            UIScrollbar scrollbar = _panelForScrollPanel.AddUIComponent<UIScrollbar> ();
            scrollbar.width = scrollbar.parent.width - _scrollablePanel.width;
            scrollbar.height = scrollbar.parent.height;
            scrollbar.orientation = UIOrientation.Vertical;
            scrollbar.pivot = UIPivotPoint.BottomLeft;
            scrollbar.AlignTo (scrollbar.parent, UIAlignAnchor.TopRight);
            scrollbar.minValue = 0;
            scrollbar.value = 0;
            scrollbar.incrementAmount = 50;

            UISlicedSprite tracSprite = scrollbar.AddUIComponent<UISlicedSprite> ();
            tracSprite.relativePosition = Vector2.zero;
            tracSprite.autoSize = true;
            tracSprite.size = tracSprite.parent.size;
            tracSprite.fillDirection = UIFillDirection.Vertical;
            tracSprite.spriteName = "ScrollbarTrack";

            scrollbar.trackObject = tracSprite;

            UISlicedSprite thumbSprite = tracSprite.AddUIComponent<UISlicedSprite> ();
            thumbSprite.relativePosition = Vector2.zero;
            thumbSprite.fillDirection = UIFillDirection.Vertical;
            thumbSprite.autoSize = true;
            thumbSprite.width = thumbSprite.parent.width;
            thumbSprite.spriteName = "ScrollbarThumb";

            scrollbar.thumbObject = thumbSprite;

            _scrollablePanel.verticalScrollbar = scrollbar;
            _scrollablePanel.eventMouseWheel += (component, param) =>
            {
                var sign = Math.Sign(param.wheelDelta);
                _scrollablePanel.scrollPosition += new Vector2(0, sign*(-1) * 20);
            };
        }
 public UIModOptionsPanelBuilder(UIHelper uiHelper, ConfigurationContainer configuration)
 {
     _uiHelper = uiHelper;
     _configuration = configuration;
     _rootPanel = uiHelper.self as UIScrollablePanel;
 }