本文整理汇总了C#中UltimaXNA.Core.Graphics.SpriteBatchUI.Draw2D方法的典型用法代码示例。如果您正苦于以下问题:C# SpriteBatchUI.Draw2D方法的具体用法?C# SpriteBatchUI.Draw2D怎么用?C# SpriteBatchUI.Draw2D使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UltimaXNA.Core.Graphics.SpriteBatchUI
的用法示例。
在下文中一共展示了SpriteBatchUI.Draw2D方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public override void Draw(SpriteBatchUI spriteBatch, Point position)
{
Vector3 hueVector = Utility.GetHueVector(Hue);
int width = (int)(m_PercentWidthDrawn * Width);
spriteBatch.Draw2D(m_Texture, new Rectangle(position.X, position.Y, width, Height), new Rectangle(0, 0, width, Height), hueVector);
base.Draw(spriteBatch, position);
}
示例2: Draw
public override void Draw(SpriteBatchUI spriteBatch, Point position)
{
base.Draw(spriteBatch, position);
if (IsChecked && m_Active != null)
{
spriteBatch.Draw2D(m_Active, new Vector3(position.X, position.Y, 0), Vector3.Zero);
}
else if (!IsChecked && m_Inactive != null)
{
spriteBatch.Draw2D(m_Inactive, new Vector3(position.X, position.Y, 0), Vector3.Zero);
}
}
示例3: Draw
public override void Draw(SpriteBatchUI spriteBatch, Point position)
{
if (m_Texture == null)
{
IResourceProvider provider = ServiceRegistry.GetService<IResourceProvider>();
if (IsFemale)
{
int index = Item.ItemData.AnimID + 60000;
int indexTranslated, hueTranslated;
if (GumpDefTranslator.ItemHasGumpTranslation(index, out indexTranslated, out hueTranslated))
{
index = indexTranslated;
m_HueOverride = hueTranslated;
m_Texture = provider.GetUITexture(index);
}
}
if (m_Texture == null)
{
int index = Item.ItemData.AnimID + 50000;
int indexTranslated, hueTranslated;
if (GumpDefTranslator.ItemHasGumpTranslation(index, out indexTranslated, out hueTranslated))
{
index = indexTranslated;
m_HueOverride = hueTranslated;
m_Texture = provider.GetUITexture(index);
}
m_Texture = provider.GetUITexture(index);
}
Size = new Point(m_Texture.Width, m_Texture.Height);
}
int hue = (Item.Hue == 0 & m_HueOverride != 0) ? m_HueOverride : Item.Hue;
spriteBatch.Draw2D(m_Texture, new Vector3(position.X, position.Y, 0), Utility.GetHueVector(hue));
base.Draw(spriteBatch, position);
}
示例4: Draw
public override void Draw(SpriteBatchUI spriteBatch, Point position)
{
Texture2D worldTexture = (m_Model.GetView() as WorldView).Isometric.Texture;
m_InputMultiplier = new Vector2((float)worldTexture.Width / Width, (float)worldTexture.Height / Height);
spriteBatch.Draw2D(worldTexture, new Rectangle(position.X, position.Y, Width, Height), Vector3.Zero);
base.Draw(spriteBatch, position);
}
示例5: Draw
public override void Draw(SpriteBatchUI spriteBatch, Point position)
{
int centerWidth = Width - m_bgGumps[0].Width - m_bgGumps[2].Width;
int centerHeight = Height - m_bgGumps[0].Height - m_bgGumps[6].Height;
int line2Y = position.Y + m_bgGumps[0].Height;
int line3Y = position.Y + Height - m_bgGumps[6].Height;
spriteBatch.Draw2D(m_bgGumps[0], new Vector3(position.X, position.Y, 0), Vector3.Zero);
spriteBatch.Draw2DTiled(m_bgGumps[1], new Rectangle(position.X + m_bgGumps[0].Width, position.Y, centerWidth, m_bgGumps[0].Height), Vector3.Zero);
spriteBatch.Draw2D(m_bgGumps[2], new Vector3(position.X + Width - m_bgGumps[2].Width, position.Y, 0), Vector3.Zero);
spriteBatch.Draw2DTiled(m_bgGumps[3], new Rectangle(position.X, line2Y, m_bgGumps[0].Width, centerHeight), Vector3.Zero);
spriteBatch.Draw2DTiled(m_bgGumps[4], new Rectangle(position.X + m_bgGumps[0].Width, line2Y, centerWidth, centerHeight), Vector3.Zero);
spriteBatch.Draw2DTiled(m_bgGumps[5], new Rectangle(position.X + Width - m_bgGumps[2].Width, line2Y, m_bgGumps[2].Width, centerHeight), Vector3.Zero);
spriteBatch.Draw2D(m_bgGumps[6], new Vector3(position.X, line3Y, 0), Vector3.Zero);
spriteBatch.Draw2DTiled(m_bgGumps[7], new Rectangle(position.X + m_bgGumps[0].Width, line3Y, centerWidth, m_bgGumps[6].Height), Vector3.Zero);
spriteBatch.Draw2D(m_bgGumps[8], new Vector3(position.X + Width - m_bgGumps[2].Width, line3Y, 0), Vector3.Zero);
base.Draw(spriteBatch, position);
}
示例6: Draw
public override void Draw(SpriteBatchUI spriteBatch, Point position)
{
if (m_texture == null)
{
if (IsFemale)
m_texture = IO.GumpData.GetGumpXNA(Item.ItemData.AnimID + 60000);
if (m_texture == null)
m_texture = IO.GumpData.GetGumpXNA(Item.ItemData.AnimID + 50000);
Size = new Point(m_texture.Width, m_texture.Height);
}
spriteBatch.Draw2D(m_texture, new Vector3(position.X, position.Y, 0), Utility.GetHueVector(Item.Hue));
base.Draw(spriteBatch, position);
}
示例7: Draw
public override void Draw(SpriteBatchUI spriteBatch, Point position)
{
if (m_texture == null)
{
m_texture = IO.ArtData.GetStaticTexture(Item.DisplayItemID);
Size = new Point(m_texture.Width, m_texture.Height);
}
Vector3 hue = Utility.GetHueVector(IsMouseOver && HighlightOnMouseOver ? WorldView.MouseOverHue : Item.Hue);
if (Item.Amount > 1 && Item.ItemData.IsGeneric)
{
int offset = Item.ItemData.Unknown4;
spriteBatch.Draw2D(m_texture, new Vector3(position.X - offset, position.Y - offset, 0), hue);
}
spriteBatch.Draw2D(m_texture, new Vector3(position.X, position.Y, 0), hue);
base.Draw(spriteBatch, position);
}
示例8: Draw
public override void Draw(SpriteBatchUI spriteBatch, Point position)
{
if (m_Texture == null)
{
IResourceProvider provider = ServiceRegistry.GetService<IResourceProvider>();
m_Texture = provider.GetItemTexture(Item.DisplayItemID);
Size = new Point(m_Texture.Width, m_Texture.Height);
}
Vector3 hue = Utility.GetHueVector(IsMouseOver && HighlightOnMouseOver ? WorldView.MouseOverHue : Item.Hue);
if (Item.Amount > 1 && Item.ItemData.IsGeneric && Item.DisplayItemID == Item.ItemID)
{
int offset = Item.ItemData.Unknown4;
spriteBatch.Draw2D(m_Texture, new Vector3(position.X - 5, position.Y - 5, 0), hue);
}
spriteBatch.Draw2D(m_Texture, new Vector3(position.X, position.Y, 0), hue);
base.Draw(spriteBatch, position);
}
示例9: Draw
public override void Draw(SpriteBatchUI spriteBatch, Point position, double frameMS)
{
int centerWidth = Width - m_Gumps[0].Width - m_Gumps[2].Width;
int centerHeight = Height - m_Gumps[0].Height - m_Gumps[6].Height;
int line2Y = position.Y + m_Gumps[0].Height;
int line3Y = position.Y + Height - m_Gumps[6].Height;
// top row
spriteBatch.Draw2D(m_Gumps[0], new Vector3(position.X, position.Y, 0), Vector3.Zero);
spriteBatch.Draw2DTiled(m_Gumps[1], new Rectangle(position.X + m_Gumps[0].Width, position.Y, centerWidth, m_Gumps[0].Height), Vector3.Zero);
spriteBatch.Draw2D(m_Gumps[2], new Vector3(position.X + Width - m_Gumps[2].Width, position.Y, 0), Vector3.Zero);
// middle
spriteBatch.Draw2DTiled(m_Gumps[3], new Rectangle(position.X, line2Y, m_Gumps[3].Width, centerHeight), Vector3.Zero);
spriteBatch.Draw2DTiled(m_Gumps[4], new Rectangle(position.X + m_Gumps[3].Width, line2Y, centerWidth, centerHeight), Vector3.Zero);
spriteBatch.Draw2DTiled(m_Gumps[5], new Rectangle(position.X + Width - m_Gumps[5].Width, line2Y, m_Gumps[5].Width, centerHeight), Vector3.Zero);
// bottom
spriteBatch.Draw2D(m_Gumps[6], new Vector3(position.X, line3Y, 0), Vector3.Zero);
spriteBatch.Draw2DTiled(m_Gumps[7], new Rectangle(position.X + m_Gumps[6].Width, line3Y, centerWidth, m_Gumps[6].Height), Vector3.Zero);
spriteBatch.Draw2D(m_Gumps[8], new Vector3(position.X + Width - m_Gumps[8].Width, line3Y, 0), Vector3.Zero);
base.Draw(spriteBatch, position, frameMS);
}
示例10: Draw
public override void Draw(SpriteBatchUI spriteBatch, Point position, double frameMS)
{
Vector3 hueVector = Utility.GetHueVector(Hue);
spriteBatch.Draw2D(m_Texture, new Vector3(position.X, position.Y, 0), hueVector);
base.Draw(spriteBatch, position, frameMS);
}
示例11: Draw
public void Draw(SpriteBatchUI sb, Rectangle destRectangle, int xScroll, int yScroll, Vector3? hueVector = null)
{
if (Text == null)
return;
Rectangle sourceRectangle;
if (xScroll > Width)
return;
else if (xScroll < -MaxWidth)
return;
else
sourceRectangle.X = xScroll;
if (yScroll > Height)
return;
else if (yScroll < -Height)
return;
else
sourceRectangle.Y = yScroll;
int maxX = sourceRectangle.X + destRectangle.Width;
if (maxX <= Width)
sourceRectangle.Width = destRectangle.Width;
else
{
sourceRectangle.Width = Width - sourceRectangle.X;
destRectangle.Width = sourceRectangle.Width;
}
int maxY = sourceRectangle.Y + destRectangle.Height;
if (maxY <= Height)
{
sourceRectangle.Height = destRectangle.Height;
}
else
{
sourceRectangle.Height = Height - sourceRectangle.Y;
destRectangle.Height = sourceRectangle.Height;
}
sb.Draw2D(m_Document.Texture, destRectangle, sourceRectangle, hueVector.HasValue ? hueVector.Value : Vector3.Zero);
for (int i = 0; i < m_Document.Links.Count; i++)
{
HtmlLink link = m_Document.Links[i];
Point position;
Rectangle sourceRect;
if (ClipRectangle(new Point(xScroll, yScroll), link.Area, destRectangle, out position, out sourceRect))
{
// only draw the font in a different color if this is a HREF region.
// otherwise it is a dummy region used to notify images that they are
// being mouse overed.
if (link.HREF != null)
{
int linkHue = 0;
if (link.Index == MouseOverRegionID)
if (IsMouseDown)
linkHue = link.Style.ActiveColorHue;
else
linkHue = link.Style.HoverColorHue;
else
linkHue = link.Style.ColorHue;
sb.Draw2D(m_Document.Texture, new Vector3(position.X, position.Y, 0),
sourceRect, Utility.GetHueVector(linkHue));
}
}
}
for (int i = 0; i < m_Document.Images.Count; i++)
{
HtmlImage image = m_Document.Images[i];
Point position;
Rectangle sourceRect;
if (ClipRectangle(new Point(xScroll, yScroll), image.Area, destRectangle, out position, out sourceRect))
{
Rectangle srcImage = new Rectangle(
sourceRect.X - image.Area.X, sourceRect.Y - image.Area.Y,
sourceRect.Width, sourceRect.Height);
Texture2D texture = null;
// is the mouse over this image?
if (image.RegionIndex == MouseOverRegionID)
{
if (IsMouseDown)
texture = image.TextureDown;
if (texture == null)
texture = image.TextureOver;
if (texture == null)
texture = image.Texture;
}
if (texture == null)
texture = image.Texture;
if (srcImage.Width > texture.Width)
srcImage.Width = texture.Width;
if (srcImage.Height > texture.Height)
srcImage.Height = texture.Height;
//.........这里部分代码省略.........
示例12: Draw
public override void Draw(SpriteBatchUI spriteBatch, Point position)
{
if (Height <= 0)
return;
// draw scrollbar background
int middleHeight = Height - m_GumpUpButton[0].Height - m_GumpDownButton[0].Height - m_GumpBackground[0].Height - m_GumpBackground[2].Height;
if (middleHeight > 0)
{
spriteBatch.Draw2D(m_GumpBackground[0], new Vector3(position.X, position.Y + m_GumpUpButton[0].Height, 0), Vector3.Zero);
spriteBatch.Draw2DTiled(m_GumpBackground[1], new Rectangle(position.X, position.Y + m_GumpUpButton[0].Height + m_GumpBackground[0].Height, m_GumpBackground[0].Width, middleHeight), Vector3.Zero);
spriteBatch.Draw2D(m_GumpBackground[2], new Vector3(position.X, position.Y + Height - m_GumpDownButton[0].Height - m_GumpBackground[2].Height, 0), Vector3.Zero);
}
else
{
middleHeight = Height - m_GumpUpButton[0].Height - m_GumpDownButton[0].Height;
spriteBatch.Draw2DTiled(m_GumpBackground[1], new Rectangle(position.X, position.Y + m_GumpUpButton[0].Height, m_GumpBackground[0].Width, middleHeight), Vector3.Zero);
}
// draw up button
spriteBatch.Draw2D(m_BtnUpClicked ? m_GumpUpButton[1] : m_GumpUpButton[0], new Vector3(position.X, position.Y, 0), Vector3.Zero);
// draw down button
spriteBatch.Draw2D(m_BtnDownClicked ? m_GumpDownButton[1] : m_GumpDownButton[0], new Vector3(position.X, position.Y + Height - m_GumpDownButton[0].Height, 0), Vector3.Zero);
// draw slider
if (MaxValue > MinValue && middleHeight > 0)
spriteBatch.Draw2D(m_GumpSlider, new Vector3(position.X + (m_GumpBackground[0].Width - m_GumpSlider.Width) / 2, position.Y + m_GumpUpButton[0].Height + m_SliderPosition, 0), Vector3.Zero);
base.Draw(spriteBatch, position);
}
示例13: Draw
public override void Draw(SpriteBatchUI spriteBatch, Point position)
{
Texture2D texture = getTextureFromMouseState();
if (Caption != string.Empty)
m_Texture.Text = Caption;
spriteBatch.Draw2D(texture, new Rectangle(position.X, position.Y, Width, Height), Vector3.Zero);
if (Caption != string.Empty)
{
int yoffset = MouseDownOnThis ? 1 : 0;
m_Texture.Draw(spriteBatch,
new Point(position.X + (Width - m_Texture.Width) / 2,
position.Y + yoffset + (Height - m_Texture.Height) / 2));
}
base.Draw(spriteBatch, position);
}
示例14: Draw
public override void Draw(SpriteBatchUI spriteBatch, Point position)
{
if (m_texture == null)
{
IResourceProvider provider = ServiceRegistry.GetService<IResourceProvider>();
m_texture = provider.GetItemTexture(m_StaticTextureID);
Size = new Point(m_texture.Width, m_texture.Height);
}
spriteBatch.Draw2D(m_texture, new Vector3(position.X, position.Y, 0), Utility.GetHueVector(Hue));
base.Draw(spriteBatch, position);
}
示例15: Draw
public override void Draw(SpriteBatchUI spriteBatch, Point position)
{
spriteBatch.Draw2D(m_huesTexture, new Rectangle(position.X, position.Y, Width, Height), Vector3.Zero);
if (IsChild && IsMouseOver)
{
spriteBatch.Draw2D(m_selectedIndicator, new Vector3(
(int)(position.X + (float)(Width / m_hueWidth) * ((Index % m_hueWidth) + 0.5f) - m_selectedIndicator.Width / 2),
(int)(position.Y + (float)(Height / m_hueHeight) * ((Index / m_hueWidth) + 0.5f) - m_selectedIndicator.Height / 2),
0), Vector3.Zero);
}
base.Draw(spriteBatch, position);
}