本文整理汇总了C#中Sandbox.Graphics.GUI.MyGuiControlTable.SetColumnComparison方法的典型用法代码示例。如果您正苦于以下问题:C# MyGuiControlTable.SetColumnComparison方法的具体用法?C# MyGuiControlTable.SetColumnComparison怎么用?C# MyGuiControlTable.SetColumnComparison使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sandbox.Graphics.GUI.MyGuiControlTable
的用法示例。
在下文中一共展示了MyGuiControlTable.SetColumnComparison方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RecreateControls
public override void RecreateControls(bool constructor)
{
base.RecreateControls(constructor);
AddCaption(MyCommonTexts.ScreenCaptionLoadWorld);
var origin = new Vector2(-0.4375f, -0.3f);
Vector2 buttonSize = MyGuiControlButton.GetVisualStyle(MyGuiControlButtonStyleEnum.Default).NormalTexture.MinSizeGui;
m_sessionsTable = new MyGuiControlTable();
m_sessionsTable.Position = origin + new Vector2(buttonSize.X * 1.1f, 0f);
m_sessionsTable.Size = new Vector2(1075f / MyGuiConstants.GUI_OPTIMAL_SIZE.X, 0.15f);
m_sessionsTable.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
m_sessionsTable.ColumnsCount = 2;
m_sessionsTable.VisibleRowsCount = 17;
m_sessionsTable.ItemSelected += OnTableItemSelected;
m_sessionsTable.ItemDoubleClicked += OnTableItemConfirmedOrDoubleClick;
m_sessionsTable.ItemConfirmed += OnTableItemConfirmedOrDoubleClick;
m_sessionsTable.SetCustomColumnWidths(new float[] { 0.65f, 0.35f });
m_sessionsTable.SetColumnComparison(0, (a, b) => ((StringBuilder)a.UserData).CompareToIgnoreCase((StringBuilder)b.UserData));
m_sessionsTable.SetColumnComparison(1, (a, b) => ((DateTime)a.UserData).CompareTo((DateTime)b.UserData));
Controls.Add(m_sessionsTable);
Vector2 buttonOrigin = origin + buttonSize * 0.5f;
Vector2 buttonDelta = MyGuiConstants.MENU_BUTTONS_POSITION_DELTA;
// Continue last game
// Load
// Edit
// Save
// Delete
Controls.Add(m_continueLastSave = MakeButton(buttonOrigin + buttonDelta * 0, MyCommonTexts.LoadScreenButtonContinueLastGame, OnContinueLastGameClick));
Controls.Add(m_loadButton = MakeButton(buttonOrigin + buttonDelta * 1, MyCommonTexts.LoadScreenButtonLoad, OnLoadClick));
Controls.Add(m_editButton = MakeButton(buttonOrigin + buttonDelta * 2, MyCommonTexts.LoadScreenButtonEditSettings, OnEditClick));
Controls.Add(m_saveButton = MakeButton(buttonOrigin + buttonDelta * 3, MyCommonTexts.LoadScreenButtonSaveAs, OnSaveAsClick));
Controls.Add(m_deleteButton = MakeButton(buttonOrigin + buttonDelta * 4, MyCommonTexts.LoadScreenButtonDelete, OnDeleteClick));
m_publishButton = MakeButton(buttonOrigin + buttonDelta * 6, MyCommonTexts.LoadScreenButtonPublish, OnPublishClick);
if (!MyFakes.XB1_PREVIEW)
{
Controls.Add(m_publishButton);
}
m_publishButton.SetToolTip(MyTexts.GetString(MyCommonTexts.LoadScreenButtonTooltipPublish));
m_continueLastSave.Enabled = false;
m_continueLastSave.DrawCrossTextureWhenDisabled = false;
m_loadButton.DrawCrossTextureWhenDisabled = false;
m_editButton.DrawCrossTextureWhenDisabled = false;
m_deleteButton.DrawCrossTextureWhenDisabled = false;
m_saveButton.DrawCrossTextureWhenDisabled = false;
m_publishButton.DrawCrossTextureWhenDisabled = false;
CloseButtonEnabled = true;
if (m_state == StateEnum.ListLoaded)
m_state = StateEnum.ListNeedsReload;
}
示例2: RecreateControls
public override void RecreateControls(bool constructor)
{
base.RecreateControls(constructor);
AddCaption(MyCommonTexts.ScreenCaptionWorkshop);
var origin = new Vector2(-0.4375f, -0.3f);
Vector2 buttonSize = MyGuiControlButton.GetVisualStyle(MyGuiControlButtonStyleEnum.Default).NormalTexture.MinSizeGui;
m_worldsTable = new MyGuiControlTable();
m_worldsTable.Position = origin + new Vector2(buttonSize.X * 1.1f, 0f);
m_worldsTable.Size = new Vector2(1075f / MyGuiConstants.GUI_OPTIMAL_SIZE.X, 1f);
m_worldsTable.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
m_worldsTable.ColumnsCount = 1;
m_worldsTable.VisibleRowsCount = 17;
m_worldsTable.ItemSelected += OnTableItemSelected;
m_worldsTable.ItemDoubleClicked += OnTableItemConfirmedOrDoubleClick;
m_worldsTable.ItemConfirmed += OnTableItemConfirmedOrDoubleClick;
m_worldsTable.SetCustomColumnWidths(new float[] { 1.0f });
m_worldsTable.SetColumnComparison(0, (a, b) => ((StringBuilder)a.UserData).CompareToIgnoreCase((StringBuilder)b.UserData));
Controls.Add(m_worldsTable);
Vector2 buttonOrigin = origin + buttonSize * 0.5f;
Vector2 buttonDelta = MyGuiConstants.MENU_BUTTONS_POSITION_DELTA;
// Load
Controls.Add(m_loadButton = MakeButton(buttonOrigin + buttonDelta * 0, MyCommonTexts.ScreenLoadSubscribedWorldCopyAndLoad, MyCommonTexts.ToolTipWorkshopCopyAndLoad, OnLoadClick));
Controls.Add(m_copyButton = MakeButton(buttonOrigin + buttonDelta * 1, MyCommonTexts.ScreenLoadSubscribedWorldCopyWorld, MyCommonTexts.ToolTipWorkshopCopyWorld, OnCopyClick));
Controls.Add(m_openInWorkshopButton = MakeButton(buttonOrigin + buttonDelta * 2, MyCommonTexts.ScreenLoadSubscribedWorldOpenInWorkshop, MyCommonTexts.ToolTipWorkshopOpenInWorkshop, OnOpenInWorkshopClick));
Controls.Add(m_refreshButton = MakeButton(buttonOrigin + buttonDelta * 3, MyCommonTexts.ScreenLoadSubscribedWorldRefresh, MyCommonTexts.ToolTipWorkshopRefresh, OnRefreshClick));
Controls.Add(m_browseWorkshopButton = MakeButton(buttonOrigin + buttonDelta * 4, MyCommonTexts.ScreenLoadSubscribedWorldBrowseWorkshop, MyCommonTexts.ToolTipWorkshopBrowseWorkshop, OnBrowseWorkshopClick));
m_loadButton.DrawCrossTextureWhenDisabled = false;
m_openInWorkshopButton.DrawCrossTextureWhenDisabled = false;
CloseButtonEnabled = true;
}
示例3: RecreateControls
public override void RecreateControls(bool constructor)
{
base.RecreateControls(constructor);
AddCaption(MySpaceTexts.ScreenCaptionWorkshop);
var origin = new Vector2(-0.4375f, -0.375f);
Vector2 tinyButtonsOrigin = new Vector2(-0.0015f, -4.5f * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA.Y);
m_modsTableDisabled = new MyGuiControlTable();
if (MyFakes.ENABLE_MOD_CATEGORIES)
{
m_modsTableDisabled.Position = origin + new Vector2(0f, 0.1f);
m_modsTableDisabled.VisibleRowsCount = 17;
}
else
{
m_modsTableDisabled.Position = origin;
m_modsTableDisabled.VisibleRowsCount = 20;
}
m_modsTableDisabled.Size = new Vector2(m_size.Value.X * 0.4375f, 1.25f);
m_modsTableDisabled.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
m_modsTableDisabled.ColumnsCount = 2;
m_modsTableDisabled.ItemSelected += OnTableItemSelected;
m_modsTableDisabled.ItemDoubleClicked += OnTableItemConfirmedOrDoubleClick;
m_modsTableDisabled.ItemConfirmed += OnTableItemConfirmedOrDoubleClick;
m_modsTableDisabled.SetCustomColumnWidths(new float[] { 0.085f, 0.905f });
m_modsTableDisabled.SetColumnComparison(1, (a, b) => (a.Text).CompareToIgnoreCase(b.Text));
Controls.Add(m_modsTableDisabled);
m_modsTableEnabled = new MyGuiControlTable();
m_modsTableEnabled.Position = origin + new Vector2(m_modsTableDisabled.Size.X + 0.04f, 0f);
m_modsTableEnabled.Size = new Vector2(m_size.Value.X * 0.4375f, 1.25f);
m_modsTableEnabled.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
m_modsTableEnabled.ColumnsCount = 2;
if (MyFakes.ENABLE_MOD_CATEGORIES)
{
m_modsTableEnabled.Position = new Vector2(m_modsTableEnabled.Position.X, m_modsTableDisabled.Position.Y - 0.065f);
m_modsTableEnabled.VisibleRowsCount = 19;
}
else
{
m_modsTableEnabled.VisibleRowsCount = 20;
}
m_modsTableEnabled.ItemSelected += OnTableItemSelected;
m_modsTableEnabled.ItemDoubleClicked += OnTableItemConfirmedOrDoubleClick;
m_modsTableEnabled.ItemConfirmed += OnTableItemConfirmedOrDoubleClick;
m_modsTableEnabled.SetCustomColumnWidths(new float[] { 0.085f, 0.905f });
Controls.Add(m_modsTableEnabled);
Controls.Add(m_labelEnabled = MakeLabel(m_modsTableEnabled.Position + new Vector2(m_modsTableEnabled.Size.X / 2f, 0f), MySpaceTexts.ScreenMods_ActiveMods));
Controls.Add(m_labelDisabled = MakeLabel(m_modsTableDisabled.Position + new Vector2(m_modsTableDisabled.Size.X / 2f, 0f), MySpaceTexts.ScreenMods_AvailableMods));
Controls.Add(m_moveUpButton = MakeButtonTiny(tinyButtonsOrigin + 0 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, -MathHelper.PiOver2, MySpaceTexts.ToolTipScreenMods_MoveUp, MyGuiConstants.TEXTURE_BUTTON_ARROW_SINGLE, OnMoveUpClick));
Controls.Add(m_moveTopButton = MakeButtonTiny(tinyButtonsOrigin + 1 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, -MathHelper.PiOver2, MySpaceTexts.ToolTipScreenMods_MoveTop, MyGuiConstants.TEXTURE_BUTTON_ARROW_DOUBLE, OnMoveTopClick));
Controls.Add(m_moveBottomButton = MakeButtonTiny(tinyButtonsOrigin + 2 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MathHelper.PiOver2, MySpaceTexts.ToolTipScreenMods_MoveBottom, MyGuiConstants.TEXTURE_BUTTON_ARROW_DOUBLE, OnMoveBottomClick));
Controls.Add(m_moveDownButton = MakeButtonTiny(tinyButtonsOrigin + 3 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MathHelper.PiOver2, MySpaceTexts.ToolTipScreenMods_MoveDown, MyGuiConstants.TEXTURE_BUTTON_ARROW_SINGLE, OnMoveDownClick));
Controls.Add(m_moveLeftButton = MakeButtonTiny(tinyButtonsOrigin + 5 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MathHelper.Pi, MySpaceTexts.ToolTipScreenMods_MoveLeft, MyGuiConstants.TEXTURE_BUTTON_ARROW_SINGLE, OnMoveLeftClick));
Controls.Add(m_moveLeftAllButton = MakeButtonTiny(tinyButtonsOrigin + 6 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, MathHelper.Pi, MySpaceTexts.ToolTipScreenMods_MoveLeftAll, MyGuiConstants.TEXTURE_BUTTON_ARROW_DOUBLE, OnMoveLeftAllClick));
Controls.Add(m_moveRightAllButton = MakeButtonTiny(tinyButtonsOrigin + 7 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, 0f, MySpaceTexts.ToolTipScreenMods_MoveRightAll, MyGuiConstants.TEXTURE_BUTTON_ARROW_DOUBLE, OnMoveRightAllClick));
Controls.Add(m_moveRightButton = MakeButtonTiny(tinyButtonsOrigin + 8 * MyGuiConstants.MENU_BUTTONS_POSITION_DELTA, 0f, MySpaceTexts.ToolTipScreenMods_MoveRight, MyGuiConstants.TEXTURE_BUTTON_ARROW_SINGLE, OnMoveRightClick));
Controls.Add(m_publishModButton = MakeButton(m_modsTableDisabled.Position + new Vector2(0f, m_modsTableDisabled.Size.Y + 0.01f), MySpaceTexts.LoadScreenButtonPublish, MySpaceTexts.LoadScreenButtonPublish, OnPublishModClick, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP));
Controls.Add(m_openInWorkshopButton = MakeButton(m_publishModButton.Position + new Vector2(m_publishModButton.Size.X + 0.04f, 0f), MySpaceTexts.ScreenLoadSubscribedWorldOpenInWorkshop, MySpaceTexts.ToolTipWorkshopOpenModInWorkshop, OnOpenInWorkshopClick, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP));
Controls.Add(m_refreshButton = MakeButton(m_publishModButton.Position + new Vector2(0f, m_publishModButton.Size.Y + 0.01f), MySpaceTexts.ScreenLoadSubscribedWorldRefresh, MySpaceTexts.ToolTipWorkshopRefreshMod, OnRefreshClick, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP));
Controls.Add(m_browseWorkshopButton = MakeButton(m_openInWorkshopButton.Position + new Vector2(0f, m_publishModButton.Size.Y + 0.01f), MySpaceTexts.ScreenLoadSubscribedWorldBrowseWorkshop, MySpaceTexts.ToolTipWorkshopBrowseWorkshop, OnBrowseWorkshopClick, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP));
Controls.Add(m_cancelButton = MakeButton(m_modsTableEnabled.Position + m_modsTableEnabled.Size + new Vector2(0f, 0.01f), MySpaceTexts.Cancel, MySpaceTexts.Cancel, OnCancelClick, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP));
Controls.Add(m_okButton = MakeButton(m_cancelButton.Position - new Vector2(m_cancelButton.Size.X + 0.04f, 0f), MySpaceTexts.Ok, MySpaceTexts.Ok, OnOkClick, MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP));
//category buttons
if (MyFakes.ENABLE_MOD_CATEGORIES)
{
Vector2 buttonPosition = m_modsTableDisabled.Position + new Vector2(0.02f, -0.03f);
Vector2 buttonOffset = new Vector2(0.0414f, 0f);
var categories = MySteamWorkshop.ModCategories;
int i = 0;
for (; i < categories.Length; ++i)
{
Controls.Add(MakeButtonCategory(buttonPosition + buttonOffset * i, categories[i]));
}
var m_categoryCategorySelectButton = new MyGuiControlButton()
{
Position = (buttonPosition + buttonOffset * i) + new Vector2(-0.02f, -0.014f),
Size = new Vector2(0.05f, 0.05f),
Name = "SelectCategory",
Text = "...",
OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
VisualStyle = MyGuiControlButtonStyleEnum.Tiny,
};
m_categoryCategorySelectButton.SetToolTip(MySpaceTexts.TooltipScreenMods_SelectCategories);
m_categoryCategorySelectButton.ButtonClicked += OnSelectCategoryClicked;
Controls.Add(m_categoryCategorySelectButton);
//.........这里部分代码省略.........
示例4: Init
public void Init(IMyGuiControlsParent controlsParent)
{
m_controlsParent = controlsParent;
//left:
m_searchIns = (MyGuiControlTextbox)m_controlsParent.Controls.GetControlByName("SearchIns");
m_searchIns.TextChanged += searchIns_TextChanged;
m_searchInsClear = (MyGuiControlButton)m_controlsParent.Controls.GetControlByName("SearchInsClear");
m_searchInsClear.ButtonClicked += searchInsClear_ButtonClicked;
m_tableIns = (MyGuiControlTable)controlsParent.Controls.GetControlByName("TableINS");
m_tableIns.SetColumnComparison(0, TableSortingComparison);
m_tableIns.ItemSelected += OnTableItemSelected;
m_tableIns.ItemDoubleClicked += OnTableDoubleclick;
//bottom buttons
m_buttonAdd = (MyGuiControlButton)m_controlsParent.Controls.GetControlByName("buttonAdd");
m_buttonAddCurrent = (MyGuiControlButton)m_controlsParent.Controls.GetControlByName("buttonFromCurrent");
m_buttonAddFromClipboard = (MyGuiControlButton)m_controlsParent.Controls.GetControlByName("buttonFromClipboard");
m_buttonDelete = (MyGuiControlButton)m_controlsParent.Controls.GetControlByName("buttonDelete");
m_buttonAdd.ButtonClicked += OnButtonPressedNew;
m_buttonAddFromClipboard.ButtonClicked += OnButtonPressedNewFromClipboard;
m_buttonAddCurrent.ButtonClicked += OnButtonPressedNewFromCurrent;
m_buttonDelete.ButtonClicked += OnButtonPressedDelete;
//right:
m_labelInsName = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("labelInsName");
m_panelInsName = (MyGuiControlTextbox)controlsParent.Controls.GetControlByName("panelInsName");
m_labelInsDesc = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("labelInsDesc");
m_panelInsDesc = (MyGuiControlTextbox)controlsParent.Controls.GetControlByName("textInsDesc");
m_labelInsX = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("labelInsX");
m_xCoord = (MyGuiControlTextbox)controlsParent.Controls.GetControlByName("textInsX");
m_labelInsY = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("labelInsY");
m_yCoord = (MyGuiControlTextbox)controlsParent.Controls.GetControlByName("textInsY");
m_labelInsZ = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("labelInsZ");
m_zCoord = (MyGuiControlTextbox)controlsParent.Controls.GetControlByName("textInsZ");
m_labelInsShowOnHud=(MyGuiControlLabel)controlsParent.Controls.GetControlByName("labelInsShowOnHud");
m_checkInsShowOnHud = (MyGuiControlCheckbox)controlsParent.Controls.GetControlByName("checkInsShowOnHud");
m_checkInsShowOnHud.IsCheckedChanged += OnShowOnHudChecked;
m_buttonCopy = (MyGuiControlButton)m_controlsParent.Controls.GetControlByName("buttonToClipboard");
m_buttonCopy.ButtonClicked += OnButtonPressedCopy;
m_labelSaveWarning = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("TerminalTab_GPS_SaveWarning");
m_labelSaveWarning.Visible = false;
HookSyncEvents();
MySession.Static.Gpss.GpsChanged += OnInsChanged;
MySession.Static.Gpss.ListChanged += OnListChanged;
//int ret = MySession.Static.Inss.ScanText("df INS:nefinalni 3:1:2.3:1: INS:nefinalni 4:2:2.3:2:");
MySession.Static.Gpss.DiscardOld();
PopulateList();
m_previousHash = null;
enableEditBoxes(false);
m_buttonDelete.Enabled = false;
}
示例5: Init
public void Init(IMyGuiControlsParent controlsParent)
{
m_controlsParent = controlsParent;
RefreshUserInfo();
m_tableFactions = (MyGuiControlTable)controlsParent.Controls.GetControlByName("FactionsTable");
m_tableFactions.SetColumnComparison(0, (a, b) => ((StringBuilder)a.UserData).CompareToIgnoreCase((StringBuilder)b.UserData));
m_tableFactions.SetColumnComparison(1, (a, b) => ((StringBuilder)a.UserData).CompareToIgnoreCase((StringBuilder)b.UserData));
m_tableFactions.ItemSelected += OnFactionsTableItemSelected;
RefreshTableFactions();
m_tableFactions.SortByColumn(1);
m_buttonCreate = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonCreate");
m_buttonJoin = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonJoin");
m_buttonCancelJoin = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonCancelJoin");
m_buttonLeave = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonLeave");
m_buttonSendPeace = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonSendPeace");
m_buttonCancelPeace = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonCancelPeace");
m_buttonAcceptPeace = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonAcceptPeace");
m_buttonMakeEnemy = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonEnemy");
m_buttonCreate.ShowTooltipWhenDisabled = true;
m_buttonCreate.TextEnum = MySpaceTexts.TerminalTab_Factions_Create;
m_buttonJoin.TextEnum = MySpaceTexts.TerminalTab_Factions_Join;
m_buttonCancelJoin.TextEnum = MySpaceTexts.TerminalTab_Factions_CancelJoin;
m_buttonLeave.TextEnum = MySpaceTexts.TerminalTab_Factions_Leave;
m_buttonSendPeace.TextEnum = MySpaceTexts.TerminalTab_Factions_Friend;
m_buttonCancelPeace.TextEnum = MySpaceTexts.TerminalTab_Factions_CancelPeaceRequest;
m_buttonAcceptPeace.TextEnum = MySpaceTexts.TerminalTab_Factions_AcceptPeaceRequest;
m_buttonMakeEnemy.TextEnum = MySpaceTexts.TerminalTab_Factions_Enemy;
m_buttonJoin.SetToolTip(MySpaceTexts.TerminalTab_Factions_JoinToolTip);
m_buttonSendPeace.SetToolTip(MySpaceTexts.TerminalTab_Factions_FriendToolTip);
m_buttonCreate.ButtonClicked += OnCreateClicked;
m_buttonJoin.ButtonClicked += OnJoinClicked;
m_buttonCancelJoin.ButtonClicked += OnCancelJoinClicked;
m_buttonLeave.ButtonClicked += OnLeaveClicked;
m_buttonSendPeace.ButtonClicked += OnFriendClicked;
m_buttonCancelPeace.ButtonClicked += OnCancelPeaceRequestClicked;
m_buttonAcceptPeace.ButtonClicked += OnAcceptFriendClicked;
m_buttonMakeEnemy.ButtonClicked += OnEnemyClicked;
// RIGHT SIDE
m_labelFactionName = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("labelFactionName");
m_labelFactionDesc = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("labelFactionDesc");
m_labelFactionPriv = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("labelFactionPrivate");
m_labelMembers = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("labelFactionMembers");
m_labelAutoAcceptMember = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("labelFactionMembersAcceptEveryone");
m_labelAutoAcceptPeace = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("labelFactionMembersAcceptPeace");
m_labelFactionDesc.Text = MyTexts.Get(MySpaceTexts.TerminalTab_Factions_CreateFactionDescription).ToString();
m_labelFactionPriv.Text = MyTexts.Get(MySpaceTexts.TerminalTab_Factions_Private).ToString();
m_labelMembers.Text = MyTexts.Get(MySpaceTexts.TerminalTab_Factions_Members).ToString();
m_labelAutoAcceptMember.Text = MyTexts.Get(MySpaceTexts.TerminalTab_Factions_AutoAccept).ToString();
m_labelAutoAcceptPeace.Text = MyTexts.Get(MySpaceTexts.TerminalTab_Factions_AutoAcceptRequest).ToString();
m_labelAutoAcceptMember.SetToolTip(MySpaceTexts.TerminalTab_Factions_AutoAcceptToolTip);
m_labelAutoAcceptPeace.SetToolTip(MySpaceTexts.TerminalTab_Factions_AutoAcceptRequestToolTip);
m_textFactionDesc = (MyGuiControlMultilineText)controlsParent.Controls.GetControlByName("textFactionDesc");
m_textFactionPriv = (MyGuiControlMultilineText)controlsParent.Controls.GetControlByName("textFactionPrivate");
m_textFactionDesc.BackgroundTexture = MyGuiConstants.TEXTURE_HIGHLIGHT_DARK;
m_textFactionPriv.BackgroundTexture = MyGuiConstants.TEXTURE_HIGHLIGHT_DARK;
m_tableMembers = (MyGuiControlTable)controlsParent.Controls.GetControlByName("tableMembers");
m_tableMembers.SetColumnComparison(1, (a, b) => ((int)((MyMemberComparerEnum)a.UserData)).CompareTo((int)((MyMemberComparerEnum)b.UserData)));
m_tableMembers.ItemSelected += OnTableItemSelected;
m_checkAutoAcceptMember = (MyGuiControlCheckbox)controlsParent.Controls.GetControlByName("checkFactionMembersAcceptEveryone");
m_checkAutoAcceptPeace = (MyGuiControlCheckbox)controlsParent.Controls.GetControlByName("checkFactionMembersAcceptPeace");
m_checkAutoAcceptMember.SetToolTip(MySpaceTexts.TerminalTab_Factions_AutoAcceptToolTip);
m_checkAutoAcceptPeace.SetToolTip(MySpaceTexts.TerminalTab_Factions_AutoAcceptRequestToolTip);
m_checkAutoAcceptMember.IsCheckedChanged += OnAutoAcceptChanged;
m_checkAutoAcceptPeace.IsCheckedChanged += OnAutoAcceptChanged;
m_buttonEdit = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonEdit");
m_buttonPromote = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonPromote");
m_buttonKick = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonKick");
m_buttonAcceptJoin = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonAcceptJoin");
m_buttonDemote = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonDemote");
m_buttonAddNpc = (MyGuiControlButton)controlsParent.Controls.GetControlByName("buttonAddNpc");
m_buttonEdit.TextEnum = MyCommonTexts.Edit;
m_buttonPromote.TextEnum = MyCommonTexts.Promote;
m_buttonKick.TextEnum = MyCommonTexts.Kick;
m_buttonAcceptJoin.TextEnum = MyCommonTexts.Accept;
m_buttonDemote.TextEnum = MyCommonTexts.Demote;
m_buttonAddNpc.TextEnum = MySpaceTexts.AddNpcToFaction;
m_buttonAddNpc.SetToolTip(MySpaceTexts.AddNpcToFactionHelp);
m_buttonEdit.ButtonClicked += OnCreateClicked;
m_buttonPromote.ButtonClicked += OnPromotePlayerClicked;
m_buttonKick.ButtonClicked += OnKickPlayerClicked;
m_buttonAcceptJoin.ButtonClicked += OnAcceptJoinClicked;
//.........这里部分代码省略.........
示例6: RecreateControls
public override void RecreateControls(bool constructor)
{
base.RecreateControls(constructor);
CloseButtonEnabled = true;
var caption = AddCaption(MyCommonTexts.ScreenCaptionPlayers);
var captionCenter = MyUtils.GetCoordCenterFromAligned(caption.Position, caption.Size, caption.OriginAlign);
var captionBottomCenter = captionCenter + new Vector2(0f, 0.5f * caption.Size.Y);
Vector2 sizeScale = Size.Value / MyGuiConstants.TEXTURE_SCREEN_BACKGROUND.SizeGui;
Vector2 topLeft = -0.5f * Size.Value + sizeScale * MyGuiConstants.TEXTURE_SCREEN_BACKGROUND.PaddingSizeGui * 1.1f;
float verticalSpacing = 0.0045f;
m_lobbyTypeCombo = new MyGuiControlCombobox(
position: new Vector2(-topLeft.X, captionBottomCenter.Y + verticalSpacing),
openAreaItemsCount: 3);
m_lobbyTypeCombo.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP;
m_lobbyTypeCombo.AddItem((int)LobbyTypeEnum.Private, MyCommonTexts.ScreenPlayersLobby_Private);
m_lobbyTypeCombo.AddItem((int)LobbyTypeEnum.FriendsOnly, MyCommonTexts.ScreenPlayersLobby_Friends);
m_lobbyTypeCombo.AddItem((int)LobbyTypeEnum.Public, MyCommonTexts.ScreenPlayersLobby_Public);
m_lobbyTypeCombo.SelectItemByKey((int)MyMultiplayer.Static.GetLobbyType());
MyGuiControlBase aboveControl;
m_inviteButton = new MyGuiControlButton(
position: new Vector2(-m_lobbyTypeCombo.Position.X, m_lobbyTypeCombo.Position.Y + m_lobbyTypeCombo.Size.Y + verticalSpacing),
originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
text: MyTexts.Get(MyCommonTexts.ScreenPlayers_Invite));
aboveControl = m_inviteButton;
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())
//.........这里部分代码省略.........
示例7: RecreateControls
public override void RecreateControls(bool constructor)
{
base.RecreateControls(constructor);
CloseButtonEnabled = true;
var caption = AddCaption(MySpaceTexts.ScreenCaptionPlayers);
var captionCenter = MyUtils.GetCoordCenterFromAligned(caption.Position, caption.Size, caption.OriginAlign);
var captionBottomCenter = captionCenter + new Vector2(0f, 0.5f * caption.Size.Y);
Vector2 sizeScale = Size.Value / MyGuiConstants.TEXTURE_SCREEN_BACKGROUND.SizeGui;
Vector2 topLeft = -0.5f * Size.Value + sizeScale * MyGuiConstants.TEXTURE_SCREEN_BACKGROUND.PaddingSizeGui * 1.1f;
float verticalSpacing = 0.5f * caption.Size.Y;
m_lobbyTypeCombo = new MyGuiControlCombobox(
position: new Vector2(-topLeft.X, captionBottomCenter.Y + verticalSpacing),
openAreaItemsCount: 3);
m_lobbyTypeCombo.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP;
m_lobbyTypeCombo.AddItem((int)LobbyTypeEnum.Private, MySpaceTexts.ScreenPlayersLobby_Private);
m_lobbyTypeCombo.AddItem((int)LobbyTypeEnum.FriendsOnly, MySpaceTexts.ScreenPlayersLobby_Friends);
m_lobbyTypeCombo.AddItem((int)LobbyTypeEnum.Public, MySpaceTexts.ScreenPlayersLobby_Public);
m_lobbyTypeCombo.SelectItemByKey((int)MyMultiplayer.Static.GetLobbyType());
MyGuiControlBase aboveControl;
m_inviteButton = new MyGuiControlButton(
position: new Vector2(-m_lobbyTypeCombo.Position.X, m_lobbyTypeCombo.Position.Y + m_lobbyTypeCombo.Size.Y + verticalSpacing),
originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
text: MyTexts.Get(MySpaceTexts.ScreenPlayers_Invite));
aboveControl = m_inviteButton;
m_kickButton = new MyGuiControlButton(
position: aboveControl.Position + new Vector2(0f, aboveControl.Size.Y),
originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
text: MyTexts.Get(MySpaceTexts.ScreenPlayers_Kick));
aboveControl = m_kickButton;
m_banButton = new MyGuiControlButton(
position: aboveControl.Position + new Vector2(0f, aboveControl.Size.Y),
originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
text: MyTexts.Get(MySpaceTexts.ScreenPlayers_Ban));
aboveControl = m_banButton;
var maxPlayersLabel = new MyGuiControlLabel(
position: aboveControl.Position + new Vector2(0f, aboveControl.Size.Y),
originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
text: MyTexts.GetString(MySpaceTexts.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: 0,
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(1075f / MyGuiConstants.GUI_OPTIMAL_SIZE.X, 1f) - m_inviteButton.Size * 1.05f,
VisibleRowsCount = 21,
OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP,
ColumnsCount = 2,
};
m_playersTable.SetCustomColumnWidths(new float[] { 0.7f, 0.3f });
m_playersTable.SetColumnName(0, MyTexts.Get(MySpaceTexts.ScreenPlayers_PlayerName));
m_playersTable.SetColumnName(1, MyTexts.Get(MySpaceTexts.ScreenPlayers_GameAdmin));
m_playersTable.SetColumnComparison(0, (a, b) => (a.Text.CompareToIgnoreCase(b.Text)));
m_playersTable.ItemSelected += playersTable_ItemSelected;
foreach (var userId in MyMultiplayer.Static.Members)
AddPlayer(userId);
m_inviteButton.ButtonClicked += inviteButton_ButtonClicked;
m_kickButton.ButtonClicked += kickButton_ButtonClicked;
m_banButton.ButtonClicked += banButton_ButtonClicked;
m_lobbyTypeCombo.ItemSelected += lobbyTypeCombo_OnSelect;
Controls.Add(m_inviteButton);
Controls.Add(m_kickButton);
Controls.Add(m_banButton);
Controls.Add(m_playersTable);
Controls.Add(m_lobbyTypeCombo);
Controls.Add(m_maxPlayersSlider);
Controls.Add(maxPlayersLabel);
UpdateButtonsEnabledState();
}
示例8: CreatePropertiesPageControls
private void CreatePropertiesPageControls(MyGuiControlParent menuParent, MyGuiControlParent panelParent)
{
m_propertiesTableParent.Name = "PropertiesTable";
m_propertiesTopMenuParent.Name = "PropertiesTopMenu";
//Combobox on top of Terminal
var shipsInRange = new MyGuiControlCombobox()
{
Position = new Vector2(0,0f),
Size = new Vector2(0.25f, 0.10f),
Name = "ShipsInRange",
Visible = false,
OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
};
var selectShipButton = new MyGuiControlButton()
{
Position = new Vector2(0.27f, 0.0f),
Size = new Vector2(0.05f, 0.05f),
Name = "SelectShip",
Text = "...",
OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
VisualStyle = MyGuiControlButtonStyleEnum.Tiny,
};
selectShipButton.SetToolTip(MySpaceTexts.ScreenTerminal_ShipList);
menuParent.Controls.Add(shipsInRange);
menuParent.Controls.Add(selectShipButton);
//The panel itself
var shipsDataTable = new MyGuiControlTable()
{
Position = new Vector2(0.0f, 0.0f),
Size = new Vector2(0.88f, 0.78f),
Name = "ShipsData",
ColumnsCount = 3,
VisibleRowsCount = 16,
HeaderVisible = true,
OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP,
};
shipsDataTable.SetCustomColumnWidths(new float[] { 0.40f, 0.20f, 0.28f });
shipsDataTable.SetColumnName(0, new StringBuilder("Name"));
shipsDataTable.SetColumnName(1, new StringBuilder("Distance"));
shipsDataTable.SetColumnName(2, new StringBuilder("Status"));
shipsDataTable.SetColumnComparison(0, (a, b) => (a.Text).CompareTo(b.Text));
shipsDataTable.SetColumnComparison(1, (a, b) => ((float)a.UserData).CompareTo((float)b.UserData));
shipsDataTable.SetColumnComparison(2, (a, b) => ((Int32)a.UserData).CompareTo((Int32)b.UserData));
panelParent.Controls.Add(shipsDataTable);
panelParent.Visible = false;
}