本文整理汇总了C#中MyGuiControlBase类的典型用法代码示例。如果您正苦于以下问题:C# MyGuiControlBase类的具体用法?C# MyGuiControlBase怎么用?C# MyGuiControlBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MyGuiControlBase类属于命名空间,在下文中一共展示了MyGuiControlBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Add
public void Add(MyGuiControlBase leftControl, MyGuiControlBase rightControl)
{
var verticalSize = Math.Max(leftControl.Size.Y, rightControl.Size.Y);
AddInternal(leftControl, MyAlignH.Left, MyAlignV.Center, false, verticalSize);
AddInternal(rightControl, MyAlignH.Right, MyAlignV.Center, false, verticalSize);
m_currentPosY += verticalSize;
}
示例2: GetNextFocusControl
public override MyGuiControlBase GetNextFocusControl(MyGuiControlBase currentFocusControl, bool forwardMovement)
{
if (HasFocus)
return Owner.GetNextFocusControl(this, forwardMovement);
else
return this;
}
示例3: ValueChanged
protected override void ValueChanged(MyGuiControlBase sender)
{
base.ValueChanged(sender);
MyRenderProxy.UpdateRenderQuality(
MyRenderConstants.RenderQualityProfile.RenderQuality,
MyRenderConstants.RenderQualityProfile.EnableCascadeBlending);
}
示例4: MyRichLabel
public MyRichLabel(MyGuiControlBase parent, float maxLineWidth, float minLineHeight, int? linesCountMax = null)
{
m_parent = parent;
m_maxLineWidth = maxLineWidth;
m_minLineHeight = minLineHeight;
m_helperSb = new StringBuilder(256);
m_visibleLinesCount = linesCountMax == null ? int.MaxValue : linesCountMax.Value;
Init();
}
示例5: ValueChanged
protected override void ValueChanged(MyGuiControlBase sender)
{
var settings = new MyRenderFogSettings()
{
FogMultiplier = MySector.FogProperties.FogMultiplier,
FogColor = MySector.FogProperties.FogColor,
FogDensity = MySector.FogProperties.FogDensity
};
MyRenderProxy.UpdateFogSettings(ref settings);
MyRenderProxy.SetSettingsDirty();
}
示例6: AddInternal
private void AddInternal(MyGuiControlBase control, MyAlignH alignH, MyAlignV alignV, bool advance, float verticalSize)
{
control.OriginAlign = (MyGuiDrawAlignEnum)(3 * (int)alignH + (int)alignV);
int alignHSign = (-1 + (int)alignH);
var offsetV = verticalSize * 0.5f * (int)alignV;
control.Position = new Vector2(
alignHSign * (0.5f * m_parentSize.X - m_horizontalPadding),
m_currentPosY + offsetV);
m_currentPosY += (advance) ? (verticalSize - offsetV) : 0f;
m_parent.Controls.Add(control);
}
示例7: Add
public void Add(MyGuiControlBase control, MyAlignH alignH, MyAlignV alignV, int row, int col, int rowSpan = 1, int colSpan = 1)
{
var min = new Vector2(m_prefixScanX[col], m_prefixScanY[row]);
var max = new Vector2(m_prefixScanX[col + colSpan], m_prefixScanY[row + rowSpan]);
var size = max - min;
control.Position = new Vector2(
min.X + size.X * 0.5f * (int)alignH,
min.Y + size.Y * 0.5f * (int)alignV);
control.OriginAlign = (MyGuiDrawAlignEnum)(3 * (int)alignH + (int)alignV);
m_parent.Controls.Add(control);
}
示例8: MyScrollbar
protected MyScrollbar(MyGuiControlBase control,
MyGuiCompositeTexture normalTexture,
MyGuiCompositeTexture highlightTexture,
MyGuiCompositeTexture backgroundTexture)
{
OwnerControl = control;
m_normalTexture = normalTexture;
m_highlightTexture = highlightTexture;
m_backgroundTexture = backgroundTexture;
RefreshInternals();
}
示例9: ValueChanged
protected override void ValueChanged(MyGuiControlBase sender)
{
base.ValueChanged(sender);
VRageRender.MyRenderProxy.UpdateHDRSettings(
MyPostProcessHDR.DebugHDRChecked,
MyPostProcessHDR.Exposure,
MyPostProcessHDR.Threshold,
MyPostProcessHDR.BloomIntensity,
MyPostProcessHDR.BloomIntensityBackground,
MyPostProcessHDR.VerticalBlurAmount,
MyPostProcessHDR.HorizontalBlurAmount,
(int)MyPostProcessHDR.NumberOfBlurPasses
);
}
示例10: MyGuiControlBlockProperty
public MyGuiControlBlockProperty(String title, String tooltip, MyGuiControlBase propertyControl,
MyGuiControlBlockPropertyLayoutEnum layout = MyGuiControlBlockPropertyLayoutEnum.Vertical, bool showExtraInfo = true)
: base(toolTip: tooltip, canHaveFocus: true, isActiveControl: false, allowFocusingElements: true)
{
const float LABEL_TEXT_SCALE = MyGuiConstants.DEFAULT_TEXT_SCALE * 0.95f;
m_title = new MyGuiControlLabel(text: title, textScale: LABEL_TEXT_SCALE);
if (title.Length > 0)
{
Elements.Add(m_title);
}
m_extraInfo = new MyGuiControlLabel(textScale: LABEL_TEXT_SCALE);
if (showExtraInfo)
{
Elements.Add(m_extraInfo);
}
m_propertyControl = propertyControl;
Elements.Add(m_propertyControl);
titleHeight = title.Length > 0 || showExtraInfo ? m_title.Size.Y : 0;
m_layout = layout;
switch (layout)
{
case MyGuiControlBlockPropertyLayoutEnum.Horizontal:
MinSize = new Vector2(m_propertyControl.Size.X + m_title.Size.X * 1.1f, Math.Max(m_propertyControl.Size.Y, 2.1f * titleHeight));
Size = MinSize;
m_title.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
m_propertyControl.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP;
m_extraInfo.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
break;
case MyGuiControlBlockPropertyLayoutEnum.Vertical:
MinSize = new Vector2(Math.Max(m_propertyControl.Size.X, m_title.Size.X), m_propertyControl.Size.Y + titleHeight * 1.1f);
Size = MinSize;
m_title.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
m_propertyControl.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
m_extraInfo.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP;
break;
}
RefreshPositionsAndSizes();
m_extraInfo.Text = "";
m_extraInfo.Visible = false;
}
示例11: ValueChanged
protected override void ValueChanged(MyGuiControlBase sender)
{
base.ValueChanged(sender);
VRageRender.MyRenderProxy.UpdateAntiAliasSettings(
MyPostProcessAntiAlias.Enabled
);
VRageRender.MyRenderProxy.UpdateFogSettings(
MySector.FogProperties.EnableFog,
MySector.FogProperties.FogNear,
MySector.FogProperties.FogFar,
MySector.FogProperties.FogMultiplier,
MySector.FogProperties.FogBacklightMultiplier,
MySector.FogProperties.FogColor);
}
示例12: ValueChanged
protected override void ValueChanged(MyGuiControlBase sender)
{
base.ValueChanged(sender);
}
示例13: inventoryControl_SizeChanged
private void inventoryControl_SizeChanged(MyGuiControlBase obj)
{
((MyGuiControlList)obj.Owner).Recalculate();
}
示例14: HandleTextInputBuffered
private void HandleTextInputBuffered(ref MyGuiControlBase ret)
{
const char BACKSPACE = '\b';
bool textChanged = false;
foreach (var character in MyInput.Static.TextInput)
{
if (IsSkipCharacter((MyKeys)character))
continue;
if (Char.IsControl(character))
{
if (character == BACKSPACE)
{
if (m_selection.Length == 0)
ApplyBackspace();
else
m_selection.EraseText(this);
textChanged = true;
}
}
else
{
if (m_selection.Length > 0)
m_selection.EraseText(this);
InsertChar(character);
textChanged = true;
}
}
// Unbuffered Delete because it's not delivered as a message through Win32 message loop.
if (m_keyThrottler.GetKeyStatus(MyKeys.Delete) == ThrottledKeyStatus.PRESSED_AND_READY)
{
if (m_selection.Length == 0)
ApplyDelete();
else
m_selection.EraseText(this);
textChanged = true;
}
if (textChanged)
{
OnTextChanged();
ret = this;
}
}
示例15: HandleNewMousePress
private void HandleNewMousePress(ref MyGuiControlBase captureInput)
{
bool cursorInItems = m_itemsRectangle.Contains(MyGuiManager.MouseCursorPosition);
if (MyInput.Static.IsNewPrimaryButtonReleased() || MyInput.Static.IsNewSecondaryButtonReleased())
{
if (cursorInItems)
{
int? mouseOverIndex = ComputeIndex(MyGuiManager.MouseCursorPosition);
if (!IsValidIndex(mouseOverIndex.Value))
mouseOverIndex = null;
SelectMouseOverItem(mouseOverIndex);
if (SelectedIndex.HasValue && m_itemClicked.HasValue && m_lastClick.HasValue && mouseOverIndex.HasValue)
{
if (MyGuiManager.TotalTimeInMilliseconds - m_lastClick.Value < MyGuiConstants.CLICK_RELEASE_DELAY && m_itemClicked.Value.ItemIndex == mouseOverIndex.Value)
{
captureInput = this;
MySharedButtonsEnum button = MySharedButtonsEnum.None;
if (MyInput.Static.IsNewPrimaryButtonReleased())
button = MySharedButtonsEnum.Primary;
else if (MyInput.Static.IsNewSecondaryButtonReleased())
button = MySharedButtonsEnum.Secondary;
EventArgs args;
MakeEventArgs(out args, SelectedIndex.Value, button);
var handler = ItemReleased;
if (handler != null)
handler(this, args);
}
}
}
m_itemClicked = null;
m_lastClick = null;
}
if (MyInput.Static.IsAnyNewMouseOrJoystickPressed() && cursorInItems)
{
m_lastClick = MyGuiManager.TotalTimeInMilliseconds;
int? mouseOverIndex = ComputeIndex(MyGuiManager.MouseCursorPosition);
if (!IsValidIndex(mouseOverIndex.Value))
mouseOverIndex = null;
SelectMouseOverItem(mouseOverIndex);
captureInput = this;
if (SelectedIndex.HasValue && (ItemClicked != null || ItemClickedWithoutDoubleClick != null))
{
MySharedButtonsEnum button = MySharedButtonsEnum.None;
if (MyInput.Static.IsNewPrimaryButtonPressed())
button = MySharedButtonsEnum.Primary;
else if (MyInput.Static.IsNewSecondaryButtonPressed())
button = MySharedButtonsEnum.Secondary;
EventArgs args;
MakeEventArgs(out args, SelectedIndex.Value, button);
var handler = ItemClicked;
if (handler != null)
handler(this, args);
m_singleClickEvents = args;
m_itemClicked = args;
if (MyInput.Static.IsAnyCtrlKeyPressed() || MyInput.Static.IsAnyShiftKeyPressed())
MyGuiSoundManager.PlaySound(GuiSounds.Item);
}
}
if (MyInput.Static.IsNewPrimaryButtonPressed() && cursorInItems)
{
if (!m_doubleClickStarted.HasValue)
{
m_doubleClickStarted = MyGuiManager.TotalTimeInMilliseconds;
m_doubleClickFirstPosition = MyGuiManager.MouseCursorPosition;
}
else if ((MyGuiManager.TotalTimeInMilliseconds - m_doubleClickStarted.Value) <= MyGuiConstants.DOUBLE_CLICK_DELAY &&
(m_doubleClickFirstPosition - MyGuiManager.MouseCursorPosition).Length() <= 0.005f)
{
if (SelectedIndex.HasValue && TryGetItemAt(SelectedIndex.Value) != null && ItemDoubleClicked != null)
{
//Cancel click event when we double click
m_singleClickEvents = null;
EventArgs args;
MakeEventArgs(out args, SelectedIndex.Value, MySharedButtonsEnum.Primary);
Debug.Assert(GetItemAt(args.ItemIndex) != null, "Double click should not be reported when clicking on empty position.");
ItemDoubleClicked(this, args);
MyGuiSoundManager.PlaySound(GuiSounds.Item);
}
m_doubleClickStarted = null;
captureInput = this;
}
}
}