本文整理汇总了C#中UltimaXNA.Ultima.World.Maps.Map类的典型用法代码示例。如果您正苦于以下问题:C# Map类的具体用法?C# Map怎么用?C# Map使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Map类属于UltimaXNA.Ultima.World.Maps命名空间,在下文中一共展示了Map类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadStatics
public void LoadStatics(TileMatrixData tileData, Map map)
{
// get data from the tile Matrix
byte[] groundData = tileData.GetLandChunk(ChunkX, ChunkY);
int staticLength;
byte[] staticsData = tileData.GetStaticChunk(ChunkX, ChunkY, out staticLength);
// load the ground data into the tiles.
int groundDataIndex = 0;
for (int i = 0; i < 64; i++)
{
int tileID = groundData[groundDataIndex++] + (groundData[groundDataIndex++] << 8);
int tileZ = (sbyte)groundData[groundDataIndex++];
Ground ground = new Ground(tileID, map);
ground.Position.Set((int)ChunkX * 8 + i % 8, (int)ChunkY * 8 + (i / 8), tileZ);
}
// load the statics data into the tiles
int countStatics = staticLength / 7;
int staticDataIndex = 0;
for (int i = 0; i < countStatics; i++)
{
int iTileID = staticsData[staticDataIndex++] + (staticsData[staticDataIndex++] << 8);
int iX = staticsData[staticDataIndex++];
int iY = staticsData[staticDataIndex++];
int iTileZ = (sbyte)staticsData[staticDataIndex++];
int hue = staticsData[staticDataIndex++] + (staticsData[staticDataIndex++] * 256);
StaticItem item = new StaticItem(iTileID, hue, i, map);
item.Position.Set((int)ChunkX * 8 + iX, (int)ChunkY * 8 + iY, iTileZ);
}
}
示例2: MovingEffect
public MovingEffect(Map map,int sourceSerial, int targetSerial, int xSource, int ySource, int zSource, int xTarget, int yTarget, int zTarget, int itemID, int hue)
: this(map, itemID, hue)
{
AEntity source = WorldModel.Entities.GetObject<AEntity>(sourceSerial, false);
if (source != null)
{
if (source is Mobile)
{
base.SetSource(source.X, source.Y, source.Z);
Mobile mobile = source as Mobile;
if ((!mobile.IsClientEntity && !mobile.IsMoving) && ((xSource | ySource | zSource) != 0))
{
source.Position.Set(xSource, ySource, zSource);
}
}
else if (source is Item)
{
base.SetSource(source.X, source.Y, source.Z);
Item item = source as Item;
if ((xSource | ySource | zSource) != 0)
{
item.Position.Set(xSource, ySource, zSource);
}
}
else
{
base.SetSource(xSource, ySource, zSource);
}
}
else
{
base.SetSource(xSource, ySource, zSource);
}
AEntity target = WorldModel.Entities.GetObject<AEntity>(targetSerial, false);
if (target != null)
{
if (target is Mobile)
{
base.SetTarget(target);
Mobile mobile = target as Mobile;
if ((!mobile.IsClientEntity && !mobile.IsMoving) && ((xTarget | yTarget | zTarget) != 0))
{
mobile.Position.Set(xTarget, yTarget, zTarget);
}
}
else if (target is Item)
{
base.SetTarget(target);
Item item = target as Item;
if ((xTarget | yTarget | zTarget) != 0)
{
item.Position.Set(xTarget, yTarget, zTarget);
}
}
else
{
base.SetSource(xTarget, yTarget, zTarget);
}
}
}
示例3: Draw
public override bool Draw(SpriteBatch3D spriteBatch, Vector3 drawPosition, MouseOverList mouseOverList, Map map)
{
if (!m_AllowDefer)
{
if (CheckDefer(map, drawPosition))
return false;
}
else
{
m_AllowDefer = false;
}
int displayItemdID = (m_Animated) ? Effect.ItemID + ((Effect.FramesActive / m_AnimData.FrameInterval) % m_AnimData.FrameCount) : Effect.ItemID;
if (displayItemdID != m_DisplayItemID)
{
m_DisplayItemID = displayItemdID;
DrawTexture = IO.ArtData.GetStaticTexture(m_DisplayItemID);
DrawArea = new Rectangle(DrawTexture.Width / 2 - 22, DrawTexture.Height - World.WorldViews.IsometricRenderer.TileSizeI + (Entity.Z * 4), DrawTexture.Width, DrawTexture.Height);
PickType = PickType.PickNothing;
DrawFlip = false;
}
// Update hue vector.
HueVector = Utility.GetHueVector(Entity.Hue);
return base.Draw(spriteBatch, drawPosition, mouseOverList, map);
}
示例4: Draw
public override bool Draw(SpriteBatch3D spriteBatch, Vector3 drawPosition, MouseOverList mouseOver, Map map, bool roofHideFlag)
{
if (Entity.NoDraw)
{
return false;
}
// Update Display texture, if necessary.
if (Entity.DisplayItemID != m_DisplayItemID)
{
m_DisplayItemID = Entity.DisplayItemID;
DrawTexture = Provider.GetItemTexture(m_DisplayItemID);
if (DrawTexture == null) // ' no draw ' item.
{
return false;
}
DrawArea = new Rectangle(DrawTexture.Width / 2 - IsometricRenderer.TILE_SIZE_INTEGER_HALF, DrawTexture.Height - IsometricRenderer.TILE_SIZE_INTEGER + (Entity.Z * 4), DrawTexture.Width, DrawTexture.Height);
PickType = PickType.PickObjects;
DrawFlip = false;
}
if (DrawTexture == null) // ' no draw ' item.
{
return false;
}
DrawArea.Y = DrawTexture.Height - IsometricRenderer.TILE_SIZE_INTEGER + (Entity.Z * 4);
HueVector = Utility.GetHueVector(Entity.Hue, Entity.ItemData.IsPartialHue, false, false);
if (Entity.Amount > 1 && Entity.ItemData.IsGeneric && Entity.DisplayItemID == Entity.ItemID)
{
int offset = Entity.ItemData.Unknown4;
Vector3 offsetDrawPosition = new Vector3(drawPosition.X - 5, drawPosition.Y - 5, 0);
base.Draw(spriteBatch, offsetDrawPosition, mouseOver, map, roofHideFlag);
}
bool drawn = base.Draw(spriteBatch, drawPosition, mouseOver, map, roofHideFlag);
DrawOverheads(spriteBatch, drawPosition, mouseOver, map, DrawArea.Y - IsometricRenderer.TILE_SIZE_INTEGER_HALF);
return drawn;
}
示例5: MovingEffect
public MovingEffect(Map map,int itemID, int hue)
: base(map)
{
Hue = hue;
itemID &= 0x3fff;
m_ItemID = itemID | 0x4000;
}
示例6: Draw
public override bool Draw(SpriteBatch3D spriteBatch, Vector3 drawPosition, MouseOverList mouseOverList, Map map)
{
if (!m_AllowDefer)
{
if (CheckDefer(map, drawPosition))
return false;
}
else
{
m_AllowDefer = false;
}
int displayItemdID = (m_Animated) ? Effect.ItemID + ((Effect.FramesActive / m_AnimData.FrameInterval) % m_AnimData.FrameCount) : Effect.ItemID;
if (displayItemdID != m_DisplayItemID)
{
m_DisplayItemID = displayItemdID;
IResourceProvider provider = ServiceRegistry.GetService<IResourceProvider>();
DrawTexture = provider.GetItemTexture(m_DisplayItemID);
DrawArea = new Rectangle(DrawTexture.Width / 2 - 22, DrawTexture.Height - IsometricRenderer.TILE_SIZE_INTEGER, DrawTexture.Width, DrawTexture.Height);
PickType = PickType.PickNothing;
DrawFlip = false;
}
DrawArea.X = 0 - (int)((Entity.Position.X_offset - Entity.Position.Y_offset) * 22);
DrawArea.Y = 0 + (int)((Entity.Position.Z_offset + Entity.Z) * 4) - (int)((Entity.Position.X_offset + Entity.Position.Y_offset) * 22);
Rotation = Effect.AngleToTarget;
// Update hue vector.
HueVector = Utility.GetHueVector(Entity.Hue);
return base.Draw(spriteBatch, drawPosition, mouseOverList, map);
}
示例7: AnimatedItemEffect
public AnimatedItemEffect(Map map, int itemID, int hue, int duration)
: base(map)
{
ItemID = (itemID & 0x3fff) | 0x4000;
Hue = hue;
Duration = duration;
}
示例8: StaticItem
public StaticItem(int itemID, int hue, int sortInfluence, Map map)
: base(Serial.Null, map)
{
ItemID = itemID;
Hue = hue;
SortInfluence = sortInfluence;
}
示例9: Draw
public override bool Draw(SpriteBatch3D spriteBatch, Vector3 drawPosition, MouseOverList mouseOverList, Map map)
{
if (!m_AllowDefer)
{
if (CheckDefer(map, drawPosition))
return false;
}
else
{
m_AllowDefer = false;
}
int displayItemdID = 0x4e20 + Effect.FramesActive;
if (displayItemdID != m_DisplayItemID)
{
m_DisplayItemID = displayItemdID;
DrawTexture = IO.GumpData.GetGumpXNA(displayItemdID);
Point offset = m_Offsets[m_DisplayItemID - 20000];
DrawArea = new Rectangle(offset.X, DrawTexture.Height - 33 + (Entity.Z * 4) + offset.Y, DrawTexture.Width, DrawTexture.Height);
PickType = PickType.PickNothing;
DrawFlip = false;
}
// Update hue vector.
HueVector = Utility.GetHueVector(Entity.Hue);
return base.Draw(spriteBatch, drawPosition, mouseOverList, map);
}
示例10: CreateSeasonalTileInfo
public void CreateSeasonalTileInfo()
{
m_StaticCounts = new Dictionary<int, int>();
TileMatrixData tileData = new TileMatrixData(0);
Map map = new Map(0);
for (uint y = 0; y < tileData.ChunkHeight; y++)
{
Tracer.Info("Map Parser: row {0}.", y);
for (uint x = 0; x < tileData.ChunkWidth; x++)
{
ParseMapBlock(tileData, x, y);
}
}
var items = from pair in m_StaticCounts
orderby pair.Value descending
select pair;
using (FileStream file = new FileStream(@"AllTiles.txt", FileMode.Create))
{
StreamWriter stream = new StreamWriter(file);
foreach (KeyValuePair<int, int> pair in items)
{
ItemData itemData = TileData.ItemData[pair.Key];
if ((itemData.IsBackground || itemData.IsFoliage) && !itemData.IsWet && !itemData.IsSurface)
stream.WriteLine(string.Format("{0},{1} ; {2}", pair.Key, pair.Value, itemData.Name));
}
stream.Flush();
file.Flush();
}
}
示例11: BaseBook
public BaseBook(Serial serial, Map map, bool writable, string title, string author)
: base(serial, map)
{
m_Title = title;
m_Author = author;
m_IsEditable = writable;
m_Pages = new BookPageInfo[0];
}
示例12: SetMap
public void SetMap(Map map)
{
if (map != Map)
{
Map = map;
Position.Tile = Position3D.NullTile;
}
}
示例13: Render
public static void Render(SpriteBatch3D spriteBatch, MouseOverList mouseOverList, Map map)
{
if (m_Views.Count > 0)
{
for (int i = 0; i < m_Views.Count; i++)
{
m_Views[i].View.Draw(spriteBatch, m_Views[i].DrawPosition, mouseOverList, map);
}
m_Views.Clear();
}
}
示例14: Draw
public override bool Draw(SpriteBatch3D spriteBatch, Vector3 drawPosition, MouseOverList mouseOverList, Map map)
{
if (Entity is Mobile)
{
Mobile mobile = Entity as Mobile;
if (!mobile.IsAlive || mobile.IsDisposed || mobile.Body == 0)
{
return false;
}
}
m_BaseView.SetAllowDefer();
return m_BaseView.Draw(spriteBatch, m_DrawPosition, mouseOverList, map);
}
示例15: Draw
public override bool Draw(SpriteBatch3D spriteBatch, Vector3 drawPosition, MouseOverList mouseOverList, Map map)
{
int facing = MirrorFacingForDraw(Entity.Facing);
int frameIndex = (int)(Entity.Frame * BodyConverter.DeathAnimationFrameCount(Entity.Body));
AnimationFrame animationFrame = getFrame(Entity.Body, facing, frameIndex, Entity.Hue);
DrawTexture = animationFrame.Texture;
DrawArea = new Rectangle(0, 0, DrawTexture.Width, DrawTexture.Height);
DrawFlip = false;
return base.Draw(spriteBatch, drawPosition, mouseOverList, map);
}