本文整理汇总了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();
}
示例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();
}