本文整理汇总了C#中Sandbox.Graphics.GUI.MyGuiControlCombobox.CustomSortItems方法的典型用法代码示例。如果您正苦于以下问题:C# MyGuiControlCombobox.CustomSortItems方法的具体用法?C# MyGuiControlCombobox.CustomSortItems怎么用?C# MyGuiControlCombobox.CustomSortItems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sandbox.Graphics.GUI.MyGuiControlCombobox
的用法示例。
在下文中一共展示了MyGuiControlCombobox.CustomSortItems方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RecreateControls
public override void RecreateControls(bool constructor)
{
base.RecreateControls(constructor);
AddCaption(MySpaceTexts.ScreenCaptionGameOptions);
var leftAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
var rightAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER;
Vector2 controlsOriginLeft = new Vector2(-m_size.Value.X / 2.0f + 0.025f, -m_size.Value.Y / 2.0f + 0.125f);
Vector2 controlsOriginRight = new Vector2(m_size.Value.X / 2.0f - 0.025f, -m_size.Value.Y / 2.0f + 0.125f);
Vector2 controlsDelta = new Vector2(0, 0.0525f);
float rowIndex = 0;
// Language
var languageLabel = new MyGuiControlLabel(text: MyTexts.GetString(MySpaceTexts.Language))
{
Position = controlsOriginLeft + rowIndex * controlsDelta,
OriginAlign = leftAlign,
};
m_languageCombobox = new MyGuiControlCombobox()
{
Position = controlsOriginRight + rowIndex * controlsDelta,
OriginAlign = rightAlign,
};
foreach (var languageId in MyLanguage.SupportedLanguages)
{
var description = MyTexts.Languages[languageId];
var name = description.Name;
if (description.IsCommunityLocalized)
name += " *";
m_languageCombobox.AddItem(languageId, name);
}
m_languageCombobox.CustomSortItems((a, b) => a.Key.CompareTo(b.Key));
m_languageCombobox.ItemSelected += m_languageCombobox_ItemSelected;
rowIndex += 0.65f;
m_localizationWebButton = new MyGuiControlButton(
position: controlsOriginRight + rowIndex * controlsDelta,
text: MyTexts.Get(MySpaceTexts.ScreenOptionsGame_MoreInfo),
textScale: MyGuiConstants.DEFAULT_TEXT_SCALE * 0.85f * 0.85f,
onButtonClick: LocalizationWebButtonClicked,
implementedFeature: true,
originAlign: rightAlign);
m_localizationWebButton.VisualStyle = MyGuiControlButtonStyleEnum.ClickableText;
var tmp = new MyGuiControlLabel(text: MyTexts.GetString(MySpaceTexts.ScreenOptionsGame_MoreInfo), textScale: MyGuiConstants.DEFAULT_TEXT_SCALE * 0.85f * 0.85f);
m_localizationWarningLabel = new MyGuiControlLabel(text: MyTexts.GetString(MySpaceTexts.ScreenOptionsGame_LocalizationWarning), textScale: MyGuiConstants.DEFAULT_TEXT_SCALE * 0.85f * 0.85f)
{
Position = controlsOriginRight + rowIndex * controlsDelta - new Vector2(tmp.Size.X + 0.005f, 0),
OriginAlign = rightAlign,
};
rowIndex += 0.8f;
var buildingModeLabel = new MyGuiControlLabel(text: MyTexts.GetString(MySpaceTexts.ScreenOptionsGame_BuildingMode))
{
Position = controlsOriginLeft + rowIndex * controlsDelta,
OriginAlign = leftAlign,
};
m_buildingModeCombobox = new MyGuiControlCombobox()
{
Position = controlsOriginRight + rowIndex * controlsDelta,
OriginAlign = rightAlign,
};
m_buildingModeCombobox.AddItem((int)MyCubeBuilder.BuildingModeEnum.SingleBlock, MySpaceTexts.ScreenOptionsGame_SingleBlock);
m_buildingModeCombobox.AddItem((int)MyCubeBuilder.BuildingModeEnum.Line, MySpaceTexts.ScreenOptionsGame_Line);
m_buildingModeCombobox.AddItem((int)MyCubeBuilder.BuildingModeEnum.Plane, MySpaceTexts.ScreenOptionsGame_Plane);
m_buildingModeCombobox.ItemSelected += m_buildingModeCombobox_ItemSelected;
// Notifications
rowIndex++;
var controlHintsLabel = new MyGuiControlLabel(text: MyTexts.GetString(MySpaceTexts.ShowControlsHints))
{
Position = controlsOriginLeft + rowIndex * controlsDelta,
OriginAlign = leftAlign
};
m_controlHintsCheckbox = new MyGuiControlCheckbox(toolTip: MyTexts.GetString(MySpaceTexts.ToolTipGameOptionsShowControlsHints))
{
Position = controlsOriginRight + rowIndex * controlsDelta,
OriginAlign = rightAlign,
};
m_controlHintsCheckbox.IsCheckedChanged += checkboxChanged;
// Rotation gizmo
MyGuiControlLabel rotationHintsLabel = null;
if (MyFakes.ENABLE_ROTATION_HINTS)
{
rowIndex++;
rotationHintsLabel = new MyGuiControlLabel(text: MyTexts.GetString(MySpaceTexts.ShowRotationHints))
{
Position = controlsOriginLeft + rowIndex * controlsDelta,
OriginAlign = leftAlign
};
m_rotationHintsCheckbox = new MyGuiControlCheckbox(toolTip: MyTexts.GetString(MySpaceTexts.ToolTipGameOptionsShowRotationHints))
{
Position = controlsOriginRight + rowIndex * controlsDelta,
OriginAlign = rightAlign,
};
m_rotationHintsCheckbox.IsCheckedChanged += checkboxChanged;
}
//.........这里部分代码省略.........