本文整理汇总了C#中Sandbox.Graphics.GUI.MyGuiControlCombobox.GetSelectedKey方法的典型用法代码示例。如果您正苦于以下问题:C# MyGuiControlCombobox.GetSelectedKey方法的具体用法?C# MyGuiControlCombobox.GetSelectedKey怎么用?C# MyGuiControlCombobox.GetSelectedKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sandbox.Graphics.GUI.MyGuiControlCombobox
的用法示例。
在下文中一共展示了MyGuiControlCombobox.GetSelectedKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CueVolumeCurveChanged
void CueVolumeCurveChanged(MyGuiControlCombobox combobox)
{
if (m_canUpdateValues)
{
m_currentCue.VolumeCurve = (MyCurveType)combobox.GetSelectedKey();
}
}
示例2: RecreateServerLimitInfo
private void RecreateServerLimitInfo(MyGuiControlList list)
{
var identity = MySession.Static.Players.TryGetIdentity(MySession.Static.LocalPlayerId);
int built;
if (MySession.Static.MaxBlocksPerPlayer > 0 || MySession.Static.BlockTypeLimits.Keys.Count > 0)
{
MyGuiControlLabel totalBlocksLabel = new MyGuiControlLabel(text: MyTexts.GetString(MySpaceTexts.TerminalTab_Info_Overview), textScale: 1.3f);
list.Controls.Add(totalBlocksLabel);
}
if (MySession.Static.MaxBlocksPerPlayer > 0)
{
MyGuiControlLabel totalBlocksLabel = new MyGuiControlLabel(text: String.Format("{0} {1}/{2} {3}", MyTexts.Get(MySpaceTexts.TerminalTab_Info_YouBuilt), identity.BlocksBuilt, MySession.Static.MaxBlocksPerPlayer + identity.BlockLimitModifier, MyTexts.Get(MySpaceTexts.TerminalTab_Info_BlocksLower)));
list.Controls.Add(totalBlocksLabel);
}
foreach (var blockType in MySession.Static.BlockTypeLimits)
{
identity.BlockTypeBuilt.TryGetValue(blockType.Key, out built);
var definition = Sandbox.Definitions.MyDefinitionManager.Static.TryGetDefinitionGroup(blockType.Key);
if (definition == null)
continue;
MyGuiControlLabel blockTypeLabel = new MyGuiControlLabel(text: String.Format("{0} {1}/{2} {3}", MyTexts.Get(MySpaceTexts.TerminalTab_Info_YouBuilt), built, MySession.Static.GetBlockTypeLimit(blockType.Key), definition.Any.DisplayNameText));
list.Controls.Add(blockTypeLabel);
}
foreach (var grid in m_infoGrids)
{
grid.OnAuthorshipChanged -= grid_OnAuthorshipChanged;
}
m_infoGrids.Clear();
identity.LockBlocksBuiltByGrid.AcquireExclusive();
for (int i = 0; i < identity.BlocksBuiltByGrid.Count; i++)
{
var grid = identity.BlocksBuiltByGrid.ElementAt(i);
MyGuiControlParent panel = new MyGuiControlParent();
if (m_infoGrids.Count == 0)
{
MyGuiControlSeparatorList infoSeparator = new MyGuiControlSeparatorList();
infoSeparator.AddHorizontal(new Vector2(-0.2f, -0.052f), 0.4f, width: 0.004f);
panel.Controls.Add(infoSeparator);
}
MyGuiControlLabel gridNameLabel = new MyGuiControlLabel(text: grid.Key.DisplayName, textScale: 0.9f);
MyGuiControlLabel gridBlockCountLabel = new MyGuiControlLabel(text: String.Format("{0} {1}", grid.Value, MyTexts.Get(MySpaceTexts.TerminalTab_Info_BlocksLower)), textScale: 0.9f);
MyGuiControlLabel assignLabel = new MyGuiControlLabel(text: MyTexts.GetString(MySpaceTexts.TerminalTab_Info_Assign), originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER, textScale: 0.9f);
MyGuiControlCombobox assignCombobox = new MyGuiControlCombobox(originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER, size: new Vector2(0.11f, 0.008f));
MyGuiControlSeparatorList lineSeparator = new MyGuiControlSeparatorList();
gridNameLabel.Position = new Vector2(-0.15f, -0.025f);
gridBlockCountLabel.Position = new Vector2(-0.15f, 0.000f);
assignLabel.Position = new Vector2(0.035f, 0.025f);
assignCombobox.Position = new Vector2(0.15f, 0.025f);
assignCombobox.ItemSelected += delegate()
{
assignCombobox_ItemSelected(grid.Key, m_playerIds[(int)assignCombobox.GetSelectedKey()]);
};
m_playerIds.Clear();
foreach (var player in MySession.Static.Players.GetOnlinePlayers())
{
if (MySession.Static.LocalHumanPlayer != player)
{
assignCombobox.AddItem(m_playerIds.Count, player.DisplayName);
m_playerIds.Add(player.Id);
}
}
lineSeparator.AddHorizontal(new Vector2(-0.15f, 0.05f), 0.3f, width: 0.002f);
panel.Controls.Add(gridNameLabel);
panel.Controls.Add(gridBlockCountLabel);
panel.Controls.Add(assignLabel);
panel.Controls.Add(assignCombobox);
panel.Controls.Add(lineSeparator);
if (MySession.Static.EnableRemoteBlockRemoval)
{
MyGuiControlLabel deleteOwnedBlocksLabel = new MyGuiControlLabel(
text: MyTexts.GetString(MySpaceTexts.buttonRemove),
originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER,
textScale: 0.9f);
MyGuiControlButton deleteOwnedBlocksButton = new MyGuiControlButton(
text: new StringBuilder("X"),
onButtonClick: deleteOwnedBlocksButton_ButtonClicked,
buttonIndex: m_infoGrids.Count,
visualStyle: MyGuiControlButtonStyleEnum.SquareSmall,
originAlign: VRage.Utils.MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER);
deleteOwnedBlocksLabel.Position = new Vector2(0.11f, -0.02f);
deleteOwnedBlocksButton.Position = new Vector2(0.15f, -0.02f);
panel.Controls.Add(deleteOwnedBlocksLabel);
panel.Controls.Add(deleteOwnedBlocksButton);
}
grid.Key.OnAuthorshipChanged += grid_OnAuthorshipChanged;
m_infoGrids.Add(grid.Key);
//.........这里部分代码省略.........