Beispiel #1
0
        public override void Start()
        {
            instance = this;

            /*atlas = SamsamTS.UIUtils.GetAtlas("Ingame");
             * backgroundSprite = "GenericTabHovered";*/
            size = new Vector2(605, 45);

            // Zoning
            toggles = new UICheckBox[(int)Category.All];
            for (int i = 0; i < (int)Category.All; i++)
            {
                toggles[i]                  = SamsamTS.UIUtils.CreateIconToggle(this, "Ingame", "ToolbarIcon" + ((Category)i), "ToolbarIcon" + ((Category)i) + "Disabled");
                toggles[i].tooltip          = Locale.Get("MAIN_TOOL", ((Category)i).ToString()) + "\nHold SHIFT or CTRL to select multiple categories";
                toggles[i].relativePosition = new Vector3(5 + 40 * i, 5);
                toggles[i].isChecked        = true;
                toggles[i].readOnly         = true;
                toggles[i].checkedBoxObject.isInteractive = false; // Don't eat my double click event please

                toggles[i].eventClick += (c, p) =>
                {
                    Event e = Event.current;

                    if (e.shift || e.control)
                    {
                        ((UICheckBox)c).isChecked = !((UICheckBox)c).isChecked;
                        eventFilteringChanged(this, 0);
                    }
                    else
                    {
                        for (int j = 0; j < (int)Category.All; j++)
                        {
                            toggles[j].isChecked = false;
                        }
                        ((UICheckBox)c).isChecked = true;

                        eventFilteringChanged(this, 0);
                    }
                };
            }

            UICheckBox last = toggles[toggles.Length - 1];

            all                  = SamsamTS.UIUtils.CreateButton(this);
            all.size             = new Vector2(55, 35);
            all.text             = "All";
            all.relativePosition = new Vector3(last.relativePosition.x + last.width + 5, 5);

            all.eventClick += (c, p) =>
            {
                for (int i = 0; i < (int)Category.All; i++)
                {
                    toggles[i].isChecked = true;
                }
                eventFilteringChanged(this, 0);
            };

            width = parent.width;
        }
Beispiel #2
0
        public override void Start()
        {
            instance = this;
            UnityEngine.Random.InitState(System.Environment.TickCount);

            // panel for search input box, type filter and building filters
            inputPanel                  = AddUIComponent <UIPanel>();
            inputPanel.atlas            = SamsamTS.UIUtils.GetAtlas("Ingame");
            inputPanel.backgroundSprite = "GenericTab";
            inputPanel.color            = new Color32(196, 200, 206, 255);
            inputPanel.size             = new Vector2(parent.width, 35);
            inputPanel.relativePosition = new Vector2(0, -inputPanel.height - 40);

            // search input box
            input                  = SamsamTS.UIUtils.CreateTextField(inputPanel);
            input.size             = new Vector2(250, 28);
            input.padding.top      = 6;
            input.relativePosition = new Vector3(5, 4);

            string search = null;

            input.eventTextChanged += (c, p) =>
            {
                search = p;
                // store search query individually for each asset type
                Debugging.Message($"store query for index '{this.typeFilter.selectedIndex}' (cast '{(DropDownOptions)this.typeFilter.selectedIndex}'): \"{p}\"");
                this.storedQueries[(DropDownOptions)this.typeFilter.selectedIndex] = p;
                Search();
            };

            input.eventTextCancelled += (c, p) =>
            {
                if (search != null)
                {
                    input.text = search;
                }
            };

            input.eventKeyDown += (component, eventParam) =>
            {
                if (eventParam.keycode != KeyCode.DownArrow && eventParam.keycode != KeyCode.UpArrow)
                {
                    return;
                }
                if (typeFilter != null)
                {
                    typeFilter.selectedIndex = Mathf.Clamp(typeFilter.selectedIndex + (eventParam.keycode == KeyCode.DownArrow ? 1 : -1), 0, typeFilter.items.Length);
                }
            };

            // search icon
            searchIcon                  = inputPanel.AddUIComponent <UISprite>();
            searchIcon.size             = new Vector2(25, 30);
            searchIcon.atlas            = FindIt.atlas;
            searchIcon.spriteName       = "FindItDisabled";
            searchIcon.relativePosition = new Vector3(5, 4);

            // clear search box
            clearButton                  = inputPanel.AddUIComponent <UISprite>();
            clearButton.size             = new Vector2(26, 26);
            clearButton.atlas            = FindIt.atlas;
            clearButton.spriteName       = "Clear";
            clearButton.tooltip          = Translations.Translate("FIF_SE_SEBTP");
            clearButton.opacity          = 0.5f;
            clearButton.relativePosition = new Vector3(input.relativePosition.x + input.width + 3, 4);
            clearButton.eventClicked    += (c, p) =>
            {
                input.text = "";
                //PickerRandomTest();
            };
            clearButton.eventMouseEnter += (c, p) =>
            {
                clearButton.opacity = 0.9f;
            };

            clearButton.eventMouseLeave += (c, p) =>
            {
                clearButton.opacity = 0.5f;
            };

            // asset type filter. Also Manipulated by the Picker mod through reflection.
            // Need to notify Quboid if a new dropdown item is added, or the item order is changed
            typeFilter                  = SamsamTS.UIUtils.CreateDropDown(inputPanel);
            typeFilter.name             = "FindIt_AssetTypeFilter";
            typeFilter.size             = new Vector2(105, 25);
            typeFilter.tooltip          = Translations.Translate("FIF_POP_SCR");
            typeFilter.relativePosition = new Vector3(clearButton.relativePosition.x + clearButton.width + 7, 5);

            if (FindIt.isRicoEnabled)
            {
                string[] items =
                {
                    Translations.Translate("FIF_SE_IA"),  // All
                    Translations.Translate("FIF_SE_IN"),  // Network
                    Translations.Translate("FIF_SE_IP"),  // Ploppable
                    Translations.Translate("FIF_SE_IG"),  // Growable
                    Translations.Translate("FIF_SE_IR"),  // RICO
                    Translations.Translate("FIF_SE_IGR"), // Growable/RICO
                    Translations.Translate("FIF_SE_IPR"), // Prop
                    Translations.Translate("FIF_SE_ID"),  // Decal
                    Translations.Translate("FIF_SE_IT")   // Tree
                };
                typeFilter.items = items;
            }
            else
            {
                string[] items =
                {
                    Translations.Translate("FIF_SE_IA"),  // All
                    Translations.Translate("FIF_SE_IN"),  // Network
                    Translations.Translate("FIF_SE_IP"),  // Ploppable
                    Translations.Translate("FIF_SE_IG"),  // Growable
                    Translations.Translate("FIF_SE_IPR"), // Prop
                    Translations.Translate("FIF_SE_ID"),  // Decal
                    Translations.Translate("FIF_SE_IT")   // Tree
                };
                typeFilter.items = items;
            }
            typeFilter.selectedIndex = 0;

            typeFilter.eventSelectedIndexChanged += (c, p) =>
            {
                UpdateFilterPanels();

                // restore stored search query individually for each asset type
                // or hold SHIFT when switching asset type to share query keyword temporarily
                Event e = Event.current;
                if (Settings.separateSearchKeyword && !e.shift)
                {
                    if (this.storedQueries.TryGetValue((UISearchBox.DropDownOptions)p, out string storedQuery))
                    {
                        // Debugging.Message($"restore stored query for category {p} (cast: '{(UISearchBox.DropDownOptions)p}': \"{storedQuery}\"");
                        this.input.text = storedQuery;
                    }
                    else
                    {
                        this.input.text = "";
                    }
                }
                Search();
            };

            // workshop filter checkbox (custom assets saved in local asset folder are also included)
            workshopFilter                    = SamsamTS.UIUtils.CreateCheckBox(inputPanel);
            workshopFilter.isChecked          = Settings.useWorkshopFilter;
            workshopFilter.width              = 80;
            workshopFilter.label.text         = Translations.Translate("FIF_SE_WF");
            workshopFilter.label.textScale    = 0.8f;
            workshopFilter.relativePosition   = new Vector3(typeFilter.relativePosition.x + typeFilter.width + 12, 10);
            workshopFilter.eventCheckChanged += (c, i) =>
            {
                Settings.useWorkshopFilter = workshopFilter.isChecked;
                XMLUtils.SaveSettings();
                Search();
            };

            // vanilla filter checkbox
            vanillaFilter                    = SamsamTS.UIUtils.CreateCheckBox(inputPanel);
            vanillaFilter.isChecked          = Settings.useVanillaFilter;
            vanillaFilter.width              = 80;
            vanillaFilter.label.text         = Translations.Translate("FIF_SE_VF");
            vanillaFilter.label.textScale    = 0.8f;
            vanillaFilter.relativePosition   = new Vector3(workshopFilter.relativePosition.x + workshopFilter.width, 10);
            vanillaFilter.eventCheckChanged += (c, i) =>
            {
                Settings.useVanillaFilter = vanillaFilter.isChecked;
                XMLUtils.SaveSettings();
                Search();
            };

            // Refresh Display
            refreshDisplayIcon                  = inputPanel.AddUIComponent <UISprite>();
            refreshDisplayIcon.size             = new Vector2(26, 22);
            refreshDisplayIcon.atlas            = FindIt.atlas;
            refreshDisplayIcon.spriteName       = "Refresh";
            refreshDisplayIcon.tooltip          = Translations.Translate("FIF_REF_DIS");
            refreshDisplayIcon.opacity          = 0.45f;
            refreshDisplayIcon.relativePosition = new Vector3(vanillaFilter.relativePosition.x + vanillaFilter.width + 5, 6.5f);
            refreshDisplayIcon.eventClicked    += (c, p) =>
            {
                AssetTagList.instance.UpdatePrefabInstanceCount(DropDownOptions.All);
                if (FindIt.isPOEnabled && Settings.includePOinstances)
                {
                    ProceduralObjectsTool.UpdatePOInfoList();
                }
                UISearchBox.instance.scrollPanel.Refresh();
            };

            refreshDisplayIcon.eventMouseEnter += (c, p) =>
            {
                refreshDisplayIcon.opacity = 0.9f;
            };

            refreshDisplayIcon.eventMouseLeave += (c, p) =>
            {
                refreshDisplayIcon.opacity = 0.45f;
            };

            // Locate Instance
            LocateNextInstanceTool.Initialize();
            locateInstanceIcon                  = inputPanel.AddUIComponent <UISprite>();
            locateInstanceIcon.size             = new Vector2(26, 23);
            locateInstanceIcon.atlas            = FindIt.atlas;
            locateInstanceIcon.spriteName       = "Locate";
            locateInstanceIcon.tooltip          = Translations.Translate("FIF_LOC_TOOL");
            locateInstanceIcon.opacity          = 0.45f;
            locateInstanceIcon.relativePosition = new Vector3(refreshDisplayIcon.relativePosition.x + refreshDisplayIcon.width + 4, 5.5f);
            locateInstanceIcon.eventClicked    += (c, p) =>
            {
                Event e = Event.current;
                if (e.shift)
                {
                    LocateNextInstanceTool.LocateNextInstance(true); // find PO instance
                }
                else
                {
                    LocateNextInstanceTool.LocateNextInstance(false); // find normal asset instance
                }
            };


            locateInstanceIcon.eventMouseEnter += (c, p) =>
            {
                locateInstanceIcon.opacity = 1.0f;
            };

            locateInstanceIcon.eventMouseLeave += (c, p) =>
            {
                locateInstanceIcon.opacity = 0.45f;
            };

            // change custom tag panel visibility
            tagToolIcon                  = inputPanel.AddUIComponent <UISprite>();
            tagToolIcon.size             = new Vector2(26, 21);
            tagToolIcon.atlas            = FindIt.atlas;
            tagToolIcon.spriteName       = "Tag";
            tagToolIcon.tooltip          = Translations.Translate("FIF_SE_SCTP");
            tagToolIcon.opacity          = 0.5f;
            tagToolIcon.relativePosition = new Vector3(locateInstanceIcon.relativePosition.x + locateInstanceIcon.width + 3.5f, 7);
            tagToolIcon.eventClicked    += (c, p) =>
            {
                if (!tagPanel.isVisible)
                {
                    tagToolIcon.opacity = 1.0f;
                    //CreateCustomTagPanel();
                    tagPanel.isVisible = true;
                }
                else
                {
                    tagToolIcon.opacity = 0.5f;
                    //DestroyCustomTagPanel();
                    tagPanel.isVisible = false;
                    tagPanel.tagDropDownCheckBox.isChecked = false;
                    Search();
                }
                UpdateTopPanelsPosition();
            };

            tagToolIcon.eventMouseEnter += (c, p) =>
            {
                tagToolIcon.opacity = 1.0f;
            };

            tagToolIcon.eventMouseLeave += (c, p) =>
            {
                if (tagPanel.isVisible)
                {
                    tagToolIcon.opacity = 1.0f;
                }
                else
                {
                    tagToolIcon.opacity = 0.5f;
                }
            };

            // change extra filters panel visibility
            extraFiltersIcon                  = inputPanel.AddUIComponent <UISprite>();
            extraFiltersIcon.size             = new Vector2(26, 23);
            extraFiltersIcon.atlas            = FindIt.atlas;
            extraFiltersIcon.spriteName       = "ExtraFilters";
            extraFiltersIcon.tooltip          = Translations.Translate("FIF_SE_EFI");
            extraFiltersIcon.opacity          = 0.5f;
            extraFiltersIcon.relativePosition = new Vector3(tagToolIcon.relativePosition.x + tagToolIcon.width + 4, 6);

            extraFiltersIcon.eventClicked += (c, p) =>
            {
                if (!extraFiltersPanel.isVisible)
                {
                    extraFiltersIcon.opacity = 1.0f;
                    //CreateExtraFiltersPanel();
                    extraFiltersPanel.isVisible = true;
                }
                else
                {
                    extraFiltersIcon.opacity = 0.5f;
                    //DestroyExtraFiltersPanel();
                    extraFiltersPanel.isVisible = false;
                    extraFiltersPanel.optionDropDownCheckBox.isChecked = false;
                    Search();
                }
                UpdateTopPanelsPosition();
            };

            extraFiltersIcon.eventMouseEnter += (c, p) =>
            {
                extraFiltersIcon.opacity = 1.0f;
            };

            extraFiltersIcon.eventMouseLeave += (c, p) =>
            {
                if (extraFiltersPanel.isVisible)
                {
                    extraFiltersIcon.opacity = 1.0f;
                }
                else
                {
                    extraFiltersIcon.opacity = 0.5f;
                }
            };

            quickMenuIcon                  = inputPanel.AddUIComponent <UISprite>();
            quickMenuIcon.size             = new Vector2(26, 23);
            quickMenuIcon.atlas            = FindIt.atlas;
            quickMenuIcon.spriteName       = "QuickMenu";
            quickMenuIcon.tooltip          = Translations.Translate("FIF_QM_TIT");
            quickMenuIcon.opacity          = 0.5f;
            quickMenuIcon.relativePosition = new Vector3(extraFiltersIcon.relativePosition.x + extraFiltersIcon.width + 4, 6);
            quickMenuIcon.eventClicked    += (c, p) =>
            {
                UIQuickMenuPopUp.ShowAt(quickMenuIcon);
                quickMenuVisible      = true;
                quickMenuIcon.opacity = 1.0f;
            };
            quickMenuIcon.eventMouseEnter += (c, p) =>
            {
                quickMenuIcon.opacity = 1.0f;
            };

            quickMenuIcon.eventMouseLeave += (c, p) =>
            {
                if (quickMenuVisible)
                {
                    quickMenuIcon.opacity = 1.0f;
                }
                else
                {
                    quickMenuIcon.opacity = 0.5f;
                }
            };

            // building size filter
            sizeFilterX                  = SamsamTS.UIUtils.CreateDropDown(inputPanel);
            sizeFilterX.size             = new Vector2(55, 25);
            sizeFilterX.items            = filterItemsGrowable;
            sizeFilterX.selectedIndex    = 0;
            sizeFilterX.relativePosition = new Vector3(quickMenuIcon.relativePosition.x + quickMenuIcon.width + 9, 5);

            sizeLabel                  = inputPanel.AddUIComponent <UILabel>();
            sizeLabel.textScale        = 0.8f;
            sizeLabel.padding          = new RectOffset(0, 0, 8, 0);
            sizeLabel.text             = "x";
            sizeLabel.tooltip          = Translations.Translate("FIF_SE_SIZEX");
            sizeLabel.relativePosition = new Vector3(sizeFilterX.relativePosition.x + sizeFilterX.width + 3.5f, 5);

            sizeLabel.eventClick += (c, p) =>
            {
                sizeFilterX.selectedIndex = 0;
                sizeFilterY.selectedIndex = 0;
            };

            sizeFilterY                  = SamsamTS.UIUtils.CreateDropDown(inputPanel);
            sizeFilterY.size             = new Vector2(55, 25);
            sizeFilterY.items            = filterItemsGrowable;
            sizeFilterY.selectedIndex    = 0;
            sizeFilterY.relativePosition = new Vector3(sizeLabel.relativePosition.x + sizeLabel.width + 2f, 5);

            sizeFilterX.eventSelectedIndexChanged += (c, i) => Search();
            sizeFilterY.eventSelectedIndexChanged += (c, i) => Search();

            // panel of sort button and filter toggle tabs
            panel       = AddUIComponent <UIPanel>();
            panel.atlas = SamsamTS.UIUtils.GetAtlas("Ingame");
            if (!Settings.useLightBackground)
            {
                panel.backgroundSprite = "GenericTabHovered";
            }
            else
            {
                panel.backgroundSprite = "GenericTab";
            }
            panel.size             = new Vector2(parent.width, 45);
            panel.relativePosition = new Vector3(0, -panel.height + 5);

            // sort button
            sortButton      = SamsamTS.UIUtils.CreateButton(panel);
            sortButton.size = new Vector2(100, 35);
            if (Settings.useRelevanceSort)
            {
                sortButton.text    = Translations.Translate("FIF_SO_RE");
                sortButton.tooltip = Translations.Translate("FIF_SO_RETP");
            }
            else
            {
                sortButton.text    = Translations.Translate("FIF_SO_NE");
                sortButton.tooltip = Translations.Translate("FIF_SO_NETP");
            }
            sortButton.relativePosition = new Vector3(5, 5);

            sortButton.eventClick += (c, p) =>
            {
                if (Settings.useRelevanceSort)
                {
                    Settings.useRelevanceSort = false;
                    XMLUtils.SaveSettings();
                    sortButton.text    = Translations.Translate("FIF_SO_NE");
                    sortButton.tooltip = Translations.Translate("FIF_SO_NETP");
                }
                else
                {
                    Settings.useRelevanceSort = true;
                    XMLUtils.SaveSettings();
                    sortButton.text    = Translations.Translate("FIF_SO_RE");
                    sortButton.tooltip = Translations.Translate("FIF_SO_RETP");
                }
                Search();
            };

            // ploppable filter tabs
            filterPloppable                        = panel.AddUIComponent <UIFilterPloppable>();
            filterPloppable.isVisible              = false;
            filterPloppable.relativePosition       = new Vector3(sortButton.relativePosition.x + sortButton.width, 0);
            filterPloppable.eventFilteringChanged += (c, p) => Search();

            // growable filter tabs
            filterGrowable                        = panel.AddUIComponent <UIFilterGrowable>();
            filterGrowable.isVisible              = false;
            filterGrowable.relativePosition       = new Vector3(sortButton.relativePosition.x + sortButton.width, 0);
            filterGrowable.eventFilteringChanged += (c, p) => Search();

            // prop filter tabs
            filterProp                        = panel.AddUIComponent <UIFilterProp>();
            filterProp.isVisible              = false;
            filterProp.relativePosition       = new Vector3(sortButton.relativePosition.x + sortButton.width, 0);
            filterProp.eventFilteringChanged += (c, p) => Search();

            // tree filter tabs
            filterTree                        = panel.AddUIComponent <UIFilterTree>();
            filterTree.isVisible              = false;
            filterTree.relativePosition       = new Vector3(sortButton.relativePosition.x + sortButton.width, 0);
            filterTree.eventFilteringChanged += (c, p) => Search();

            // network filter tabs
            filterNetwork                        = panel.AddUIComponent <UIFilterNetwork>();
            filterNetwork.isVisible              = false;
            filterNetwork.relativePosition       = new Vector3(sortButton.relativePosition.x + sortButton.width, 0);
            filterNetwork.eventFilteringChanged += (c, p) => Search();

            // decal filter tabs
            filterDecal                  = panel.AddUIComponent <UIFilterDecal>();
            filterDecal.isVisible        = false;
            filterDecal.relativePosition = new Vector3(sortButton.relativePosition.x + sortButton.width, 0);

            UpdateFilterPanels();
            CreateAssetTypePanel();
            if (Settings.showAssetTypePanel)
            {
                assetTypePanel.isVisible = true;
            }
            CreateCustomTagPanel();
            CreateExtraFiltersPanel();

            size = Vector2.zero;
        }
Beispiel #3
0
        public override void Start()
        {
            instance = this;

            /*atlas = SamsamTS.UIUtils.GetAtlas("Ingame");
             * backgroundSprite = "GenericTabHovered";*/
            size = new Vector2(605, 45);

            // generate filter tabs UI
            toggles = new UICheckBox[(int)Category.All];
            for (int i = 0; i < (int)Category.All; i++)
            {
                toggles[i]                  = SamsamTS.UIUtils.CreateIconToggle(this, CategoryIcons.atlases[i], CategoryIcons.spriteNames[i], CategoryIcons.spriteNames[i] + "Disabled");
                toggles[i].tooltip          = CategoryIcons.tooltips[i] + "\n" + Translations.Translate("FIF_SE_SC");
                toggles[i].relativePosition = new Vector3(5 + 40 * i, 5);
                toggles[i].isChecked        = true;
                toggles[i].readOnly         = true;
                toggles[i].checkedBoxObject.isInteractive = false; // Don't eat my double click event please

                toggles[i].eventClick += (c, p) =>
                {
                    Event e = Event.current;

                    if (e.shift || e.control)
                    {
                        ((UICheckBox)c).isChecked = !((UICheckBox)c).isChecked;
                        eventFilteringChanged(this, 0);
                    }
                    else
                    {
                        // when all tabs are checked, toggle a tab will uncheck all the other tabs
                        bool check = true;
                        for (int j = 0; j < (int)Category.All; j++)
                        {
                            check = check && toggles[j].isChecked;
                        }
                        if (check)
                        {
                            for (int j = 0; j < (int)Category.All; j++)
                            {
                                toggles[j].isChecked = false;
                            }
                            ((UICheckBox)c).isChecked = true;
                            eventFilteringChanged(this, 0);
                            return;
                        }

                        // when a tab is unchecked, toggle it will uncheck all the other tabs
                        if (((UICheckBox)c).isChecked == false)
                        {
                            for (int j = 0; j < (int)Category.All; j++)
                            {
                                toggles[j].isChecked = false;
                            }
                            ((UICheckBox)c).isChecked = true;
                            eventFilteringChanged(this, 0);
                            return;
                        }

                        // when a tab is already checked, toggle it will move back to select all
                        if (((UICheckBox)c).isChecked == true)
                        {
                            for (int j = 0; j < (int)Category.All; j++)
                            {
                                toggles[j].isChecked = true;
                            }
                            eventFilteringChanged(this, 0);
                            return;
                        }
                    }
                };
            }

            UICheckBox last = toggles[toggles.Length - 1];

            all                  = SamsamTS.UIUtils.CreateButton(this);
            all.size             = new Vector2(55, 35);
            all.text             = Translations.Translate("FIF_SE_IA");
            all.relativePosition = new Vector3(last.relativePosition.x + last.width + 5, 5);

            all.eventClick += (c, p) =>
            {
                for (int i = 0; i < (int)Category.All; i++)
                {
                    toggles[i].isChecked = true;
                }
                eventFilteringChanged(this, 0);
            };

            width = parent.width;
        }
Beispiel #4
0
        public override void Start()
        {
            instance = this;

            inputPanel                  = AddUIComponent <UIPanel>();
            inputPanel.atlas            = SamsamTS.UIUtils.GetAtlas("Ingame");
            inputPanel.backgroundSprite = "GenericTab";
            inputPanel.size             = new Vector2(300, 40);
            inputPanel.relativePosition = new Vector2(0, -inputPanel.height - 40);

            input                  = SamsamTS.UIUtils.CreateTextField(inputPanel);
            input.size             = new Vector2(inputPanel.width - 45, 30);
            input.padding.top      = 7;
            input.relativePosition = new Vector3(5, 5);

            string search = null;

            input.eventTextChanged += (c, p) =>
            {
                search = p;
                Search();
            };

            input.eventTextCancelled += (c, p) =>
            {
                input.text = search;
            };

            searchButton                  = inputPanel.AddUIComponent <UIButton>();
            searchButton.size             = new Vector2(43, 49);
            searchButton.atlas            = FindIt.instance.mainButton.atlas;
            searchButton.playAudioEvents  = true;
            searchButton.normalFgSprite   = "FindIt";
            searchButton.hoveredFgSprite  = "FindItFocused";
            searchButton.pressedFgSprite  = "FindItPressed";
            searchButton.relativePosition = new Vector3(inputPanel.width - 41, -3);

            searchButton.eventClick += (c, p) =>
            {
                input.Focus();
                input.SelectAll();
            };

            filterPanel                  = AddUIComponent <UIPanel>();
            filterPanel.atlas            = SamsamTS.UIUtils.GetAtlas("Ingame");
            filterPanel.backgroundSprite = "GenericTab";
            filterPanel.color            = new Color32(196, 200, 206, 255);
            filterPanel.size             = new Vector2(155, 35);
            filterPanel.SendToBack();
            filterPanel.relativePosition = new Vector3(inputPanel.width, -filterPanel.height - 40);

            // workshop filter checkbox (custom assets saved in local asset folder are also included)
            workshopFilter                    = SamsamTS.UIUtils.CreateCheckBox(filterPanel);
            workshopFilter.isChecked          = true;
            workshopFilter.width              = 80;
            workshopFilter.label.text         = Translations.Translate("FIF_SE_WF");
            workshopFilter.label.textScale    = 0.8f;
            workshopFilter.relativePosition   = new Vector3(10, 10);
            workshopFilter.eventCheckChanged += (c, i) => Search();

            // vanilla filter checkbox
            vanillaFilter                    = SamsamTS.UIUtils.CreateCheckBox(filterPanel);
            vanillaFilter.isChecked          = true;
            vanillaFilter.width              = 80;
            vanillaFilter.label.text         = Translations.Translate("FIF_SE_VF");
            vanillaFilter.label.textScale    = 0.8f;
            vanillaFilter.relativePosition   = new Vector3(workshopFilter.relativePosition.x + workshopFilter.width, 10);
            vanillaFilter.eventCheckChanged += (c, i) => Search();

            // asset type filter
            typeFilter                  = SamsamTS.UIUtils.CreateDropDown(filterPanel);
            typeFilter.size             = new Vector2(100, 25);
            typeFilter.relativePosition = new Vector3(vanillaFilter.relativePosition.x + vanillaFilter.width, 5);

            if (FindIt.isRicoEnabled)
            {
                string[] items =
                {
                    Translations.Translate("FIF_SE_IA"),
                    Translations.Translate("FIF_SE_IN"),
                    Translations.Translate("FIF_SE_IP"),
                    Translations.Translate("FIF_SE_IG"),
                    Translations.Translate("FIF_SE_IR"),
                    Translations.Translate("FIF_SE_IPR"),
                    Translations.Translate("FIF_SE_ID"),
                    Translations.Translate("FIF_SE_IT")
                };
                typeFilter.items = items;
            }
            else
            {
                string[] items =
                {
                    Translations.Translate("FIF_SE_IA"),
                    Translations.Translate("FIF_SE_IN"),
                    Translations.Translate("FIF_SE_IP"),
                    Translations.Translate("FIF_SE_IG"),
                    Translations.Translate("FIF_SE_IPR"),
                    Translations.Translate("FIF_SE_ID"),
                    Translations.Translate("FIF_SE_IT")
                };
                typeFilter.items = items;
            }
            typeFilter.selectedIndex = 0;

            typeFilter.eventSelectedIndexChanged += (c, p) =>
            {
                UpdateFilterPanels();
                Search();
            };

            buildingFilters                  = filterPanel.AddUIComponent <UIPanel>();
            buildingFilters.size             = new Vector2(90, 35);
            buildingFilters.relativePosition = new Vector3(typeFilter.relativePosition.x + typeFilter.width, 0);

            // Level
            UILabel levelLabel = buildingFilters.AddUIComponent <UILabel>();

            levelLabel.textScale        = 0.8f;
            levelLabel.padding          = new RectOffset(0, 0, 8, 0);
            levelLabel.text             = Translations.Translate("FIF_SE_LV");
            levelLabel.relativePosition = new Vector3(10, 5);

            levelFilter      = SamsamTS.UIUtils.CreateDropDown(buildingFilters);
            levelFilter.size = new Vector2(55, 25);
            levelFilter.AddItem(Translations.Translate("FIF_SE_IA"));
            levelFilter.AddItem("1");
            levelFilter.AddItem("2");
            levelFilter.AddItem("3");
            levelFilter.AddItem("4");
            levelFilter.AddItem("5");
            levelFilter.selectedIndex    = 0;
            levelFilter.relativePosition = new Vector3(levelLabel.relativePosition.x + levelLabel.width + 5, 5);

            levelFilter.eventSelectedIndexChanged += (c, i) => Search();

            // Size
            UILabel sizeLabel = buildingFilters.AddUIComponent <UILabel>();

            sizeLabel.textScale        = 0.8f;
            sizeLabel.padding          = new RectOffset(0, 0, 8, 0);
            sizeLabel.text             = Translations.Translate("FIF_SE_SZ");
            sizeLabel.relativePosition = new Vector3(levelFilter.relativePosition.x + levelFilter.width + 10, 5);

            sizeFilterX      = SamsamTS.UIUtils.CreateDropDown(buildingFilters);
            sizeFilterX.size = new Vector2(55, 25);
            sizeFilterX.AddItem(Translations.Translate("FIF_SE_IA"));
            sizeFilterX.AddItem("1");
            sizeFilterX.AddItem("2");
            sizeFilterX.AddItem("3");
            sizeFilterX.AddItem("4");
            sizeFilterX.selectedIndex    = 0;
            sizeFilterX.relativePosition = new Vector3(sizeLabel.relativePosition.x + sizeLabel.width + 5, 5);


            UILabel XLabel = buildingFilters.AddUIComponent <UILabel>();

            XLabel.textScale = 0.8f;
            XLabel.padding   = new RectOffset(0, 0, 8, 0);
            //XLabel.text = "X";
            XLabel.text             = " ";
            XLabel.isVisible        = false;
            XLabel.relativePosition = new Vector3(sizeFilterX.relativePosition.x + sizeFilterX.width - 5, 5);

            sizeFilterY      = SamsamTS.UIUtils.CreateDropDown(buildingFilters);
            sizeFilterY.size = new Vector2(55, 25);
            sizeFilterY.AddItem(Translations.Translate("FIF_SE_IA"));
            sizeFilterY.AddItem("1");
            sizeFilterY.AddItem("2");
            sizeFilterY.AddItem("3");
            sizeFilterY.AddItem("4");
            sizeFilterY.selectedIndex = 0;
            //sizeFilterY.isVisible = false;
            sizeFilterY.relativePosition = new Vector3(XLabel.relativePosition.x + XLabel.width + 5, 5);

            sizeFilterX.eventSelectedIndexChanged += (c, i) => Search();
            sizeFilterY.eventSelectedIndexChanged += (c, i) => Search();


            UIPanel panel = AddUIComponent <UIPanel>();

            panel.atlas            = SamsamTS.UIUtils.GetAtlas("Ingame");
            panel.backgroundSprite = "GenericTabHovered";
            panel.size             = new Vector2(parent.width, 45);
            panel.relativePosition = new Vector3(0, -panel.height + 5);

            filterPloppable                  = panel.AddUIComponent <UIFilterPloppable>();
            filterPloppable.isVisible        = false;
            filterPloppable.relativePosition = new Vector3(0, 0);

            filterPloppable.eventFilteringChanged += (c, p) => Search();

            filterGrowable                  = panel.AddUIComponent <UIFilterGrowable>();
            filterGrowable.isVisible        = false;
            filterGrowable.relativePosition = new Vector3(0, 0);

            filterGrowable.eventFilteringChanged += (c, p) => Search();

            UpdateFilterPanels();

            size = Vector2.zero;
        }
Beispiel #5
0
        public override void Start()
        {
            instance = this;

            inputPanel                  = AddUIComponent <UIPanel>();
            inputPanel.atlas            = SamsamTS.UIUtils.GetAtlas("Ingame");
            inputPanel.backgroundSprite = "GenericTab";
            inputPanel.size             = new Vector2(300, 40);
            inputPanel.relativePosition = new Vector2(5, -inputPanel.height - 40);

            input                  = SamsamTS.UIUtils.CreateTextField(inputPanel);
            input.size             = new Vector2(inputPanel.width - 45, 30);
            input.padding.top      = 7;
            input.relativePosition = new Vector3(5, 5);

            string search = null;

            input.eventTextChanged += (c, p) =>
            {
                search = p;
                Search();
            };

            input.eventTextCancelled += (c, p) =>
            {
                input.text = search;
            };

            searchButton                  = inputPanel.AddUIComponent <UIButton>();
            searchButton.size             = new Vector2(43, 49);
            searchButton.atlas            = FindIt.instance.mainButton.atlas;
            searchButton.playAudioEvents  = true;
            searchButton.normalFgSprite   = "FindIt";
            searchButton.hoveredFgSprite  = "FindItFocused";
            searchButton.pressedFgSprite  = "FindItPressed";
            searchButton.relativePosition = new Vector3(inputPanel.width - 41, -3);

            searchButton.eventClick += (c, p) =>
            {
                input.Focus();
                input.SelectAll();
            };

            filterPanel                  = AddUIComponent <UIPanel>();
            filterPanel.atlas            = SamsamTS.UIUtils.GetAtlas("Ingame");
            filterPanel.backgroundSprite = "GenericTab";
            filterPanel.color            = new Color32(196, 200, 206, 255);
            filterPanel.size             = new Vector2(105, 35);
            filterPanel.SendToBack();
            filterPanel.relativePosition = new Vector3(inputPanel.width, -filterPanel.height - 40);

            typeFilter                  = SamsamTS.UIUtils.CreateDropDown(filterPanel);
            typeFilter.size             = new Vector2(130, 25);
            typeFilter.relativePosition = new Vector3(10, 5);

            if (FindIt.isRicoEnabled)
            {
                string[] items =
                {
                    "All",
                    "Net Structures",
                    "Ploppable",
                    "Growable",
                    "Rico",
                    "Prop",
                    "Decal",
                    "Tree"
                };
                typeFilter.items = items;
            }
            else
            {
                string[] items =
                {
                    "All",
                    "Net Structures",
                    "Ploppable",
                    "Growable",
                    "Prop",
                    "Decal",
                    "Tree"
                };
                typeFilter.items = items;
            }
            typeFilter.selectedIndex = 0;

            typeFilter.eventSelectedIndexChanged += (c, p) =>
            {
                UpdateFilterPanels();
                Search();
            };

            buildingFilters                  = filterPanel.AddUIComponent <UIPanel>();
            buildingFilters.size             = new Vector2(90, 35);
            buildingFilters.relativePosition = new Vector3(typeFilter.relativePosition.x + typeFilter.width, 0);

            // Level
            UILabel levelLabel = buildingFilters.AddUIComponent <UILabel>();

            levelLabel.textScale        = 0.8f;
            levelLabel.padding          = new RectOffset(0, 0, 8, 0);
            levelLabel.text             = "Level: ";
            levelLabel.relativePosition = new Vector3(10, 5);

            levelFilter      = SamsamTS.UIUtils.CreateDropDown(buildingFilters);
            levelFilter.size = new Vector2(55, 25);
            levelFilter.AddItem("All");
            levelFilter.AddItem("1");
            levelFilter.AddItem("2");
            levelFilter.AddItem("3");
            levelFilter.AddItem("4");
            levelFilter.AddItem("5");
            levelFilter.selectedIndex    = 0;
            levelFilter.relativePosition = new Vector3(levelLabel.relativePosition.x + levelLabel.width + 5, 5);

            levelFilter.eventSelectedIndexChanged += (c, i) => Search();

            // Size
            UILabel sizeLabel = buildingFilters.AddUIComponent <UILabel>();

            sizeLabel.textScale        = 0.8f;
            sizeLabel.padding          = new RectOffset(0, 0, 8, 0);
            sizeLabel.text             = "Size: ";
            sizeLabel.relativePosition = new Vector3(levelFilter.relativePosition.x + levelFilter.width + 10, 5);

            sizeFilterX      = SamsamTS.UIUtils.CreateDropDown(buildingFilters);
            sizeFilterX.size = new Vector2(55, 25);
            sizeFilterX.AddItem("All");
            sizeFilterX.AddItem("1");
            sizeFilterX.AddItem("2");
            sizeFilterX.AddItem("3");
            sizeFilterX.AddItem("4");
            sizeFilterX.selectedIndex    = 0;
            sizeFilterX.relativePosition = new Vector3(sizeLabel.relativePosition.x + sizeLabel.width + 5, 5);

            UILabel XLabel = buildingFilters.AddUIComponent <UILabel>();

            XLabel.textScale        = 0.8f;
            XLabel.padding          = new RectOffset(0, 0, 8, 0);
            XLabel.text             = "X";
            XLabel.isVisible        = false;
            XLabel.relativePosition = new Vector3(sizeFilterX.relativePosition.x + sizeFilterX.width - 5, 5);

            sizeFilterY      = SamsamTS.UIUtils.CreateDropDown(buildingFilters);
            sizeFilterY.size = new Vector2(45, 25);
            sizeFilterY.AddItem("1");
            sizeFilterY.AddItem("2");
            sizeFilterY.AddItem("3");
            sizeFilterY.AddItem("4");
            sizeFilterY.selectedIndex    = 0;
            sizeFilterY.isVisible        = false;
            sizeFilterY.relativePosition = new Vector3(XLabel.relativePosition.x + XLabel.width + 5, 5);

            sizeFilterX.eventSelectedIndexChanged += (c, i) =>
            {
                if (i == 0)
                {
                    sizeFilterX.width     = 55;
                    XLabel.isVisible      = false;
                    sizeFilterY.isVisible = false;
                }
                else
                {
                    sizeFilterX.width     = 45;
                    XLabel.isVisible      = true;
                    sizeFilterY.isVisible = true;
                }

                UpdateBuildingFilters();

                Search();
            };

            sizeFilterY.eventSelectedIndexChanged += (c, i) => Search();

            UIPanel panel = AddUIComponent <UIPanel>();

            panel.atlas            = SamsamTS.UIUtils.GetAtlas("Ingame");
            panel.backgroundSprite = "GenericTabHovered";
            panel.size             = new Vector2(parent.width, 45);
            panel.relativePosition = new Vector3(0, -panel.height + 5);

            filterPloppable                  = panel.AddUIComponent <UIFilterPloppable>();
            filterPloppable.isVisible        = false;
            filterPloppable.relativePosition = new Vector3(0, 0);

            filterPloppable.eventFilteringChanged += (c, p) => Search();

            filterGrowable                  = panel.AddUIComponent <UIFilterGrowable>();
            filterGrowable.isVisible        = false;
            filterGrowable.relativePosition = new Vector3(0, 0);

            filterGrowable.eventFilteringChanged += (c, p) => Search();

            UpdateFilterPanels();

            size = Vector2.zero;
        }
Beispiel #6
0
        public override void Start()
        {
            instance = this;
            UnityEngine.Random.InitState(System.Environment.TickCount);

            // panel for search input box, type filter and building filters
            inputPanel                  = AddUIComponent <UIPanel>();
            inputPanel.atlas            = SamsamTS.UIUtils.GetAtlas("Ingame");
            inputPanel.backgroundSprite = "GenericTab";
            inputPanel.color            = new Color32(196, 200, 206, 255);
            inputPanel.size             = new Vector2(parent.width, 35);
            inputPanel.relativePosition = new Vector2(0, -inputPanel.height - 40);

            // search input box
            input                  = SamsamTS.UIUtils.CreateTextField(inputPanel);
            input.size             = new Vector2(250, 28);
            input.padding.top      = 6;
            input.relativePosition = new Vector3(5, 4);

            string search = null;

            input.eventTextChanged += (c, p) =>
            {
                search = p;
                Search();
            };

            input.eventTextCancelled += (c, p) =>
            {
                if (search != null)
                {
                    input.text = search;
                }
            };

            input.eventKeyDown += (component, eventParam) =>
            {
                if (eventParam.keycode != KeyCode.DownArrow && eventParam.keycode != KeyCode.UpArrow)
                {
                    return;
                }
                if (typeFilter != null)
                {
                    typeFilter.selectedIndex = Mathf.Clamp(typeFilter.selectedIndex + (eventParam.keycode == KeyCode.DownArrow ? 1 : -1), 0, typeFilter.items.Length);
                }
            };

            // search icon
            searchIcon                  = inputPanel.AddUIComponent <UISprite>();
            searchIcon.size             = new Vector2(25, 30);
            searchIcon.atlas            = FindIt.atlas;
            searchIcon.spriteName       = "FindItDisabled";
            searchIcon.relativePosition = new Vector3(5, 4);

            // change custom tag panel visibility
            clearButton                  = inputPanel.AddUIComponent <UISprite>();
            clearButton.size             = new Vector2(30, 30);
            clearButton.atlas            = FindIt.atlas;
            clearButton.spriteName       = "Clear";
            clearButton.tooltip          = Translations.Translate("FIF_SE_SEBTP");
            clearButton.opacity          = 0.5f;
            clearButton.relativePosition = new Vector3(input.relativePosition.x + input.width + 5, 2.5f);
            clearButton.eventClicked    += (c, p) =>
            {
                input.text = "";
                //PickerRandomTest();
            };
            clearButton.eventMouseEnter += (c, p) =>
            {
                clearButton.opacity = 1.0f;
            };

            clearButton.eventMouseLeave += (c, p) =>
            {
                clearButton.opacity = 0.5f;
            };

            // asset type filter. Also Manipulated by the Picker mod through reflection.
            // Need to notify Quboid if a new dropdown item is added, or the item order is changed
            typeFilter                  = SamsamTS.UIUtils.CreateDropDown(inputPanel);
            typeFilter.name             = "FindIt_AssetTypeFilter";
            typeFilter.size             = new Vector2(105, 25);
            typeFilter.tooltip          = Translations.Translate("FIF_POP_SCR");
            typeFilter.relativePosition = new Vector3(clearButton.relativePosition.x + clearButton.width + 15, 5);

            if (FindIt.isRicoEnabled)
            {
                string[] items =
                {
                    Translations.Translate("FIF_SE_IA"),  // All
                    Translations.Translate("FIF_SE_IN"),  // Network
                    Translations.Translate("FIF_SE_IP"),  // Ploppable
                    Translations.Translate("FIF_SE_IG"),  // Growable
                    Translations.Translate("FIF_SE_IR"),  // RICO
                    Translations.Translate("FIF_SE_IGR"), // Growable/RICO
                    Translations.Translate("FIF_SE_IPR"), // Prop
                    Translations.Translate("FIF_SE_ID"),  // Decal
                    Translations.Translate("FIF_SE_IT")   // Tree
                };
                typeFilter.items = items;
            }
            else
            {
                string[] items =
                {
                    Translations.Translate("FIF_SE_IA"),  // All
                    Translations.Translate("FIF_SE_IN"),  // Network
                    Translations.Translate("FIF_SE_IP"),  // Ploppable
                    Translations.Translate("FIF_SE_IG"),  // Growable
                    Translations.Translate("FIF_SE_IPR"), // Prop
                    Translations.Translate("FIF_SE_ID"),  // Decal
                    Translations.Translate("FIF_SE_IT")   // Tree
                };
                typeFilter.items = items;
            }
            typeFilter.selectedIndex = 0;

            typeFilter.eventSelectedIndexChanged += (c, p) =>
            {
                UpdateFilterPanels();
                Search();
            };

            // workshop filter checkbox (custom assets saved in local asset folder are also included)
            workshopFilter                    = SamsamTS.UIUtils.CreateCheckBox(inputPanel);
            workshopFilter.isChecked          = true;
            workshopFilter.width              = 80;
            workshopFilter.label.text         = Translations.Translate("FIF_SE_WF");
            workshopFilter.label.textScale    = 0.8f;
            workshopFilter.relativePosition   = new Vector3(typeFilter.relativePosition.x + typeFilter.width + 12, 10);
            workshopFilter.eventCheckChanged += (c, i) => Search();

            // vanilla filter checkbox
            vanillaFilter                    = SamsamTS.UIUtils.CreateCheckBox(inputPanel);
            vanillaFilter.isChecked          = true;
            vanillaFilter.width              = 80;
            vanillaFilter.label.text         = Translations.Translate("FIF_SE_VF");
            vanillaFilter.label.textScale    = 0.8f;
            vanillaFilter.relativePosition   = new Vector3(workshopFilter.relativePosition.x + workshopFilter.width, 10);
            vanillaFilter.eventCheckChanged += (c, i) => Search();

            // change custom tag panel visibility
            tagToolIcon                  = inputPanel.AddUIComponent <UISprite>();
            tagToolIcon.size             = new Vector2(26, 21);
            tagToolIcon.atlas            = FindIt.atlas;
            tagToolIcon.spriteName       = "Tag";
            tagToolIcon.tooltip          = Translations.Translate("FIF_SE_SCTP");
            tagToolIcon.opacity          = 0.5f;
            tagToolIcon.relativePosition = new Vector3(vanillaFilter.relativePosition.x + vanillaFilter.width + 5, 7);
            tagToolIcon.eventClicked    += (c, p) =>
            {
                if (tagPanel == null)
                {
                    tagToolIcon.opacity = 1.0f;
                    CreateCustomTagPanel();
                }
                else
                {
                    tagToolIcon.opacity = 0.5f;
                    DestroyCustomTagPanel();
                    Search();
                }
                UpdateTopPanelsPosition();
            };

            tagToolIcon.eventMouseEnter += (c, p) =>
            {
                tagToolIcon.opacity = 1.0f;
            };

            tagToolIcon.eventMouseLeave += (c, p) =>
            {
                if (tagPanel != null)
                {
                    tagToolIcon.opacity = 1.0f;
                }
                else
                {
                    tagToolIcon.opacity = 0.5f;
                }
            };

            // change extra filters panel visibility
            extraFiltersIcon                  = inputPanel.AddUIComponent <UISprite>();
            extraFiltersIcon.size             = new Vector2(26, 23);
            extraFiltersIcon.atlas            = FindIt.atlas;
            extraFiltersIcon.spriteName       = "ExtraFilters";
            extraFiltersIcon.tooltip          = Translations.Translate("FIF_SE_EFI");
            extraFiltersIcon.opacity          = 0.5f;
            extraFiltersIcon.relativePosition = new Vector3(tagToolIcon.relativePosition.x + tagToolIcon.width + 5, 6);

            extraFiltersIcon.eventClicked += (c, p) =>
            {
                if (extraFiltersPanel == null)
                {
                    extraFiltersIcon.opacity = 1.0f;
                    CreateExtraFiltersPanel();
                }
                else
                {
                    extraFiltersIcon.opacity = 0.5f;
                    DestroyExtraFiltersPanel();
                    Search();
                }
                UpdateTopPanelsPosition();
            };

            extraFiltersIcon.eventMouseEnter += (c, p) =>
            {
                extraFiltersIcon.opacity = 1.0f;
            };

            extraFiltersIcon.eventMouseLeave += (c, p) =>
            {
                if (extraFiltersPanel != null)
                {
                    extraFiltersIcon.opacity = 1.0f;
                }
                else
                {
                    extraFiltersIcon.opacity = 0.5f;
                }
            };

            quickMenuIcon                  = inputPanel.AddUIComponent <UISprite>();
            quickMenuIcon.size             = new Vector2(26, 23);
            quickMenuIcon.atlas            = FindIt.atlas;
            quickMenuIcon.spriteName       = "QuickMenu";
            quickMenuIcon.tooltip          = Translations.Translate("FIF_QM_TIT");
            quickMenuIcon.opacity          = 0.5f;
            quickMenuIcon.relativePosition = new Vector3(extraFiltersIcon.relativePosition.x + extraFiltersIcon.width + 5, 6);
            quickMenuIcon.eventClicked    += (c, p) =>
            {
                UIQuickMenuPopUp.ShowAt(quickMenuIcon);
                quickMenuVisible      = true;
                quickMenuIcon.opacity = 1.0f;
            };
            quickMenuIcon.eventMouseEnter += (c, p) =>
            {
                quickMenuIcon.opacity = 1.0f;
            };

            quickMenuIcon.eventMouseLeave += (c, p) =>
            {
                if (quickMenuVisible)
                {
                    quickMenuIcon.opacity = 1.0f;
                }
                else
                {
                    quickMenuIcon.opacity = 0.5f;
                }
            };

            // building size filter
            sizeLabel                  = inputPanel.AddUIComponent <UILabel>();
            sizeLabel.textScale        = 0.8f;
            sizeLabel.padding          = new RectOffset(0, 0, 8, 0);
            sizeLabel.text             = Translations.Translate("FIF_SE_SZ");
            sizeLabel.relativePosition = new Vector3(quickMenuIcon.relativePosition.x + quickMenuIcon.width + 10, 5);

            sizeFilterX                  = SamsamTS.UIUtils.CreateDropDown(inputPanel);
            sizeFilterX.size             = new Vector2(55, 25);
            sizeFilterX.items            = filterItemsGrowable;
            sizeFilterX.selectedIndex    = 0;
            sizeFilterX.relativePosition = new Vector3(sizeLabel.relativePosition.x + sizeLabel.width + 5, 5);

            sizeFilterY                  = SamsamTS.UIUtils.CreateDropDown(inputPanel);
            sizeFilterY.size             = new Vector2(55, 25);
            sizeFilterY.items            = filterItemsGrowable;
            sizeFilterY.selectedIndex    = 0;
            sizeFilterY.relativePosition = new Vector3(sizeFilterX.relativePosition.x + sizeFilterX.width + 10, 5);

            sizeFilterX.eventSelectedIndexChanged += (c, i) => Search();
            sizeFilterY.eventSelectedIndexChanged += (c, i) => Search();

            // panel of sort button and filter toggle tabs
            panel                  = AddUIComponent <UIPanel>();
            panel.atlas            = SamsamTS.UIUtils.GetAtlas("Ingame");
            panel.backgroundSprite = "GenericTabHovered";
            panel.size             = new Vector2(parent.width, 45);
            panel.relativePosition = new Vector3(0, -panel.height + 5);

            // sort button
            sortButton                  = SamsamTS.UIUtils.CreateButton(panel);
            sortButton.size             = new Vector2(100, 35);
            sortButton.text             = Translations.Translate("FIF_SO_RE");
            sortButton.tooltip          = Translations.Translate("FIF_SO_RETP");
            sortButton.relativePosition = new Vector3(5, 5);

            sortButton.eventClick += (c, p) =>
            {
                if (sortButtonTextState)
                {
                    sortButton.text     = Translations.Translate("FIF_SO_NE");
                    sortButtonTextState = false;
                    sortButton.tooltip  = Translations.Translate("FIF_SO_NETP");
                }
                else
                {
                    sortButton.text     = Translations.Translate("FIF_SO_RE");
                    sortButtonTextState = true;
                    sortButton.tooltip  = Translations.Translate("FIF_SO_RETP");
                }
                Search();

                if (FindIt.isPOEnabled)
                {
                    FindIt.instance.POTool.UpdatePOInfoList();
                }
            };

            // ploppable filter tabs
            filterPloppable                        = panel.AddUIComponent <UIFilterPloppable>();
            filterPloppable.isVisible              = false;
            filterPloppable.relativePosition       = new Vector3(sortButton.relativePosition.x + sortButton.width, 0);
            filterPloppable.eventFilteringChanged += (c, p) => Search();

            // growable filter tabs
            filterGrowable                        = panel.AddUIComponent <UIFilterGrowable>();
            filterGrowable.isVisible              = false;
            filterGrowable.relativePosition       = new Vector3(sortButton.relativePosition.x + sortButton.width, 0);
            filterGrowable.eventFilteringChanged += (c, p) => Search();

            // prop filter tabs
            filterProp                        = panel.AddUIComponent <UIFilterProp>();
            filterProp.isVisible              = false;
            filterProp.relativePosition       = new Vector3(sortButton.relativePosition.x + sortButton.width, 0);
            filterProp.eventFilteringChanged += (c, p) => Search();

            // tree filter tabs
            filterTree                        = panel.AddUIComponent <UIFilterTree>();
            filterTree.isVisible              = false;
            filterTree.relativePosition       = new Vector3(sortButton.relativePosition.x + sortButton.width, 0);
            filterTree.eventFilteringChanged += (c, p) => Search();

            // network filter tabs
            filterNetwork                        = panel.AddUIComponent <UIFilterNetwork>();
            filterNetwork.isVisible              = false;
            filterNetwork.relativePosition       = new Vector3(sortButton.relativePosition.x + sortButton.width, 0);
            filterNetwork.eventFilteringChanged += (c, p) => Search();

            // decal filter tabs
            filterDecal                  = panel.AddUIComponent <UIFilterDecal>();
            filterDecal.isVisible        = false;
            filterDecal.relativePosition = new Vector3(sortButton.relativePosition.x + sortButton.width, 0);

            UpdateFilterPanels();

            size = Vector2.zero;
        }