本文整理汇总了C#中MyGuiDrawAlignEnum类的典型用法代码示例。如果您正苦于以下问题:C# MyGuiDrawAlignEnum类的具体用法?C# MyGuiDrawAlignEnum怎么用?C# MyGuiDrawAlignEnum使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MyGuiDrawAlignEnum类属于命名空间,在下文中一共展示了MyGuiDrawAlignEnum类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: MyNotification
private MyNotification(int notificationTextId, string notificationString, MyGuiScreenGamePlayType LifeArea, float scale,
MyGuiFont font,
MyGuiDrawAlignEnum textAlign, int disapearTimeMs, MyEntity owner, bool showConfirmMessage = false,
object[] textFormatArguments = null)
{
Owner = owner;
m_originalText = notificationString;
m_notificationText = notificationString;
m_notificationTextID = (int)notificationTextId;
m_isTextDirty = false;
// always false:
m_isDisappeared = false;
m_actualScale = scale;
m_actualFont = font;
m_actualTextAlign = textAlign;
m_textFormatArguments = textFormatArguments;
// timing:
m_disappearTimeMs = disapearTimeMs;
m_aliveTime = 0;
// life space;
m_lifeSpace = LifeArea;
// show standart message?
m_showConfirmMessage = showConfirmMessage;
}
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:30,代码来源:MyHudNotification.cs
示例2: GetCoordAligned
/// <summary>
/// Aligns rectangle, works in screen/texture/pixel coordinates, not normalized coordinates.
/// </summary>
/// <returns>Pixel coordinates for texture.</returns>
public static Vector2 GetCoordAligned(Vector2 coordScreen, Vector2 size, MyGuiDrawAlignEnum drawAlign)
{
switch (drawAlign)
{
case MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP:
return coordScreen;
case MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER:
return coordScreen - size * 0.5f;
case MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_TOP:
return coordScreen - size * new Vector2(0.5f, 0.0f);
case MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_BOTTOM:
return coordScreen - size * new Vector2(0.5f, 1.0f);
case MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_BOTTOM:
return coordScreen - size;
case MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER:
return coordScreen - size * new Vector2(0.0f, 0.5f);
case MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_CENTER:
return coordScreen - size * new Vector2(1.0f, 0.5f);
case MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_BOTTOM:
return coordScreen - size * new Vector2(0.0f, 1.0f);
case MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP:
return coordScreen - size * new Vector2(1.0f, 0.0f);
default:
throw new InvalidBranchException();
}
}
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:39,代码来源:MyUtils-String.cs
示例3: MyGuiControlProgressBar
public MyGuiControlProgressBar( Vector2? position = null,
Vector2? size = null,
Color? progressBarColor = null,
MyGuiDrawAlignEnum originAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
MyGuiCompositeTexture backgroundTexture = null,
bool isHorizontal = true,
bool potentialBarEnabled = true)
: base( position: position,
size: size,
backgroundTexture: backgroundTexture,
originAlign: originAlign,
colorMask: null,
toolTip: null)
{
ProgressColor = (progressBarColor.HasValue ? progressBarColor.Value : DEFAULT_PROGRESS_COLOR);
IsHorizontal = isHorizontal;
m_progressForeground = new MyGuiControlPanel( position: new Vector2(-Size.X/2.0f, 0.0f),
originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
backgroundColor: ProgressColor);
m_progressForeground.BackgroundTexture = MyGuiConstants.TEXTURE_GUI_BLANK;
m_potentialBar = new MyGuiControlPanel(originAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_CENTER,
size: new Vector2(0f, Size.Y));
m_potentialBar.BackgroundTexture = MyGuiConstants.TEXTURE_GUI_BLANK;
m_potentialBar.ColorMask = new Vector4(ProgressColor, 0.7f);
m_potentialBar.Visible = false;
m_potentialBar.Enabled = potentialBarEnabled;
Elements.Add(m_potentialBar);
Elements.Add(m_progressForeground);
}
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:31,代码来源:MyGuiControlProgressBar.cs
示例4: MyGuiControlMultilineText
public MyGuiControlMultilineText(
IMyGuiControlsParent parent, Vector2 position,
Vector2 size, Vector4? backgroundColor,
MyGuiFont font, float textScale, MyGuiDrawAlignEnum textAlign, StringBuilder contents, bool drawBorders = true, bool drawScrollbar = true)
: base(parent, position, size, backgroundColor, null)
{
m_font = font;
m_textScale = textScale;
m_textAlign = textAlign;
m_drawBorders = drawBorders;
m_drawScrollbar = drawScrollbar;
TextColor = new Color(MyGuiConstants.LABEL_TEXT_COLOR);
m_scrollbar = new MyVScrollbar(this);
m_scrollbar.TopBorder = m_scrollbar.RightBorder = m_scrollbar.BottomBorder = false;
m_scrollbar.LeftBorder = drawBorders;
m_scrollbarSize = new Vector2(0.0334f, MyGuiConstants.COMBOBOX_VSCROLLBAR_SIZE.Y);
m_scrollbarSize = MyGuiConstants.COMBOBOX_VSCROLLBAR_SIZE;
float minLineHeight = MyGuiManager.MeasureString(m_font,
MyTextsWrapper.Get(MyTextsWrapperEnum.ServerShutdownNotificationCaption),
m_parent.GetPositionAbsolute() + m_position, m_textScale,
m_textAlign).Size.Y;
m_label = new MyRichLabel(size.X, minLineHeight);
if (contents != null && contents.Length > 0)
{
SetText(contents);
}
}
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:28,代码来源:MyGuiControlMultilineText.cs
示例5: AdjustPosition
private static Vector2 AdjustPosition(Vector2 position, ref Vector2 textSize, ref Vector2 shadowSize, MyGuiDrawAlignEnum alignment)
{
// CHECK-ME: May be needed to support other alignments
switch (alignment)
{
case MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER:
{
// Do nothing
break;
}
case MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP:
{
float diffWidth = shadowSize.X - textSize.X;
float diffHeight = shadowSize.Y - textSize.Y;
position.X -= diffWidth / 2;
position.Y -= diffHeight / 2;
break;
}
case MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP:
{
float diffWidth = shadowSize.X - textSize.X;
float diffHeight = shadowSize.Y - textSize.Y;
position.X += diffWidth / 2;
position.Y -= diffHeight / 2;
break;
}
}
return position;
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:30,代码来源:MyGuiTextShadows.cs
示例6: MyGuiControlRotatingWheel
public MyGuiControlRotatingWheel(
Vector2? position = null,
Vector4? colorMask = null,
float scale = MyGuiConstants.ROTATING_WHEEL_DEFAULT_SCALE,
MyGuiDrawAlignEnum align = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
string texture = MyGuiConstants.LOADING_TEXTURE,
bool manualRotationUpdate = true,
bool multipleSpinningWheels = true,
Vector2? textureResolution = null,
float radiansPerSecond = 1.5f)
: base(position: position,
size: null,
colorMask: colorMask,
toolTip: null,
isActiveControl: false)
{
UpdateRotation();
m_wheelScale = scale;
m_texture = texture;
m_textureResolution = textureResolution.HasValue ? textureResolution.Value : new Vector2(256, 256);
MultipleSpinningWheels = multipleSpinningWheels;
ManualRotationUpdate = manualRotationUpdate;
m_rotationSpeed = radiansPerSecond;
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:27,代码来源:MyGuiControlRotatingWheel.cs
示例7: MyGuiControlPanel
public MyGuiControlPanel(IMyGuiControlsParent parent, Vector2 position, Vector2? size, Vector4 backgroundColor,
MyTexture2D texture, MyTexture2D hoverTexture, MyTexture2D pressedTexture, MyTexture2D shadowTexture,
MyGuiDrawAlignEnum align)
: base(parent, position, size, backgroundColor, new StringBuilder(),
texture, hoverTexture, pressedTexture, false)
{
Visible = true;
}
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:8,代码来源:MyGuiControlPanel.cs
示例8: Draw
public void Draw(Vector2 normalizedPosition, MyGuiDrawAlignEnum drawAlign, float backgroundAlphaFade, bool isHighlight, float colorMultiplicator = 1f)
{
Color drawColor = isHighlight ? HighlightColor : NormalColor;
Vector4 vctColor = drawColor.ToVector4();
vctColor.W *= backgroundAlphaFade;
vctColor *= colorMultiplicator;
MyGuiManager.DrawString(Font, Text, normalizedPosition + Offset, ScaleWithLanguage, new Color(vctColor), drawAlign);
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:9,代码来源:MyColoredText.cs
示例9: MyGuiControlLabel
public MyGuiControlLabel(IMyGuiControlsParent parent, Vector2 position, Vector2? size, MyTextsWrapperEnum textEnum, Vector4 textColor, float textScale, MyGuiDrawAlignEnum textAlign)
: base(parent, position, size, null, null, false)
{
m_type = MyGuiControlLabelType.DEFINED_BY_TEXT_WRAPPER_ENUM;
m_textEnum = textEnum;
Init(textColor, textScale, textAlign);
}
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:9,代码来源:MyGuiControlLabel.cs
示例10: MyHudMissingComponentNotification
public MyHudMissingComponentNotification(MyStringId text,
int disapearTimeMs = 2500,
MyFontEnum font = MyFontEnum.White,
MyGuiDrawAlignEnum textAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
int priority = 0,
MyNotificationLevel level = MyNotificationLevel.Normal)
: base(disapearTimeMs, font, textAlign, priority, level)
{
m_originalText = text;
}
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:10,代码来源:MyHudNotification.cs
示例11: MyGuiControlRotatingWheel
public MyGuiControlRotatingWheel(IMyGuiControlsParent parent, Vector2 position, Vector4 color, float scale, MyGuiDrawAlignEnum align, MyTexture2D texture)
: base(parent, position, null, null, null, false)
{
m_rotatingAngle = MyMwcUtils.GetRandomRadian();
m_color = color;
m_wheelScale = scale;
//m_scale = 4;
m_align = align;
m_texture = texture;
}
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:10,代码来源:MyGuiControlRotatingWheel.cs
示例12: MyGuiControlStat
public MyGuiControlStat(MyEntityStat stat, Vector2 position, Vector2 size, MyGuiDrawAlignEnum originAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER)
: base(position: position, size: size, originAlign: originAlign)
{
Debug.Assert(stat != null);
m_stat = stat;
if(m_stat != null)
{
m_stat.OnStatChanged += UpdateStatText;
}
}
开发者ID:martejj,项目名称:SpaceEngineers,代码行数:10,代码来源:MyGuiControlStats.cs
示例13: Start
// IMPORTANT: This class isn't initialized by constructor, but by Start() because it's supposed to be used in memory pool
public void Start(MyGuiFont font, Vector2 position, Color color, float scale, MyGuiDrawAlignEnum alignement)
{
Font = font;
Position = position;
Color = color;
Scale = scale;
Alignement = alignement;
// Clear current text
MyMwcUtils.ClearStringBuilder(m_text);
}
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:12,代码来源:MyHudText.cs
示例14: AddCompositePanel
protected MyGuiControlCompositePanel AddCompositePanel(MyGuiCompositeTexture texture, Vector2 position, Vector2 size, MyGuiDrawAlignEnum panelAlign)
{
var panel = new MyGuiControlCompositePanel()
{
BackgroundTexture = texture
};
panel.Position = position;
panel.Size = size;
panel.OriginAlign = panelAlign;
Controls.Add(panel);
return panel;
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:13,代码来源:MyGuiBlueprintBase.cs
示例15: DrawShadow
public static void DrawShadow(ref Vector2 position, ref Vector2 textSize, string textureSet = null, float fogAlphaMultiplier = 1,
MyGuiDrawAlignEnum alignment = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER)
{
if (textureSet == null)
textureSet = TEXT_SHADOW_DEFAULT;
ShadowTexture texture;
Vector2 shadowSize = GetShadowSize(ref textSize, textureSet, out texture);
Vector2 shadowPosition = AdjustPosition(position, ref textSize, ref shadowSize, alignment);
Color color = new Color(0, 0, 0, (byte)(255 * texture.DefaultAlpha * fogAlphaMultiplier));
MyGuiManager.DrawSpriteBatch(texture.Texture, shadowPosition, shadowSize, color, alignment);
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:13,代码来源:MyGuiTextShadows.cs
示例16: MyGuiControlStat
public MyGuiControlStat(MyEntityStat stat, Vector2 position, Vector2 size, MyGuiDrawAlignEnum originAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER)
: base(position: position, size: size, originAlign: originAlign)
{
Debug.Assert(stat != null);
m_stat = stat;
var vecColor = m_stat.StatDefinition.GuiDef.CriticalColorFrom;
m_criticalValueColorFrom = new Color(vecColor.X, vecColor.Y, vecColor.Z);
vecColor = m_stat.StatDefinition.GuiDef.CriticalColorTo;
m_criticalValueColorTo = new Color(vecColor.X, vecColor.Y, vecColor.Z);
if(m_stat != null)
{
m_stat.OnStatChanged += UpdateStatControl;
}
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:14,代码来源:MyGuiControlStats.cs
示例17: MyGuiControlSlider
public MyGuiControlSlider(
Vector2? position = null,
float minValue = 0f,
float maxValue = 1f,
float width = 464f/1600f,
float? defaultValue = null,
Vector4? color = null,
String labelText = null,
int labelDecimalPlaces = 1,
float labelScale = MyGuiConstants.DEFAULT_TEXT_SCALE,
float labelSpaceWidth = 0f,
string labelFont = MyFontEnum.White,
String toolTip = null,
MyGuiControlSliderStyleEnum visualStyle = MyGuiControlSliderStyleEnum.Default,
MyGuiDrawAlignEnum originAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER,
bool intValue = false)
: base(
position: position,
width: width,
color: color,
labelScale: labelScale,
labelSpaceWidth: labelSpaceWidth,
labelFont: labelFont,
toolTip: toolTip,
visualStyle: visualStyle,
originAlign: originAlign
)
{
m_minValue = minValue;
m_maxValue = maxValue;
m_range = m_maxValue - m_minValue;
MyDebug.AssertDebug(m_maxValue > m_minValue && m_maxValue != m_minValue);
Propeties = new MyGuiSliderProperties()
{
FormatLabel = FormatValue,
RatioFilter = FilterRatio,
RatioToValue = RatioToValue,
ValueToRatio = ValueToRatio
};
DefaultRatio = defaultValue.HasValue ? ValueToRatio(defaultValue.Value) : default(float?);
Ratio = DefaultRatio ?? minValue;
m_intValue = intValue;
LabelDecimalPlaces = labelDecimalPlaces;
m_labelFormat = labelText;
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:50,代码来源:MyGuiControlSlider.cs
示例18: MyGuiControlMultilineEditableText
public MyGuiControlMultilineEditableText(
Vector2? position = null,
Vector2? size = null,
Vector4? backgroundColor = null,
MyFontEnum font = MyFontEnum.Blue,
float textScale = MyGuiConstants.DEFAULT_TEXT_SCALE,
MyGuiDrawAlignEnum textAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
StringBuilder contents = null,
bool drawScrollbar = true,
MyGuiDrawAlignEnum textBoxAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER)
: base(position, size, backgroundColor, font, textScale, textAlign, contents, drawScrollbar, textBoxAlign, true)
{
m_fontHeight = MyGuiManager.GetFontHeight(Font, TextScaleWithLanguage);
this.AllowFocusingElements = false;
}
开发者ID:Krulac,项目名称:SpaceEngineers,代码行数:15,代码来源:MyGuiControlMultilineEditableText.cs
示例19: MyGuiControlStat
public MyGuiControlStat(MyEntityStat stat, Vector2 position, Vector2 size, MyGuiDrawAlignEnum originAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER)
: base(position: position, size: size, originAlign: originAlign)
{
Debug.Assert(stat != null);
m_stat = stat;
var vecColor = m_stat.StatDefinition.GuiDef.CriticalColorFrom;
m_criticalValueColorFrom = new Color(vecColor.X, vecColor.Y, vecColor.Z);
vecColor = m_stat.StatDefinition.GuiDef.CriticalColorTo;
m_criticalValueColorTo = new Color(vecColor.X, vecColor.Y, vecColor.Z);
if(m_stat != null)
{
m_stat.OnStatChanged += UpdateStatControl;
m_stat.OnStatChanged += DisplayStatNotification;
m_outOfStatNotification = new MyHudNotification(MyCommonTexts.NotificationStatZero, disappearTimeMs: 1000, font: MyFontEnum.Red, level: MyNotificationLevel.Important);
m_outOfStatNotification.SetTextFormatArguments(m_stat.StatId.ToString());
}
}
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:17,代码来源:MyGuiControlStats.cs
示例20: MyGuiControlPanel
public MyGuiControlPanel(
Vector2? position = null,
Vector2? size = null,
Vector4? backgroundColor = null,
string texture = null,
String toolTip = null,
MyGuiDrawAlignEnum originAlign = MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER)
: base(position: position,
size: size,
colorMask: backgroundColor,
toolTip: toolTip,
backgroundTexture: new MyGuiCompositeTexture() { Center = new MyGuiSizedTexture() { Texture = texture } },
isActiveControl: false,
originAlign: originAlign,
highlightType: MyGuiControlHighlightType.NEVER)
{
Visible = true;
}
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:18,代码来源:MyGuiControlPanel.cs
注:本文中的MyGuiDrawAlignEnum类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论