当前位置: 首页>>代码示例>>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;未经允许,请勿转载。