本文整理汇总了C#中Sandbox.Graphics.GUI.MyGuiControlTable.GetRow方法的典型用法代码示例。如果您正苦于以下问题:C# MyGuiControlTable.GetRow方法的具体用法?C# MyGuiControlTable.GetRow怎么用?C# MyGuiControlTable.GetRow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sandbox.Graphics.GUI.MyGuiControlTable
的用法示例。
在下文中一共展示了MyGuiControlTable.GetRow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RecreateControls
//.........这里部分代码省略.........
m_promoteButton = new MyGuiControlButton(
position: aboveControl.Position + new Vector2(0f, aboveControl.Size.Y + verticalSpacing),
originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
text: MyTexts.Get(MyCommonTexts.ScreenPlayers_Promote));
aboveControl = m_promoteButton;
m_demoteButton = new MyGuiControlButton(
position: aboveControl.Position + new Vector2(0f, aboveControl.Size.Y + verticalSpacing),
originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
text: MyTexts.Get(MyCommonTexts.ScreenPlayers_Demote));
aboveControl = m_demoteButton;
m_kickButton = new MyGuiControlButton(
position: aboveControl.Position + new Vector2(0f, aboveControl.Size.Y + verticalSpacing),
originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
text: MyTexts.Get(MyCommonTexts.ScreenPlayers_Kick));
aboveControl = m_kickButton;
m_banButton = new MyGuiControlButton(
position: aboveControl.Position + new Vector2(0f, aboveControl.Size.Y + verticalSpacing),
originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
text: MyTexts.Get(MyCommonTexts.ScreenPlayers_Ban));
aboveControl = m_banButton;
var maxPlayersLabel = new MyGuiControlLabel(
position: aboveControl.Position + new Vector2(0f, aboveControl.Size.Y + verticalSpacing),
originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
text: MyTexts.GetString(MyCommonTexts.MaxPlayers));
aboveControl = maxPlayersLabel;
m_maxPlayersSlider = new MyGuiControlSlider(
position: aboveControl.Position + new Vector2(0f, aboveControl.Size.Y),
width: 0.15f,
originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
minValue: 2,
maxValue: MyMultiplayer.Static != null ? MyMultiplayer.Static.MaxPlayers : 16,
labelText: new StringBuilder("{0}").ToString(),
labelDecimalPlaces: 0,
labelSpaceWidth: 0.02f,
defaultValue: Sync.IsServer ? MySession.Static.MaxPlayers : MyMultiplayer.Static.MemberLimit,
intValue: true);
m_maxPlayersSlider.ValueChanged = MaxPlayersSlider_Changed;
aboveControl = m_maxPlayersSlider;
m_playersTable = new MyGuiControlTable()
{
Position = new Vector2(-m_inviteButton.Position.X, m_inviteButton.Position.Y),
Size = new Vector2(1200f / MyGuiConstants.GUI_OPTIMAL_SIZE.X, 1f) - m_inviteButton.Size * 1.05f,
VisibleRowsCount = 21,
OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
ColumnsCount = 5,
};
float PlayerNameWidth = 0.3f;
float FactionTagWidth = 0.1f;
float FactionNameWidth = MyPerGameSettings.EnableMutePlayer ? 0.3f : 0.34f;
float MutedWidth = MyPerGameSettings.EnableMutePlayer ? 0.13f : 0;
m_playersTable.SetCustomColumnWidths(new float[] { PlayerNameWidth, FactionTagWidth, FactionNameWidth, MutedWidth, 1 - PlayerNameWidth - FactionTagWidth - FactionNameWidth - MutedWidth });
m_playersTable.SetColumnName(PlayerNameColumn, MyTexts.Get(MyCommonTexts.ScreenPlayers_PlayerName));
m_playersTable.SetColumnName(PlayerFactionTagColumn, MyTexts.Get(MyCommonTexts.ScreenPlayers_FactionTag));
m_playersTable.SetColumnName(PlayerFactionNameColumn, MyTexts.Get(MyCommonTexts.ScreenPlayers_FactionName));
m_playersTable.SetColumnName(PlayerMutedColumn, new StringBuilder(MyTexts.GetString(MyCommonTexts.ScreenPlayers_Muted)));
m_playersTable.SetColumnName(GameAdminColumn, MyTexts.Get(MyCommonTexts.ScreenPlayers_GameAdmin));
m_playersTable.SetColumnComparison(0, (a, b) => (a.Text.CompareToIgnoreCase(b.Text)));
m_playersTable.ItemSelected += playersTable_ItemSelected;
// CH: To show the clients correctly, we would need to know, whether the game is a dedicated-server-hosted game.
// We don't know that, so I just show all clients with players
foreach (var player in Sync.Players.GetOnlinePlayers())
{
if (player.Id.SerialId != 0) continue;
for (int i = 0; i < m_playersTable.RowsCount; ++i)
{
var row = m_playersTable.GetRow(i);
if (row.UserData is ulong && (ulong)row.UserData == player.Id.SteamId) continue;
}
AddPlayer(player.Id.SteamId);
}
m_inviteButton.ButtonClicked += inviteButton_ButtonClicked;
m_promoteButton.ButtonClicked += promoteButton_ButtonClicked;
m_demoteButton.ButtonClicked += demoteButton_ButtonClicked;
m_kickButton.ButtonClicked += kickButton_ButtonClicked;
m_banButton.ButtonClicked += banButton_ButtonClicked;
m_lobbyTypeCombo.ItemSelected += lobbyTypeCombo_OnSelect;
Controls.Add(m_inviteButton);
Controls.Add(m_promoteButton);
Controls.Add(m_demoteButton);
Controls.Add(m_kickButton);
Controls.Add(m_banButton);
Controls.Add(m_playersTable);
Controls.Add(m_lobbyTypeCombo);
Controls.Add(m_maxPlayersSlider);
Controls.Add(maxPlayersLabel);
UpdateButtonsEnabledState();
}