本文整理匯總了C#中Text.LoadContent方法的典型用法代碼示例。如果您正苦於以下問題:C# Text.LoadContent方法的具體用法?C# Text.LoadContent怎麽用?C# Text.LoadContent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Text
的用法示例。
在下文中一共展示了Text.LoadContent方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: LoadAndAddNewTextEntryBelowPrevious
public void LoadAndAddNewTextEntryBelowPrevious(Text text)
{
text.LoadContent(ScreenManager.Content);
Text previousText = null;
foreach (UIElement uielement in ActiveUIElements)
{
if (uielement as Text != null)
{
if (previousText != null)
{
if (uielement.Position.Y > previousText.Position.Y)
{
previousText = (Text)uielement;
}
}
else
{
previousText = (Text)uielement;
}
}
}
foreach (UIElement uielement in UIElementsToAdd)
{
if (uielement as Text != null)
{
if (previousText != null)
{
if (uielement.Position.Y > previousText.Position.Y)
{
previousText = (Text)uielement;
}
}
else
{
previousText = (Text)uielement;
}
}
}
if (previousText != null)
{
text.SetPosition(new Vector2(0, 4 * previousText.TextOrigin.Y));
AddUIElementRelativeTo(text, previousText);
}
else
{
AddUIElement(text);
}
}
示例2: SetHoverInfoText
public void SetHoverInfoText(string text, Vector2 position)
{
Text infoText = new Text(
text,
Vector2.Zero,
100,
Color.White,
"Hover Info Text");
infoText.LoadContent(ScreenManager.Content);
HoverInfo = new Panel(
"Sprites/UI/Panels/Panel",
position,
2 * infoText.TextOrigin,
Color.Black,
"Hover Info",
0.5f);
HoverInfo.LoadContent(ScreenManager.Content);
HoverInfo.AddUIElement(infoText, infoText.Position);
}