當前位置: 首頁>>代碼示例>>C#>>正文


C# MyGuiControlList.SetScrollBarPage方法代碼示例

本文整理匯總了C#中Sandbox.Graphics.GUI.MyGuiControlList.SetScrollBarPage方法的典型用法代碼示例。如果您正苦於以下問題:C# MyGuiControlList.SetScrollBarPage方法的具體用法?C# MyGuiControlList.SetScrollBarPage怎麽用?C# MyGuiControlList.SetScrollBarPage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Sandbox.Graphics.GUI.MyGuiControlList的用法示例。


在下文中一共展示了MyGuiControlList.SetScrollBarPage方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ApplyTypeGroupSelectionChange

        private void ApplyTypeGroupSelectionChange(
            MyGuiControlRadioButtonGroup obj,
            ref bool showsGrid,
            MyGuiControlList targetControlList,
            MyInventoryOwnerTypeEnum? filterType,
            MyGuiControlRadioButtonGroup filterButtonGroup,
            MyGuiControlCheckbox showEmpty,
            MyGuiControlLabel    showEmptyLabel,
            MyGuiControlTextbox blockSearch,
            MyGuiControlButton  blockSearchClear,
            bool isLeftControllist)
        {
            switch (obj.SelectedButton.VisualStyle)
            {
                case MyGuiControlRadioButtonStyleEnum.FilterCharacter:
                    showsGrid = false;

                    showEmpty.Visible        = false;
                    showEmptyLabel.Visible   = false;
                    blockSearch.Visible      = false;
                    blockSearchClear.Visible = false;

                    targetControlList.Position = (isLeftControllist) ? m_leftControlListPosition : m_rightControlListPosition;
                    targetControlList.Size     = m_controlListFullSize;

                    // hack to allow looting, force user on left and interacted corpse on right
                    if (targetControlList == m_leftOwnersControl)
                        CreateInventoryControlInList(m_userAsOwner, targetControlList);
                    else
                        CreateInventoryControlInList(m_interactedAsOwner, targetControlList);
                    break;

                case MyGuiControlRadioButtonStyleEnum.FilterGrid:
                    showsGrid = true;
                    CreateInventoryControlsInList(m_interactedGridOwners, targetControlList, filterType);

                    showEmpty.Visible        = true;
                    showEmptyLabel.Visible   = true;
                    blockSearch.Visible      = true;
                    blockSearchClear.Visible = true;

                    blockSearch.Text = blockSearch.Text;

                    targetControlList.Position = (isLeftControllist) ? m_leftControlListPosWithSearch : m_rightControlListPosWithSearch;
                    targetControlList.Size     = m_controlListSizeWithSearch;
                    break;

                default:
                    Debug.Assert(false, "Invalid branch!");
                    break;
            }
            foreach (var button in filterButtonGroup)
                button.Visible = button.Enabled = showsGrid;

            RefreshSelectedInventoryItem();

            //GR: Do this to return the scrolbar position to zero. Other solution would be to add it to Scrollbar Init but that would cause other bugs so I commented it out for now
            targetControlList.SetScrollBarPage();
        }
開發者ID:ChristianHeinz71,項目名稱:SpaceEngineers,代碼行數:59,代碼來源:MyTerminalInventoryController.cs

示例2: SearchInList

        private void SearchInList(MyGuiControlTextbox searchText, MyGuiControlList list, bool hideEmpty)
        {
            if (searchText.Text != "")
            {
                String[] tmpSearch = searchText.Text.ToLower().Split(' ');

                foreach (var item in list.Controls)
                {
                    var owner   = (item as MyGuiControlInventoryOwner).InventoryOwner;
                    var tmp     = (owner as MyEntity).DisplayNameText.ToString().ToLower();
                    var add     = true;
                    var isEmpty = true;

                    foreach (var search in tmpSearch)
                    {
                        if (!tmp.Contains(search))
                        {
                            add = false;
                            break;
                        }
                    }

                    if (!add)
                    {
                        for (int i = 0; i < owner.InventoryCount; i++)
                        {
                            System.Diagnostics.Debug.Assert(owner.GetInventory(i) as MyInventory != null, "Null or other inventory type!");

                            foreach (var inventoryItem in (owner.GetInventory(i) as MyInventory).GetItems())
                            {
                                bool matches = true;
                                string inventoryItemName = MyDefinitionManager.Static.GetPhysicalItemDefinition(inventoryItem.Content).DisplayNameText.ToString().ToLower();
                                foreach (var search in tmpSearch)
                                {
                                    if (!inventoryItemName.Contains(search))
                                    {
                                        matches = false;
                                        break;
                                    }
                                }

                                if (matches)
                                {
                                    add = true;
                                    break;
                                }
                            }
                            if (add)
                            {
                                break;
                            }
                        }
                    }

                    if (add)
                    {
                        for (int i = 0; i < owner.InventoryCount; ++i)
                        {
                            if (owner.GetInventory(i).CurrentMass != 0)
                            {
                                isEmpty = false;
                                break;
                            }
                        }
                        item.Visible = (hideEmpty && isEmpty) ? false : true;
                    }
                    else
                        item.Visible = false;
                }
            }
            else
            {
                foreach (var item in list.Controls)
                {
                    bool isEmpty = true;
                    var owner = (item as MyGuiControlInventoryOwner).InventoryOwner;

                    for (int i = 0; i < owner.InventoryCount; ++i)
                    {
                        if (owner.GetInventory(i).CurrentMass != 0)
                        {
                            isEmpty = false;
                            break;
                        }
                    }

                    if (hideEmpty && isEmpty)
                        item.Visible = false;
                    else
                        item.Visible = true;
                }
            }
            list.SetScrollBarPage();
        }
開發者ID:ChristianHeinz71,項目名稱:SpaceEngineers,代碼行數:94,代碼來源:MyTerminalInventoryController.cs


注:本文中的Sandbox.Graphics.GUI.MyGuiControlList.SetScrollBarPage方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。