本文整理汇总了C#中Sandbox.Graphics.GUI.MyGuiControlMultilineText.AppendText方法的典型用法代码示例。如果您正苦于以下问题:C# MyGuiControlMultilineText.AppendText方法的具体用法?C# MyGuiControlMultilineText.AppendText怎么用?C# MyGuiControlMultilineText.AppendText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sandbox.Graphics.GUI.MyGuiControlMultilineText
的用法示例。
在下文中一共展示了MyGuiControlMultilineText.AppendText方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ParseText
//implementation without RegularExpressions
public static void ParseText(string text, ref MyGuiControlMultilineText label)
{
try
{
var substrings = text.Split(']');
foreach (var substring in substrings)
{
var textAndMarkup = substring.Split('[');
if (textAndMarkup.Length == 2)
{
label.AppendText(textAndMarkup[0]);
var indexOfSpace = textAndMarkup[1].IndexOf(' ');
if (indexOfSpace != -1)
{
label.AppendLink(textAndMarkup[1].Substring(0, indexOfSpace), textAndMarkup[1].Substring(indexOfSpace + 1));
}
else
{
System.Diagnostics.Debug.Assert(false);
label.AppendText(textAndMarkup[1]);
}
} else {
label.AppendText(substring);
}
}
}
catch
{
}
}
示例2: Draw
public void Draw(MyGuiControlMultilineText control)
{
if (Visible)
{
if (IsDirty)
{
control.Clear();
control.AppendText(CameraName);
control.AppendLine();
control.AppendText(ShipName);
IsDirty = false;
}
}
else
{
if (IsDirty)
{
control.Clear();
IsDirty = false;
}
}
}
示例3: ParseText
public static void ParseText(string text, ref MyGuiControlMultilineText label)
{
try
{
var texts = m_splitRegex.Split(text);
var matches = m_splitRegex.Matches(text);
for (int i = 0; i < matches.Count || i < texts.Count(); i++)
{
if (i < texts.Count())
label.AppendText(m_stringCache.Clear().Append(texts[i]));
if (i < matches.Count)
ParseMarkup(label, matches[i].Value);
}
}
catch
{
}
}
示例4: ComputeLineDataFromString
private MultilineData ComputeLineDataFromString(string value)
{
MultilineData ret;
ret.data = value;
MyGuiControlMultilineText textBox = new MyGuiControlMultilineText(size: new Vector2(QuestlogSize.X * 0.92f, 1), drawScrollbar: false);
textBox.Visible = false;
textBox.TextScale = 0.9f;
textBox.AppendText(value);
ret.lines = textBox.NumberOfRows;
return ret;
}
示例5: GenerateSizeNotAvailableText
/// <summary>
/// Generates multiline text control indicating that block is not available.
/// </summary>
/// <param name="blockSizeLarge">Is block size large.</param>
/// <returns>Multiline text control with block not available info.</returns>
private MyGuiControlMultilineText GenerateSizeNotAvailableText(bool blockSizeLarge)
{
MyGuiControlMultilineText textControl = new MyGuiControlMultilineText(size: new Vector2(0.2f, 0.1f), font: MyFontEnum.Red, showTextShadow: true, textAlign: MyGuiDrawAlignEnum.HORISONTAL_CENTER_AND_VERTICAL_CENTER);
string blockTypeLabelText = MyTexts.GetString(!blockSizeLarge ? MySpaceTexts.HudBlockInfo_LargeShip_Station : MySpaceTexts.HudBlockInfo_SmallShip);
textControl.AppendText(string.Format(MyTexts.GetString(MySpaceTexts.BlockSize_NotAvailable), blockTypeLabelText));
return textControl;
}
示例6: RecreateControls
public void RecreateControls()
{
if (QuestInfo == null || Elements == null)
return;
Elements.Clear();
Vector2 topleft = -this.Size / 2;
Vector2 textOffset = new Vector2(0.015f, 0.015f);
// Title
MyGuiControlLabel title = new MyGuiControlLabel();
title.Text = QuestInfo.QuestTitle;
title.Position = topleft + textOffset;
title.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
title.Visible = true;
Elements.Add(title);
// Pages
if (QuestInfo.MaxPages != 0)
{
MyGuiControlLabel numbers = new MyGuiControlLabel();
numbers.Text = QuestInfo.Page + "/" + QuestInfo.MaxPages;
numbers.Position = topleft + Vector2.UnitX * this.Size - textOffset * new Vector2(1, -1);
numbers.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_RIGHT_AND_VERTICAL_TOP;
Elements.Add(numbers);
}
// Separator
MyGuiControlSeparatorList m_separator;
m_separator = new MyGuiControlSeparatorList();
m_separator.AddHorizontal(topleft + textOffset + new Vector2(0, 0.03f), this.Size.X - 2 * textOffset.X, 0.003f); // Title separator
m_separator.Visible = true;
Elements.Add(m_separator);
// Details
var rowOffset = new Vector2(0, 0.025f);
string[] details = QuestInfo.GetQuestGetails();
int idx = 0;
for (int i = 0; i < details.Length; i++)
{
if (details[i] == null)
continue;
MyGuiControlMultilineText textBox = new MyGuiControlMultilineText(
size: new Vector2(Size.X * 0.92f, rowOffset.Y * 5),
position: topleft + textOffset + new Vector2(0, 0.04f) + rowOffset * idx,
textAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
textBoxAlign: MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP,
//Debug purpose
//backgroundColor: Vector4.One,
//backgroundTexture: BackgroundTexture,
drawScrollbar: false
);
textBox.OriginAlign = MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP;
textBox.TextScale = 0.9f;
textBox.AppendText(details[i]);
textBox.Visible = true;
idx += textBox.NumberOfRows;
Elements.Add(textBox);
}
}