本文整理汇总了C#中MyGuiDrawAlignEnum类的典型用法代码示例。如果您正苦于以下问题:C# MyGuiDrawAlignEnum类的具体用法?C# MyGuiDrawAlignEnum怎么用?C# MyGuiDrawAlignEnum使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MyGuiDrawAlignEnum类属于命名空间,在下文中一共展示了MyGuiDrawAlignEnum类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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();
}
}
示例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);
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
}
示例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);
}
示例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;
}
示例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);
}