本文整理汇总了C#中Server.StaticTile类的典型用法代码示例。如果您正苦于以下问题:C# StaticTile类的具体用法?C# StaticTile怎么用?C# StaticTile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StaticTile类属于Server命名空间,在下文中一共展示了StaticTile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MultiComponentList
public MultiComponentList( MultiComponentList toCopy )
{
m_Min = toCopy.m_Min;
m_Max = toCopy.m_Max;
m_Center = toCopy.m_Center;
m_Width = toCopy.m_Width;
m_Height = toCopy.m_Height;
m_Tiles = new StaticTile[m_Width][][];
for ( int x = 0; x < m_Width; ++x )
{
m_Tiles[x] = new StaticTile[m_Height][];
for ( int y = 0; y < m_Height; ++y )
{
m_Tiles[x][y] = new StaticTile[toCopy.m_Tiles[x][y].Length];
for ( int i = 0; i < m_Tiles[x][y].Length; ++i )
m_Tiles[x][y][i] = toCopy.m_Tiles[x][y][i];
}
}
m_List = new MultiTileEntry[toCopy.m_List.Length];
for ( int i = 0; i < m_List.Length; ++i )
m_List[i] = toCopy.m_List[i];
}
示例2: ToArray
public StaticTile[] ToArray()
{
if (this.m_Count == 0)
return m_EmptyTiles;
StaticTile[] tiles = new StaticTile[this.m_Count];
for (int i = 0; i < this.m_Count; ++i)
tiles[i] = this.m_Tiles[i];
this.m_Count = 0;
return tiles;
}
示例3: AddRange
public void AddRange( StaticTile[] tiles )
{
if ( (m_Count + tiles.Length) > m_Tiles.Length )
{
StaticTile[] old = m_Tiles;
m_Tiles = new StaticTile[(m_Count + tiles.Length) * 2];
for ( int i = 0; i < old.Length; ++i )
m_Tiles[i] = old[i];
}
for ( int i = 0; i < tiles.Length; ++i )
m_Tiles[m_Count++] = tiles[i];
}
示例4: AddRange
public void AddRange(StaticTile[] tiles)
{
if ((this.m_Count + tiles.Length) > this.m_Tiles.Length)
{
StaticTile[] old = this.m_Tiles;
this.m_Tiles = new StaticTile[(this.m_Count + tiles.Length) * 2];
for (int i = 0; i < old.Length; ++i)
this.m_Tiles[i] = old[i];
}
for (int i = 0; i < tiles.Length; ++i)
this.m_Tiles[this.m_Count++] = tiles[i];
}
示例5: PatchTiles
public static StaticTile[] PatchTiles(StaticTile[] tiles, int season)
{
if ( season <= 0 || season >= SeasonCount )
return tiles;
var tileChanges = m_TileChanges[season];
if ( tileChanges != null )
{
for ( int i = 0; i < tiles.Length; i++ )
{
if (tileChanges.ContainsKey(tiles[i].ID))
tiles[i].ID = tileChanges[tiles[i].ID];
}
}
return tiles;
}
示例6: IsOk
private bool IsOk( bool ignoreDoors, bool ignoreSpellFields, int ourZ, int ourTop, StaticTile[] tiles, List<Item> items )
{
for ( int i = 0; i < tiles.Length; ++i )
{
StaticTile check = tiles[i];
ItemData itemData = TileData.ItemTable[check.ID & TileData.MaxItemValue];
if ( (itemData.Flags & ImpassableSurface) != 0 ) // Impassable || Surface
{
int checkZ = check.Z;
int checkTop = checkZ + itemData.CalcHeight;
if ( checkTop > ourZ && ourTop > checkZ )
return false;
}
}
for ( int i = 0; i < items.Count; ++i )
{
Item item = items[i];
int itemID = item.ItemID & TileData.MaxItemValue;
ItemData itemData = TileData.ItemTable[itemID];
TileFlag flags = itemData.Flags;
if ( (flags & ImpassableSurface) != 0 ) // Impassable || Surface
{
if ( ignoreDoors && ((flags & TileFlag.Door) != 0 || itemID == 0x692 || itemID == 0x846 || itemID == 0x873 || (itemID >= 0x6F5 && itemID <= 0x6F6)) )
continue;
if ( ignoreSpellFields && ( itemID == 0x82 || itemID == 0x3946 || itemID == 0x3956 ) )
continue;
int checkZ = item.Z;
int checkTop = checkZ + itemData.CalcHeight;
if ( checkTop > ourZ && ourTop > checkZ )
return false;
}
}
return true;
}
示例7: Resize
public void Resize( int newWidth, int newHeight )
{
int oldWidth = m_Width, oldHeight = m_Height;
StaticTile[][][] oldTiles = m_Tiles;
int totalLength = 0;
StaticTile[][][] newTiles = new StaticTile[newWidth][][];
for ( int x = 0; x < newWidth; ++x )
{
newTiles[x] = new StaticTile[newHeight][];
for ( int y = 0; y < newHeight; ++y )
{
if ( x < oldWidth && y < oldHeight )
newTiles[x][y] = oldTiles[x][y];
else
newTiles[x][y] = new StaticTile[0];
totalLength += newTiles[x][y].Length;
}
}
m_Tiles = newTiles;
m_List = new MultiTileEntry[totalLength];
m_Width = newWidth;
m_Height = newHeight;
m_Min = Point2D.Zero;
m_Max = Point2D.Zero;
int index = 0;
for ( int x = 0; x < newWidth; ++x )
{
for ( int y = 0; y < newHeight; ++y )
{
StaticTile[] tiles = newTiles[x][y];
for ( int i = 0; i < tiles.Length; ++i )
{
StaticTile tile = tiles[i];
int vx = x - m_Center.X;
int vy = y - m_Center.Y;
if ( vx < m_Min.m_X )
m_Min.m_X = vx;
if ( vy < m_Min.m_Y )
m_Min.m_Y = vy;
if ( vx > m_Max.m_X )
m_Max.m_X = vx;
if ( vy > m_Max.m_Y )
m_Max.m_Y = vy;
m_List[index++] = new MultiTileEntry( (ushort)tile.ID, (short)vx, (short)vy, (short)tile.Z, 1 );
}
}
}
}
示例8: IsExcludedTile
public override bool IsExcludedTile(StaticTile[] tiles)
{
foreach(StaticTile tile in tiles)
{
if (!IsMastTile(tile))
return false;
}
return true;
}
示例9: Add
public void Add( int itemID, int x, int y, int z )
{
int vx = x + m_Center.m_X;
int vy = y + m_Center.m_Y;
if ( vx >= 0 && vx < m_Width && vy >= 0 && vy < m_Height )
{
StaticTile[] oldTiles = m_Tiles[vx][vy];
for ( int i = oldTiles.Length - 1; i >= 0; --i )
{
ItemData data = TileData.ItemTable[itemID & TileData.MaxItemValue];
if ( oldTiles[i].Z == z && (oldTiles[i].Height > 0 == data.Height > 0 ) )
{
bool newIsRoof = ( data.Flags & TileFlag.Roof) != 0;
bool oldIsRoof = (TileData.ItemTable[oldTiles[i].ID & TileData.MaxItemValue].Flags & TileFlag.Roof ) != 0;
if ( newIsRoof == oldIsRoof )
Remove( oldTiles[i].ID, x, y, z );
}
}
oldTiles = m_Tiles[vx][vy];
StaticTile[] newTiles = new StaticTile[oldTiles.Length + 1];
for ( int i = 0; i < oldTiles.Length; ++i )
newTiles[i] = oldTiles[i];
newTiles[oldTiles.Length] = new StaticTile( (ushort)itemID, (sbyte)z );
m_Tiles[vx][vy] = newTiles;
MultiTileEntry[] oldList = m_List;
MultiTileEntry[] newList = new MultiTileEntry[oldList.Length + 1];
for ( int i = 0; i < oldList.Length; ++i )
newList[i] = oldList[i];
newList[oldList.Length] = new MultiTileEntry( (ushort)itemID, (short)x, (short)y, (short)z, 1 );
m_List = newList;
if ( x < m_Min.m_X )
m_Min.m_X = x;
if ( y < m_Min.m_Y )
m_Min.m_Y = y;
if ( x > m_Max.m_X )
m_Max.m_X = x;
if ( y > m_Max.m_Y )
m_Max.m_Y = y;
}
}
示例10: RemoveXYZH
public void RemoveXYZH( int x, int y, int z, int minHeight )
{
int vx = x + m_Center.m_X;
int vy = y + m_Center.m_Y;
if ( vx >= 0 && vx < m_Width && vy >= 0 && vy < m_Height )
{
StaticTile[] oldTiles = m_Tiles[vx][vy];
for ( int i = 0; i < oldTiles.Length; ++i )
{
StaticTile tile = oldTiles[i];
if ( tile.Z == z && tile.Height >= minHeight )
{
StaticTile[] newTiles = new StaticTile[oldTiles.Length - 1];
for ( int j = 0; j < i; ++j )
newTiles[j] = oldTiles[j];
for ( int j = i + 1; j < oldTiles.Length; ++j )
newTiles[j - 1] = oldTiles[j];
m_Tiles[vx][vy] = newTiles;
break;
}
}
MultiTileEntry[] oldList = m_List;
for ( int i = 0; i < oldList.Length; ++i )
{
MultiTileEntry tile = oldList[i];
if ( tile.m_OffsetX == (short)x && tile.m_OffsetY == (short)y && tile.m_OffsetZ == (short)z && TileData.ItemTable[tile.m_ItemID & TileData.MaxItemValue].Height >= minHeight )
{
MultiTileEntry[] newList = new MultiTileEntry[oldList.Length - 1];
for ( int j = 0; j < i; ++j )
newList[j] = oldList[j];
for ( int j = i + 1; j < oldList.Length; ++j )
newList[j - 1] = oldList[j];
m_List = newList;
break;
}
}
}
}
示例11: MultiComponentList
public MultiComponentList(GenericReader reader)
{
int version = reader.ReadInt();
m_Min = reader.ReadPoint2D();
m_Max = reader.ReadPoint2D();
m_Center = reader.ReadPoint2D();
m_Width = reader.ReadInt();
m_Height = reader.ReadInt();
int length = reader.ReadInt();
var allTiles = m_List = new MultiTileEntry[length];
if (version == 0)
{
for (int i = 0; i < length; ++i)
{
int id = reader.ReadShort();
if (id >= 0x4000)
{
id -= 0x4000;
}
allTiles[i].m_ItemID = (ushort)id;
allTiles[i].m_OffsetX = reader.ReadShort();
allTiles[i].m_OffsetY = reader.ReadShort();
allTiles[i].m_OffsetZ = reader.ReadShort();
allTiles[i].m_Flags = reader.ReadInt();
}
}
else
{
for (int i = 0; i < length; ++i)
{
allTiles[i].m_ItemID = reader.ReadUShort();
allTiles[i].m_OffsetX = reader.ReadShort();
allTiles[i].m_OffsetY = reader.ReadShort();
allTiles[i].m_OffsetZ = reader.ReadShort();
allTiles[i].m_Flags = reader.ReadInt();
}
}
var tiles = new TileList[m_Width][];
m_Tiles = new StaticTile[m_Width][][];
for (int x = 0; x < m_Width; ++x)
{
tiles[x] = new TileList[m_Height];
m_Tiles[x] = new StaticTile[m_Height][];
for (int y = 0; y < m_Height; ++y)
{
tiles[x][y] = new TileList();
}
}
for (int i = 0; i < allTiles.Length; ++i)
{
if (i == 0 || allTiles[i].m_Flags != 0)
{
int xOffset = allTiles[i].m_OffsetX + m_Center.m_X;
int yOffset = allTiles[i].m_OffsetY + m_Center.m_Y;
#region Stygian Abyss
//tiles[xOffset][yOffset].Add( (ushort)allTiles[i].m_ItemID, (sbyte)allTiles[i].m_OffsetZ );
tiles[xOffset][yOffset].Add(
(ushort)((allTiles[i].m_ItemID & TileData.MaxItemValue) | 0x10000), (sbyte)allTiles[i].m_OffsetZ);
#endregion
}
}
for (int x = 0; x < m_Width; ++x)
{
for (int y = 0; y < m_Height; ++y)
{
m_Tiles[x][y] = tiles[x][y].ToArray();
}
}
}
示例12: Freeze
//.........这里部分代码省略.........
from.SendGump( new NoticeGump( 1060637, 30720, "No freezable items were found. Only the following item types are frozen:<br> - Static<br> - BaseFloor<br> - BaseWall", 0xFFC000, 320, 240, null, null ) );
return;
}
bool badDataFile = false;
int totalFrozen = 0;
foreach ( DictionaryEntry de in mapTable )
{
Map map = (Map)de.Key;
Hashtable table = (Hashtable)de.Value;
TileMatrix matrix = map.Tiles;
using ( FileStream idxStream = OpenWrite( matrix.IndexStream ) )
{
using ( FileStream mulStream = OpenWrite( matrix.DataStream ) )
{
if ( idxStream == null || mulStream == null )
{
badDataFile = true;
continue;
}
BinaryReader idxReader = new BinaryReader( idxStream );
BinaryWriter idxWriter = new BinaryWriter( idxStream );
BinaryWriter mulWriter = new BinaryWriter( mulStream );
foreach ( DeltaState state in table.Values )
{
int oldTileCount;
StaticTile[] oldTiles = ReadStaticBlock( idxReader, mulStream, state.m_X, state.m_Y, matrix.BlockWidth, matrix.BlockHeight, out oldTileCount );
if ( oldTileCount < 0 )
continue;
int newTileCount = 0;
StaticTile[] newTiles = new StaticTile[state.m_List.Count];
for ( int i = 0; i < state.m_List.Count; ++i )
{
Item item = (Item)state.m_List[i];
int xOffset = item.X - (state.m_X * 8);
int yOffset = item.Y - (state.m_Y * 8);
if ( xOffset < 0 || xOffset >= 8 || yOffset < 0 || yOffset >= 8 )
continue;
StaticTile newTile = new StaticTile();
newTile.m_ID = (short)(item.ItemID & 0x3FFF);
newTile.m_X = (byte)xOffset;
newTile.m_Y = (byte)yOffset;
newTile.m_Z = (sbyte)item.Z;
newTile.m_Hue = (short)item.Hue;
newTiles[newTileCount++] = newTile;
item.Delete();
++totalFrozen;
}
示例13: PatchStatics
private unsafe int PatchStatics( TileMatrix matrix, string dataPath, string indexPath, string lookupPath )
{
using ( FileStream fsData = new FileStream( dataPath, FileMode.Open, FileAccess.Read, FileShare.Read ) )
{
using ( FileStream fsIndex = new FileStream( indexPath, FileMode.Open, FileAccess.Read, FileShare.Read ) )
{
using ( FileStream fsLookup = new FileStream( lookupPath, FileMode.Open, FileAccess.Read, FileShare.Read ) )
{
BinaryReader indexReader = new BinaryReader( fsIndex );
BinaryReader lookupReader = new BinaryReader( fsLookup );
int count = (int)(indexReader.BaseStream.Length / 4);
TileList[][] lists = new TileList[8][];
for ( int x = 0; x < 8; ++x )
{
lists[x] = new TileList[8];
for ( int y = 0; y < 8; ++y )
lists[x][y] = new TileList();
}
for ( int i = 0; i < count; ++i )
{
int blockID = indexReader.ReadInt32();
int blockX = blockID / matrix.BlockHeight;
int blockY = blockID % matrix.BlockHeight;
int offset = lookupReader.ReadInt32();
int length = lookupReader.ReadInt32();
lookupReader.ReadInt32(); // Extra
if ( offset < 0 || length <= 0 )
{
matrix.SetStaticBlock( blockX, blockY, matrix.EmptyStaticBlock );
continue;
}
fsData.Seek( offset, SeekOrigin.Begin );
int tileCount = length / 7;
if ( m_TileBuffer.Length < tileCount )
m_TileBuffer = new StaticTile[tileCount];
StaticTile[] staTiles = m_TileBuffer;
fixed ( StaticTile *pTiles = staTiles )
{
#if !MONO
NativeReader.Read( fsData.SafeFileHandle.DangerousGetHandle(), pTiles, length );
#else
NativeReader.Read( fsData.Handle, pTiles, length );
#endif
StaticTile *pCur = pTiles, pEnd = pTiles + tileCount;
while ( pCur < pEnd )
{
lists[pCur->m_X & 0x7][pCur->m_Y & 0x7].Add( (ushort)pCur->m_ID, pCur->m_Z );
pCur = pCur + 1;
}
StaticTile[][][] tiles = new StaticTile[8][][];
for ( int x = 0; x < 8; ++x )
{
tiles[x] = new StaticTile[8][];
for ( int y = 0; y < 8; ++y )
tiles[x][y] = lists[x][y].ToArray();
}
matrix.SetStaticBlock( blockX, blockY, tiles );
}
}
indexReader.Close();
lookupReader.Close();
return count;
}
}
}
}
示例14: SetStaticBlock
public void SetStaticBlock( int x, int y, StaticTile[][][] value )
{
if ( x < 0 || y < 0 || x >= m_BlockWidth || y >= m_BlockHeight )
return;
if ( m_StaticTiles[x] == null )
m_StaticTiles[x] = new StaticTile[m_BlockHeight][][][];
m_StaticTiles[x][y] = value;
if ( m_StaticPatches[x] == null )
m_StaticPatches[x] = new int[(m_BlockHeight + 31) >> 5];
m_StaticPatches[x][y >> 5] |= 1 << (y & 0x1F);
}
示例15: IsMastTile
public bool IsMastTile(StaticTile tile)
{
int id = tile.ID;
if ((id >= 30150 && id <= 30193) || (id >= 30650 && id <= 30693))
return true;
if ((id >= 30650 && id <= 30693) || (id >= 31150 && id <= 31193))
return true;
if ((id >= 31150 && id <= 31193) || (id >= 31650 && id <= 31693))
return true;
if ((id >= 31840 && id <= 31883) || (id >= 32040 && id <= 32083))
return true;
if ((id >= 32240 && id <= 32283) || (id >= 32440 && id <= 32483))
return true;
if ((id >= 32640 && id <= 32683) || (id >= 32840 && id <= 32883))
return true;
if ((id >= 33040 && id <= 33083) || (id >= 33240 && id <= 33283))
return true;
if ((id >= 23720 && id <= 23740) || (id >= 23742 && id <= 23892))
return true;
if ((id >= 23894 && id <= 23902) || (id >= 23904 && id <= 23935))
return true;
if (id >= 25256 && id <= 25471)
return true;
return false;
}