本文整理汇总了C#中Sandbox.Graphics.GUI.MyGuiControlTable类的典型用法代码示例。如果您正苦于以下问题:C# MyGuiControlTable类的具体用法?C# MyGuiControlTable怎么用?C# MyGuiControlTable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MyGuiControlTable类属于Sandbox.Graphics.GUI命名空间,在下文中一共展示了MyGuiControlTable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: CreateScenarioTable
protected override Graphics.GUI.MyGuiControlTable CreateScenarioTable()
{
var scenarioTable = new MyGuiControlTable();
scenarioTable.Position = new Vector2(-0.42f, -0.435f + MARGIN_TOP);
scenarioTable.Size = new Vector2(0.38f, 1.8f);
scenarioTable.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
scenarioTable.VisibleRowsCount = 18;
scenarioTable.ColumnsCount = 2;
scenarioTable.SetCustomColumnWidths(new float[] { 0.085f, 0.905f });
scenarioTable.SetColumnName(1, MyTexts.Get(MyCommonTexts.Name));
scenarioTable.ItemSelected += OnTableItemSelected;
return scenarioTable;
}
示例3: MyGuiScreenTriggerBlockDestroyed
public MyGuiScreenTriggerBlockDestroyed(MyTrigger trig) : base(trig,new Vector2(0.5f,0.8f))
{
trigger=(MyTriggerBlockDestroyed)trig;
AddCaption(MySpaceTexts.GuiTriggerCaptionBlockDestroyed);
var layout = new MyLayoutTable(this);
layout.SetColumnWidthsNormalized(10, 30, 3, 30, 10);
layout.SetRowHeightsNormalized(20, 35, 6, 4, 4, 5, 33);
m_selectedBlocks = new MyGuiControlTable();
m_selectedBlocks.VisibleRowsCount = 8;
m_selectedBlocks.ColumnsCount = 1;
m_selectedBlocks.SetCustomColumnWidths(new float[]{1});
m_selectedBlocks.SetColumnName(0, MyTexts.Get(MySpaceTexts.GuiTriggerBlockDestroyed_ColumnName));
layout.AddWithSize(m_selectedBlocks, MyAlignH.Left, MyAlignV.Top, 1, 1, rowSpan: 1, colSpan: 3);
m_buttonPaste = new MyGuiControlButton(
text: MyTexts.Get(MySpaceTexts.GuiTriggerPasteBlocks),
visualStyle: MyGuiControlButtonStyleEnum.Rectangular,
onButtonClick: OnPasteButtonClick
);
m_buttonPaste.SetToolTip(MySpaceTexts.GuiTriggerPasteBlocksTooltip);
layout.AddWithSize(m_buttonPaste, MyAlignH.Left, MyAlignV.Top, 2, 1, rowSpan: 1, colSpan: 1);
m_buttonDelete = new MyGuiControlButton(
text: MyTexts.Get(MySpaceTexts.GuiTriggerDeleteBlocks),
visualStyle: MyGuiControlButtonStyleEnum.Rectangular,
onButtonClick: OnDeleteButtonClick);
layout.AddWithSize(m_buttonDelete, MyAlignH.Left, MyAlignV.Top, 2, 3, rowSpan: 1, colSpan: 1);
m_labelSingleMessage = new MyGuiControlLabel(
text: MyTexts.Get(MySpaceTexts.GuiTriggerBlockDestroyedSingleMessage).ToString()
);
layout.AddWithSize(m_labelSingleMessage, MyAlignH.Left, MyAlignV.Top, 3, 1, rowSpan: 1, colSpan: 1);
m_textboxSingleMessage = new MyGuiControlTextbox(
defaultText: trigger.SingleMessage,
maxLength: 85);
layout.AddWithSize(m_textboxSingleMessage, MyAlignH.Left, MyAlignV.Top, 4, 1, rowSpan: 1, colSpan: 3);
foreach(var block in trigger.Blocks)
AddRow(block.Key);
m_tempSb.Clear().Append(trigger.SingleMessage);
m_textboxSingleMessage.SetText(m_tempSb);
}
示例4: 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;
}
示例5: OnTableDoubleclick
private void OnTableDoubleclick(MyGuiControlTable sender, Sandbox.Graphics.GUI.MyGuiControlTable.EventArgs args)
{
if (sender.SelectedRow != null)
{
((MyGps)sender.SelectedRow.UserData).ShowOnHud ^= true;
MySession.Static.Gpss.ChangeShowOnHud(MySession.LocalPlayerId, ((MyGps)sender.SelectedRow.UserData).Hash, ((MyGps)sender.SelectedRow.UserData).ShowOnHud);
}
}
示例6: Init
public void Init(MyGuiControlParent menuParent, MyGuiControlParent panelParent, MyEntity interactedEntity, MyEntity openInventoryInteractedEntity)
{
m_interactedEntityRepresentative = GetInteractedEntityRepresentative(interactedEntity);
m_openInventoryInteractedEntityRepresentative = GetInteractedEntityRepresentative(openInventoryInteractedEntity);
if(menuParent == null) MySandboxGame.Log.WriteLine("menuParent is null");
if(panelParent == null) MySandboxGame.Log.WriteLine("panelParent is null");
if (menuParent == null || panelParent == null)
return;
m_shipsInRange = (MyGuiControlCombobox)menuParent.Controls.GetControlByName("ShipsInRange");
m_button = (MyGuiControlButton)menuParent.Controls.GetControlByName("SelectShip");
m_shipsData = (MyGuiControlTable)panelParent.Controls.GetControlByName("ShipsData");
//sort by status by default
m_columnToSort = 2;
m_button.ButtonClicked += Menu_ButtonClicked;
m_shipsData.ItemDoubleClicked += shipsData_ItemDoubleClicked;
m_shipsData.ColumnClicked += shipsData_ColumnClicked;
m_shipsInRange.ItemSelected += shipsInRange_ItemSelected;
Refresh();
}
示例7: OnTableItemSelected
private void OnTableItemSelected(MyGuiControlTable sender, Sandbox.Graphics.GUI.MyGuiControlTable.EventArgs args)
{
trySync();
if (sender.SelectedRow != null)
{
enableEditBoxes(true);
m_buttonDelete.Enabled = true;
FillRight((MyGps)sender.SelectedRow.UserData);
}
else
{
enableEditBoxes(false);
m_buttonDelete.Enabled = false;
ClearRight();
}
}
示例8: OnTableItemSelected
private void OnTableItemSelected(MyGuiControlTable sender, MyGuiControlTable.EventArgs eventArgs)
{
m_selectedRow = sender.SelectedRow;
m_selectedTable = sender;
if (sender == m_modsTableEnabled)
m_modsTableDisabled.SelectedRowIndex = null;
if (sender == m_modsTableDisabled)
m_modsTableEnabled.SelectedRowIndex = null;
if (MyInput.Static.IsAnyCtrlKeyPressed())
OnTableItemConfirmedOrDoubleClick(sender, eventArgs);
}
示例9: RefreshGameList
//.........这里部分代码省略.........
title.Append(subscribedItem.Title);
var shortLen = Math.Min(subscribedItem.Description.Length, 128);
var newlineIndex = subscribedItem.Description.IndexOf("\n");
if (newlineIndex > 0)
shortLen = Math.Min(shortLen, newlineIndex - 1);
toolTip.Append(subscribedItem.Description.Substring(0, shortLen));
}
else
{
title.Append(mod.PublishedFileId.ToString());
toolTip = MyTexts.Get(MySpaceTexts.ScreenMods_MissingDetails);
textColor = MyHudConstants.MARKER_COLOR_RED;
}
MyGuiHighlightTexture icon = MyGuiConstants.TEXTURE_ICON_MODS_WORKSHOP;
AddMod(true, title, toolTip, modState, icon, mod, textColor);
}
}
if (!Directory.Exists(MyFileSystem.ModsPath))
Directory.CreateDirectory(MyFileSystem.ModsPath);
foreach (var modFullPath in Directory.GetDirectories(MyFileSystem.ModsPath, "*", SearchOption.TopDirectoryOnly))
{
var modName = Path.GetFileName(modFullPath);
if (m_worldLocalMods.Contains(modName))
continue;
if (Directory.GetFileSystemEntries(modFullPath).Length == 0)
continue;
if (MyFakes.ENABLE_MOD_CATEGORIES)
{
if (!CheckSearch(modName))
continue;
}
var titleSB = new StringBuilder(modName);
var descriptionSB = modFullPath;
var modStateSB = MyTexts.GetString(MySpaceTexts.ScreenMods_LocalMod);
var publishedFileId = MySteamWorkshop.GetWorkshopIdFromLocalMod(modFullPath);
MyGuiHighlightTexture icon = MyGuiConstants.TEXTURE_ICON_MODS_LOCAL;
var row = new MyGuiControlTable.Row(new MyObjectBuilder_Checkpoint.ModItem(modName, 0));
row.AddCell(new MyGuiControlTable.Cell(text: new StringBuilder(), toolTip: modStateSB, icon: icon));
row.AddCell(new MyGuiControlTable.Cell(text: titleSB, toolTip: descriptionSB));
m_modsTableDisabled.Add(row);
}
if (m_subscribedMods != null)
{
foreach (var mod in m_subscribedMods)
{
if (m_worldWorkshopMods.Contains(mod.PublishedFileId))
continue;
if (MyFakes.ENABLE_MOD_CATEGORIES)
{
bool add = false;
foreach (var tag in mod.Tags)
{
if (m_selectedCategories.Contains(tag.ToLower()) || m_selectedCategories.Count == 0)
{
add = true;
break;
}
}
if (!CheckSearch(mod.Title))
continue;
if (!add)
continue;
}
var titleSB = new StringBuilder(mod.Title);
var shortLen = Math.Min(mod.Description.Length, 128);
var newlineIndex = mod.Description.IndexOf("\n");
if (newlineIndex > 0)
shortLen = Math.Min(shortLen, newlineIndex - 1);
var descriptionSB = new StringBuilder();
var modStateSB = MyTexts.GetString(MySpaceTexts.ScreenMods_WorkshopMod);
var path = Path.Combine(MyFileSystem.ModsPath, string.Format("{0}.sbm", mod.PublishedFileId));
if (mod.Description.Length != 0)
descriptionSB.AppendLine(path);
else
descriptionSB.Append(path);
descriptionSB.Append(mod.Description.Substring(0, shortLen));
MyGuiHighlightTexture icon = MyGuiConstants.TEXTURE_ICON_MODS_WORKSHOP;
var row = new MyGuiControlTable.Row(new MyObjectBuilder_Checkpoint.ModItem(null, mod.PublishedFileId));
row.AddCell(new MyGuiControlTable.Cell(text: new StringBuilder(), toolTip: modStateSB, icon: icon));
row.AddCell(new MyGuiControlTable.Cell(text: titleSB, toolTip: descriptionSB.ToString()));
m_modsTableDisabled.Add(row);
}
}
}
示例10: OnServerTableItemDoubleClick
private void OnServerTableItemDoubleClick(MyGuiControlTable sender, MyGuiControlTable.EventArgs eventArgs)
{
JoinSelectedServer();
}
示例11: 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);
//.........这里部分代码省略.........
示例12: OnTableItemSelected
private void OnTableItemSelected(MyGuiControlTable sender, MyGuiControlTable.EventArgs eventArgs)
{
if (m_gamesTable.SelectedRow != null)
{
m_joinButton.Enabled = true;
}
else
{
m_joinButton.Enabled = false;
}
}
示例13: OnTableItemSelected
void OnTableItemSelected(MyGuiControlTable sender, MyGuiControlTable.EventArgs eventArgs)
{
m_selectedRow = eventArgs.RowIndex;
FillRight();
}
示例14: FindSave
private Tuple<string, MyWorldInfo> FindSave(MyGuiControlTable.Row row)
{
string savePath = (string)row.UserData;
var entry = m_availableSaves.Find((x) => x.Item1 == savePath);
return entry;
}
示例15: BuildControls
//.........这里部分代码省略.........
m_onlineMode.AddItem((int)MyOnlineModeEnum.OFFLINE, MySpaceTexts.WorldSettings_OnlineModeOffline);
m_onlineMode.AddItem((int)MyOnlineModeEnum.PRIVATE, MySpaceTexts.WorldSettings_OnlineModePrivate);
m_onlineMode.AddItem((int)MyOnlineModeEnum.FRIENDS, MySpaceTexts.WorldSettings_OnlineModeFriends);
m_onlineMode.AddItem((int)MyOnlineModeEnum.PUBLIC, MySpaceTexts.WorldSettings_OnlineModePublic);
m_nameTextbox.TextChanged += m_nameTextbox_TextChanged;
// Add controls in pairs; label first, control second. They will be laid out automatically this way.
Controls.Add(nameLabel);
Controls.Add(m_nameTextbox);
//m_nameTextbox.Enabled = false;
Controls.Add(descriptionLabel);
Controls.Add(m_descriptionTextbox);
//m_descriptionTextbox.Enabled = false;
Controls.Add(difficultyLabel);
Controls.Add(m_difficultyCombo);
m_difficultyCombo.Enabled = false;
Controls.Add(onlineModeLabel);
Controls.Add(m_onlineMode);
m_onlineMode.Enabled = false;
Controls.Add(m_maxPlayersLabel);
Controls.Add(m_maxPlayersSlider);
float labelSize = 0.12f;
float MARGIN_TOP = 0.1f;
float MARGIN_LEFT = 0.42f;// m_isNewGame ? 0.315f : 0.08f;
// Automatic layout.
Vector2 originL, originC;
Vector2 controlsDelta = new Vector2(0f, 0.052f);
float rightColumnOffset;
originL = -m_size.Value / 2 + new Vector2(MARGIN_LEFT, MARGIN_TOP);
originC = originL + new Vector2(labelSize, 0f);
rightColumnOffset = originC.X + m_onlineMode.Size.X - labelSize - 0.017f;
foreach (var control in Controls)
{
control.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
if (control is MyGuiControlLabel)
control.Position = originL + controlsDelta * numControls;
else
control.Position = originC + controlsDelta * numControls++;
}
//BRIEFING:
//var textBackgroundPanel = AddCompositePanel(MyGuiConstants.TEXTURE_RECTANGLE_DARK, new Vector2(0f,0f), new Vector2(0.43f, 0.422f), MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP);
//textBackgroundPanel.InnerHeight = 6;
MyGuiControlParent briefing = new MyGuiControlParent();//new Vector2(0f, 0f), new Vector2(0.43f, 0.422f));
var briefingScrollableArea = new MyGuiControlScrollablePanel(
scrolledControl: briefing)
{
Name = "BriefingScrollableArea",
ScrollbarVEnabled = true,
Position = new Vector2(-0.02f, -0.12f),
Size = new Vector2(0.43f, 0.422f),
OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
BackgroundTexture = MyGuiConstants.TEXTURE_SCROLLABLE_LIST,
ScrolledAreaPadding = new MyGuiBorderThickness(0.005f),
};
Controls.Add(briefingScrollableArea);
//inside scrollable area:
m_descriptionBox = AddMultilineText(offset: new Vector2(0.0f, 0.0f), size: new Vector2(1f, 1f), selectable: false);
briefing.Controls.Add(m_descriptionBox);
//LEFT:
m_scenarioTable = new MyGuiControlTable();
m_scenarioTable.Position = new Vector2(-0.42f, -0.5f+MARGIN_TOP);
m_scenarioTable.Size = new Vector2(0.38f, 1.8f);
m_scenarioTable.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
m_scenarioTable.VisibleRowsCount = 20;
m_scenarioTable.ColumnsCount = 2;
m_scenarioTable.SetCustomColumnWidths(new float[] { 0.085f, 0.905f });
m_scenarioTable.SetColumnName(1, MyTexts.Get(MySpaceTexts.Name));
m_scenarioTable.ItemSelected += OnTableItemSelected;
//m_scenarioTable.ItemDoubleClicked += OnTableItemConfirmedOrDoubleClick;
//m_scenarioTable.ItemConfirmed += OnTableItemConfirmedOrDoubleClick;
Controls.Add(m_scenarioTable);
//BUTTONS:
Controls.Add(m_removeButton);
m_removeButton.Enabled = false;
Controls.Add(m_publishButton);
m_publishButton.Enabled = false;
Controls.Add(m_createButton);
m_createButton.Enabled = false;
Controls.Add(m_browseWorkshopButton);
m_browseWorkshopButton.Enabled = false;
Controls.Add(m_refreshButton);
Controls.Add(m_openInWorkshopButton);
m_openInWorkshopButton.Enabled = false;
Controls.Add(m_okButton);
Controls.Add(m_cancelButton);
CloseButtonEnabled = true;
SetDefaultValues();
}