本文整理汇总了C#中Sandbox.Graphics.GUI.MyGuiControlButton.SetToolTip方法的典型用法代码示例。如果您正苦于以下问题:C# MyGuiControlButton.SetToolTip方法的具体用法?C# MyGuiControlButton.SetToolTip怎么用?C# MyGuiControlButton.SetToolTip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sandbox.Graphics.GUI.MyGuiControlButton
的用法示例。
在下文中一共展示了MyGuiControlButton.SetToolTip方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: Init
public void Init(IMyGuiControlsParent controlsParent, MyPlayer controller, MyCubeGrid grid, MyTerminalBlock currentBlock, MyGridColorHelper colorHelper)
{
m_controlsParent = controlsParent;
m_controller = controller;
m_colorHelper = colorHelper;
if (grid == null)
{
foreach (var control in controlsParent.Controls)
control.Visible = false;
var label = MyGuiScreenTerminal.CreateErrorLabel(MySpaceTexts.ScreenTerminalError_ShipNotConnected, "ErrorMessage");
controlsParent.Controls.Add(label);
return;
}
m_terminalSystem = grid.GridSystems.TerminalSystem;
m_tmpGroup = new MyBlockGroup(grid);
m_blockSearch = (MyGuiControlTextbox)m_controlsParent.Controls.GetControlByName("FunctionalBlockSearch");
m_blockSearch.TextChanged += blockSearch_TextChanged;
m_blockSearchClear = (MyGuiControlButton)m_controlsParent.Controls.GetControlByName("FunctionalBlockSearchClear");
m_blockSearchClear.ButtonClicked += blockSearchClear_ButtonClicked;
m_blockListbox = (MyGuiControlListbox)m_controlsParent.Controls.GetControlByName("FunctionalBlockListbox");
m_blockNameLabel = (MyGuiControlLabel)m_controlsParent.Controls.GetControlByName("BlockNameLabel");
m_blockNameLabel.Text = "";
m_groupName = (MyGuiControlTextbox)m_controlsParent.Controls.GetControlByName("GroupName");
m_groupName.TextChanged += m_groupName_TextChanged;
m_showAll = (MyGuiControlButton)m_controlsParent.Controls.GetControlByName("ShowAll");
m_showAll.Selected = m_showAllTerminalBlocks;
m_showAll.ButtonClicked += showAll_Clicked;
m_showAll.SetToolTip(MySpaceTexts.Terminal_ShowAllInTerminal);
m_showAll.IconRotation = 0f;
m_showAll.Icon = new MyGuiHighlightTexture
{
Normal = @"Textures\GUI\Controls\button_hide.dds",
Highlight = @"Textures\GUI\Controls\button_unhide.dds",
SizePx = new Vector2(40f, 40f),
};
m_showAll.Size = new Vector2(0, 0);
m_showAll.HighlightType = MyGuiControlHighlightType.FORCED;
m_showAll.IconOriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
m_groupSave = (MyGuiControlButton)m_controlsParent.Controls.GetControlByName("GroupSave");
m_groupSave.TextEnum = MySpaceTexts.TerminalButton_GroupSave;
m_groupSave.TextAlignment = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER;
m_groupSave.ButtonClicked += groupSave_ButtonClicked;
m_groupDelete = (MyGuiControlButton)m_controlsParent.Controls.GetControlByName("GroupDelete");
m_groupDelete.ButtonClicked += groupDelete_ButtonClicked;
m_groupDelete.Enabled = false;
m_blockListbox.ItemsSelected += blockListbox_ItemSelected;
RefreshBlockList();
m_terminalSystem.BlockAdded += TerminalSystem_BlockAdded;
m_terminalSystem.BlockRemoved += TerminalSystem_BlockRemoved;
m_terminalSystem.GroupAdded += TerminalSystem_GroupAdded;
m_terminalSystem.GroupRemoved += TerminalSystem_GroupRemoved;
if (currentBlock != null)
SelectBlocks(new MyTerminalBlock[] { currentBlock });
}
示例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: BuildControls
protected virtual void BuildControls()
{
Vector2 buttonSize = MyGuiConstants.BACK_BUTTON_SIZE;
Vector2 buttonsOrigin = m_size.Value / 2 - new Vector2(0.23f, 0.03f);
if (m_isNewGame)
AddCaption(MyCommonTexts.ScreenCaptionCustomWorld);
else
AddCaption(MyCommonTexts.ScreenCaptionEditSettings);
int numControls = 0;
var nameLabel = MakeLabel(MyCommonTexts.Name);
var descriptionLabel = MakeLabel(MyCommonTexts.Description);
var gameModeLabel = MakeLabel(MyCommonTexts.WorldSettings_GameMode);
var onlineModeLabel = MakeLabel(MyCommonTexts.WorldSettings_OnlineMode);
m_maxPlayersLabel = MakeLabel(MyCommonTexts.MaxPlayers);
var environmentLabel = MakeLabel(MySpaceTexts.WorldSettings_EnvironmentHostility);
var scenarioLabel = MakeLabel(MySpaceTexts.WorldSettings_Scenario);
var soundModeLabel = MakeLabel(MySpaceTexts.WorldSettings_SoundMode);
float width = 0.284375f + 0.025f;
m_nameTextbox = new MyGuiControlTextbox(maxLength: MySession.MAX_NAME_LENGTH);
m_descriptionTextbox = new MyGuiControlTextbox(maxLength: MySession.MAX_DESCRIPTION_LENGTH);
m_onlineMode = new MyGuiControlCombobox(size: new Vector2(width, 0.04f));
m_environment = new MyGuiControlCombobox(size: new Vector2(width, 0.04f));
m_maxPlayersSlider = new MyGuiControlSlider(
position: Vector2.Zero,
width: m_onlineMode.Size.X,
minValue: 2,
maxValue: 16,
labelText: new StringBuilder("{0}").ToString(),
labelDecimalPlaces: 0,
labelSpaceWidth: 0.05f,
intValue: true
);
m_asteroidAmountLabel = MakeLabel(MySpaceTexts.Asteroid_Amount);
m_asteroidAmountCombo = new MyGuiControlCombobox(size: new Vector2(width, 0.04f));
m_asteroidAmountCombo.ItemSelected += m_asteroidAmountCombo_ItemSelected;
m_soundModeCombo = new MyGuiControlCombobox(size: new Vector2(width, 0.04f));
m_scenarioTypesList = new MyGuiControlList();
// Ok/Cancel
m_okButton = new MyGuiControlButton(position: buttonsOrigin - new Vector2(0.01f, 0f), size: buttonSize, text: MyTexts.Get(MyCommonTexts.Ok), onButtonClick: OnOkButtonClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
m_cancelButton = new MyGuiControlButton(position: buttonsOrigin + new Vector2(0.01f, 0f), size: buttonSize, text: MyTexts.Get(MyCommonTexts.Cancel), onButtonClick: OnCancelButtonClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM);
m_creativeModeButton = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Small, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MyCommonTexts.WorldSettings_GameModeCreative), onButtonClick: OnCreativeClick);
m_creativeModeButton.SetToolTip(MySpaceTexts.ToolTipWorldSettingsModeCreative);
m_survivalModeButton = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Small, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MyCommonTexts.WorldSettings_GameModeSurvival), onButtonClick: OnSurvivalClick);
m_survivalModeButton.SetToolTip(MySpaceTexts.ToolTipWorldSettingsModeSurvival);
m_onlineMode.ItemSelected += OnOnlineModeSelect;
m_onlineMode.AddItem((int)MyOnlineModeEnum.OFFLINE, MyCommonTexts.WorldSettings_OnlineModeOffline);
m_onlineMode.AddItem((int)MyOnlineModeEnum.PRIVATE, MyCommonTexts.WorldSettings_OnlineModePrivate);
m_onlineMode.AddItem((int)MyOnlineModeEnum.FRIENDS, MyCommonTexts.WorldSettings_OnlineModeFriends);
m_onlineMode.AddItem((int)MyOnlineModeEnum.PUBLIC, MyCommonTexts.WorldSettings_OnlineModePublic);
m_environment.AddItem((int)MyEnvironmentHostilityEnum.SAFE, MySpaceTexts.WorldSettings_EnvironmentHostilitySafe);
m_environment.AddItem((int)MyEnvironmentHostilityEnum.NORMAL, MySpaceTexts.WorldSettings_EnvironmentHostilityNormal);
m_environment.AddItem((int)MyEnvironmentHostilityEnum.CATACLYSM, MySpaceTexts.WorldSettings_EnvironmentHostilityCataclysm);
m_environment.AddItem((int)MyEnvironmentHostilityEnum.CATACLYSM_UNREAL, MySpaceTexts.WorldSettings_EnvironmentHostilityCataclysmUnreal);
m_environment.ItemSelected += HostilityChanged;
m_soundModeCombo.AddItem((int)MySoundModeEnum.Arcade, MySpaceTexts.WorldSettings_ArcadeSound);
m_soundModeCombo.AddItem((int)MySoundModeEnum.Realistic, MySpaceTexts.WorldSettings_RealisticSound);
if (m_isNewGame)
{
m_scenarioTypesGroup = new MyGuiControlRadioButtonGroup();
m_scenarioTypesGroup.SelectedChanged += scenario_SelectedChanged;
foreach (var scenario in MyDefinitionManager.Static.GetScenarioDefinitions())
{
if (!scenario.Public && !MyFakes.ENABLE_NON_PUBLIC_SCENARIOS)
continue;
var button = new MyGuiControlScenarioButton(scenario);
m_scenarioTypesGroup.Add(button);
m_scenarioTypesList.Controls.Add(button);
}
}
m_nameTextbox.SetToolTip(string.Format(MyTexts.GetString(MyCommonTexts.ToolTipWorldSettingsName), MySession.MIN_NAME_LENGTH, MySession.MAX_NAME_LENGTH));
m_descriptionTextbox.SetToolTip(MyTexts.GetString(MyCommonTexts.ToolTipWorldSettingsDescription));
m_environment.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettingsEnvironment));
m_onlineMode.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettingsOnlineMode));
m_maxPlayersSlider.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettingsMaxPlayer));
m_asteroidAmountCombo.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettingsAsteroidAmount));
m_soundModeCombo.SetToolTip(MyTexts.GetString(MySpaceTexts.ToolTipWorldSettingsSoundMode));
m_nameTextbox.TextChanged += m_nameTextbox_TextChanged;
m_soundModeCombo.ItemSelected += m_soundModeCombo_ItemSelected;
var advanced = new MyGuiControlButton(highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MySpaceTexts.WorldSettings_Advanced), onButtonClick: OnAdvancedClick);
//.........这里部分代码省略.........
示例5: Init
public void Init(IMyGuiControlsParent controlsParent, MyEntity thisEntity, MyEntity interactedEntity, MyGridColorHelper colorHelper)
{
ProfilerShort.Begin("MyGuiScreenTerminal.ControllerInventory.Init");
m_userAsEntity = thisEntity;
m_interactedAsEntity = interactedEntity;
m_colorHelper = colorHelper;
m_leftOwnersControl = (MyGuiControlList)controlsParent.Controls.GetControlByName("LeftInventory");
m_rightOwnersControl = (MyGuiControlList)controlsParent.Controls.GetControlByName("RightInventory");
m_leftSuitButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("LeftSuitButton");
m_leftGridButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("LeftGridButton");
m_leftFilterStorageButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("LeftFilterStorageButton");
m_leftFilterSystemButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("LeftFilterSystemButton");
m_leftFilterEnergyButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("LeftFilterEnergyButton");
m_leftFilterAllButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("LeftFilterAllButton");
m_rightSuitButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("RightSuitButton");
m_rightGridButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("RightGridButton");
m_rightFilterStorageButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("RightFilterStorageButton");
m_rightFilterSystemButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("RightFilterSystemButton");
m_rightFilterEnergyButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("RightFilterEnergyButton");
m_rightFilterAllButton = (MyGuiControlRadioButton)controlsParent.Controls.GetControlByName("RightFilterAllButton");
m_throwOutButton = (MyGuiControlButton)controlsParent.Controls.GetControlByName("ThrowOutButton");
m_hideEmptyLeft = (MyGuiControlCheckbox)controlsParent.Controls.GetControlByName("CheckboxHideEmptyLeft");
m_hideEmptyLeftLabel = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("LabelHideEmptyLeft");
m_hideEmptyRight = (MyGuiControlCheckbox)controlsParent.Controls.GetControlByName("CheckboxHideEmptyRight");
m_hideEmptyRightLabel = (MyGuiControlLabel)controlsParent.Controls.GetControlByName("LabelHideEmptyRight");
m_blockSearchLeft = (MyGuiControlTextbox)controlsParent.Controls.GetControlByName("BlockSearchLeft");
m_blockSearchClearLeft = (MyGuiControlButton)controlsParent.Controls.GetControlByName("BlockSearchClearLeft");
m_blockSearchRight = (MyGuiControlTextbox)controlsParent.Controls.GetControlByName("BlockSearchRight");
m_blockSearchClearRight = (MyGuiControlButton)controlsParent.Controls.GetControlByName("BlockSearchClearRight");
m_hideEmptyLeft.Visible = false;
m_hideEmptyLeftLabel.Visible = false;
m_hideEmptyRight.Visible = true;
m_hideEmptyRightLabel.Visible = true;
m_blockSearchLeft.Visible = false;
m_blockSearchClearLeft.Visible = false;
m_blockSearchRight.Visible = true;
m_blockSearchClearRight.Visible = true;
m_hideEmptyLeft.IsCheckedChanged += HideEmptyLeft_Checked;
m_hideEmptyRight.IsCheckedChanged += HideEmptyRight_Checked;
m_blockSearchLeft.TextChanged += BlockSearchLeft_TextChanged;
m_blockSearchClearLeft.ButtonClicked += BlockSearchClearLeft_ButtonClicked;
m_blockSearchRight.TextChanged += BlockSearchRight_TextChanged;
m_blockSearchClearRight.ButtonClicked += BlockSearchClearRight_ButtonClicked;
m_leftSuitButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_ShowCharacter);
m_leftGridButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_ShowConnected);
m_rightSuitButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_ShowInteracted);
m_rightGridButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_ShowConnected);
m_leftFilterAllButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_FilterAll);
m_leftFilterEnergyButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_FilterEnergy);
m_leftFilterStorageButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_FilterStorage);
m_leftFilterSystemButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_FilterSystem);
m_rightFilterAllButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_FilterAll);
m_rightFilterEnergyButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_FilterEnergy);
m_rightFilterStorageButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_FilterStorage);
m_rightFilterSystemButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_FilterSystem);
m_throwOutButton.SetToolTip(MySpaceTexts.ToolTipTerminalInventory_ThrowOut);
m_throwOutButton.CueEnum = GuiSounds.None;
m_leftTypeGroup.Add(m_leftSuitButton);
m_leftTypeGroup.Add(m_leftGridButton);
m_rightTypeGroup.Add(m_rightSuitButton);
m_rightTypeGroup.Add(m_rightGridButton);
m_leftFilterGroup.Add(m_leftFilterAllButton);
m_leftFilterGroup.Add(m_leftFilterEnergyButton);
m_leftFilterGroup.Add(m_leftFilterStorageButton);
m_leftFilterGroup.Add(m_leftFilterSystemButton);
m_rightFilterGroup.Add(m_rightFilterAllButton);
m_rightFilterGroup.Add(m_rightFilterEnergyButton);
m_rightFilterGroup.Add(m_rightFilterStorageButton);
m_rightFilterGroup.Add(m_rightFilterSystemButton);
m_throwOutButton.DrawCrossTextureWhenDisabled = false;
//m_throwOutButton.Enabled = false;
// initialize drag and drop
// maybe this requires screen?
m_dragAndDrop = new MyGuiControlGridDragAndDrop(MyGuiConstants.DRAG_AND_DROP_BACKGROUND_COLOR,
MyGuiConstants.DRAG_AND_DROP_TEXT_COLOR,
0.7f,
MyGuiConstants.DRAG_AND_DROP_TEXT_OFFSET, true);
controlsParent.Controls.Add(m_dragAndDrop);
m_dragAndDrop.DrawBackgroundTexture = false;
m_throwOutButton.ButtonClicked += throwOutButton_OnButtonClick;
m_dragAndDrop.ItemDropped += dragDrop_OnItemDropped;
//.........这里部分代码省略.........
示例6: 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;
//.........这里部分代码省略.........
示例7: 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;
}
示例8: MakeButton
private MyGuiControlButton MakeButton(Vector2 position, MyStringId text, Action<MyGuiControlButton> onClick, MyStringId? tooltip = null)
{
var button = new MyGuiControlButton(
position: position,
text: MyTexts.Get(text),
textScale: MyGuiConstants.MAIN_MENU_BUTTON_TEXT_SCALE,
onButtonClick: onClick,
implementedFeature: onClick != null,
originAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM);
if (tooltip.HasValue)
button.SetToolTip(MyTexts.GetString(tooltip.Value));
return button;
}
示例9: CreateInfoPageControls
private void CreateInfoPageControls(MyGuiControlTabPage infoPage)
{
infoPage.Name = "PageInfo";
infoPage.TextEnum = MySpaceTexts.TerminalTab_Info;
var list = new MyGuiControlList(new Vector2(-0.462f, -0.34f), new Vector2(0.35f, 0.69f));
//var list = new MyGuiControlMultilineText( new Vector2(-0.462f, -0.34f), new Vector2(0.35f,0.69f), null, MyFontEnum.White, 1, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, new StringBuilder());
list.Name = "InfoList";
list.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
infoPage.Controls.Add(list);
var convertBtn = new MyGuiControlButton();
convertBtn.Position = new Vector2(0f, 0.06f);
convertBtn.TextEnum = MySpaceTexts.TerminalTab_Info_ConvertButton;
convertBtn.SetToolTip(MySpaceTexts.TerminalTab_Info_ConvertButton_TT);
convertBtn.ShowTooltipWhenDisabled = true;
convertBtn.Name = "ConvertBtn";
infoPage.Controls.Add(convertBtn);
var convertToStationBtn = new MyGuiControlButton();
convertBtn.Position = new Vector2(0f, -0.06f);
convertToStationBtn.TextEnum = MySpaceTexts.TerminalTab_Info_ConvertToStationButton;
convertToStationBtn.SetToolTip(MySpaceTexts.TerminalTab_Info_ConvertToStationButton_TT);
convertToStationBtn.ShowTooltipWhenDisabled = true;
convertToStationBtn.Name = "ConvertToStationBtn";
convertToStationBtn.Visible = MySession.Static.EnableConvertToStation;
infoPage.Controls.Add(convertToStationBtn);
if (MyFakes.ENABLE_CENTER_OF_MASS)
{
var sep = new MyGuiControlSeparatorList();
sep.AddVertical(new Vector2(0.14f, -0.34f), 0.7f, 0.002f);
infoPage.Controls.Add(sep);
var centerBtnLabel = new MyGuiControlLabel(new Vector2(0.15f, -0.32f), text: MyTexts.GetString(MySpaceTexts.TerminalTab_Info_ShowMassCenter));
centerBtnLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
infoPage.Controls.Add(centerBtnLabel);
var centerBtn = new MyGuiControlCheckbox(new Vector2(0.45f, centerBtnLabel.Position.Y));
centerBtn.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER;
centerBtn.Name = "CenterBtn";
infoPage.Controls.Add(centerBtn);
}
var showGravityGizmoBtnLabel = new MyGuiControlLabel(new Vector2(0.15f, -0.27f), text: MyTexts.GetString(MySpaceTexts.TerminalTab_Info_ShowGravityGizmo));
showGravityGizmoBtnLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
infoPage.Controls.Add(showGravityGizmoBtnLabel);
var showGravityGizmoBtn = new MyGuiControlCheckbox(new Vector2(0.45f, showGravityGizmoBtnLabel.Position.Y));
showGravityGizmoBtn.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER;
showGravityGizmoBtn.Name = "ShowGravityGizmo";
infoPage.Controls.Add(showGravityGizmoBtn);
var showSenzorGizmoBtnLabel = new MyGuiControlLabel(new Vector2(0.15f, -0.22f), text: MyTexts.GetString(MySpaceTexts.TerminalTab_Info_ShowSenzorGizmo));
showSenzorGizmoBtnLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
infoPage.Controls.Add(showSenzorGizmoBtnLabel);
var showSenzorGizmoBtn = new MyGuiControlCheckbox(new Vector2(0.45f, showSenzorGizmoBtnLabel.Position.Y));
showSenzorGizmoBtn.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER;
showSenzorGizmoBtn.Name = "ShowSenzorGizmo";
infoPage.Controls.Add(showSenzorGizmoBtn);
var showAntenaGizmoBtnLabel = new MyGuiControlLabel(new Vector2(0.15f, -0.17f), text: MyTexts.GetString(MySpaceTexts.TerminalTab_Info_ShowAntenaGizmo));
showAntenaGizmoBtnLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
infoPage.Controls.Add(showAntenaGizmoBtnLabel);
var showAntenaGizmoBtn = new MyGuiControlCheckbox(new Vector2(0.45f, showAntenaGizmoBtnLabel.Position.Y));
showAntenaGizmoBtn.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER;
showAntenaGizmoBtn.Name = "ShowAntenaGizmo";
infoPage.Controls.Add(showAntenaGizmoBtn);
CreateAntennaSlider(infoPage, MyTexts.GetString(MySpaceTexts.TerminalTab_Info_FriendlyAntennaRange),"FriendAntennaRange",-0.13f);
CreateAntennaSlider(infoPage, MyTexts.GetString(MySpaceTexts.TerminalTab_Info_EnemyAntennaRange), "EnemyAntennaRange", -0.01f);
CreateAntennaSlider(infoPage, MyTexts.GetString(MySpaceTexts.TerminalTab_Info_OwnedAntennaRange), "OwnedAntennaRange", 0.11f);
var pivotBtnLabel = new MyGuiControlLabel(new Vector2(0.15f, 0.23f), text: MyTexts.GetString(MySpaceTexts.TerminalTab_Info_PivotBtn));
pivotBtnLabel.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER;
infoPage.Controls.Add(pivotBtnLabel);
var pivotBtn = new MyGuiControlCheckbox(new Vector2(0.45f, pivotBtnLabel.Position.Y));
pivotBtn.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER;
pivotBtn.Name = "PivotBtn";
infoPage.Controls.Add(pivotBtn);
if (MyFakes.ENABLE_TERMINAL_PROPERTIES)
{
var nameLabel = new MyGuiControlLabel()
{
Name = "RenameShipLabel",
Text = "Ship Name",
Position = new Vector2(0.15f, 0.26f)
};
var nameTextBox = new MyGuiControlTextbox()
{
Name = "RenameShipText",
Position = new Vector2(0.25f, 0.3f),
Size = new Vector2(0.2f, 0.005f)
};
//.........这里部分代码省略.........
示例10: BuildControls
//.........这里部分代码省略.........
labelText: new StringBuilder("{0}").ToString(),
labelDecimalPlaces: 0,
labelSpaceWidth: 0.05f,
intValue: true
);
m_maxFloatingObjectsSlider = new MyGuiControlSlider(
position: Vector2.Zero,
width: m_onlineMode.Size.X,
minValue: 16,
maxValue: 1024,
labelText: new StringBuilder("{0}").ToString(),
labelDecimalPlaces: 0,
labelSpaceWidth: 0.05f,
intValue: true
);
m_startInRespawnScreen = new MyGuiControlCheckbox();
m_enableVoxelDestruction = new MyGuiControlCheckbox();
m_trashRemoval = new MyGuiControlCheckbox();
m_respawnShipDelete = new MyGuiControlCheckbox();
m_worldSizeCombo = new MyGuiControlCombobox(size: new Vector2(width, 0.04f));
m_soundModeCombo = new MyGuiControlCombobox(size: new Vector2(width, 0.04f));
m_spawnShipTimeCombo = new MyGuiControlCombobox(size: new Vector2(width, 0.04f));
m_viewDistanceCombo = new MyGuiControlCombobox(size: new Vector2(width, 0.04f));
m_physicsOptionsCombo = new MyGuiControlCombobox(size: new Vector2(width, 0.04f));
// Ok/Cancel
m_okButton = new MyGuiControlButton(position: buttonsOrigin - new Vector2(0.01f, 0f), size: buttonSize, text: MyTexts.Get(MySpaceTexts.Ok), onButtonClick: OkButtonClicked, originAlign: MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM);
m_cancelButton = new MyGuiControlButton(position: buttonsOrigin + new Vector2(0.01f, 0f), size: buttonSize, text: MyTexts.Get(MySpaceTexts.Cancel), onButtonClick: CancelButtonClicked, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM);
m_creativeModeButton = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Small, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MySpaceTexts.WorldSettings_GameModeCreative), onButtonClick: CreativeClicked);
m_creativeModeButton.SetToolTip(MySpaceTexts.ToolTipWorldSettingsModeCreative);
m_survivalModeButton = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Small, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MySpaceTexts.WorldSettings_GameModeSurvival), onButtonClick: SurvivalClicked);
m_survivalModeButton.SetToolTip(MySpaceTexts.ToolTipWorldSettingsModeSurvival);
m_inventory_x1 = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Small, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MySpaceTexts.WorldSettings_Realistic), onButtonClick: OnInventoryClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
m_inventory_x3 = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Tiny, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MySpaceTexts.WorldSettings_Realistic_x3), onButtonClick: OnInventoryClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
m_inventory_x10 = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Tiny, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MySpaceTexts.WorldSettings_Realistic_x10), onButtonClick: OnInventoryClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
m_inventory_x1.UserData = 1.0f;
m_inventory_x3.UserData = 3.0f;
m_inventory_x10.UserData = 10.0f;
m_inventory_x1.SetToolTip(MySpaceTexts.ToolTipWorldSettings_Inventory_x1);
m_inventory_x3.SetToolTip(MySpaceTexts.ToolTipWorldSettings_Inventory_x3);
m_inventory_x10.SetToolTip(MySpaceTexts.ToolTipWorldSettings_Inventory_x10);
m_assembler_x1 = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Small, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MySpaceTexts.WorldSettings_Realistic), onButtonClick: OnAssemblerClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
m_assembler_x3 = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Tiny, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MySpaceTexts.WorldSettings_Realistic_x3), onButtonClick: OnAssemblerClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
m_assembler_x10 = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Tiny, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MySpaceTexts.WorldSettings_Realistic_x10), onButtonClick: OnAssemblerClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
m_assembler_x1.UserData = 1.0f;
m_assembler_x3.UserData = 3.0f;
m_assembler_x10.UserData = 10.0f;
m_assembler_x1.SetToolTip(MySpaceTexts.ToolTipWorldSettings_Assembler_x1);
m_assembler_x3.SetToolTip(MySpaceTexts.ToolTipWorldSettings_Assembler_x3);
m_assembler_x10.SetToolTip(MySpaceTexts.ToolTipWorldSettings_Assembler_x10);
m_refinery_x1 = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Small, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MySpaceTexts.WorldSettings_Realistic), onButtonClick: OnRefineryClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
m_refinery_x3 = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Tiny, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MySpaceTexts.WorldSettings_Realistic_x3), onButtonClick: OnRefineryClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
m_refinery_x10 = new MyGuiControlButton(visualStyle: MyGuiControlButtonStyleEnum.Tiny, highlightType: MyGuiControlHighlightType.WHEN_ACTIVE, text: MyTexts.Get(MySpaceTexts.WorldSettings_Realistic_x10), onButtonClick: OnRefineryClick, originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER);
m_refinery_x1.UserData = 1.0f;
m_refinery_x3.UserData = 3.0f;
m_refinery_x10.UserData = 10.0f;
m_refinery_x1.SetToolTip(MySpaceTexts.ToolTipWorldSettings_Refinery_x1);
m_refinery_x3.SetToolTip(MySpaceTexts.ToolTipWorldSettings_Refinery_x3);
m_refinery_x10.SetToolTip(MySpaceTexts.ToolTipWorldSettings_Refinery_x10);