예제 #1
0
        public void CreateUI(IUIBuilder builder)
        {
            AddressInput = builder.CreateTextInput("OutputTarget:Udp:Address", "Address:", "127.0.0.1", 50);
            PortInput    = builder.CreateTextInput("OutputTarget:Udp:Port", "Port:", "8889", 50);
            IpText       = AddressInput.storable;
            PortText     = PortInput.storable;

            ButtonGroup = builder.CreateHorizontalGroup(510, 50, new Vector2(10, 0), 2, idx => builder.CreateButtonEx());
            var startSerialButton = ButtonGroup.items[0].GetComponent <UIDynamicButton>();

            startSerialButton.label = "Start Udp";
            startSerialButton.button.onClick.AddListener(StartUdp);

            var stopSerialButton = ButtonGroup.items[1].GetComponent <UIDynamicButton>();

            stopSerialButton.label = "Stop Udp";
            stopSerialButton.button.onClick.AddListener(StopUdp);

            StartUdpAction = UIManager.CreateAction("Start Udp", StartUdp);
            StopUdpAction  = UIManager.CreateAction("Stop Udp", StopUdp);
        }
예제 #2
0
        // on start create ui
        protected override void Start()
        {
            // set cursor stylesheet
            UI.SetCursor("ui/cursor.ini");

            // create ui root
            _uiroot = UI.CreateRoot();

            // create button and list window
            var buttonAndListWindow = UI.CreateWindow("ui/window.ini", _uiroot, "Button & List");

            buttonAndListWindow.AutoArrangeChildren = true;
            buttonAndListWindow.Offset = new PointI(50, 40);

            // add into text and button
            UI.CreateText("ui/small_text.ini", buttonAndListWindow, "This demo shows some built-in UI elements. \nFor example, here's a button:");
            var button      = UI.CreateButton("ui/button.ini", buttonAndListWindow, "Click Me!");
            int clickCounts = 1;

            button.OnMouseReleased((UIElement elem) =>
            {
                button.Caption.Text = "Thanks! Clicks: " + clickCounts++;
            });

            // add a list
            var listTitle = UI.CreateText("ui/small_text.ini", buttonAndListWindow, "And here's a list:");
            var list      = UI.CreateList("ui/list.ini", buttonAndListWindow);

            for (var i = 1; i <= 15; ++i)
            {
                list.AddItem("Item #" + i);
            }

            // add text to show selected
            var listSelected = UI.CreateText("ui/small_text.ini", buttonAndListWindow, "Selected: ");

            list.OnValueChange((UIElement element) =>
            {
                listSelected.Text = "Selected: " + list.SelectedItem;
            });

            // create another window for checkboxes and slider
            var checkboxSliderWindow = UI.CreateWindow("ui/window.ini", _uiroot, "Checkbox, Radio & Slider");

            checkboxSliderWindow.Offset = new PointI(200, 80);
            checkboxSliderWindow.AutoArrangeChildren = true;

            // some checkboxes
            UI.CreateText("ui/small_text.ini", checkboxSliderWindow, "Checkboxes: ");
            var checkbox1 = UI.CreateCheckBox("ui/checkbox.ini", checkboxSliderWindow, "This is a checkbox");

            _debugDrawCheckbox = UI.CreateCheckBox("ui/checkbox.ini", checkboxSliderWindow, "Debug draw UI");

            // some radio buttons
            var radioIntro = UI.CreateText("ui/small_text.ini", checkboxSliderWindow, "Radio buttons: ");

            for (var i = 1; i <= 3; ++i)
            {
                var radio = UI.CreateRadioButton("ui/radiobutton.ini", checkboxSliderWindow, "Radio Button #" + i);
            }

            // add slider
            var sliderText = UI.CreateText("ui/small_text.ini", checkboxSliderWindow, "Slider Input [value=0]:");
            var slider     = UI.CreateSlider("ui/slider.ini", checkboxSliderWindow);

            slider.OnValueChange((UIElement element) =>
            {
                sliderText.Text = "Slider Input [value=" + slider.Value + "]:";
            });

            // create another window for text inputs
            var textInputsWindow = UI.CreateWindow("ui/window.ini", _uiroot, "Text Inputs");

            textInputsWindow.Offset = new PointI(350, 120);
            textInputsWindow.AutoArrangeChildren = true;

            // add text input
            UITextInput textInput = UI.CreateTextInput("ui/textinput.ini", textInputsWindow, "", "Free text input..");

            textInput.MaxLength = 16;

            // add numbers input
            UITextInput numbersInput = UI.CreateTextInput("ui/textinput.ini", textInputsWindow, "", "Numbers input..");

            numbersInput.InputMode = UITextInputMode.NumbersOnly;
            numbersInput.MaxLength = 16;

            // add characters input
            UITextInput alphaInput = UI.CreateTextInput("ui/textinput.ini", textInputsWindow, "", "Alpha input..");

            alphaInput.InputMode = UITextInputMode.AlphaOnly;
            alphaInput.MaxLength = 16;

            // add numbers and alpha input
            UITextInput numbersAlphaInput = UI.CreateTextInput("ui/textinput.ini", textInputsWindow, "", "Numbers & alpha input..");

            numbersAlphaInput.InputMode = UITextInputMode.NumbersOnly | UITextInputMode.AlphaOnly;
            numbersAlphaInput.MaxLength = 16;

            // add upper input
            UITextInput upperInput = UI.CreateTextInput("ui/textinput.ini", textInputsWindow, "", "UPPERCASE INPUT..");

            upperInput.InputMode = UITextInputMode.Uppercase;
            upperInput.MaxLength = 16;

            // add lower input
            UITextInput lowerInput = UI.CreateTextInput("ui/textinput.ini", textInputsWindow, "", "lowercase input..");

            lowerInput.InputMode = UITextInputMode.Lowercase;
            lowerInput.MaxLength = 16;

            // add upper alpha input
            UITextInput upperAlphaInput = UI.CreateTextInput("ui/textinput.ini", textInputsWindow, "", "UPPERCASE ALPHA INPUT..");

            upperAlphaInput.InputMode = UITextInputMode.Uppercase | UITextInputMode.AlphaOnly;
            upperAlphaInput.MaxLength = 16;

            // order windows
            checkboxSliderWindow.MoveToFront();
            buttonAndListWindow.MoveToFront();
        }
예제 #3
0
        public TeleporterPanel(TileEntities.Teleporter teleporter) : base(teleporter)
        {
            Width.Percent  = 20;
            Height.Percent = 35;

            UITextInput inputName = new UITextInput(ref Container.DisplayName)
            {
                X                   = { Percent = 50 },
                MaxLength           = 24,
                RenderPanel         = false,
                HintText            = "Teleporter",
                HorizontalAlignment = HorizontalAlignment.Center,
                SizeToText          = true
            };

            inputName.OnTextChange += () => Net.SendTeleporterName(Container);
            Add(inputName);

            UITextButton buttonClose = new UITextButton("X")
            {
                Size        = new Vector2(20),
                X           = { Pixels = -20, Percent = 100 },
                RenderPanel = false,
                Padding     = Padding.Zero,
                HoverText   = Language.GetText("Mods.BaseLibrary.UI.Close")
            };

            buttonClose.OnClick += args => PanelUI.Instance.CloseUI(Container);
            Add(buttonClose);

            UITextButton buttonOptions = new UITextButton("O")
            {
                Size        = new Vector2(20),
                RenderPanel = false,
                Padding     = Padding.Zero,
                HoverText   = Language.GetText("Mods.BaseLibrary.UI.Options")
            };

            buttonOptions.OnClick += args =>
            {
                Remove(currentPanel);
                SelectedTeleporter = null;
                currentPanel       = currentPanel == panelSettings ? panelMain : panelSettings;
                Add(currentPanel);
            };
            Add(buttonOptions);

            currentPanel = new BaseElement
            {
                Width  = { Percent = 100 },
                Height = { Pixels = -28, Percent = 100 },
                Y      = { Pixels = 28 }
            };

            Add(currentPanel);
            SetupMainPanel();
            SetupSettingsPanel();
            Remove(currentPanel);
            currentPanel = panelMain;
            Add(currentPanel);
        }
예제 #4
0
        // on start create ui
        protected override void Start()
        {
            // set cursor stylesheet
            UI.SetCursor("ui/cursor.ini");

            // create ui root
            _uiroot = UI.CreateRoot();

            // create button and list window
            var buttonAndListWindow = UI.CreateWindow("ui/window.ini", _uiroot, "Button, DropDown & List");

            buttonAndListWindow.AutoArrangeChildren = true;
            buttonAndListWindow.Offset = new PointI(40, 30);
            buttonAndListWindow.Grow(0, 50);

            // add into text and button
            UI.CreateText("ui/small_text.ini", buttonAndListWindow, "This demo shows UI elements. \nFor example, here's a button:");
            var button      = UI.CreateButton("ui/button.ini", buttonAndListWindow, "Click Me!");
            int clickCounts = 1;

            button.OnMouseReleased((UIElement elem) =>
            {
                button.Caption.Text = "Thanks! Clicks: " + clickCounts++;
            });

            // add a dropdown
            var dropdownTitle = UI.CreateText("ui/small_text.ini", buttonAndListWindow, "Here's a DropDown:");
            var dropdown      = UI.CreateDropDown("ui/dropdown.ini", buttonAndListWindow);

            dropdown.PlaceholderText = "Click to show options.";
            for (var i = 1; i <= 15; ++i)
            {
                dropdown.AddItem("Item #" + i);
            }

            // add a list
            var listTitle = UI.CreateText("ui/small_text.ini", buttonAndListWindow, "And here's a List:");
            var list      = UI.CreateList("ui/list.ini", buttonAndListWindow);

            for (var i = 1; i <= 15; ++i)
            {
                list.AddItem("Item #" + i);
            }

            // add text to show selected
            var listSelected = UI.CreateText("ui/small_text.ini", buttonAndListWindow, "Selected: ");

            list.OnValueChange((UIElement element) =>
            {
                listSelected.Text = "Selected: " + list.SelectedItem;
            });

            // create another window for checkboxes and slider
            var checkboxSliderWindow = UI.CreateWindow("ui/window.ini", _uiroot, "Checkbox, Radio & Slider");

            checkboxSliderWindow.Offset = new PointI(140, 60);
            checkboxSliderWindow.AutoArrangeChildren = true;

            // some checkboxes
            UI.CreateText("ui/small_text.ini", checkboxSliderWindow, "Checkboxes: ");
            var checkbox1 = UI.CreateCheckBox("ui/checkbox.ini", checkboxSliderWindow, "This is a checkbox");

            _debugDrawCheckbox = UI.CreateCheckBox("ui/checkbox.ini", checkboxSliderWindow, "Debug draw UI");

            // some radio buttons
            var radioIntro = UI.CreateText("ui/small_text.ini", checkboxSliderWindow, "Radio buttons: ");

            for (var i = 1; i <= 3; ++i)
            {
                var radio = UI.CreateRadioButton("ui/radiobutton.ini", checkboxSliderWindow, "Radio Button #" + i);
            }

            // add slider
            var sliderText = UI.CreateText("ui/small_text.ini", checkboxSliderWindow, "Slider Input [value=0]:");
            var slider     = UI.CreateSlider("ui/slider.ini", checkboxSliderWindow);

            slider.OnValueChange((UIElement element) =>
            {
                sliderText.Text = "Slider Input [value=" + slider.Value + "]:";
            });

            // create another window for text inputs
            var textInputsWindow = UI.CreateWindow("ui/window.ini", _uiroot, "Text Inputs");

            textInputsWindow.Offset = new PointI(240, 90);
            textInputsWindow.AutoArrangeChildren = true;

            // add text input
            UITextInput textInput = UI.CreateTextInput("ui/textinput.ini", textInputsWindow, "", "Free text input..");

            textInput.MaxLength = 16;

            // add numbers input
            UITextInput numbersInput = UI.CreateTextInput("ui/textinput.ini", textInputsWindow, "", "Numbers input..");

            numbersInput.InputMode = UITextInputMode.NumbersOnly;
            numbersInput.MaxLength = 16;

            // add characters input
            UITextInput alphaInput = UI.CreateTextInput("ui/textinput.ini", textInputsWindow, "", "Alpha input..");

            alphaInput.InputMode = UITextInputMode.AlphaOnly;
            alphaInput.MaxLength = 16;

            // add numbers and alpha input
            UITextInput numbersAlphaInput = UI.CreateTextInput("ui/textinput.ini", textInputsWindow, "", "Numbers & alpha input..");

            numbersAlphaInput.InputMode = UITextInputMode.NumbersOnly | UITextInputMode.AlphaOnly;
            numbersAlphaInput.MaxLength = 16;

            // add upper input
            UITextInput upperInput = UI.CreateTextInput("ui/textinput.ini", textInputsWindow, "", "UPPERCASE INPUT..");

            upperInput.InputMode = UITextInputMode.Uppercase;
            upperInput.MaxLength = 16;

            // add lower input
            UITextInput lowerInput = UI.CreateTextInput("ui/textinput.ini", textInputsWindow, "", "lowercase input..");

            lowerInput.InputMode = UITextInputMode.Lowercase;
            lowerInput.MaxLength = 16;

            // add upper alpha input
            UITextInput upperAlphaInput = UI.CreateTextInput("ui/textinput.ini", textInputsWindow, "", "UPPERCASE ALPHA INPUT..");

            upperAlphaInput.InputMode = UITextInputMode.Uppercase | UITextInputMode.AlphaOnly;
            upperAlphaInput.MaxLength = 16;

            // create additional window for columns
            UIWindow columnsWindow = UI.CreateWindow("ui/window.ini", _uiroot, "Columns");

            columnsWindow.AutoArrangeChildren = true;
            columnsWindow.SizePixels          = new PointI(400, 450);
            columnsWindow.Offset = new PointI(340, 120);

            // create some test columns
            {
                UIElement   column = columnsWindow.CreateColumn(null, 80);
                UIRectangle rect   = UI.CreateRectangle(null, column);
                rect.SetSizeToMax();
                rect.Color  = Color.Red;
                rect.Filled = false;
            }
            {
                UIElement   column = columnsWindow.CreateColumn(null, 70);
                UIRectangle rect   = UI.CreateRectangle(null, column);
                rect.SetSizeToMax();
                rect.Color  = Color.Orange;
                rect.Filled = false;
            }
            {
                UIElement   column = columnsWindow.CreateColumn(null, 80, alignment: UIAlignment.Right);
                UIRectangle rect   = UI.CreateRectangle(null, column);
                rect.SetSizeToMax();
                rect.Color  = Color.Blue;
                rect.Filled = false;
            }
            {
                UIElement   column = columnsWindow.CreateColumn(null, 70, alignment: UIAlignment.Right);
                UIRectangle rect   = UI.CreateRectangle(null, column);
                rect.SetSizeToMax();
                rect.Color  = Color.Teal;
                rect.Filled = false;
            }
            {
                UIElement   column = columnsWindow.CreateColumn(null, 50, alignment: UIAlignment.Center);
                UIRectangle rect   = UI.CreateRectangle(null, column);
                rect.SetSizeToMax();
                rect.Color  = Color.Black;
                rect.Filled = false;
            }
            UI.CreateText("ui/small_text.ini", columnsWindow,
                          "Columns allow you to divide containers into sections. Its useful when you need to place elements side by side.");

            // order windows
            textInputsWindow.MoveToFront();
            checkboxSliderWindow.MoveToFront();
            buttonAndListWindow.MoveToFront();
        }
예제 #5
0
        public RequesterModulePanel(RequesterModule module) : base(module)
        {
            Width.Pixels  = 60 + (SlotSize + SlotMargin) * Columns - SlotMargin;
            Height.Pixels = 144 + (SlotSize + SlotMargin) * (Rows + 2) - SlotMargin * 2;
            X.Percent     = Y.Percent = 50;

            UITextButton buttonClose = new UITextButton("X")
            {
                Width       = { Pixels = 20 },
                Height      = { Pixels = 20 },
                X           = { Percent = 100 },
                RenderPanel = false,
                Padding     = new Padding(0)
            };

            buttonClose.OnClick += args =>
            {
                if (args.Button != MouseButton.Left)
                {
                    return;
                }

                PanelUI.Instance.CloseUI(Container);
            };
            Add(buttonClose);

            textQueue = new UIText("Queue")
            {
                Width = { Percent = 50 },
                HorizontalAlignment = HorizontalAlignment.Left
            };
            Add(textQueue);

            UIText textLabel = new UIText("Requester Module")
            {
                Width = { Percent = 100 },
                HorizontalAlignment = HorizontalAlignment.Center
            };

            Add(textLabel);

            UIPanel panel = new UIPanel
            {
                Y               = { Pixels = 28 },
                Width           = { Percent = 100 },
                Height          = { Pixels = (SlotSize + SlotMargin) * Rows - SlotMargin },
                BorderColor     = Color.Transparent,
                BackgroundColor = Utility.ColorPanel_Selected * 0.75f
            };

            Add(panel);

            gridSlots = new UIGrid <UIRequesterSlot>(Columns)
            {
                Width      = { Percent = 100, Pixels = -26 },
                Height     = { Percent = 100 },
                ItemMargin = SlotMargin
            };
            gridSlots.SearchSelector += item =>
            {
                if (string.IsNullOrWhiteSpace(search.Value))
                {
                    return(true);
                }

                string itemName   = item.Item.HoverName.ToLower();
                string searchName = search.Value.ToLower();

                return(itemName.Contains(searchName));
            };
            panel.Add(gridSlots);

            gridSlots.scrollbar.X.Percent      = 100;
            gridSlots.scrollbar.Y.Pixels       = 0;
            gridSlots.scrollbar.Height.Percent = 100;
            panel.Add(gridSlots.scrollbar);

            UITextInput inputSearch = new UITextInput(ref search)
            {
                Y                 = { Pixels = 36 + (SlotSize + SlotMargin) * Rows - SlotMargin },
                Width             = { Percent = 100 },
                Height            = { Pixels = 40 },
                RenderPanel       = true,
                VerticalAlignment = VerticalAlignment.Center,
                HintText          = "Search",
                Padding           = new Padding(8)
            };

            inputSearch.OnKeyPressed += args =>
            {
                if (inputSearch.Focused && (args.Key == Keys.Enter || args.Key == Keys.Escape))
                {
                    args.Handled        = true;
                    inputSearch.Focused = false;
                }
            };
            inputSearch.OnTextChange += () => gridSlots.Search();
            Add(inputSearch);

            // requested items
            {
                UIText textRequestedItem = new UIText("Requested Items")
                {
                    Width  = { Pixels = (SlotSize + SlotMargin) * 10 - SlotMargin },
                    Margin = new Margin(8, 0, 0, 0),
                    Y      = { Pixels = 84 + (SlotSize + SlotMargin) * Rows - SlotMargin },
                    HorizontalAlignment = HorizontalAlignment.Center
                };
                Add(textRequestedItem);

                panel = new UIPanel
                {
                    Y               = { Pixels = 112 + (SlotSize + SlotMargin) * Rows - SlotMargin },
                    Width           = { Percent = 100 },
                    Height          = { Pixels = 16 + (SlotSize + SlotMargin) * 2 - SlotMargin },
                    BorderColor     = Color.Transparent,
                    BackgroundColor = Utility.ColorPanel_Selected * 0.75f
                };
                Add(panel);

                UIGrid <UIContainerSlot> gridOutout = new UIGrid <UIContainerSlot>(10)
                {
                    Width      = { Pixels = (SlotSize + SlotMargin) * 10 },
                    Height     = { Percent = 100 },
                    ItemMargin = SlotMargin
                };
                panel.Add(gridOutout);

                for (int i = 0; i < Container.Handler.Slots; i++)
                {
                    UIContainerSlot slot = new UIContainerSlot(() => Container.Handler, i)
                    {
                        Width   = { Pixels = SlotSize },
                        Height  = { Pixels = SlotSize },
                        Padding = new Padding(2)
                    };
                    gridOutout.Add(slot);
                }
            }

            // return items
            {
                UIText textReturnItems = new UIText("Return")
                {
                    Width  = { Pixels = (SlotSize + SlotMargin) * 3 - SlotMargin },
                    Margin = new Margin(0, 0, 8, 0),
                    X      = { Percent = 100 },
                    Y      = { Pixels = 84 + (SlotSize + SlotMargin) * Rows - SlotMargin },
                    HorizontalAlignment = HorizontalAlignment.Center
                };
                Add(textReturnItems);

                UIGrid <UIContainerSlot> gridInput = new UIGrid <UIContainerSlot>(3)
                {
                    Width      = { Pixels = (SlotSize + SlotMargin) * 3 - SlotMargin },
                    Height     = { Percent = 100 },
                    X          = { Percent = 100 },
                    ItemMargin = SlotMargin
                };
                panel.Add(gridInput);

                for (int i = 0; i < Container.ReturnHandler.Slots; i++)
                {
                    UIContainerSlot slot = new UIContainerSlot(() => Container.ReturnHandler, i)
                    {
                        Width   = { Pixels = SlotSize },
                        Height  = { Pixels = SlotSize },
                        Padding = new Padding(2)
                    };
                    gridInput.Add(slot);
                }
            }

            UIButton buttonTransfer = new UIButton(ModContent.GetTexture("BaseLibrary/Textures/UI/QuickStack"))
            {
                Y         = { Percent = 50 },
                X         = { Pixels = 6 + (SlotSize + SlotMargin) * 10 - SlotMargin },
                Width     = { Pixels = 20 },
                Height    = { Pixels = 20 },
                HoverText = "Transfer items"
            };

            buttonTransfer.OnClick += args =>
            {
                for (int i = 0; i < Container.Handler.Slots; i++)
                {
                    ref Item item = ref Container.Handler.GetItemInSlotByRef(i);
                    Container.ReturnHandler.InsertItem(ref item);
                    if (!item.IsAir)
                    {
                        break;
                    }
                }

                Recipe.FindRecipes();
            };
예제 #6
0
        public UpgradeStationUI()
        {
            UIPanel panelMain = new UIPanel
            {
                Width    = { Pixels = 1000 },
                Height   = { Pixels = 550 + 28 },
                X        = { Percent = 50 },
                Y        = { Percent = 50 },
                Settings =
                {
                    Draggable = true,
                    DragZones = new List <DragZone> {
                        new DragZone {
                            Width = { Percent = 100 },Height               = { Pixels = 28 }
                        }
                    }
                }
            };

            Add(panelMain);

            panelMain.With(() =>
            {
                UIText title = new UIText("Upgrade Station")
                {
                    Height = { Pixels = 20 }
                };
                panelMain.Add(title);

                UIText closeButton = new UIText("X")
                {
                    Height = { Pixels = 20 },
                    Width  = { Pixels = 20 },
                    X      = { Percent = 100 }
                };
                closeButton.OnClick += args =>
                {
                    args.Handled = true;
                    Display      = Display.None;
                };
                closeButton.OnMouseEnter += args => closeButton.Settings.TextColor = Color.Red;
                closeButton.OnMouseLeave += args => closeButton.Settings.TextColor = Color.White;
                panelMain.Add(closeButton);

                UIPanel panelItems = new UIPanel
                {
                    Width    = { Pixels = 64 },
                    Height   = { Percent = 100, Pixels = -28 },
                    Y        = { Pixels = 28 },
                    Settings =
                    {
                        BorderColor     = Color.Transparent,
                        BackgroundColor = DrawingUtility.Colors.PanelSelected * 0.75f
                    }
                };
                panelMain.Add(panelItems);
                panelMain.With(() =>
                {
                    gridItems = new UIGrid <UIModularItem>
                    {
                        Width    = { Percent = 100 },
                        Height   = { Percent = 100 },
                        Settings = { MaxSelectedItems = 1 }
                    };
                    panelItems.Add(gridItems);
                });

                UIPanel panelModules = new UIPanel
                {
                    Width    = { Percent = 40, Pixels = -64 },
                    Height   = { Percent = 100, Pixels = -28 },
                    X        = { Pixels = 64 },
                    Y        = { Pixels = 28 },
                    Settings =
                    {
                        BorderColor     = Color.Transparent,
                        BackgroundColor = DrawingUtility.Colors.PanelSelected * 0.75f
                    }
                };
                panelMain.Add(panelModules);
                panelModules.With(() =>
                {
                    UIPanel inputBG = new UIPanel
                    {
                        Width    = { Percent = 100 },
                        Height   = { Pixels = 36 },
                        Settings = { BorderColor = Color.Transparent }
                    };
                    panelModules.Add(inputBG);

                    UITextInput input = new UITextInput(ref search)
                    {
                        Width        = { Percent = 100 },
                        Height       = { Percent = 100 },
                        OnTextChange = () => gridModules.Search(),
                        Settings     = { HintText = "<Search>" }
                    };
                    inputBG.Add(input);

                    // todo: category buttons

                    gridModules = new UIGrid <UIModule>
                    {
                        Width          = { Percent = 100 },
                        Height         = { Percent = 100, Pixels = -44 },
                        Y              = { Pixels = 44 },
                        SearchSelector = item => string.IsNullOrWhiteSpace(search.Value) || TextUtility.Search(item.Module.DisplayName.Get().ToLower(), search.Value.ToLower()).Any()
                    };
                    panelModules.Add(gridModules);
                });

                UIPanel panelInfo = new UIPanel
                {
                    Width    = { Percent = 60 },
                    Height   = { Percent = 100, Pixels = -28 },
                    X        = { Percent = 100 },
                    Y        = { Pixels = 28 },
                    Settings =
                    {
                        BorderColor     = Color.Transparent,
                        BackgroundColor = DrawingUtility.Colors.PanelSelected * 0.75f
                    }
                };
                panelMain.Add(panelInfo);
                panelInfo.With(() =>
                {
                    textModule = new UIText("")
                    {
                        Width  = { Percent = 100 },
                        Height = { Pixels = 20 }
                    };
                    panelInfo.Add(textModule);

                    UIDivider divider = new UIDivider
                    {
                        Width = { Percent = 100 },
                        Y     = { Pixels = 28 }
                    };
                    panelInfo.Add(divider);

                    textModuleDescription = new UIText("")
                    {
                        Width  = { Percent = 100 },
                        Height = { Percent = 100 },
                        Y      = { Pixels = 36 }
                    };
                    panelInfo.Add(textModuleDescription);

                    textRequirements = new UIText("")
                    {
                        Width  = { Percent = 50 },
                        Height = { Pixels = 20 },
                        Y      = { Pixels = 100 + 36 }
                    };
                    panelInfo.Add(textRequirements);

                    textIncompatible = new UIText("")
                    {
                        Width  = { Percent = 50 },
                        Height = { Pixels = 20 },
                        X      = { Percent = 100 },
                        Y      = { Pixels = 100 + 36 }
                    };
                    panelInfo.Add(textIncompatible);

                    buttonInstall = new UITextButton("Install")
                    {
                        Width    = { Percent = 50, Pixels = -4 },
                        Height   = { Pixels = 30 },
                        Y        = { Percent = 100 },
                        Settings =
                        {
                            VerticalAlignment   = VerticalAlignment.Center,
                            HorizontalAlignment = HorizontalAlignment.Center
                        }
                    };
                    buttonInstall.OnClick += args =>
                    {
                        args.Handled = true;

                        if (selectedItem.CanInstall(selectedModule.Type))
                        {
                            BaseModule clone = selectedModule.Clone();
                            clone.InternalInstall(selectedItem);

                            gridModules.Children.OfType <UIModule>().FirstOrDefault(x => x.Module == selectedModule).Color = Color.LimeGreen;
                            buttonInstall.Settings.Disabled   = true;
                            buttonUninstall.Settings.Disabled = false;
                        }
                    };
                    panelInfo.Add(buttonInstall);

                    buttonUninstall = new UITextButton("Uninstall")
                    {
                        Width    = { Percent = 50, Pixels = -4 },
                        Height   = { Pixels = 30 },
                        X        = { Percent = 100 },
                        Y        = { Percent = 100 },
                        Settings =
                        {
                            VerticalAlignment   = VerticalAlignment.Center,
                            HorizontalAlignment = HorizontalAlignment.Center
                        }
                    };
                    buttonUninstall.OnClick += args =>
                    {
                        args.Handled = true;

                        if (selectedItem.CanUninstall(selectedModule.Type))
                        {
                            BaseModule clone = selectedItem.InstalledModules.First(x => x.Type == selectedModule.Type);
                            clone.InternalRemove(selectedItem);

                            gridModules.Children.OfType <UIModule>().FirstOrDefault(x => x.Module == selectedModule).Color = Color.Red;
                            buttonInstall.Settings.Disabled   = false;
                            buttonUninstall.Settings.Disabled = true;
                        }
                    };
                    panelInfo.Add(buttonUninstall);
                });
            });
        }