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; }
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; }
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(); }
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; }
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; } }; }