Exemplo n.º 1
0
        private void CreateComponents()
        {
            UILabel label = AddUIComponent <UILabel>();

            label.text             = "Select an effect to add";
            label.relativePosition = new Vector3(WIDTH / 2 - label.width / 2, 10);

            // Drag handle
            UIDragHandle handle = AddUIComponent <UIDragHandle>();

            handle.target            = this;
            handle.constrainToScreen = true;
            handle.width             = WIDTH;
            handle.height            = 40;
            handle.relativePosition  = Vector3.zero;

            // Name field
            label      = AddUIComponent <UILabel>();
            label.text = "Name:";

            m_searchField       = UIUtils.CreateTextField(this);
            m_searchField.width = 250;

            label.relativePosition         = new Vector3((WIDTH - (label.width + m_searchField.width + 10)) / 2, 55);
            m_searchField.relativePosition = new Vector3((WIDTH - m_searchField.width + label.width + 10) / 2, 50);
            m_searchField.text             = "";

            m_searchField.eventTextChanged += (c, s) => {
                PopulateList();
            };
            m_searchField.tooltip = "Search for an effect by name";

            // Buttons
            UIButton confirmButton = UIUtils.CreateButton(this);

            confirmButton.text             = "Add";
            confirmButton.relativePosition = new Vector3(WIDTH / 2 - confirmButton.width - 10, HEIGHT - confirmButton.height - 10);
            confirmButton.eventClicked    += (c, p) =>
            {
                AddEffect();
            };

            UIButton cancelButton = UIUtils.CreateButton(this);

            cancelButton.text             = "Cancel";
            cancelButton.relativePosition = new Vector3(WIDTH / 2 + 10, HEIGHT - cancelButton.height - 10);
            cancelButton.eventClicked    += (c, p) =>
            {
                isVisible = false;
            };

            // Effect list
            m_effectList = UIFastList.Create <UIEffectRow>(this);
            m_effectList.backgroundSprite = "UnlockingPanel";
            m_effectList.relativePosition = new Vector3(10, 90);
            m_effectList.height           = HEIGHT - 90 - 10 - cancelButton.height;
            m_effectList.width            = WIDTH - 20;
            m_effectList.canSelect        = true;
        }
Exemplo n.º 2
0
 private void CreateFastList(Vector2 listSize, float rowHeight)
 {
     _fastList = UIFastList.Create <ListRow>(this);
     _fastList.BackgroundSprite  = "UnlockingPanel";
     _fastList.size              = listSize;
     _fastList.RowHeight         = rowHeight;
     _fastList.CanSelect         = true;
     _fastList.AutoHideScrollbar = true;
 }
Exemplo n.º 3
0
        private void CreateOptionList(Dictionary <string, OptionItem> options, UIFastList list = null)
        {
            if (list != null)
            {
                foreach (KeyValuePair <string, OptionItem> option in options)
                {
                    option.Value.id = option.Key;

                    list.rowsData.Add(option.Value);
                }
            }
        }
Exemplo n.º 4
0
        private void CreatePanelComponents()
        {
            vehicleList                  = UIFastList.Create <VehicleInfoListEntry>(this);
            vehicleList.size             = new Vector2(this.width - m_UIPadding.left - m_UIPadding.right, (this.height - titleOffset - m_UIPadding.top - m_UIPadding.bottom));
            vehicleList.canSelect        = false;
            vehicleList.relativePosition = new Vector2(m_UIPadding.left, titleOffset + m_UIPadding.top);
            vehicleList.rowHeight        = 40f;
            vehicleList.rowsData.Clear();
            vehicleList.selectedIndex = -1;

            RefreshList();
        }
Exemplo n.º 5
0
        private void CreateOptions()
        {
            scrollOptionsList = UIFastList.Create <UIOptionItem>(this);
            scrollOptionsList.backgroundSprite = "UnlockingPanel";
            scrollOptionsList.size             = new Vector2(192, 290);
            scrollOptionsList.canSelect        = true;
            scrollOptionsList.relativePosition = offset;
            scrollOptionsList.rowHeight        = 20f;
            scrollOptionsList.rowsData.Clear();
            scrollOptionsList.selectedIndex = -1;

            offset += new Vector2(0, scrollOptionsList.height + 5);

            CreateOptionList(MapperOptionsManager.exportOptions, scrollOptionsList);

            scrollOptionsList.DisplayAt(0);
            scrollOptionsList.selectedIndex = 0;
        }
Exemplo n.º 6
0
        private void CreateOptions()
        {
            scrollOptionsList = UIFastList.Create<UIOptionItem>(this);
            scrollOptionsList.backgroundSprite = "UnlockingPanel";
            scrollOptionsList.size = new Vector2(192, 290);
            scrollOptionsList.canSelect = true;
            scrollOptionsList.relativePosition = offset;
            scrollOptionsList.rowHeight = 20f;
            scrollOptionsList.rowsData.Clear();
            scrollOptionsList.selectedIndex = -1;

            offset += new Vector2(0, scrollOptionsList.height + 5);

            CreateOptionList(MapperOptionsManager.exportOptions, scrollOptionsList);

            scrollOptionsList.DisplayAt(0);
            scrollOptionsList.selectedIndex = 0;
        }
Exemplo n.º 7
0
        private void CreateOptionList(Dictionary<string, OptionItem> options, UIFastList list = null)
        {
            if (list != null)
            {
                foreach (KeyValuePair<string, OptionItem> option in options)
                {
                    option.Value.id = option.Key;

                    list.rowsData.Add(option.Value);
                }
            }
        }
Exemplo n.º 8
0
        private void SetupControls()
        {
            // Title Bar
            m_title = AddUIComponent<UITitleBar>();
            m_title.title = "Theme Manager";
            m_title.iconSprite = "ToolbarIconZoomOutCity";

            // Filter
            m_filter = AddUIComponent<UIBuildingFilter>();
            m_filter.width = width - SPACING * 2;
            m_filter.height = 70;
            m_filter.relativePosition = new Vector3(SPACING, TITLE_HEIGHT);

            m_filter.eventFilteringChanged += (c, i) =>
            {
                if (m_themeSelection != null && m_themeSelection.selectedIndex != -1)
                {
                    Configuration.Theme theme = m_themeSelection.selectedItem as Configuration.Theme;
                    m_buildingSelection.selectedIndex = -1;
                    m_buildingSelection.rowsData = Filter(m_themes[theme]);
                }
            };

            // Panels
            UIPanel left = AddUIComponent<UIPanel>();
            left.width = LEFT_WIDTH;
            left.height = HEIGHT - m_filter.height;
            left.relativePosition = new Vector3(SPACING, TITLE_HEIGHT + m_filter.height + SPACING);

            UIPanel middle = AddUIComponent<UIPanel>();
            middle.width = MIDDLE_WIDTH;
            middle.height = HEIGHT - m_filter.height;
            middle.relativePosition = new Vector3(LEFT_WIDTH + SPACING * 2, TITLE_HEIGHT + m_filter.height + SPACING);

            UIPanel right = AddUIComponent<UIPanel>();
            right.width = RIGHT_WIDTH;
            right.height = HEIGHT - m_filter.height;
            right.relativePosition = new Vector3(LEFT_WIDTH + MIDDLE_WIDTH + SPACING * 3, TITLE_HEIGHT + m_filter.height + SPACING);

            // Theme selection
            m_themeSelection = UIFastList.Create<UIThemeItem>(left);

            m_themeSelection.backgroundSprite = "UnlockingPanel";
            m_themeSelection.width = left.width;
            m_themeSelection.height = left.height - 40;
            m_themeSelection.canSelect = true;
            m_themeSelection.rowHeight = 40;
            m_themeSelection.autoHideScrollbar = true;
            m_themeSelection.relativePosition = Vector3.zero;

            m_themeSelection.rowsData.m_buffer = m_themes.Keys.ToArray();
            m_themeSelection.rowsData.m_size = m_themeSelection.rowsData.m_buffer.Length;
            m_themeSelection.DisplayAt(0);

            m_themeSelection.eventSelectedIndexChanged += (c, i) =>
            {
                if (i == -1) return;

                int listCount = m_buildingSelection.rowsData.m_size;
                float pos = m_buildingSelection.listPosition;

                Configuration.Theme theme = m_themeSelection.selectedItem as Configuration.Theme;
                m_buildingSelection.selectedIndex = -1;
                m_buildingSelection.rowsData = Filter(m_themes[theme]);

                if (m_filter.buildingStatus == Status.All && m_buildingSelection.rowsData.m_size == listCount)
                {
                    m_buildingSelection.DisplayAt(pos);
                }

                m_themeRemove.isEnabled = !((Configuration.Theme)m_themeSelection.selectedItem).isBuiltIn;
            };

            // Add theme
            m_themeAdd = UIUtils.CreateButton(left);
            m_themeAdd.width = (LEFT_WIDTH - SPACING) / 2;
            m_themeAdd.text = "New Theme";
            m_themeAdd.relativePosition = new Vector3(0, m_themeSelection.height + SPACING);

            m_themeAdd.eventClick += (c, p) =>
            {
                UIView.PushModal(UINewThemeModal.instance);
                UINewThemeModal.instance.Show(true);
            };

            // Remove theme
            m_themeRemove = UIUtils.CreateButton(left);
            m_themeRemove.width = (LEFT_WIDTH - SPACING) / 2;
            m_themeRemove.text = "Delete Theme";
            m_themeRemove.isEnabled = false;
            m_themeRemove.relativePosition = new Vector3(LEFT_WIDTH - m_themeRemove.width, m_themeSelection.height + SPACING);

            m_themeRemove.eventClick += (c, p) =>
            {
                ConfirmPanel.ShowModal("Delete Theme", "Are you sure you want to delete '" + selectedTheme.name + "' theme ?",
                    (d, i) => { if (i == 1) DeleteTheme(selectedTheme); });
            };

            // Building selection
            m_buildingSelection = UIFastList.Create<UIBuildingItem>(middle);

            m_buildingSelection.backgroundSprite = "UnlockingPanel";
            m_buildingSelection.width = middle.width;
            m_buildingSelection.height = middle.height - 40;
            m_buildingSelection.canSelect = true;
            m_buildingSelection.rowHeight = 40;
            m_buildingSelection.autoHideScrollbar = true;
            m_buildingSelection.relativePosition = Vector3.zero;

            m_buildingSelection.rowsData = new FastList<object>();

            m_buildingSelection.eventSelectedIndexChanged += (c, i) =>
            {
                m_cloneBuilding.isEnabled = selectedBuilding != null && selectedBuilding.prefab != null;

                if (selectedBuilding != null && selectedBuilding.isCloned)
                {
                    BuildingItem item = GetBuildingItem(selectedBuilding.building.baseName);
                    m_cloneBuilding.isEnabled = item != null && item.prefab != null;
                }
            };

            m_buildingSelection.eventMouseLeave += (c, p) =>
            {
                UpdateBuildingInfo(selectedBuilding);
            };

            // Include buttons
            m_includeNone = UIUtils.CreateButton(middle);
            m_includeNone.width = 55;
            m_includeNone.text = "None";
            m_includeNone.relativePosition = new Vector3(MIDDLE_WIDTH - m_includeNone.width, m_buildingSelection.height + SPACING);

            m_includeAll = UIUtils.CreateButton(middle);
            m_includeAll.width = 55;
            m_includeAll.text = "All";
            m_includeAll.relativePosition = new Vector3(m_includeNone.relativePosition.x - m_includeAll.width - SPACING, m_buildingSelection.height + SPACING);

            UILabel include = middle.AddUIComponent<UILabel>();
            include.width = 100;
            include.padding = new RectOffset(0, 0, 8, 0);
            include.textScale = 0.8f;
            include.text = "Include:";
            include.relativePosition = new Vector3(m_includeAll.relativePosition.x - include.width - SPACING, m_buildingSelection.height + SPACING);

            m_includeAll.eventClick += (c, p) =>
            {
                for (int i = 0; i < m_buildingSelection.rowsData.m_size; i++)
                {
                    BuildingItem item = m_buildingSelection.rowsData[i] as BuildingItem;
                    if (item != null) ChangeBuildingStatus(item, true);
                }

                m_buildingSelection.Refresh();
            };

            m_includeNone.eventClick += (c, p) =>
            {
                for (int i = 0; i < m_buildingSelection.rowsData.m_size; i++)
                {
                    BuildingItem item = m_buildingSelection.rowsData[i] as BuildingItem;
                    if (item != null) ChangeBuildingStatus(item, false);
                }

                m_buildingSelection.Refresh();
            };

            // Preview
            m_buildingPreview = right.AddUIComponent<UIBuildingPreview>();
            m_buildingPreview.width = right.width;
            m_buildingPreview.height = (right.height - SPACING) / 2;
            m_buildingPreview.relativePosition = Vector3.zero;

            // Building Options
            m_buildingOptions = right.AddUIComponent<UIBuildingOptions>();
            m_buildingOptions.width = RIGHT_WIDTH;
            m_buildingOptions.height = (right.height - SPACING) / 2 - 40;
            m_buildingOptions.relativePosition = new Vector3(0, m_buildingPreview.height + SPACING);

            // Clone building
            m_cloneBuilding = UIUtils.CreateButton(right);
            m_cloneBuilding.width = RIGHT_WIDTH;
            m_cloneBuilding.height = 30;
            m_cloneBuilding.text = "Clone building";
            m_cloneBuilding.isEnabled = false;
            m_cloneBuilding.relativePosition = new Vector3(0, m_buildingOptions.relativePosition.y + m_buildingOptions.height + SPACING);

            m_cloneBuilding.eventClick += (c, p) =>
            {
                UIView.PushModal(UICloneBuildingModal.instance);
                UICloneBuildingModal.instance.Show(true);
            };
        }
Exemplo n.º 9
0
        public static void AddThemesTab()
        {
            if (container != null)
            {
                return;
            }

            UITabstrip tabstrip = ToolsModifierControl.policiesPanel.Find("Tabstrip") as UITabstrip;

            // Add a custom tab
            tab = tabstrip.AddTab("Themes");
            tab.stringUserData = "Themes";
            tab.textScale = 0.875f;

            // recalculate the width of the tabs
            for (int i = 0; i < tabstrip.tabCount; i++)
            {
                tabstrip.tabs[i].width = tabstrip.width / ((float)tabstrip.tabCount - 1);
            }

            // The container for the policies was created by the game when we added the tab
            var pageIndex = tabstrip.tabPages.childCount - 1;
            container = (UIPanel)tabstrip.tabPages.components[pageIndex];

            container.autoLayout = true;
            container.autoLayoutDirection = LayoutDirection.Vertical;
            container.autoLayoutPadding.top = 5;

            // Only make the container visible if our tab was selected when the panel was closed last time
            container.isVisible = tabstrip.selectedIndex == pageIndex;

            // Theme buttons
            themePolicyButtons = UIFastList.Create<UIThemePolicyItem>(container);
            themePolicyButtons.width = 364f;
            themePolicyButtons.rowHeight = 49f;
            themePolicyButtons.autoHideScrollbar = true;

            // The panel holding the controls
            controls = container.AddUIComponent<UIPanel>();

            controls.width = container.width;
            controls.height = 100f;
            controls.autoLayout = true;
            controls.autoLayoutDirection = LayoutDirection.Vertical;
            controls.autoLayoutPadding.top = 5;

            // Add a checkbox to toggle "Blacklist Mode"
            UICheckBox blacklistModeCheckBox = CreateCheckBox(controls);
            blacklistModeCheckBox.name = "Blacklist Mode Checkbox";
            blacklistModeCheckBox.gameObject.AddComponent<BlacklistModeCheckboxContainer>();
            blacklistModeCheckBox.text = "Allow buildings which are not in any theme";
            blacklistModeCheckBox.isChecked = false;

            blacklistModeCheckBox.eventCheckChanged += delegate(UIComponent component, bool isChecked)
            {
                lock (component)
                {
                    var districtId1 = ToolsModifierControl.policiesPanel.targetDistrict;

                    Singleton<BuildingThemesManager>.instance.ToggleBlacklistMode(districtId1, isChecked);
                }

            };

            // Add a checkbox to "Enable Theme Management for this district"
            UICheckBox enableThemeManagementCheckBox = CreateCheckBox(controls);
            enableThemeManagementCheckBox.name = "Theme Management Checkbox";
            enableThemeManagementCheckBox.gameObject.AddComponent<ThemeManagementCheckboxContainer>();
            enableThemeManagementCheckBox.text = "Enable Theme Management for this district";
            enableThemeManagementCheckBox.isChecked = false;

            enableThemeManagementCheckBox.eventCheckChanged += delegate(UIComponent component, bool isChecked)
            {
                lock (component)
                {
                    var districtId1 = ToolsModifierControl.policiesPanel.targetDistrict;

                    Singleton<BuildingThemesManager>.instance.ToggleThemeManagement(districtId1, isChecked);
                }

            };

            // Add a button to show the Building Theme Manager
            UIButton showThemeManager = GUI.UIUtils.CreateButton(controls);
            showThemeManager.width = controls.width;
            showThemeManager.text = "Theme Manager";

            showThemeManager.eventClick += (c, p) => GUI.UIThemeManager.instance.Toggle();

            RefreshThemesContainer();
        }
Exemplo n.º 10
0
        private void CreateComponents()
        {
            int headerHeight = 40;

            // Label
            UILabel label = AddUIComponent <UILabel>();

            label.text             = "Effects";
            label.relativePosition = new Vector3(WIDTH / 2 - label.width / 2, 10);

            // Drag handle
            UIDragHandle handle = AddUIComponent <UIDragHandle>();

            handle.target            = this;
            handle.constrainToScreen = true;
            handle.width             = WIDTH;
            handle.height            = headerHeight;
            handle.relativePosition  = Vector3.zero;

            // close button
            UIButton closeButton = UIUtils.CreateButton(this);

            closeButton.size             = new Vector2(30, 30);
            closeButton.normalBgSprite   = "buttonclose";
            closeButton.hoveredBgSprite  = "buttonclosehover";
            closeButton.pressedBgSprite  = "buttonclosepressed";
            closeButton.relativePosition = new Vector3(WIDTH - 35, 5);
            closeButton.eventClicked    += (c, p) => {
                isVisible = false;
            };

            // Dropdown
            m_vehicleDropdown                            = UIUtils.CreateDropDown(this);
            m_vehicleDropdown.width                      = 300;
            m_vehicleDropdown.relativePosition           = new Vector3(10, headerHeight + 10);
            m_vehicleDropdown.eventSelectedIndexChanged += OnDropdownIndexChanged;
            m_vehicleDropdown.selectedIndex              = -1;

            // Fastlist for effects
            m_effectList = UIFastList.Create <UIVehicleEffectRow>(this);
            m_effectList.backgroundSprite           = "UnlockingPanel";
            m_effectList.width                      = (WIDTH - 30) / 2;
            m_effectList.height                     = HEIGHT - headerHeight - m_vehicleDropdown.height - 30 - 50;
            m_effectList.relativePosition           = new Vector3(10, headerHeight + 20 + m_vehicleDropdown.height);
            m_effectList.canSelect                  = true;
            m_effectList.eventSelectedIndexChanged += OnEffectSelectionChanged;

            // Create options panel
            m_optionsPanel                  = AddUIComponent <UIEffectOptionsPanel>();
            m_optionsPanel.width            = m_effectList.width;
            m_optionsPanel.height           = m_effectList.height;
            m_optionsPanel.relativePosition = new Vector3(WIDTH / 2 + 5, headerHeight + 20 + m_vehicleDropdown.height);
            m_optionsPanel.m_mainPanel      = this;
            m_optionsPanel.CreateComponents();

            // Button to add effects (footer)
            m_addEffectButton                  = UIUtils.CreateButton(this);
            m_addEffectButton.text             = "Add effect";
            m_addEffectButton.width            = 120;
            m_addEffectButton.relativePosition = new Vector3(10, HEIGHT - 40);
            m_addEffectButton.eventClicked    += (c, b) =>
            {
                if (!m_addPanel.isVisible)
                {
                    m_addPanel.isVisible = true;
                }
            };
        }
Exemplo n.º 11
0
        public void ShowDropDown()
        {
            Category category = m_item.category;
            if (category == Category.None && m_item.isCloned)
            {
                BuildingItem item = UIThemeManager.instance.GetBuildingItem(m_item.building.baseName);
                if (item != null) category = item.category;
            }

            FastList<object> list = UIThemeManager.instance.GetBuildingsFiltered(category, m_item.level + 1, m_item.size, m_upgradeName.text);

            if (m_dropDownList == null)
            {
                m_dropDownList = UIFastList.Create<UIDropDownItem>(GetRootContainer());
                m_dropDownList.width = m_upgradeName.width;
                m_dropDownList.rowHeight = 30;
                m_dropDownList.autoHideScrollbar = true;
                m_dropDownList.canSelect = true;
                m_dropDownList.selectOnMouseEnter = true;
                m_dropDownList.canFocus = true;
                m_dropDownList.backgroundSprite = "GenericPanelLight";
                m_dropDownList.backgroundColor = new Color32(45, 52, 61, 255);
                m_dropDownList.absolutePosition = m_upgradeName.absolutePosition + new Vector3(0, m_upgradeName.height);
            }

            m_dropDownList.height = Mathf.Min(list.m_size * 30, 150);
            m_dropDownList.rowsData = list;
            m_dropDownList.isVisible = list.m_size > 0;
            if (m_dropDownList.isVisible)
                m_dropDownList.selectedIndex = 0;
            else
                m_dropDownList.selectedIndex = -1;
        }
Exemplo n.º 12
0
        private void SetupControls()
        {
            // Title Bar
            m_title = AddUIComponent<UITitleBar>();
            m_title.title = "Theme Manager";
            m_title.iconSprite = "ToolbarIconZoomOutCity";

            // Filter
            m_filter = AddUIComponent<UIBuildingFilter>();
            m_filter.width = width - SPACING * 2;
            m_filter.height = 70;
            m_filter.relativePosition = new Vector3(SPACING, TITLE_HEIGHT);

            m_filter.eventFilteringChanged += (c, i) =>
            {
                if (m_themeSelection != null && m_themeSelection.selectedIndex != -1)
                {
                    m_buildingSelection.selectedIndex = -1;
                    m_buildingSelection.rowsData = Filter(m_themes[m_themeSelection.selectedIndex]);
                }
            };

            // Panels
            UIPanel left = AddUIComponent<UIPanel>();
            left.width = LEFT_WIDTH;
            left.height = HEIGHT - m_filter.height;
            left.relativePosition = new Vector3(SPACING, TITLE_HEIGHT + m_filter.height + SPACING);

            UIPanel middle = AddUIComponent<UIPanel>();
            middle.width = MIDDLE_WIDTH;
            middle.height = HEIGHT - m_filter.height;
            middle.relativePosition = new Vector3(LEFT_WIDTH + SPACING * 2, TITLE_HEIGHT + m_filter.height + SPACING);

            UIPanel right = AddUIComponent<UIPanel>();
            right.width = RIGHT_WIDTH;
            right.height = HEIGHT - m_filter.height;
            right.relativePosition = new Vector3(LEFT_WIDTH + MIDDLE_WIDTH + SPACING * 3, TITLE_HEIGHT + m_filter.height + SPACING);

            // Theme selection
            m_themeSelection = UIFastList.Create<UIThemeItem>(left);

            m_themeSelection.backgroundSprite = "UnlockingPanel";
            m_themeSelection.width = left.width;
            m_themeSelection.height = left.height - 40;
            m_themeSelection.canSelect = true;
            m_themeSelection.rowHeight = 40;
            m_themeSelection.autoHideScrollbar = true;
            m_themeSelection.relativePosition = Vector3.zero;

            m_themeSelection.rowsData.m_buffer = m_allThemes;
            m_themeSelection.rowsData.m_size = m_allThemes.Length;
            m_themeSelection.DisplayAt(0);

            m_themeSelection.eventSelectedIndexChanged += (c, i) =>
            {
                if (i == -1) return;

                int listCount = m_buildingSelection.rowsData.m_size;
                float pos = m_buildingSelection.listPosition;

                m_buildingSelection.selectedIndex = -1;
                m_buildingSelection.rowsData = Filter(m_themes[i]);

                if (m_filter.buildingStatus == UIBuildingFilter.Status.All && m_buildingSelection.rowsData.m_size == listCount)
                {
                    m_buildingSelection.DisplayAt(pos);
                }

                m_themeRemove.isEnabled = !((Configuration.Theme)m_themeSelection.selectedItem).isBuiltIn;
            };

            // Add theme
            m_themeAdd = UIUtils.CreateButton(left);
            m_themeAdd.width = (LEFT_WIDTH - SPACING) / 2;
            m_themeAdd.text = "New Theme";
            m_themeAdd.relativePosition = new Vector3(0, m_themeSelection.height + SPACING);

            m_themeAdd.eventClick += (c, p) =>
            {
                UIView.PushModal(UINewThemeModal.instance);
                UINewThemeModal.instance.Show(true);
            };

            // Remove theme
            m_themeRemove = UIUtils.CreateButton(left);
            m_themeRemove.width = (LEFT_WIDTH - SPACING) / 2;
            m_themeRemove.text = "Delete Theme";
            m_themeRemove.isEnabled = false;
            m_themeRemove.relativePosition = new Vector3(LEFT_WIDTH - m_themeRemove.width, m_themeSelection.height + SPACING);

            m_themeRemove.eventClick += (c, p) =>
            {
                ConfirmPanel.ShowModal("Delete Theme", "Are you sure you want to delete '" + selectedTheme.name + "' theme ?",
                    (d, i) => { if (i == 1) DeleteTheme(selectedTheme); });
            };

            // Building selection
            m_buildingSelection = UIFastList.Create<UIBuildingItem>(middle);

            m_buildingSelection.backgroundSprite = "UnlockingPanel";
            m_buildingSelection.width = middle.width;
            m_buildingSelection.height = middle.height - 40;
            m_buildingSelection.canSelect = true;
            m_buildingSelection.rowHeight = 40;
            m_buildingSelection.autoHideScrollbar = true;
            m_buildingSelection.relativePosition = Vector3.zero;

            m_buildingSelection.rowsData = new FastList<object>();

            BuildingItem selectedItem = null;
            m_buildingSelection.eventSelectedIndexChanged += (c, i) =>
            {
                selectedItem = m_buildingSelection.selectedItem as BuildingItem;
            };

            m_buildingSelection.eventMouseLeave += (c, p) =>
            {
                if (selectedItem != null)
                    UpdateBuildingInfo(selectedItem);
                else
                    UpdateBuildingInfo(null);
            };

            // Include buttons
            m_includeNone = UIUtils.CreateButton(middle);
            m_includeNone.width = 55;
            m_includeNone.text = "None";
            m_includeNone.relativePosition = new Vector3(MIDDLE_WIDTH - m_includeNone.width, m_buildingSelection.height + SPACING);

            m_includeAll = UIUtils.CreateButton(middle);
            m_includeAll.width = 55;
            m_includeAll.text = "All";
            m_includeAll.relativePosition = new Vector3(m_includeNone.relativePosition.x - m_includeAll.width - SPACING, m_buildingSelection.height + SPACING);

            UILabel include = middle.AddUIComponent<UILabel>();
            include.width = 100;
            include.padding = new RectOffset(0, 0, 8, 0);
            include.textScale = 0.8f;
            include.text = "Include:";
            include.relativePosition = new Vector3(m_includeAll.relativePosition.x - include.width - SPACING, m_buildingSelection.height + SPACING);

            m_includeAll.eventClick += (c, p) =>
            {
                for (int i = 0; i < m_buildingSelection.rowsData.m_size; i++)
                {
                    BuildingItem item = m_buildingSelection.rowsData[i] as BuildingItem;
                    if (item != null) ChangeBuildingStatus(item, true);
                }

                m_buildingSelection.Refresh();
            };

            m_includeNone.eventClick += (c, p) =>
            {
                for (int i = 0; i < m_buildingSelection.rowsData.m_size; i++)
                {
                    BuildingItem item = m_buildingSelection.rowsData[i] as BuildingItem;
                    if (item != null) ChangeBuildingStatus(item, false);
                }

                m_buildingSelection.Refresh();
            };

            // Preview
            UIPanel previewPanel = right.AddUIComponent<UIPanel>();
            previewPanel.backgroundSprite = "GenericPanel";
            previewPanel.width = right.width;
            previewPanel.height = (right.height - SPACING * 2) / 2;
            previewPanel.relativePosition = Vector3.zero;

            m_preview = previewPanel.AddUIComponent<UITextureSprite>();
            m_preview.size = previewPanel.size;
            m_preview.relativePosition = Vector3.zero;

            m_noPreview = previewPanel.AddUIComponent<UISprite>();
            m_noPreview.spriteName = "Niet";
            m_noPreview.relativePosition = new Vector3((previewPanel.width - m_noPreview.spriteInfo.width) / 2, (previewPanel.height - m_noPreview.spriteInfo.height) / 2);

            m_previewRenderer = gameObject.AddComponent<PreviewRenderer>();
            m_previewRenderer.size = m_preview.size * 2; // Twice the size for anti-aliasing

            previewPanel.eventMouseDown += (c, p) =>
            {
                eventMouseMove += RotateCamera;
            };

            previewPanel.eventMouseUp += (c, p) =>
            {
                eventMouseMove -= RotateCamera;
            };

            previewPanel.eventMouseWheel += (c, p) =>
            {
                m_previewRenderer.zoom -= Mathf.Sign(p.wheelDelta) * 0.25f;
                RenderPreview();
            };

            // Building Options
            m_buildingOptions = right.AddUIComponent<UIBuildingInfo>();
            m_buildingOptions.width = RIGHT_WIDTH;
            m_buildingOptions.height = (right.height - SPACING * 2) / 2;
            m_buildingOptions.relativePosition = new Vector3(0, previewPanel.height + SPACING);
        }