Esempio n. 1
0
        public UIRatingList(uint avatarID)
        {
            InnerBackground = new UIImage(GetTexture((ulong)0x7A400000001)).With9Slice(13, 13, 13, 13);
            InnerBackground.SetSize(475, 349);
            Add(InnerBackground);

            RatingList = new UIListBox()
            {
                RowHeight = 69,
                Size      = new Vector2(475, 352)
            };
            RatingList.Columns.Add(new UIListBoxColumn()
            {
                Width = 475
            });
            RatingList.ScrollbarGutter = 5;
            Add(RatingList);
            RatingList.ScrollbarImage = GetTexture(0x31000000001);
            RatingList.InitDefaultSlider();

            Size     = new Vector2(490, 352);
            AvatarID = avatarID;

            ControllerUtils.BindController <RatingListController>(this);
        }
Esempio n. 2
0
        public override void Start()
        {
            backgroundSprite = "GenericPanel";
            name             = "MPChatLogPanel";
            color            = new Color32(110, 110, 110, 200);

            // Grab the view for calculating width and height of game
            var view = UIView.GetAView();

            // Center this window in the game
            relativePosition = new Vector3(10.0f, view.fixedHeight - 430.0f);

            width  = 500;
            height = 300;

            // Create the message box
            _messageBox           = (UIListBox)AddUIComponent(typeof(UIListBox));
            _messageBox.isVisible = true;
            _messageBox.isEnabled = true;
            _messageBox.width     = 480;
            _messageBox.height    = 280;
            _messageBox.position  = new Vector2(10, -10);

            base.Start();
        }
        public static void Postfix(ContentManagerPanel __instance, UIListBox ___m_Categories, UITabContainer ___m_CategoriesContainer, UIComponent ___m_ModsContainer)
        {
            Debug.Log("Create Categories!");

            var handler = (PropertyChangedEventHandler <int>)Delegate.CreateDelegate(typeof(PropertyChangedEventHandler <int>), __instance, "OnCategoryChanged");

            ___m_Categories.eventSelectedIndexChanged -= handler;
            ___m_Categories.selectedIndex              = -1;

            // Manually Insert Category
            // TODO: Cleanup!
            UIComponent   container;
            List <string> list = (___m_Categories.items == null) ? new List <string>() : new List <string>(___m_Categories.items);

            list.Insert(list.Count - 2, "GROUPS");
            container                     = ___m_CategoriesContainer.AddUIComponent <UIPanel>();
            container.zOrder              = list.Count - 3;
            ___m_Categories.items         = list.ToArray();
            ___m_Categories.filteredItems = new int[1] {
                10
            };

            ___m_Categories.eventSelectedIndexChanged += handler;
            ___m_Categories.selectedIndex              = 0;
        }
Esempio n. 4
0
        private static void AddSubfolders(UIListBox m_FileList, string[] extensions)
        {
            DirectoryInfo dir = new DirectoryInfo(AssetImporterAssetImport.assetImportPath);

            if (!dir.Exists)
            {
                return;
            }

            var fileInfos = new List <FileInfo>();

            foreach (var subdir in dir.GetDirectories())
            {
                if (!subdir.Name.StartsWith("_"))
                {
                    fileInfos.AddRange(AddSubfoldersRecursive(subdir, extensions));
                }
            }

            // append names
            var names = fileInfos.Select(_f => _f.MakeRelative(dir));

            names            = m_FileList.items.Concat(names);
            m_FileList.items = names.ToArray();
        }
Esempio n. 5
0
        public void Update()
        {
            if (label == null)
            {
                var panelGo = GameObject.Find("(Library) LoadThemePanel");
                if (panelGo == null)
                {
                    return;
                }
                saveLoadPanel = panelGo.GetComponent <LoadThemePanel>();
                saveList      = saveLoadPanel.component.Find <UIListBox>("SaveList");
                saveList.eventSelectedIndexChanged += OnListingSelectionChanged;
                var loadPanel = panelGo.GetComponent <UIPanel>();

                label         = loadPanel.Find <UILabel>("MapTheme");
                mapThemeLabel = loadPanel.Find <UILabel>("MapThemeLabel");

                envDropDown                            = UIUtils.CreateDropDown(label.parent);
                envDropDown.name                       = "EnvironmentDropDown";
                envDropDown.size                       = new Vector2(196, 27.0f);
                envDropDown.textScale                  = label.textScale;
                envDropDown.relativePosition           = label.relativePosition;
                envDropDown.eventSelectedIndexChanged += OnEnvDropDownEventSelectedIndexChanged;
            }
            if (label == null || !label.parent.isVisible)
            {
                return;
            }
            label.Hide();
            mapThemeLabel.Show();
        }
Esempio n. 6
0
        public static void Postfix(LoadAssetPanel __instance, UIListBox ___m_SaveList)
        {
            try
            {
                // Taken from LoadAssetPanel.OnLoad
                var selectedIndex            = ___m_SaveList.selectedIndex;
                var getListingMetaDataMethod = typeof(LoadSavePanelBase <CustomAssetMetaData>).GetMethod(
                    "GetListingMetaData", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
                var listingMetaData = (CustomAssetMetaData)getListingMetaDataMethod.Invoke(__instance, new object[] { selectedIndex });


                // Taken from LoadingManager.LoadCustomContent
                if (listingMetaData.userDataRef != null)
                {
                    AssetDataWrapper.UserAssetData userAssetData = listingMetaData.userDataRef.Instantiate() as AssetDataWrapper.UserAssetData;
                    if (userAssetData == null)
                    {
                        userAssetData = new AssetDataWrapper.UserAssetData();
                    }
                    AssetData.OnAssetLoadedImpl(listingMetaData.name, ToolsModifierControl.toolController.m_editPrefabInfo, userAssetData.Data);
                }
            }
            catch (Exception e)
            {
                Debug.LogError(e);
            }
        }
Esempio n. 7
0
        private void InitializeMusicList()
        {
            m_MusicList = AddUIComponent <UIListBox>();

            m_MusicList.width            = width - 34;
            m_MusicList.height           = height - 60 - 20;
            m_MusicList.relativePosition = new Vector3(10, 60 + 10);
            m_MusicList.textColor        = new Color32(150, 150, 150, 255);
            m_MusicList.itemHighlight    = "ListEntryNormal";
            m_MusicList.itemHover        = "ListEntryHover";
            m_MusicList.itemHeight       = 32;
            m_MusicList.itemPadding      = new RectOffset(0, 0, 4, 4);
            m_MusicList.tooltip          = !ModOptions.Instance.ImprovedDisableContentUI ? "Double-click to disable an entry" : "";
            m_MusicList.zOrder           = -50;
            m_MusicList.atlas            = m_IconAtlas;
            m_MusicList.processMarkup    = true;
            //m_MusicList.animateHover = true;

            m_MusicList.Show();

            InitializeMusicListChannelInfo();

            InitializeMusicListScrollBar();

            //UpdateMusicList();

            m_MusicList.eventItemClicked       += musicEntrySelected;
            m_MusicList.eventItemDoubleClicked += musicEntryDoubleClick;
        }
Esempio n. 8
0
 private void OnDropDownClose(UIDropDown dropdown, UIListBox popup, ref bool overridden)
 {
     if (_disableEvents)
     {
         return;
     }
     _loadLutDropDown.triggerButton.isInteractive = true;
 }
Esempio n. 9
0
        void listBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            ListBox        list          = (ListBox)sender;
            UIListBox      lb            = (UIListBox)list.Parent;
            CWindowControl WindowControl = (CWindowControl)lb.Tag;

            RefreshLinkageWindowControl(WindowControl);
        }
Esempio n. 10
0
        public UIAdmitList()
        {
            List1   = new UIListBox();
            List1.X = -15;
            List1.SetSize(100, 20 * 4);
            List1.NumVisibleRows = 4;
            List1.RowHeight      = 20;

            List1.TextStyle = new UIListBoxTextStyle()
            {
                Normal           = TextStyle.DefaultLabel.Clone(),
                NormalColor      = new Color(247, 232, 145),
                Selected         = TextStyle.DefaultLabel.Clone(),
                SelectedColor    = Color.Black,
                Highlighted      = TextStyle.DefaultLabel.Clone(),
                HighlightedColor = Color.White,
                Disabled         = TextStyle.DefaultLabel.Clone(),
                DisabledColor    = Color.Gray
            };
            List1.Columns = new UIListBoxColumnCollection();
            List1.Columns.Add(new UIListBoxColumn()
            {
                Width = 100
            });
            List1.SelectionFillColor = new Color(250, 200, 140);
            Add(List1);
            List2   = new UIListBox();
            List2.X = 85;
            List2.SetSize(100, 20 * 4);
            List2.NumVisibleRows     = 4;
            List2.RowHeight          = 20;
            List2.TextStyle          = List1.TextStyle;
            List2.Columns            = List1.Columns;
            List2.SelectionFillColor = new Color(250, 200, 140);
            Add(List2);

            List1.OnDoubleClick += (btn) => { if (List1.SelectedIndex != -1)
                                              {
                                                  OnAvatarClick?.Invoke((List1.SelectedItem.Data as Avatar).Avatar_Id);
                                              }
            };
            List2.OnDoubleClick += (btn) => { if (List2.SelectedIndex != -1)
                                              {
                                                  OnAvatarClick?.Invoke((List2.SelectedItem.Data as Avatar).Avatar_Id);
                                              }
            };
            List1.OnChange += (elem) => { if (List1.SelectedIndex != -1 && List2.SelectedIndex != -1)
                                          {
                                              List2.SelectedIndex = -1;
                                          }
            };
            List2.OnChange += (elem) => { if (List2.SelectedIndex != -1 && List1.SelectedIndex != -1)
                                          {
                                              List1.SelectedIndex = -1;
                                          }
            };
        }
Esempio n. 11
0
 private void loadBasicDetails()
 {
     try {
         textBox_item_findItem.ListBox = listBox_list_findItem;
         UIListBox.recentItems(listBox_list_findItem, 100);
         UIComboBox.categoriesForSelect(comboBox_category_selectItem);
         UIComboBox.companiesForSelect(comboBox_company_selectItem);
     } catch (Exception) {
     }
 }
Esempio n. 12
0
        public override void Start()
        {
            // Generates the following UI:
            // |---------------|
            // |               | <-- _messageBox
            // |               |
            // |---------------|
            // |               | <-- _chatText
            // |---------------|

            backgroundSprite = "GenericPanel";
            name             = "MPChatLogPanel";
            color            = new Color32(22, 22, 22, 240);

            // Activates the dragging of the window
            AddUIComponent(typeof(UIDragHandle));

            // Grab the view for calculating width and height of game
            var view = UIView.GetAView();

            // Center this window in the game
            relativePosition = new Vector3(10.0f, view.fixedHeight - 440.0f);

            width  = 500;
            height = 300;

            // Create the message box
            _messageBox                = (UIListBox)AddUIComponent(typeof(UIListBox));
            _messageBox.isVisible      = true;
            _messageBox.isEnabled      = true;
            _messageBox.width          = 480;
            _messageBox.height         = 240;
            _messageBox.position       = new Vector2(10, -10);
            _messageBox.multilineItems = true;
            _messageBox.textScale      = 0.8f;
            _messageBox.itemHeight     = 20;

            // Create the message text box (used for sending messages)
            _chatText                      = (UITextField)AddUIComponent(typeof(UITextField));
            _chatText.width                = width;
            _chatText.height               = 30;
            _chatText.position             = new Vector2(0, -270);
            _chatText.atlas                = UiHelpers.GetAtlas("Ingame");
            _chatText.normalBgSprite       = "TextFieldPanelHovered";
            _chatText.builtinKeyNavigation = true;
            _chatText.isInteractive        = true;
            _chatText.readOnly             = false;
            _chatText.horizontalAlignment  = UIHorizontalAlignment.Left;
            _chatText.eventKeyDown        += OnChatKeyDown;
            _chatText.textColor            = new Color32(0, 0, 0, 255);
            _chatText.padding              = new RectOffset(6, 6, 6, 6);
            _chatText.selectionSprite      = "EmptySprite";

            base.Start();
        }
Esempio n. 13
0
        public void AddListBox(UINode node)
        {
            UIListBox list = new UIListBox();

            Components.Add(node.ID, list);
            list.ID = node.ID;

            DoSetControlProperties(list, node);
            target.Add(list);
            WireUp(node.ID, list);
        }
Esempio n. 14
0
        private static bool Prefix(ref LoadThemePanel __instance, ref UIListBox ___m_SaveList, ref UIButton ___m_LoadButton, string ___m_LastSaveName)
        {
            using (AutoProfile.Start("LoadMapPanel.Refresh()")) {
                ClearListing.Invoke(__instance, null);
                bool snowfallOwned = SteamHelper.IsDLCOwned(SteamHelper.DLC.SnowFallDLC);
                foreach (Package.Asset asset in PackageManager.FilterAssets(UserAssetType.MapThemeMetaData))
                {
                    if (asset == null || !asset.isEnabled)
                    {
                        continue;
                    }
                    try {
                        var mmd = asset.Instantiate <MapThemeMetaData>();
                        mmd.SetSelfRef(asset);
                        if (mmd.environment == "Winter" && !snowfallOwned)
                        {
                            continue;
                        }
                        var forbid = false;
                        foreach (string s in Forbidden)
                        {
                            if (asset.fullName.Contains(s))
                            {
                                forbid = true;
                            }
                        }
                        if (forbid)
                        {
                            continue;
                        }
                        var parameters = _addToListingParamCount == 5 ? new object[] { asset.name, mmd.timeStamp, asset, mmd, true } : new object[] { asset.name, mmd.timeStamp, asset, mmd, true, false };
                        AddToListing.Invoke(__instance, parameters);
                    } catch (Exception ex) {
                        CODebug.Error(LogChannel.Serialization, "'" + asset.name + "' failed to load.\n" + ex.ToString());
                    }
                }

                ___m_SaveList.items = GetListingItems.Invoke(__instance, null) as string[];
                var listingCount = (int)GetListingCount.Invoke(__instance, null);
                if (listingCount > 0)
                {
                    var idx = (int)FindIndexOf.Invoke(__instance, new object[] { ___m_LastSaveName });
                    ___m_SaveList.selectedIndex = (idx != -1) ? idx : 0;
                    ___m_LoadButton.isEnabled   = true;
                }
                else
                {
                    ___m_LoadButton.isEnabled = false;
                }
            }
            return(false);
        }
Esempio n. 15
0
 private void InvokeAppendListBoxAction(UIListBox box, string message)
 {
     if (box.InvokeRequired)
     {
         InvokeAppendListBoxActionDelegate d = InvokeAppendListBoxAction;
         box.Invoke(d, box, message);
     }
     else
     {
         box.Items.Add(message);
         box.SelectedIndex = box.Items.Count - 1;
     }
 }
Esempio n. 16
0
 private void textBox_itemName_TextChanged(object sender, TextChangedEventArgs e)
 {
     try {
         if (textBox_itemName.IsNull())
         {
             UIListBox.recentItems(listBox, 100);
         }
         else
         {
             UIListBox.loadItemsByCategoryAndCompanyAndName(listBox, textBox_itemName.Text);
         }
     } catch (Exception) {
     }
 }
Esempio n. 17
0
        public UIComboBox()
        {
            this.SetBackgroundTexture(
                GetTexture((ulong)TSOVille.FileIDs.UIFileIDs.dialog_textboxbackground),
                13, 13, 13, 13);

            TextMargin = new Rectangle(8, 3, 8, 5);

            lstCombo       = new UIListBox();
            lstCombo.Items = items;


            m_MouseEvent = ListenForMouse(new Rectangle(0, 0, 10, 10), new UIMouseEvent(OnMouseEvent));
        }
Esempio n. 18
0
        protected void Awake()
        {
            this.m_SaveList = transform.Find("SaveList").GetComponent <UIListBox>();

            var asd = new ColossalFramework.UI.PropertyChangedEventHandler <int>(this.OnListingSelectionChanged);

            m_SaveList.ClearEventInvocations("eventSelectedIndexChanged");
            //m_LoadButton.ClearEventInvocations("eventButtonStateChanged");

            this.m_SaveList.eventSelectedIndexChanged += new ColossalFramework.UI.PropertyChangedEventHandler <int>(this.OnListingSelectionChanged);
            this.m_LoadButton     = transform.Find("Load").GetComponent <UIButton>();
            this.m_CityName       = transform.Find("CityInfo").Find("CityName").GetComponent <UILabel>();
            this.m_SnapShotSprite = transform.Find("SnapShot").GetComponent <UITextureSprite>();
            //this.m_AchNope = transform.Find("Ach").Find("AchNope").GetComponent<UISprite>();

            var hostInfoPanel = transform.Find("CityInfo").GetComponent <UIPanel>();

            m_serverNameTextbox = hostInfoPanel.AddUIComponent <UITextField>();
            var serverNameLabel = hostInfoPanel.AddUIComponent <UILabel>();

            SetLabel(serverNameLabel, "Server Name: ", 0, 115);
            SetTextBox(m_serverNameTextbox, "Unnamed Server", 85, 115, 300, 20);

            m_serverPortTextbox = hostInfoPanel.AddUIComponent <UITextField>();
            var serverPortLabel = hostInfoPanel.AddUIComponent <UILabel>();

            SetLabel(serverPortLabel, "Port: ", 0, 140);
            SetTextBox(m_serverPortTextbox, "27015", 85, 140, 100, 20);

            m_serverPrivateCheckbox = hostInfoPanel.AddUIComponent <UICheckBox>();
            var serverPrivateLabel = hostInfoPanel.AddUIComponent <UILabel>();

            SetLabel(serverPrivateLabel, "Private Server: ", 0, 165);
            SetCheckBox(m_serverPrivateCheckbox, 35, 166);


            transform.Find("CityInfo").Find("MapThemeLabel").gameObject.SetActive(false);
            transform.Find("CityInfo").Find("MapTheme").gameObject.SetActive(false);
            transform.Find("CityInfo").Find("PopulationLabel").gameObject.SetActive(false);
            transform.Find("CityInfo").Find("Population").gameObject.SetActive(false);
            transform.Find("CityInfo").Find("MoneyLabel").gameObject.SetActive(false);
            transform.Find("CityInfo").Find("Money").gameObject.SetActive(false);
            transform.Find("AchGroup").gameObject.SetActive(false);

            this.ClearInfo();

            UIView v = UIView.GetAView();

            m_hostGameHelpPanel = v.AddUIComponent(typeof(HostGameHelpPanel)) as HostGameHelpPanel;
        }
Esempio n. 19
0
        public static void LoadAssetPanelOnLoadPostfix(LoadAssetPanel __instance, UIListBox ___m_SaveList)
        {
            if (AccessTools.Method(typeof(LoadSavePanelBase <CustomAssetMetaData>), "GetListingMetaData") is not MethodInfo method)
            {
                return;
            }

            var listingMetaData = (CustomAssetMetaData)method.Invoke(__instance, new object[] { ___m_SaveList.selectedIndex });

            if (listingMetaData.userDataRef != null)
            {
                var userAssetData = (listingMetaData.userDataRef.Instantiate() as AssetDataWrapper.UserAssetData) ?? new AssetDataWrapper.UserAssetData();
                Instance.OnAssetLoaded(listingMetaData.name, ToolsModifierControl.toolController.m_editPrefabInfo, userAssetData.Data);
            }
        }
        public static UIListBox CreateListBox(UIComponent parent)
        {
            UIListBox listBox = parent.AddUIComponent <UIListBox>();

            listBox.size                 = new Vector2(90f, 30f);
            listBox.itemHeight           = 30;
            listBox.itemHover            = "ListItemHover";
            listBox.itemHighlight        = "ListItemHighlight";
            listBox.normalBgSprite       = "ButtonMenu";
            listBox.disabledBgSprite     = "ButtonMenu";
            listBox.hoveredBgSprite      = "ButtonMenu";
            listBox.focusedBgSprite      = "ButtonMenu";
            listBox.foregroundSpriteMode = UIForegroundSpriteMode.Stretch;
            //listBox.popupColor = new Color32(45, 52, 61, 255);
            //listBox.popupTextColor = new Color32(170, 170, 170, 255);
            listBox.zOrder    = 1;
            listBox.textScale = 0.85f;
            //listBox.verticalAlignment = UIVerticalAlignment.Middle;
            //listBox.horizontalAlignment = UIHorizontalAlignment.Left;
            //listBox.selectedIndex = 0;
            //listBox.textFieldPadding = new RectOffset(8, 0, 8, 0);
            listBox.itemPadding = new RectOffset(14, 0, 8, 0);

            //UIButton button = listBox.AddUIComponent<UIButton>();
            //button.triggerButton = button;
            //button.text = "";
            //button.size = listBox.size;
            //button.relativePosition = new Vector3(0f, 0f);
            //button.textVerticalAlignment = UIVerticalAlignment.Middle;
            //button.textHorizontalAlignment = UIHorizontalAlignment.Left;
            //button.normalFgSprite = "IconDownArrow";
            //button.hoveredFgSprite = "IconDownArrowHovered";
            //button.pressedFgSprite = "IconDownArrowPressed";
            //button.focusedFgSprite = "IconDownArrowFocused";
            //button.disabledFgSprite = "IconDownArrowDisabled";
            //button.foregroundSpriteMode = UIForegroundSpriteMode.Fill;
            //button.horizontalAlignment = UIHorizontalAlignment.Right;
            //button.verticalAlignment = UIVerticalAlignment.Middle;
            //button.zOrder = 0;
            //button.textScale = 0.8f;

            listBox.eventSizeChanged += new PropertyChangedEventHandler <Vector2>((c, t) =>
            {
                listBox.width = (int)t.x;
            });

            return(listBox);
        }
Esempio n. 21
0
        //////////////////////////////////////////////////////////////////////////////////////////////
        //////////////////////////////////////////////////////////////////////////////////////////////
        //////////////////////////////////////////////////////////////////////////////////////////////


        internal void UserControl_Loaded()
        {
            try {
                itemManager.Pagination        = new Pagination();
                itemManager.Pagination.Filter = itemManager;
                itemManager.grid_pagination.Children.Add(itemManager.Pagination);
                itemManager.textBox_category_basicDetails.ListBox = itemManager.listBox_category_basicDetails;
                itemManager.textBox_company_basicDetails.ListBox  = itemManager.listBox_company_basicDetails;

                UIComboBox.unitsForAddItem(itemManager.comboBox_unit_sellingDetails);
                UIListBox.loadCategories(itemManager.listBox_category_basicDetails, null);
                UIListBox.loadCompanies(itemManager.listBox_company_basicDetails, null);

                UIComboBox.categoriesForSelect(itemManager.comboBox_category_filter);
                UIComboBox.companiesForSelect(itemManager.comboBox_company_filter);
                UIComboBox.yesNoForSelect(itemManager.comboBox_sip_filter);
                UIComboBox.unitsForFilter(itemManager.comboBox_unit_filter);
                UIComboBox.yesNoForSelect(itemManager.comboBox_isActive_filter);

                itemManager.DataTable = new DataTable();
                itemManager.DataTable.Columns.Add("ID", typeof(int));
                itemManager.DataTable.Columns.Add("Category", typeof(String));
                itemManager.DataTable.Columns.Add("Company", typeof(String));
                itemManager.DataTable.Columns.Add("Name", typeof(String));
                itemManager.DataTable.Columns.Add("Unit", typeof(String));
                itemManager.DataTable.Columns.Add("Item Code", typeof(String));
                itemManager.DataTable.Columns.Add("Barcode", typeof(String));
                itemManager.DataTable.Columns.Add("POS Name", typeof(String));
                itemManager.DataTable.Columns.Add("QTY Per Pack", typeof(String));
                itemManager.DataTable.Columns.Add("Pack Name", typeof(String));
                itemManager.DataTable.Columns.Add("RO Level", typeof(String));
                itemManager.dataGrid_items_items.DataContext = itemManager.DataTable.DefaultView;
                checkBox_sip_sellingDetails_Click();
                setRowsCount();
                if (Session.Permission["canAddCategory"] == 0)
                {
                    itemManager.button_addCategory.IsEnabled = false;
                }
                if (Session.Permission["canAddCompany"] == 0)
                {
                    itemManager.button_addCompany.IsEnabled = false;
                }
                itemManager.AddCategory = new AddCategory(null);
                itemManager.AddCompany  = new AddCompany(null);
            } catch (Exception) {
            }
        }
Esempio n. 22
0
        /// <summary>
        /// when loading asset from a file, IAssetData.OnAssetLoaded() is called for all assets but the one that is loaded from the file.
        /// this postfix calls IAssetData.OnAssetLoaded() for asset loaded from file.
        /// Note: even if new road intanciated based on an AR Road, we still need to do this because
        ///       NetInfo metadata is stored in external array
        ///       also we cannot be sure that it is always instancitated properly.
        /// </summary>
        public static void Postfix(LoadAssetPanel __instance, UIListBox ___m_SaveList)
        {
            try {
                // Taken from LoadAssetPanel.OnLoad
                var selectedIndex   = ___m_SaveList.selectedIndex;
                var listingMetaData = (CustomAssetMetaData)mListingMetaData
                                      .Invoke(__instance, new object[] { selectedIndex });

                // Taken from LoadingManager.LoadCustomContent
                if (listingMetaData.userDataRef != null)
                {
                    AssetDataWrapper.UserAssetData userAssetData =
                        listingMetaData.userDataRef.Instantiate() as AssetDataWrapper.UserAssetData;
                    if (userAssetData == null)
                    {
                        userAssetData = new AssetDataWrapper.UserAssetData();
                    }
                    Log.Debug($"LoadAssetPanel.OnLoad().Postfix(): Loading asset from load asset panel");
                    AssetDataExtension.OnAssetLoadedImpl(
                        listingMetaData.name,
                        ToolsModifierControl.toolController.m_editPrefabInfo,
                        userAssetData.Data);

                    var originalInfo = GetOriginalNetInfo(listingMetaData);
                    if (originalInfo)
                    {
                        // OnLoad() calls IntializePrefab() which reverses metadata
                        // and can't be patched because its generic.
                        // so we restore asset metadata here
                        Log.Debug($" restoring original metadata.");
                        AssetDataExtension.OnAssetLoadedImpl(
                            listingMetaData.name,
                            originalInfo,
                            userAssetData.Data);
                    }
                }
                NetInfoExtionsion.Ensure_EditedNetInfos();
                Log.Debug($"LoadAssetPanel.OnLoad().Postfix() succeeded!");
            } catch (Exception ex) {
                Log.Exception(ex);
            }
        }
Esempio n. 23
0
        static void Postfix(string[] extensions,
                            AssetImporterAssetImport __instance,
                            UIListBox ___m_FileList,
                            UITextureSprite ___m_SmallPreview

                            )
        {
            try {
                // increase panel size:
                __instance.component.width     = 1115;
                ___m_FileList.width            = 550;
                ___m_FileList.relativePosition =
                    ___m_FileList.relativePosition.SetI(0, 0);
                ___m_SmallPreview.relativePosition =
                    ___m_SmallPreview.relativePosition.SetI(600, 0);

                AddSubfolders(___m_FileList, extensions);
            } catch (Exception ex) {
                Log.Exception(ex);
            }
        }
Esempio n. 24
0
        public UIHintWindow() : base(UIDialogStyle.Close, true)
        {
            Caption = "Hints";
            SetSize(800, 600);

            CloseButton.OnButtonClick += (btn) => { UIScreen.RemoveDialog(this); };
            Opacity = 1f;

            InnerBackground          = new UIImage(GetTexture((ulong)0x7A400000001)).With9Slice(13, 13, 13, 13);
            InnerBackground.Position = new Vector2(15, 45);
            InnerBackground.SetSize(240, 530);
            AddAt(3, InnerBackground);

            AllHints = FSOFacade.Hints.LoadAllHints();
            var cats = AllHints.GroupBy(x => x.Category).OrderBy(x => x.FirstOrDefault(y => y.CatOrder != null)?.CatOrder ?? 0);

            int index = 0;

            foreach (var cat in cats)
            {
                var item = new UIHintListItem(true, cat.FirstOrDefault().Category, 0);
                item.ChildItems = new List <UIHintListItem>();
                foreach (var hint in cat)
                {
                    var subitem = new UIHintListItem(false, hint.Title, index++);
                    subitem.Hint = hint;
                    item.ChildItems.Add(subitem);
                }
                Categories.Add(item);
            }

            ListBox = new UIListBox()
            {
                Position = new Vector2(15 + 7, 45 + 6)
            };
            ListBox.SetSize(227, 530 - 12);
            ListBox.RowHeight = 24;
            ListBox.Columns   = new UIListBoxColumnCollection();
            ListBox.Columns.Add(new UIListBoxColumn()
            {
                Width = 227
            });
            ListBox.SelectionFillColor = new Color(250, 200, 140);
            ListBox.OnChange          += ListBox_OnChange;
            Add(ListBox);

            ResultsSlider             = new UISlider();
            ResultsSlider.Orientation = 1;
            ResultsSlider.Texture     = GetTexture(0x31000000001);
            ResultsSlider.MinValue    = 0;
            ResultsSlider.MaxValue    = 2;

            ResultsSlider.X = 260;
            ResultsSlider.Y = 51;
            ResultsSlider.SetSize(0, 514f);
            Add(ResultsSlider);

            SliderUpButton          = new UIButton(GetTexture(0x31200000001));
            SliderUpButton.Position = new Vector2(257, 44);
            Add(SliderUpButton);
            SliderDownButton          = new UIButton(GetTexture(0x31100000001));
            SliderDownButton.Position = new Vector2(257, 566);
            Add(SliderDownButton);

            ResultsSlider.AttachButtons(SliderUpButton, SliderDownButton, 1f);
            ListBox.AttachSlider(ResultsSlider);

            Icon          = new UIImage();
            Icon.Position = new Vector2(290, 65);
            Icon.SetSize(0, 0);
            Add(Icon);

            Title                     = new UILabel();
            Title.Position            = Icon.Position = new Vector2(290, 40);
            Title.Size                = new Vector2(492, 15);
            Title.CaptionStyle        = TextStyle.DefaultTitle;
            Title.CaptionStyle        = Title.CaptionStyle.Clone();
            Title.CaptionStyle.Color  = Color.White;
            Title.CaptionStyle.Size   = 14;
            Title.CaptionStyle.Shadow = true;
            Title.Alignment           = TextAlignment.Center | TextAlignment.Middle;
            Add(Title);

            RenderCategories();
        }
        public override void Start()
        {
            base.Start ();
            Debug.PrintMessage ("Start");
            this.size = new Vector2 (WIDTH, HEIGHT);
            this.backgroundSprite = "MenuPanel";
            this.canFocus = true;
            this.isInteractive = true;
            this.BringToFront ();
            this.relativePosition = new Vector3 (50, 50);
            this.Show ();
            this.cachedName = cacheName;

            m_challengePanel = (ChallengePanel) this.GetUIView ().AddUIComponent (typeof(ChallengePanel));
            Debug.PrintMessage("Start() - Does ChallengePanel Exists? " + (m_challengePanel != null).ToString());
            m_challengePanel.manager = this;
            m_challengePanel.OnChallengeStarted += () => {m_selectButton.Disable ();};
            m_challengePanel.OnChallengeEnded += () => {m_selectButton.Enable ();};

            m_challengePanel.Hide ();

            m_title = this.AddUIComponent<UILabel> ();
            m_title.text = "CHALLENGES OPTIONS";
            m_title.relativePosition = new Vector3 (WIDTH / 2 - m_title.width / 2, HEAD / 2 - m_title.height / 2);
            m_title.textAlignment = UIHorizontalAlignment.Center;

            m_dragHandle = this.AddUIComponent<UIDragHandle> ();
            m_dragHandle.size = new Vector2(WIDTH,HEIGHT);
            m_dragHandle.relativePosition = Vector3.zero;
            m_dragHandle.target = this;

            m_closeButton = this.AddUIComponent<UIButton> ();
            m_closeButton.normalBgSprite = "buttonclose";
            m_closeButton.hoveredBgSprite = "buttonclosehover";
            m_closeButton.pressedBgSprite = "buttonclosepressed";
            m_closeButton.relativePosition = new Vector3 (WIDTH - 35, 5,10);
            m_closeButton.eventClick += (component, eventParam) => {
                this.Hide();
            };

            m_challengeListPanel = this.AddUIComponent<UIPanel> ();
            m_challengeListPanel.size = new Vector2 (LIST_PANEL_WIDTH, LIST_PANEL_HEIGHT);
            m_challengeListPanel.relativePosition = new Vector3 (0, HEAD);

            m_challengeBrowser = m_challengeListPanel.AddUIComponent<UIListBox> ();
            m_challengeBrowser.size = new Vector2 (LIST_PANEL_WIDTH - SPACING * 2, LIST_PANEL_HEIGHT - SELECT_BUTTON_HEIGHT - SPACING * 2);
            m_challengeBrowser.relativePosition = new Vector3 (SPACING, SPACING);

            m_challengeBrowser.normalBgSprite = "GenericPanelDark";
            //m_challengeBrowser.bottomColor = Color.green;

            m_challengeBrowser.itemHighlight = "ListItemHighlight";
            m_challengeBrowser.itemHover = "ListItemHover";
            m_challengeBrowser.itemPadding.left = 10;
            m_challengeBrowser.itemPadding.top = 4;
            m_challengeBrowser.listPadding.top = 10;
            m_challengeBrowser.listPadding.bottom = 10;
            m_challengeBrowser.colorizeSprites = true;

            LoadChallenges ();

            m_selectButton = m_challengeListPanel.AddUIComponent<UIButton> ();
            m_selectButton.text = "START";
            m_selectButton.size = new Vector2 (LIST_PANEL_WIDTH - SPACING * 2, SELECT_BUTTON_HEIGHT - SPACING);
            m_selectButton.textScale = 1.25f;
            m_selectButton.textVerticalAlignment = UIVerticalAlignment.Middle;
            m_selectButton.textHorizontalAlignment = UIHorizontalAlignment.Center;
            m_selectButton.normalBgSprite = "ButtonMenu";
            m_selectButton.hoveredBgSprite = "ButtonMenuHovered";
            m_selectButton.pressedBgSprite = "ButtonMenuPressed";
            m_selectButton.disabledBgSprite = "ButtonMenuDisabled";
            m_selectButton.color = Color.green;
            m_selectButton.focusedColor = m_selectButton.color;
            m_selectButton.hoveredColor = m_selectButton.color;
            m_selectButton.pressedColor = m_selectButton.color;
            m_selectButton.relativePosition = new Vector3 (SPACING, LIST_PANEL_HEIGHT - SELECT_BUTTON_HEIGHT);
            m_selectButton.Disable ();
            m_selectButton.eventClick += ChallengeSelected;

            m_refresh = this.AddUIComponent<UIButton> ();
            m_refresh.size = new Vector2 (60,24);
            m_refresh.text = "Refresh";
            m_refresh.textScale = 0.875f;
            m_refresh.normalBgSprite = "ButtonMenu";
            m_refresh.hoveredBgSprite = "ButtonMenuHovered";
            m_refresh.pressedBgSprite = "ButtonMenuPressed";
            m_refresh.disabledBgSprite = "ButtonMenuDisabled";
            //m_refresh.color = new Color32(255,0,0,255);
            //m_refresh.focusedColor = m_refresh.color;
            //m_refresh.hoveredColor = m_refresh.color;
            //m_refresh.pressedColor = m_refresh.color;
            m_refresh.relativePosition = m_closeButton.relativePosition + new Vector3 (-60 -SPACING,6f);
            m_refresh.eventClick += (component, eventParam) => {LoadChallenges();};

            m_challengeDetailsPanel = this.AddUIComponent<UIPanel> ();
            m_challengeDetailsPanel.size = new Vector2 (WIDTH - LIST_PANEL_WIDTH, HEIGHT - HEAD);
            //m_challengeDetailsPanel.backgroundSprite = "GenericPanel";
            m_challengeDetailsPanel.relativePosition = new Vector3 (LIST_PANEL_WIDTH, HEAD);

            m_challengeName = m_challengeDetailsPanel.AddUIComponent<UILabel> ();
            m_challengeName.text = "Name\n";
            m_challengeName.disabledTextColor = Color.gray;
            m_challengeName.Disable ();

            m_challengeDesc = m_challengeDetailsPanel.AddUIComponent<UILabel> ();
            m_challengeDesc.text = "Description\n";
            //m_challengeDesc.backgroundSprite = "GenericPanel";
            m_challengeDesc.width = m_challengeDetailsPanel.width;
            m_challengeDesc.minimumSize = new Vector2 (m_challengeDetailsPanel.width - SPACING * 2, 20);
            m_challengeDesc.wordWrap = true;
            m_challengeDesc.disabledTextColor = Color.gray;
            m_challengeDesc.Disable ();

            m_challengeBreakdown = m_challengeDetailsPanel.AddUIComponent<UILabel> ();
            m_challengeBreakdown.text = "Breakdown\n";
            //m_challengeBreakdown.backgroundSprite = "GenericPanel";
            m_challengeBreakdown.minimumSize = new Vector2 (m_challengeDetailsPanel.width - SPACING * 2, 20);
            m_challengeBreakdown.wordWrap = true;
            m_challengeBreakdown.disabledTextColor = Color.gray;
            m_challengeBreakdown.Disable ();

            m_challengeReward = m_challengeDetailsPanel.AddUIComponent<UILabel> ();
            m_challengeReward.text = "Reward\n";
            //m_challengeBreakdown.backgroundSprite = "GenericPanel";
            m_challengeReward.minimumSize = new Vector2 (m_challengeDetailsPanel.width - SPACING * 2, 20);
            m_challengeReward.wordWrap = true;
            m_challengeReward.autoSize = true;
            m_challengeReward.disabledTextColor = Color.gray;
            m_challengeReward.Disable ();

            m_challengePenalty = m_challengeDetailsPanel.AddUIComponent<UILabel> ();
            m_challengePenalty.text = "Penalty\n";
            //m_challengeBreakdown.backgroundSprite = "GenericPanel";
            m_challengePenalty.minimumSize = new Vector2 (m_challengeDetailsPanel.width - SPACING * 2, 20);
            m_challengePenalty.wordWrap = true;
            m_challengePenalty.autoSize = true;
            m_challengePenalty.disabledTextColor = Color.gray;
            m_challengePenalty.Disable ();

            m_challengeDeadline = m_challengeDetailsPanel.AddUIComponent<UILabel> ();
            m_challengeDeadline.text = "Duration\n";
            m_challengeDeadline.disabledTextColor = Color.gray;
            m_challengeDeadline.Disable ();

            FormatDetails ();

            if (m_temp_challenge != null) {
                m_challengePanel.SetCurrentChallenge (m_temp_challenge,true);
                //m_temp_challenge = null;
            }
        }
Esempio n. 26
0
        private void CreateTestUI()
        {
            UIButton button;
            button = new UIButton(this);
            button.Name = "Button1";
            button.Text = "Fullscreen: " + (graphics.IsFullScreen ? "On" : "Off");
            button.PositionAndSize = new Rectangle(10, 10, 150, 30);
            button.Action += (UIButton_Action)((btn) =>
            {
                SetGraphMode(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight, !graphics.IsFullScreen);
                btn.Text = "Fullscreen: " + (graphics.IsFullScreen ? "On" : "Off");
                UI["TextBox1"].Enabled = !UI["TextBox1"].Enabled;
                UI["Combo1"].Enabled = !UI["Combo1"].Enabled;
            });
            UI.Add(button);

            button = new UIButton(this);
            button.Name = "Button2";
            button.Text = "taaa...";
            button.PositionAndSize = new Rectangle(165, 10, 100, 50);
            button.Action += (UIButton_Action)((btn) =>
            {
                UI["Button1"].Enabled = !UI["Button1"].Enabled;
                UI["Label1"].Enabled = !UI["Label1"].Enabled;
                ((UIComboBox)UI["Combo1"]).Edible = !((UIComboBox)UI["Combo1"]).Edible;
                if (((UIComboBox)UI["Combo1"]).Edible)
                    UI["Combo1"].PositionAndSize = new Rectangle(UI["Combo1"].PositionAndSize.X, UI["Combo1"].PositionAndSize.Y, 200, 50);
                else
                    UI["Combo1"].PositionAndSize = new Rectangle(UI["Combo1"].PositionAndSize.X, UI["Combo1"].PositionAndSize.Y, 100, 0);
                switch (((UITextBox)UI["TextBox1"]).PasswordChar)
                {
                    case '\0': ((UITextBox)UI["TextBox1"]).PasswordChar = '*'; break;
                    case '*': ((UITextBox)UI["TextBox1"]).PasswordChar = '\0'; break;
                }
                ((UIListBox)UI["ListBox1"]).Add(UI["TextBox1"].Text);
            });
            UI.Add(button);

            UITextBox textbox = new UITextBox(this);
            textbox.Name = "TextBox1";
            textbox.Text = "kupa";
            textbox.TextLenghtLimit = 10;
            textbox.PositionAndSize = new Rectangle(270, 10, 150, 30);
            textbox.PasswordChar = '*';
            UI.Add(textbox);

            UILabel label = new UILabel(this);
            label.Name = "Label1";
            label.Text = "jakis tam...\ntekst";
            label.Enabled = false;
            label.PositionAndSize = new Rectangle(UI["Button1"].PositionAndSize.X, UI["Button1"].PositionAndSize.Y + UI["Button1"].PositionAndSize.Height + 5, 0, 0);
            UI.Add(label);

            UIComboBox combo1 = new UIComboBox(this);
            combo1.Name = "Combo1";
            combo1.Edible = false;
            combo1.PositionAndSize = new Rectangle(UI["Button2"].PositionAndSize.X, UI["Button2"].PositionAndSize.Y + UI["Button2"].PositionAndSize.Height + 5, 100, 0);
            combo1.Values.Add("pos1");
            combo1.Values.Add("pos2");
            combo1.Values.Add("pos3");
            combo1.Values.Add("pos4");
            combo1.MaxDisplayedItems = 3;
            combo1.SelectionChanged += (UIComboBox_SelectionChanged)((combo, oldindex) =>
            {
                UI["TextBox1"].Text = combo.SelectedValue;
            });
            UI.Add(combo1);

            UIListBox listBox1 = new UIListBox(this);
            listBox1.Name = "ListBox1";
            listBox1.PositionAndSize = new Rectangle(UI["TextBox1"].PositionAndSize.X + UI["TextBox1"].PositionAndSize.Width + 5, UI["TextBox1"].PositionAndSize.Y, 150, 0);
            listBox1.AutoSizeHeight = true;
            listBox1.MaxVisibleValues = 5;
            listBox1.Add("Button1");
            listBox1.Add("Button2");
            listBox1.Add("TextBox1");
            listBox1.Add("Label1");
            listBox1.Add("Combo1");
            listBox1.AutoSizeHeight = false;
            listBox1.PositionAndSize = new Rectangle(listBox1.PositionAndSize.X, listBox1.PositionAndSize.Y, listBox1.PositionAndSize.Width, listBox1.PositionAndSize.Height + 50);
            listBox1.ItemHover += (UIListBox_ItemEvent)((list, itemindex) =>
            {
                list.SelectedIndex = itemindex;
            });
            listBox1.ItemClicked += (UIListBox_ItemEvent)((list, itemindex) =>
            {
                if (itemindex < 5)
                    UI[list[itemindex].Text].Enabled = !UI[list[itemindex].Text].Enabled;
                else
                    ((UIListBox)UI["ListBox1"]).RemoveAt(itemindex);
            });
            UI.Add(listBox1);

            UIScrollBar scroll1 = new UIScrollBar(this, false);
            scroll1.Name = "Scroll1";
            scroll1.MinimalValue = 0;
            scroll1.MaximalValue = 200;
            scroll1.PositionAndSize = new Rectangle(label.PositionAndSize.X, label.PositionAndSize.Y + label.PositionAndSize.Height + 100, 150, 150);
            scroll1.Value = 0;
            scroll1.ValuesOnScreen = 3;
            scroll1.ValueChanged += (UIScrollBar_ValueChanged)((scroll, oldval) =>
            {
                UI["Label1"].Text = (oldval < scroll.Value ? "zwiekszone na:\n" : "zmniejszone na:\n") + scroll.Value;
                ((UIProgress)UI["ProgressBar1"]).Percent = scroll.Value / 200.0;
            });
            UI.Add(scroll1);

            UICheckBox checkBox1 = new UICheckBox(this);
            checkBox1.Name = "CheckBox1";
            checkBox1.AutoSize = true;
            checkBox1.Text = "checkbox1";
            checkBox1.PositionAndSize = new Rectangle(combo1.PositionAndSize.X, combo1.PositionAndSize.Bottom + 5, 0, 0);
            UI.Add(checkBox1);

            UIKeyPicker keypicker1 = new UIKeyPicker(this);
            keypicker1.Name = "KeyPicker1";
            keypicker1.PositionAndSize = new Rectangle(scroll1.PositionAndSize.X, scroll1.PositionAndSize.Bottom + 5, 100, 30);
            keypicker1.SelectedKey = Keys.A;
            UI.Add(keypicker1);

            UIProgress progress1 = new UIProgress(this);
            progress1.Name = "ProgressBar1";
            progress1.PositionAndSize = new Rectangle(keypicker1.PositionAndSize.X, keypicker1.PositionAndSize.Bottom + 5, 100, 20);
            progress1.Angular = true;
            progress1.color = Color.Blue; //relevant when Angular==true
            progress1.Percent = 0.8;
            UI.Add(progress1);
        }
        public void Awake()
        {
            MainContainer                     = GetComponent <UIPanel>();
            MainContainer.autoLayout          = true;
            MainContainer.clipChildren        = true;
            MainContainer.autoLayoutDirection = LayoutDirection.Vertical;
            MainContainer.autoLayoutPadding   = new RectOffset(0, 0, 4, 4);

            KlyteMonoUtils.CreateTabsComponent(out m_tabstrip, out UITabContainer m_tabContainer, MainContainer.transform, "TextEditor", new Vector4(0, 0, MainContainer.width, 40), new Vector4(0, 0, MainContainer.width, MainContainer.height - 40));
            UIPanel m_tabSettings   = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_Settings), "K45_ACE_BASICTAB_BASIC_SETTINGS", "RcSettings");
            UIPanel m_tabAppearence = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_AutoColorIcon), "K45_ACE_BASICTAB_APPEARANCE_SETTINGS", "RcAppearence");
            UIPanel m_tabLib        = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_Load), "K45_ACE_BASICTAB_LIB_SETTINGS", "RcLib");

            var helperSettings   = new UIHelperExtension(m_tabSettings, LayoutDirection.Vertical);
            var helperAppearence = new UIHelperExtension(m_tabAppearence, LayoutDirection.Vertical);
            var helperLib        = new UIHelperExtension(m_tabLib, LayoutDirection.Vertical);


            AddTextField(Locale.Get("K45_ACE_BASICTAB_NAME"), out m_name, helperSettings, OnSetName);
            helperSettings.AddSpace(5);

            AddDropdown(Locale.Get("K45_ACE_BASICTAB_RULEFILTER"), out m_ruleFilter, helperSettings, Enum.GetNames(typeof(RuleCheckTypeVehicle)).Select(x => Locale.Get("K45_ACE_RULECHECKTYPE", x)).ToArray(), OnChangeRuleCheckType);
            AddButtonInEditorRow(m_ruleFilter, CommonsSpriteNames.K45_QuestionMark, Help_RuleFilter);
            AddDropdown(Locale.Get("K45_ACE_BASICTAB_SERVICEFILTER"), out m_service, helperSettings, (Enum.GetValues(typeof(ItemClass.Service)) as ItemClass.Service[]).OrderBy(x => (int)x).Select(x => x == 0 ? Locale.Get("K45_ACE_ANYSERVICE_OPTION") : $"{x}").ToArray(), OnChangeServiceFilter);
            AddDropdown(Locale.Get("K45_ACE_BASICTAB_SUBSERVICEFILTER"), out m_subService, helperSettings, Enum.GetNames(typeof(ItemClass.SubService)).Select(x => $"{x}").ToArray(), OnChangeSubServiceFilter);
            AddDropdown(Locale.Get("K45_ACE_BASICTAB_LEVELFILTER"), out m_level, helperSettings, (Enum.GetValues(typeof(ItemClass.Level)) as ItemClass.Level[]).OrderBy(x => (int)x).Select(x => $"{x}").ToArray(), OnChangeLevelFilter);
            AddDropdown(Locale.Get("K45_ACE_BASICTAB_CLASSFILTER"), out m_class, helperSettings, new string[0], OnChangeClassFilter);
            AddTextField(Locale.Get("K45_ACE_VEHICLERULES_ASSETSELECTSELF"), out m_assetFilterSelf, helperSettings, null);

            KlyteMonoUtils.UiTextFieldDefaultsForm(m_assetFilterSelf);
            m_popupSelf        = ConfigureListSelectionPopupForUITextField(m_assetFilterSelf, (text) => AssetColorExpanderMod.Controller?.AssetsCache.FilterVehiclesByText(text), OnAssetSelectedSelfChanged);
            m_popupSelf.height = 290;
            m_popupSelf.width -= 20;
            AddTextField(Locale.Get("K45_ACE_VEHICLERULES_ASSETSELECTOWNER"), out m_assetFilterOwner, helperSettings, null);

            KlyteMonoUtils.UiTextFieldDefaultsForm(m_assetFilterOwner);
            m_popupOwner        = ConfigureListSelectionPopupForUITextField(m_assetFilterOwner, (text) => AssetColorExpanderMod.Controller?.AssetsCache.FilterBuildingsByText(text), OnAssetSelectedOwnerChanged);
            m_popupOwner.height = 290;
            m_popupOwner.width -= 20;


            ACECommonsUI.GenerateExportButtons(helperSettings, "Vehicle",
                                               out m_exportButtonContainer, out m_exportButton, OnExport,
                                               out m_exportButtonContainerLocal, out m_exportButtonLocal, OnExportLocal);

            AddLibBox <ACEVehcileRuleLib, VehicleCityDataRuleXml>(helperLib, out m_copySettings, OnCopyRule, out m_pasteSettings, OnPasteRule, out _, null, OnLoadRule, GetRuleSerialized);

            AddCheckboxLocale("K45_ACE_VEHICLERULES_ALLOWWAGONWITHDIFFERENTCOLORS", out m_allowWagonDifferentColors, helperAppearence, OnAllowWagonDifferentColors);
            AddCheckboxLocale("K45_ACE_VEHICLERULES_OVERRIDELINEPREFIXCOLOR", out m_overrideLineColor, helperAppearence, OnOverrideLineColorChange);

            AddDropdown(Locale.Get("K45_ACE_COLORMODE"), out m_colorMode, helperAppearence, Enum.GetNames(typeof(ColoringMode)).Select(x => Locale.Get("K45_ACE_COLORINGMODE", x)).ToArray(), OnChangeColoringMode);
            AddButtonInEditorRow(m_colorMode, CommonsSpriteNames.K45_QuestionMark, Help_ColorMode);

            AddCheckboxLocale("K45_ACE_COLORMODE_ALLOWREDTONES", out m_allowRed, helperAppearence, OnAllowRedChanged);
            AddCheckboxLocale("K45_ACE_COLORMODE_ALLOWGREENTONES", out m_allowGreen, helperAppearence, OnAllowGreenChanged);
            AddCheckboxLocale("K45_ACE_COLORMODE_ALLOWBLUETONES", out m_allowBlues, helperAppearence, OnAllowBlueChanged);
            AddCheckboxLocale("K45_ACE_COLORMODE_ALLOWNEUTRALTONES", out m_allowNeutral, helperAppearence, OnAllowNeutralChanged);


            KlyteMonoUtils.CreateUIElement(out m_listColorContainer, helperAppearence.Self.transform, "listColors", new UnityEngine.Vector4(0, 0, helperAppearence.Self.width, helperAppearence.Self.height - 120));
            KlyteMonoUtils.CreateScrollPanel(m_listColorContainer, out m_colorListScroll, out _, m_listColorContainer.width - 20, m_listColorContainer.height);
            m_colorListScroll.backgroundSprite    = "OptionsScrollbarTrack";
            m_colorListScroll.autoLayout          = true;
            m_colorListScroll.autoLayoutDirection = LayoutDirection.Horizontal;
            m_colorListScroll.wrapLayout          = true;
            CreateTemplateColorItem();
            m_colorFieldTemplateListColors = new UITemplateList <UIPanel>(m_colorListScroll, COLOR_SELECTOR_TEMPLATE);

            KlyteMonoUtils.InitCircledButton(m_colorListScroll, out m_addColor, CommonsSpriteNames.K45_Plus, (x, y) => AddColor(), "", 36);

            MainContainer.isVisible   = false;
            m_pasteSettings.isVisible = false;
        }
Esempio n. 28
0
        private void InitializeMusicList()
        {
            var panel = _musicList = AddUIComponent <UIListBox>();

            panel.width            = width - 34;
            panel.height           = height - 80 - 20;
            panel.relativePosition = new Vector3(10, 80 + 10);
            panel.textColor        = new Color32(150, 150, 150, 255);
            panel.itemHover        = "SubcategoriesPanel";
            panel.itemHeight       = 32;
            panel.itemPadding      = new RectOffset(0, 0, 4, 4);
            panel.tooltip          = "Click on an item to play the song.\nDouble click to enable/disable it.\nDrag to resort the list.";

            panel.Show();

            /**
             * Not working -.-
             * */

            //Update 3.3 scrollbar
            //if (CSLMusicModSettings.MusicListEnableScrollbar)
            {
                var scroller = panel.AddUIComponent <UIScrollbar>();
                scroller.width            = 15;
                scroller.height           = panel.height;
                scroller.relativePosition = new Vector3(width - 15 - 15f, 0);
                scroller.orientation      = UIOrientation.Vertical;

                //All credits to https://github.com/justacid/Skylines-ExtendedPublicTransport
                {
                    var track = scroller.AddUIComponent <UISlicedSprite>();
                    track.relativePosition = Vector2.zero;
                    track.autoSize         = true;
                    track.size             = track.parent.size;
                    track.fillDirection    = UIFillDirection.Vertical;
                    track.spriteName       = "ScrollbarTrack";
                    scroller.trackObject   = track;

                    {
                        UISlicedSprite thumbSprite = track.AddUIComponent <UISlicedSprite>();
                        thumbSprite.relativePosition = Vector2.zero;
                        thumbSprite.fillDirection    = UIFillDirection.Vertical;
                        thumbSprite.autoSize         = true;
                        thumbSprite.width            = thumbSprite.parent.width;
                        thumbSprite.spriteName       = "ChirpScrollbarThumb";
                        thumbSprite.color            = new Color32(255, 255, 255, 128);
                        //thumbSprite.color = new Color32(0, 100, 180, 255);

                        scroller.thumbObject = thumbSprite;
                    }
                }

                _musicList.scrollbar = scroller;

                scroller.isVisible = true;
            }

            //UpdateMusicList();

            panel.eventItemClicked += delegate(UIComponent component, int value)
            {
                if (AudioWatcher != null)
                {
                    //+ Only if not resorted, switch to track
                    if (!_resort_resorted && value >= 0 && _filtered_MusicEntryList.Count > value)
                    {
                        //AudioWatcher.RequestSwitchMusic(MusicManager.MusicEntries[value]);
                        AudioWatcher.RequestSwitchMusic(_filtered_MusicEntryList[value]); //use filtered list
                    }
                }
            };
            panel.eventItemDoubleClicked += delegate(UIComponent component, int value)
            {
                if (value >= 0 && _filtered_MusicEntryList.Count > value)
                {
                    //Store old entry
                    MusicEntry current = AudioWatcher.CurrentMusicEntry;

                    //MusicEntry entry = MusicManager.MusicEntries[value];
                    var entry = _filtered_MusicEntryList[value];
                    entry.Enable = !entry.Enable;

                    UpdateMusicListPreserveScroll();

                    //Restore the current entry
                    AudioWatcher.RequestSwitchMusic(current);
                }
            };

            //Add feature to resort the music list
            panel.eventItemMouseDown += delegate(UIComponent component, int value)
            {
                if (AudioWatcher != null)
                {
                    //Disable resort while filtering
                    if (Filtered)
                    {
                        return;
                    }

                    if (value >= 0 && MusicManager.MusicEntries.Count > value)
                    {
                        _resort_CurrentItem       = MusicManager.MusicEntries[value];
                        _resort_currentPivotIndex = value;
                        _resort_resorted          = false;
                    }
                }
            };
            panel.eventItemMouseUp += delegate(UIComponent component, int value)
            {
                _resort_CurrentItem = null;

                if (_resort_resorted)
                {
                    MusicManager.SaveMusicFileSettings();
                }
            };
            panel.eventItemMouseHover += delegate(UIComponent component, int value)
            {
                if (value >= 0 && _filtered_MusicEntryList.Count > value)
                {
                    if (_resort_CurrentItem != null && value != _resort_currentPivotIndex)
                    {
                        //Disable resort while filtering
                        if (Filtered)
                        {
                            return;
                        }

                        MusicManager.MusicEntries.Remove(_resort_CurrentItem);
                        MusicManager.MusicEntries.Insert(value, _resort_CurrentItem);
                        _resort_currentPivotIndex = value;

                        UpdateMusicListPreserveScroll();

                        _resort_resorted = true;
                    }
                    else
                    {
                        var entry = _filtered_MusicEntryList[value];

                        String tooltip = entry.BaseName + "\n----\n";
                        tooltip += "Supported tags:\n";
                        foreach (var tag in entry.TagSongs.Keys)
                        {
                            if (tag == "")
                            {
                                tooltip += "Default music\n";
                            }
                            else
                            {
                                tooltip += MusicManager.TagIndicator + tag + "\n";
                            }
                        }
                        tooltip += "\n\nClick on an item to play the song.\nDouble click to enable/disable it.\nDrag to resort the list.";

                        _musicList.tooltip = tooltip;
                    }
                }
            };
        }
        public void Awake()
        {
            MainContainer                     = GetComponent <UIPanel>();
            MainContainer.autoLayout          = true;
            MainContainer.clipChildren        = true;
            MainContainer.autoLayoutDirection = LayoutDirection.Vertical;
            MainContainer.autoLayoutPadding   = new RectOffset(0, 0, 4, 4);

            KlyteMonoUtils.CreateTabsComponent(out m_tabstrip, out UITabContainer m_tabContainer, MainContainer.transform, "TextEditor", new Vector4(0, 0, MainContainer.width, 40), new Vector4(0, 0, MainContainer.width, MainContainer.height - 40));
            UIPanel m_tabSettings   = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_Settings), "K45_ACE_BASICTAB_BASIC_SETTINGS", "RcSettings");
            UIPanel m_tabAppearence = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_AutoColorIcon), "K45_ACE_BASICTAB_APPEARANCE_SETTINGS", "RcAppearence");
            UIPanel m_tabDistricts  = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, "ToolbarIconDistrict", "K45_ACE_BASICTAB_DISTRICT_SETTINGS", "RcDistricts");
            UIPanel m_tabLib        = TabCommons.CreateNonScrollableTabLocalized(m_tabstrip, KlyteResourceLoader.GetDefaultSpriteNameFor(CommonsSpriteNames.K45_Load), "K45_ACE_BASICTAB_LIB_SETTINGS", "RcLib");

            var helperSettings   = new UIHelperExtension(m_tabSettings, LayoutDirection.Vertical);
            var helperAppearence = new UIHelperExtension(m_tabAppearence, LayoutDirection.Vertical);
            var helperDistricts  = new UIHelperExtension(m_tabDistricts, LayoutDirection.Vertical);
            var helperLib        = new UIHelperExtension(m_tabLib, LayoutDirection.Vertical);


            AddTextField(Locale.Get("K45_ACE_BASICTAB_NAME"), out m_name, helperSettings, OnSetName);
            helperSettings.AddSpace(5);

            AddDropdown(Locale.Get("K45_ACE_BASICTAB_RULEFILTER"), out m_ruleFilter, helperSettings, Enum.GetNames(typeof(RuleCheckTypeProp)).Select(x => Locale.Get("K45_ACE_RULECHECKTYPE", x)).ToArray(), OnChangeRuleCheckType);
            AddButtonInEditorRow(m_ruleFilter, CommonsSpriteNames.K45_QuestionMark, Help_RuleFilter);
            AddDropdown(Locale.Get("K45_ACE_BASICTAB_SERVICEFILTER"), out m_service, helperSettings, (Enum.GetValues(typeof(ItemClass.Service)) as ItemClass.Service[]).OrderBy(x => (int)x).Select(x => x == 0 ? Locale.Get("K45_ACE_ANYSERVICE_OPTION") : $"{x}").ToArray(), OnChangeServiceFilter);
            AddDropdown(Locale.Get("K45_ACE_BASICTAB_SUBSERVICEFILTER"), out m_subService, helperSettings, Enum.GetNames(typeof(ItemClass.SubService)).Select(x => $"{x}").ToArray(), OnChangeSubServiceFilter);
            AddDropdown(Locale.Get("K45_ACE_BASICTAB_LEVELFILTER"), out m_level, helperSettings, (Enum.GetValues(typeof(ItemClass.Level)) as ItemClass.Level[]).OrderBy(x => (int)x).Select(x => $"{x}").ToArray(), OnChangeLevelFilter);
            AddDropdown(Locale.Get("K45_ACE_BASICTAB_CLASSFILTER"), out m_class, helperSettings, new string[0], OnChangeClassFilter);
            AddDropdown(Locale.Get("K45_ACE_BASICTAB_CLASSFILTER"), out m_parentClass, helperSettings, new string[0], OnChangeParentClassFilter);
            AddTextField(Locale.Get("K45_ACE_PROPRULES_ASSETSELECT_BUILDING"), out m_assetFilterBuilding, helperSettings, null);

            KlyteMonoUtils.UiTextFieldDefaultsForm(m_assetFilterBuilding);
            m_popupBuilding        = ConfigureListSelectionPopupForUITextField(m_assetFilterBuilding, (text) => AssetColorExpanderMod.Controller?.AssetsCache.FilterBuildingsByText(text), OnAssetSelectedBuildingChanged);
            m_popupBuilding.height = 290;
            m_popupBuilding.width -= 20;

            AddTextField(Locale.Get("K45_ACE_PROPRULES_ASSETSELECT_NET"), out m_assetFilterNet, helperSettings, null);

            KlyteMonoUtils.UiTextFieldDefaultsForm(m_assetFilterNet);
            m_popupNet        = ConfigureListSelectionPopupForUITextField(m_assetFilterNet, (text) => AssetColorExpanderMod.Controller?.AssetsCache.FilterNetsByText(text), OnAssetSelectedNetChanged);
            m_popupNet.height = 290;
            m_popupNet.width -= 20;

            AddTextField(Locale.Get("K45_ACE_PROPRULES_ASSETSELECT"), out m_assetFilter, helperSettings, null);

            KlyteMonoUtils.UiTextFieldDefaultsForm(m_assetFilter);
            m_popup        = ConfigureListSelectionPopupForUITextField(m_assetFilter, (text) => AssetColorExpanderMod.Controller?.AssetsCache.FilterPropsByText(text), OnAssetSelectedChanged);
            m_popup.height = 290;
            m_popup.width -= 20;

            GenerateExportButtons(helperSettings, "Building",
                                  out m_exportButtonContainer, out m_exportButton, OnExport,
                                  out m_exportButtonContainerLocal, out m_exportButtonLocal, OnExportLocal);

            AddLibBox <ACEPropRuleLib, PropCityDataRuleXml>(helperLib, out m_copySettings, OnCopyRule, out m_pasteSettings, OnPasteRule, out _, null, OnLoadRule, GetRuleSerialized);

            AddDropdown(Locale.Get("K45_ACE_COLORMODE"), out m_colorMode, helperAppearence, Enum.GetNames(typeof(ColoringMode)).Select(x => Locale.Get("K45_ACE_COLORINGMODE", x)).ToArray(), OnChangeColoringMode);
            AddButtonInEditorRow(m_colorMode, CommonsSpriteNames.K45_QuestionMark, Help_ColorMode);

            AddCheckboxLocale("K45_ACE_COLORMODE_ALLOWREDTONES", out m_allowRed, helperAppearence, OnAllowRedChanged);
            AddCheckboxLocale("K45_ACE_COLORMODE_ALLOWGREENTONES", out m_allowGreen, helperAppearence, OnAllowGreenChanged);
            AddCheckboxLocale("K45_ACE_COLORMODE_ALLOWBLUETONES", out m_allowBlues, helperAppearence, OnAllowBlueChanged);
            AddCheckboxLocale("K45_ACE_COLORMODE_ALLOWNEUTRALTONES", out m_allowNeutral, helperAppearence, OnAllowNeutralChanged);


            KlyteMonoUtils.CreateUIElement(out m_listColorContainer, helperAppearence.Self.transform, "listColors", new UnityEngine.Vector4(0, 0, helperAppearence.Self.width, helperAppearence.Self.height - 80));
            KlyteMonoUtils.CreateScrollPanel(m_listColorContainer, out m_colorListScroll, out _, m_listColorContainer.width - 20, m_listColorContainer.height);
            m_colorListScroll.backgroundSprite    = "OptionsScrollbarTrack";
            m_colorListScroll.autoLayout          = true;
            m_colorListScroll.autoLayoutDirection = LayoutDirection.Horizontal;
            m_colorListScroll.wrapLayout          = true;
            CreateTemplateColorItem();
            m_colorFieldTemplateListColors = new UITemplateList <UIPanel>(m_colorListScroll, COLOR_SELECTOR_TEMPLATE);

            KlyteMonoUtils.InitCircledButton(m_colorListScroll, out m_addColor, CommonsSpriteNames.K45_Plus, (x, y) => AddColor(), "", 36);


            AddCheckboxLocale("K45_ACE_BASICTAB_DISTRICTSELECTIONASWHITELIST", out m_districtWhiteList, helperDistricts, OnSetDistrictsAsWhitelist);
            AddCheckboxLocale("K45_ACE_BASICTAB_DISTRICTSELECTIONASBLACKLIST", out m_districtBlackList, helperDistricts, OnSetDistrictsAsBlacklist);
            AddDropdown(Locale.Get("K45_ACE_BASICTAB_DISTRICTRESTRICTIONSOLVEORDER"), out m_districtResolutionOrder, helperDistricts, Enum.GetNames(typeof(DistrictRestrictionOrder)).Select(x => Locale.Get("K45_ACE_DISTRICTRESTRICTIONORDER", x)).ToArray(), OnChangeDistrictRestrictionOrder);
            AddButtonInEditorRow(m_districtResolutionOrder, CommonsSpriteNames.K45_QuestionMark, Help_DistrictFilter);
            KlyteMonoUtils.CreateUIElement(out m_listContainer, helperDistricts.Self.transform, "previewPanel", new UnityEngine.Vector4(0, 0, helperDistricts.Self.width, helperDistricts.Self.height - 160));
            KlyteMonoUtils.CreateScrollPanel(m_listContainer, out m_districtList, out _, m_listContainer.width - 20, m_listContainer.height);
            m_districtList.backgroundSprite    = "OptionsScrollbarTrack";
            m_districtList.autoLayout          = true;
            m_districtList.autoLayoutDirection = LayoutDirection.Vertical;

            CreateTemplateDistrict();
            m_checkboxTemplateListDistrict = new UITemplateList <UIPanel>(m_districtList, DISTRICT_SELECTOR_TEMPLATE);


            MainContainer.isVisible   = false;
            m_pasteSettings.isVisible = false;
        }
Esempio n. 30
0
        protected void Awake()
        {
            this.m_Author   = base.Find <UILabel>("Author");
            this.m_FileList = base.Find <UIListBox>("MapList");
            base.ClearListing();
            m_FileList.ClearEventInvocations("eventSelectedIndexChanged");
            this.m_FileList.eventSelectedIndexChanged +=
                new ColossalFramework.UI.PropertyChangedEventHandler <int>(this.OnMapSelectionChanged);
            this.m_MapName = base.Find <UITextField>("MapName");
            this.m_MapName.ClearEventInvocations("eventTextChanged");
            //this.m_MapName.eventTextChanged += (c, t) => (this.m_Virgin = false);
            this.m_SnapShot             = base.Find <UITextureSprite>("SnapShot");
            this.m_BuildableArea        = base.Find <UILabel>("BuildableArea");
            this.m_OilResources         = base.Find <UIProgressBar>("ResourceBarOil");
            this.m_OreResources         = base.Find <UIProgressBar>("ResourceBarOre");
            this.m_ForestryResources    = base.Find <UIProgressBar>("ResourceBarForestry");
            this.m_FertilityResources   = base.Find <UIProgressBar>("ResourceBarFarming");
            this.m_WaterResources       = base.Find <UIProgressBar>("ResourceBarWater");
            this.m_OilNoResources       = base.Find("ResourceOil").Find <UISprite>("NoNoNo");
            this.m_OreNoResources       = base.Find("ResourceOre").Find <UISprite>("NoNoNo");
            this.m_ForestryNoResources  = base.Find("ResourceForestry").Find <UISprite>("NoNoNo");
            this.m_FertilityNoResources = base.Find("ResourceFarming").Find <UISprite>("NoNoNo");
            this.m_WaterNoResources     = base.Find("ResourceWater").Find <UISprite>("NoNoNo");
            this.m_Highway    = base.Find <UISprite>("Highway");
            this.m_NoHighway  = this.m_Highway.Find <UISprite>("NoNoNo");
            this.m_InHighway  = this.m_Highway.Find <UISprite>("Incoming");
            this.m_OutHighway = this.m_Highway.Find <UISprite>("Outgoing");
            this.m_Train      = base.Find <UISprite>("Train");
            this.m_NoTrain    = this.m_Train.Find <UISprite>("NoNoNo");
            this.m_InTrain    = this.m_Train.Find <UISprite>("Incoming");
            this.m_OutTrain   = this.m_Train.Find <UISprite>("Outgoing");
            this.m_Ship       = base.Find <UISprite>("Ship");
            this.m_NoShip     = this.m_Ship.Find <UISprite>("NoNoNo");
            this.m_InShip     = this.m_Ship.Find <UISprite>("Incoming");
            this.m_OutShip    = this.m_Ship.Find <UISprite>("Outgoing");
            this.m_Plane      = base.Find <UISprite>("Plane");
            this.m_NoPlane    = this.m_Plane.Find <UISprite>("NoNoNo");
            this.m_InPlane    = this.m_Plane.Find <UISprite>("Incoming");
            this.m_OutPlane   = this.m_Plane.Find <UISprite>("Outgoing");
            this.m_Start      = this.Find <UIButton>("Start");
            m_Start.ClearEventInvocations("eventClick");
            this.m_Start.eventClick +=
                new MouseEventHandler(this.OnStartClick);
            m_Start.color = Color.red;
            this.Refresh();

            var joinPanel = transform.GetComponent <UIPanel>();

            m_playersLabel = joinPanel.AddUIComponent <UILabel>();
            SetLabel(m_playersLabel, "Players: ", 505, 100);

            m_pingLabel = joinPanel.AddUIComponent <UILabel>();
            SetLabel(m_pingLabel, "Ping: ", 505, 125);

            m_errorLabel = joinPanel.AddUIComponent <UILabel>();
            SetLabel(m_errorLabel, "", 505, 150);


            NetPeerConfiguration config = new NetPeerConfiguration("FPSMod");

            config.SetMessageTypeEnabled(NetIncomingMessageType.UnconnectedData, true);

            m_netClient = new NetClient(config);
            m_netClient.Start();
        }
 private void SelectBrushDropDown_eventDropdownClose(UIDropDown dropdown, UIListBox popup, ref bool overridden)
 {
     SelectBrushDropDown.triggerButton.isInteractive = true;
 }
Esempio n. 32
0
        public UIRelationshipDialog()
            : base(UIDialogStyle.Standard | UIDialogStyle.Close, true)
        {
            this.Caption = GameFacade.Strings.GetString("f106", "10");
            //f_web_inbtn = 0x1972454856DDBAC,
            //f_web_outbtn = 0x3D3AEF0856DDBAC,

            InnerBackground          = new UIImage(GetTexture((ulong)0x7A400000001)).With9Slice(13, 13, 13, 13);
            InnerBackground.Position = new Vector2(15, 65);
            InnerBackground.SetSize(510, 230);
            AddAt(3, InnerBackground);

            ResultsBox         = new UIListBox();
            ResultsBox.Columns = new UIListBoxColumnCollection();
            for (int i = 0; i < 3; i++)
            {
                ResultsBox.Columns.Add(new UIListBoxColumn()
                {
                    Width = 170
                });
            }
            ResultsBox.Position = new Vector2(25, 82);
            ResultsBox.SetSize(510, 230);
            ResultsBox.RowHeight          = 40;
            ResultsBox.NumVisibleRows     = 6;
            ResultsBox.SelectionFillColor = Color.TransparentBlack;
            Add(ResultsBox);

            var seat = new UIImage(GetTexture(0x19700000002));

            seat.Position = new Vector2(28, 28);
            Add(seat);

            IncomingButton          = new UIButton(GetTexture((ulong)0x1972454856DDBAC));
            IncomingButton.Position = new Vector2(33, 33);
            IncomingButton.Tooltip  = GameFacade.Strings.GetString("f106", "12");
            Add(IncomingButton);
            OutgoingButton          = new UIButton(GetTexture((ulong)0x3D3AEF0856DDBAC));
            OutgoingButton.Position = new Vector2(33, 33);
            OutgoingButton.Tooltip  = GameFacade.Strings.GetString("f106", "13");
            Add(OutgoingButton);

            SearchBox          = new UITextBox();
            SearchBox.Position = new Vector2(550 - 170, 37);
            SearchBox.SetSize(150, 25);
            SearchBox.OnEnterPress += SearchBox_OnEnterPress;
            Add(SearchBox);

            SortLabel                   = new UILabel();
            SortLabel.Caption           = GameFacade.Strings.GetString("f106", "1");
            SortLabel.Position          = new Vector2(95, 30);
            SortLabel.CaptionStyle      = SortLabel.CaptionStyle.Clone();
            SortLabel.CaptionStyle.Size = 8;
            Add(SortLabel);

            SearchLabel           = new UILabel();
            SearchLabel.Caption   = GameFacade.Strings.GetString("f106", "14");
            SearchLabel.Alignment = Framework.TextAlignment.Right;
            SearchLabel.Position  = new Vector2(550 - 230, 38);
            SearchLabel.Size      = new Vector2(50, 1);
            Add(SearchLabel);

            SortFriendButton          = new UIButton(GetTexture((ulong)0xCE300000001)); //gizmo_friendliestthumb = 0xCE300000001,
            SortFriendButton.Tooltip  = GameFacade.Strings.GetString("f106", "2");
            SortFriendButton.Position = new Vector2(95, 47);
            Add(SortFriendButton);

            SortEnemyButton          = new UIButton(GetTexture((ulong)0xCE600000001)); //gizmo_meanestthumb = 0xCE600000001,
            SortEnemyButton.Tooltip  = GameFacade.Strings.GetString("f106", "3");
            SortEnemyButton.Position = new Vector2(115, 47) + (new Vector2(17 / 2f, 14) - new Vector2(SortEnemyButton.Texture.Width / 8, SortEnemyButton.Texture.Height));
            Add(SortEnemyButton);

            SortAlmostFriendButton          = new UIButton(GetTexture((ulong)0x31600000001)); //gizmo_top100defaultthumb = 0x31600000001,
            SortAlmostFriendButton.Tooltip  = GameFacade.Strings.GetString("f106", "4");
            SortAlmostFriendButton.Position = new Vector2(135, 47)
                                              + (new Vector2(17 / 2f, 14) - new Vector2(SortAlmostFriendButton.Texture.Width / 8, SortAlmostFriendButton.Texture.Height));
            Add(SortAlmostFriendButton);

            SortAlmostEnemyButton          = new UIButton(GetTexture((ulong)0xCE400000001)); //gizmo_infamousthumb = 0xCE400000001,
            SortAlmostEnemyButton.Tooltip  = GameFacade.Strings.GetString("f106", "5");
            SortAlmostEnemyButton.Position = new Vector2(155, 47)
                                             + (new Vector2(17 / 2f, 14) - new Vector2(SortAlmostEnemyButton.Texture.Width / 8, SortAlmostEnemyButton.Texture.Height));
            Add(SortAlmostEnemyButton);

            SortRoommateButton          = new UIButton(GetTexture((ulong)0x4B700000001)); //ucp far zoom
            SortRoommateButton.Tooltip  = GameFacade.Strings.GetString("f106", "6");
            SortRoommateButton.Position = new Vector2(175, 47)
                                          + (new Vector2(17 / 2f, 14) - new Vector2(SortRoommateButton.Texture.Width / 8, SortRoommateButton.Texture.Height));
            Add(SortRoommateButton);

            //gizmo_scrollbarimg = 0x31000000001,
            //gizmo_scrolldownbtn = 0x31100000001,
            //gizmo_scrollupbtn = 0x31200000001,

            ResultsSlider             = new UISlider();
            ResultsSlider.Orientation = 1;
            ResultsSlider.Texture     = GetTexture(0x31000000001);
            ResultsSlider.MinValue    = 0;
            ResultsSlider.MaxValue    = 2;

            ResultsSlider.X = 529;
            ResultsSlider.Y = 72;
            ResultsSlider.SetSize(0, 214f);
            Add(ResultsSlider);

            SliderUpButton          = new UIButton(GetTexture(0x31200000001));
            SliderUpButton.Position = new Vector2(526, 65);
            Add(SliderUpButton);
            SliderDownButton          = new UIButton(GetTexture(0x31100000001));
            SliderDownButton.Position = new Vector2(526, 287);
            Add(SliderDownButton);

            ResultsSlider.AttachButtons(SliderUpButton, SliderDownButton, 1f);
            ResultsBox.AttachSlider(ResultsSlider);

            SetSize(560, 320);

            SortFriendButton.OnButtonClick       += (btn) => ChangeOrderFunc(OrderFriendly);
            SortEnemyButton.OnButtonClick        += (btn) => ChangeOrderFunc(OrderEnemy);
            SortAlmostFriendButton.OnButtonClick += (btn) => ChangeOrderFunc(OrderAlmostFriendly);
            SortAlmostEnemyButton.OnButtonClick  += (btn) => ChangeOrderFunc(OrderAlmostEnemy);
            SortRoommateButton.OnButtonClick     += (btn) => ChangeOrderFunc(OrderRoommate);

            ChangeOrderFunc(OrderFriendly);

            IncomingButton.OnButtonClick += (btn) => SetOutgoing(false);
            OutgoingButton.OnButtonClick += (btn) => SetOutgoing(true);

            TargetIcon           = new UIPersonButton();
            TargetIcon.FrameSize = UIPersonButtonSize.SMALL;
            TargetIcon.Position  = new Vector2(72, 35);
            Add(TargetIcon);

            CloseButton.OnButtonClick += CloseButton_OnButtonClick;

            FriendLabel          = new UILabel();
            FriendLabel.Position = new Vector2(35, 292);
            Add(FriendLabel);

            IncomingLabel           = new UILabel();
            IncomingLabel.Position  = new Vector2(540 - 36, 292);
            IncomingLabel.Size      = new Vector2(1, 1);
            IncomingLabel.Alignment = TextAlignment.Right;
            Add(IncomingLabel);

            SetOutgoing(true);
        }