本文整理汇总了C#中Server.MultiTileEntry类的典型用法代码示例。如果您正苦于以下问题:C# MultiTileEntry类的具体用法?C# MultiTileEntry怎么用?C# MultiTileEntry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MultiTileEntry类属于Server命名空间,在下文中一共展示了MultiTileEntry类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DesignStateDetailed
public DesignStateDetailed( int serial, int revision, int xMin, int yMin, int xMax, int yMax, MultiTileEntry[] tiles )
: base(0xD8)
{
EnsureCapacity( 17 + (tiles.Length * 5) );
Write( (byte) 0x03 ); // Compression Type
Write( (byte) 0x00 ); // Unknown
Write( (int) serial );
Write( (int) revision );
Write( (short) tiles.Length );
Write( (short) 0 ); // Buffer length : reserved
Write( (byte) 0 ); // Plane count : reserved
int totalLength = 1; // includes plane count
int width = (xMax - xMin) + 1;
int height = (yMax - yMin) + 1;
if ( m_PlaneBuffers == null )
{
m_PlaneBuffers = new byte[9][];
m_PlaneUsed = new bool[9];
for ( int i = 0; i < m_PlaneBuffers.Length; ++i )
m_PlaneBuffers[i] = new byte[0x400];
m_StairBuffers = new byte[6][];
for ( int i = 0; i < m_StairBuffers.Length; ++i )
m_StairBuffers[i] = new byte[MaxItemsPerStairBuffer * 5];
}
else
{
for ( int i = 0; i < m_PlaneUsed.Length; ++i )
m_PlaneUsed[i] = false;
Clear( m_PlaneBuffers[0], width * height * 2 );
for ( int i = 0; i < 4; ++i )
{
Clear( m_PlaneBuffers[1 + i], (width - 1) * (height - 2) * 2 );
Clear( m_PlaneBuffers[5 + i], width * (height - 1) * 2 );
}
}
int totalStairsUsed = 0;
for ( int i = 0; i < tiles.Length; ++i )
{
MultiTileEntry mte = tiles[i];
int x = mte.m_OffsetX - xMin;
int y = mte.m_OffsetY - yMin;
int z = mte.m_OffsetZ;
bool floor = ( TileData.ItemTable[mte.m_ItemID & 0x3FFF].Height <= 0 );
int plane, size;
switch ( z )
{
case 0: plane = 0; break;
case 7: plane = 1; break;
case 27: plane = 2; break;
case 47: plane = 3; break;
case 67: plane = 4; break;
default:
{
int stairBufferIndex = ( totalStairsUsed / MaxItemsPerStairBuffer );
byte[] stairBuffer = m_StairBuffers[stairBufferIndex];
int byteIndex = (totalStairsUsed % MaxItemsPerStairBuffer) * 5;
stairBuffer[byteIndex++] = (byte) ((mte.m_ItemID >> 8) & 0x3F);
stairBuffer[byteIndex++] = (byte) mte.m_ItemID;
stairBuffer[byteIndex++] = (byte) mte.m_OffsetX;
stairBuffer[byteIndex++] = (byte) mte.m_OffsetY;
stairBuffer[byteIndex++] = (byte) mte.m_OffsetZ;
++totalStairsUsed;
continue;
}
}
if ( plane == 0 )
{
size = height;
}
else if ( floor )
{
size = height - 2;
x -= 1;
y -= 1;
}
else
{
size = height - 1;
plane += 4;
}
int index = ((x * size) + y) * 2;
//.........这里部分代码省略.........
示例2: AddFixture
public void AddFixture( Item item, MultiTileEntry mte )
{
m_Fixtures.Add( item );
item.MoveToWorld( new Point3D( X + mte.m_OffsetX, Y + mte.m_OffsetY, Z + mte.m_OffsetZ ), Map );
}
示例3: AddFixtures
public void AddFixtures( Mobile from, MultiTileEntry[] list )
{
if ( m_Fixtures == null )
m_Fixtures = new ArrayList();
uint keyValue = 0;
for ( int i = 0; i < list.Length; ++i )
{
MultiTileEntry mte = list[i];
int itemID = mte.m_ItemID & 0x3FFF;
if ( itemID >= 0x181D && itemID < 0x1829 )
{
HouseTeleporter tp = new HouseTeleporter( itemID );
AddFixture( tp, mte );
}
else
{
BaseDoor door = null;
if ( itemID >= 0x675 && itemID < 0x6F5 )
{
int type = (itemID - 0x675) / 16;
DoorFacing facing = (DoorFacing)(((itemID - 0x675) / 2) % 8);
switch ( type )
{
case 0: door = new GenericHouseDoor( facing, 0x675, 0xEC, 0xF3 ); break;
case 1: door = new GenericHouseDoor( facing, 0x685, 0xEC, 0xF3 ); break;
case 2: door = new GenericHouseDoor( facing, 0x695, 0xEB, 0xF2 ); break;
case 3: door = new GenericHouseDoor( facing, 0x6A5, 0xEA, 0xF1 ); break;
case 4: door = new GenericHouseDoor( facing, 0x6B5, 0xEA, 0xF1 ); break;
case 5: door = new GenericHouseDoor( facing, 0x6C5, 0xEC, 0xF3 ); break;
case 6: door = new GenericHouseDoor( facing, 0x6D5, 0xEA, 0xF1 ); break;
case 7: door = new GenericHouseDoor( facing, 0x6E5, 0xEA, 0xF1 ); break;
}
}
else if ( itemID >= 0x314 && itemID < 0x364 )
{
int type = (itemID - 0x314) / 16;
DoorFacing facing = (DoorFacing)(((itemID - 0x314) / 2) % 8);
switch ( type )
{
case 0: door = new GenericHouseDoor( facing, 0x314, 0xED, 0xF4 ); break;
case 1: door = new GenericHouseDoor( facing, 0x324, 0xED, 0xF4 ); break;
case 2: door = new GenericHouseDoor( facing, 0x334, 0xED, 0xF4 ); break;
case 3: door = new GenericHouseDoor( facing, 0x344, 0xED, 0xF4 ); break;
case 4: door = new GenericHouseDoor( facing, 0x354, 0xED, 0xF4 ); break;
}
}
else if ( itemID >= 0x824 && itemID < 0x834 )
{
DoorFacing facing = (DoorFacing)(((itemID - 0x824) / 2) % 8);
door = new GenericHouseDoor( facing, 0x824, 0xEC, 0xF3 );
}
else if ( itemID >= 0x839 && itemID < 0x849 )
{
DoorFacing facing = (DoorFacing)(((itemID - 0x839) / 2) % 8);
door = new GenericHouseDoor( facing, 0x839, 0xEB, 0xF2 );
}
else if ( itemID >= 0x84C && itemID < 0x85C )
{
DoorFacing facing = (DoorFacing)(((itemID - 0x84C) / 2) % 8);
door = new GenericHouseDoor( facing, 0x84C, 0xEC, 0xF3 );
}
else if ( itemID >= 0x866 && itemID < 0x876 )
{
DoorFacing facing = (DoorFacing)(((itemID - 0x866) / 2) % 8);
door = new GenericHouseDoor( facing, 0x866, 0xEB, 0xF2 );
}
else if ( itemID >= 0xE8 && itemID < 0xF8 )
{
DoorFacing facing = (DoorFacing)(((itemID - 0xE8) / 2) % 8);
door = new GenericHouseDoor( facing, 0xE8, 0xED, 0xF4 );
}
else if ( itemID >= 0x1FED && itemID < 0x1FFD )
{
DoorFacing facing = (DoorFacing)(((itemID - 0x1FED) / 2) % 8);
door = new GenericHouseDoor( facing, 0x1FED, 0xEC, 0xF3 );
}
else if ( itemID >= 0x241F && itemID < 0x2421 )
{
//DoorFacing facing = (DoorFacing)(((itemID - 0x241F) / 2) % 8);
door = new GenericHouseDoor( DoorFacing.NorthCCW, 0x2415, -1, -1 );
}
else if ( itemID >= 0x2423 && itemID < 0x2425 )
{
//DoorFacing facing = (DoorFacing)(((itemID - 0x241F) / 2) % 8);
//This one and the above one are 'special' cases, ie: OSI had the ItemID pattern discombobulated for these
door = new GenericHouseDoor( DoorFacing.WestCW, 0x2423, -1, -1 );
}
else if ( itemID >= 0x2A05 && itemID < 0x2A1D )
{
DoorFacing facing = (DoorFacing)((((itemID - 0x2A05) / 2) % 4) + 8);
int sound = ( itemID >= 0x2A0D && itemID < 0x2a15 ) ? 0x539 : -1;
//.........这里部分代码省略.........
示例4: 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;
}
}
}
}
示例5: 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 );
}
}
}
}
示例6: AddFixtures
public void AddFixtures( Mobile from, MultiTileEntry[] list )
{
if( m_Fixtures == null )
m_Fixtures = new List<Item>();
uint keyValue = 0;
for( int i = 0; i < list.Length; ++i )
{
MultiTileEntry mte = list[i];
int itemID = mte.m_ItemID;
if( itemID >= 0x181D && itemID < 0x1829 )
{
HouseTeleporter tp = new HouseTeleporter( itemID );
AddFixture( tp, mte );
}
else
{
BaseDoor door = null;
if( itemID >= 0x675 && itemID < 0x6F5 )
{
int type = (itemID - 0x675) / 16;
DoorFacing facing = (DoorFacing)(((itemID - 0x675) / 2) % 8);
switch( type )
{
case 0: door = new GenericHouseDoor( facing, 0x675, 0xEC, 0xF3 ); break;
case 1: door = new GenericHouseDoor( facing, 0x685, 0xEC, 0xF3 ); break;
case 2: door = new GenericHouseDoor( facing, 0x695, 0xEB, 0xF2 ); break;
case 3: door = new GenericHouseDoor( facing, 0x6A5, 0xEA, 0xF1 ); break;
case 4: door = new GenericHouseDoor( facing, 0x6B5, 0xEA, 0xF1 ); break;
case 5: door = new GenericHouseDoor( facing, 0x6C5, 0xEC, 0xF3 ); break;
case 6: door = new GenericHouseDoor( facing, 0x6D5, 0xEA, 0xF1 ); break;
case 7: door = new GenericHouseDoor( facing, 0x6E5, 0xEA, 0xF1 ); break;
}
}
else if( itemID >= 0x314 && itemID < 0x364 )
{
int type = (itemID - 0x314) / 16;
DoorFacing facing = (DoorFacing)(((itemID - 0x314) / 2) % 8);
door = new GenericHouseDoor( facing, 0x314 + ( type * 16 ), 0xED, 0xF4 );
}
else if( itemID >= 0x824 && itemID < 0x834 )
{
DoorFacing facing = (DoorFacing)(((itemID - 0x824) / 2) % 8);
door = new GenericHouseDoor( facing, 0x824, 0xEC, 0xF3 );
}
else if( itemID >= 0x839 && itemID < 0x849 )
{
DoorFacing facing = (DoorFacing)(((itemID - 0x839) / 2) % 8);
door = new GenericHouseDoor( facing, 0x839, 0xEB, 0xF2 );
}
else if( itemID >= 0x84C && itemID < 0x85C )
{
DoorFacing facing = (DoorFacing)(((itemID - 0x84C) / 2) % 8);
door = new GenericHouseDoor( facing, 0x84C, 0xEC, 0xF3 );
}
else if( itemID >= 0x866 && itemID < 0x876 )
{
DoorFacing facing = (DoorFacing)(((itemID - 0x866) / 2) % 8);
door = new GenericHouseDoor( facing, 0x866, 0xEB, 0xF2 );
}
else if( itemID >= 0xE8 && itemID < 0xF8 )
{
DoorFacing facing = (DoorFacing)(((itemID - 0xE8) / 2) % 8);
door = new GenericHouseDoor( facing, 0xE8, 0xED, 0xF4 );
}
else if( itemID >= 0x1FED && itemID < 0x1FFD )
{
DoorFacing facing = (DoorFacing)(((itemID - 0x1FED) / 2) % 8);
door = new GenericHouseDoor( facing, 0x1FED, 0xEC, 0xF3 );
}
else if( itemID >= 0x241F && itemID < 0x2421 )
{
//DoorFacing facing = (DoorFacing)(((itemID - 0x241F) / 2) % 8);
door = new GenericHouseDoor( DoorFacing.NorthCCW, 0x2415, -1, -1 );
}
else if( itemID >= 0x2423 && itemID < 0x2425 )
{
//DoorFacing facing = (DoorFacing)(((itemID - 0x241F) / 2) % 8);
//This one and the above one are 'special' cases, ie: OSI had the ItemID pattern discombobulated for these
door = new GenericHouseDoor( DoorFacing.WestCW, 0x2423, -1, -1 );
}
else if( itemID >= 0x2A05 && itemID < 0x2A1D )
{
DoorFacing facing = (DoorFacing)((((itemID - 0x2A05) / 2) % 4) + 8);
int sound = (itemID >= 0x2A0D && itemID < 0x2a15) ? 0x539 : -1;
door = new GenericHouseDoor( facing, 0x29F5 + (8 * ((itemID - 0x2A05) / 8)), sound, sound );
}
else if( itemID == 0x2D46 )
{
door = new GenericHouseDoor( DoorFacing.NorthCW, 0x2D46, 0xEA, 0xF1, false );
}
else if( itemID == 0x2D48 || itemID == 0x2FE2 )
{
//.........这里部分代码省略.........
示例7: 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;
}
}
示例8: Remove
public void Remove(int itemID, int x, int y, int z)
{
int vx = x + this.m_Center.m_X;
int vy = y + this.m_Center.m_Y;
if (vx >= 0 && vx < this.m_Width && vy >= 0 && vy < this.m_Height)
{
StaticTile[] oldTiles = this.m_Tiles[vx][vy];
for (int i = 0; i < oldTiles.Length; ++i)
{
StaticTile tile = oldTiles[i];
if (tile.ID == itemID && tile.Z == z)
{
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];
this.m_Tiles[vx][vy] = newTiles;
break;
}
}
MultiTileEntry[] oldList = this.m_List;
for (int i = 0; i < oldList.Length; ++i)
{
MultiTileEntry tile = oldList[i];
if (tile.m_ItemID == itemID && tile.m_OffsetX == (short)x && tile.m_OffsetY == (short)y && tile.m_OffsetZ == (short)z)
{
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];
this.m_List = newList;
break;
}
}
}
}
示例9: AddFixtures
public void AddFixtures( Mobile from, MultiTileEntry[] list )
{
if( m_Fixtures == null )
m_Fixtures = new ArrayList();
uint keyValue = 0;
for( int i = 0; i < list.Length; ++i )
{
MultiTileEntry mte = list[i];
int itemID = mte.m_ItemID & 0x3FFF;
if( itemID >= 0x181D && itemID < 0x1829 )
{
HouseTeleporter tp = new HouseTeleporter( itemID );
AddFixture( tp, mte );
}
else
{
BaseDoor door = null;
if( itemID >= 0x675 && itemID < 0x6F5 )
{
int type = (itemID - 0x675) / 16;
DoorFacing facing = (DoorFacing)(((itemID - 0x675) / 2) % 8);
switch( type )
{
case 0: door = new GenericHouseDoor( facing, 0x675, 0xEC, 0xF3 ); break;
case 1: door = new GenericHouseDoor( facing, 0x685, 0xEC, 0xF3 ); break;
case 2: door = new GenericHouseDoor( facing, 0x695, 0xEB, 0xF2 ); break;
case 3: door = new GenericHouseDoor( facing, 0x6A5, 0xEA, 0xF1 ); break;
case 4: door = new GenericHouseDoor( facing, 0x6B5, 0xEA, 0xF1 ); break;
case 5: door = new GenericHouseDoor( facing, 0x6C5, 0xEC, 0xF3 ); break;
case 6: door = new GenericHouseDoor( facing, 0x6D5, 0xEA, 0xF1 ); break;
case 7: door = new GenericHouseDoor( facing, 0x6E5, 0xEA, 0xF1 ); break;
}
}
else if( itemID >= 0x314 && itemID < 0x364 )
{
int type = (itemID - 0x314) / 16;
DoorFacing facing = (DoorFacing)(((itemID - 0x314) / 2) % 8);
//TODO: Change this to just do a 0x314 + type*16
switch( type )
{
case 0: door = new GenericHouseDoor( facing, 0x314, 0xED, 0xF4 ); break;
case 1: door = new GenericHouseDoor( facing, 0x324, 0xED, 0xF4 ); break;
case 2: door = new GenericHouseDoor( facing, 0x334, 0xED, 0xF4 ); break;
case 3: door = new GenericHouseDoor( facing, 0x344, 0xED, 0xF4 ); break;
case 4: door = new GenericHouseDoor( facing, 0x354, 0xED, 0xF4 ); break;
}
}
else if( itemID >= 0x824 && itemID < 0x834 )
{
DoorFacing facing = (DoorFacing)(((itemID - 0x824) / 2) % 8);
door = new GenericHouseDoor( facing, 0x824, 0xEC, 0xF3 );
}
else if( itemID >= 0x839 && itemID < 0x849 )
{
DoorFacing facing = (DoorFacing)(((itemID - 0x839) / 2) % 8);
door = new GenericHouseDoor( facing, 0x839, 0xEB, 0xF2 );
}
else if( itemID >= 0x84C && itemID < 0x85C )
{
DoorFacing facing = (DoorFacing)(((itemID - 0x84C) / 2) % 8);
door = new GenericHouseDoor( facing, 0x84C, 0xEC, 0xF3 );
}
else if( itemID >= 0x866 && itemID < 0x876 )
{
DoorFacing facing = (DoorFacing)(((itemID - 0x866) / 2) % 8);
door = new GenericHouseDoor( facing, 0x866, 0xEB, 0xF2 );
}
else if( itemID >= 0xE8 && itemID < 0xF8 )
{
DoorFacing facing = (DoorFacing)(((itemID - 0xE8) / 2) % 8);
door = new GenericHouseDoor( facing, 0xE8, 0xED, 0xF4 );
}
else if( itemID >= 0x1FED && itemID < 0x1FFD )
{
DoorFacing facing = (DoorFacing)(((itemID - 0x1FED) / 2) % 8);
door = new GenericHouseDoor( facing, 0x1FED, 0xEC, 0xF3 );
}
else if( itemID >= 0x241F && itemID < 0x2421 )
{
//DoorFacing facing = (DoorFacing)(((itemID - 0x241F) / 2) % 8);
door = new GenericHouseDoor( DoorFacing.NorthCCW, 0x2415, -1, -1 );
}
else if( itemID >= 0x2423 && itemID < 0x2425 )
{
//DoorFacing facing = (DoorFacing)(((itemID - 0x241F) / 2) % 8);
//This one and the above one are 'special' cases, ie: OSI had the ItemID pattern discombobulated for these
door = new GenericHouseDoor( DoorFacing.WestCW, 0x2423, -1, -1 );
}
else if( itemID >= 0x2A05 && itemID < 0x2A1D )
{
DoorFacing facing = (DoorFacing)((((itemID - 0x2A05) / 2) % 4) + 8);
int sound = (itemID >= 0x2A0D && itemID < 0x2a15) ? 0x539 : -1;
//.........这里部分代码省略.........
示例10: Remove
public void Remove( 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 )
{
Tile[] oldTiles = m_Tiles[vx][vy];
for ( int i = 0; i < oldTiles.Length; ++i )
{
Tile tile = oldTiles[i];
#region SA
if ( (tile.ID & 0x7FFF) == (itemID & 0x7FFF) && tile.Z == z )
{
#endregion
Tile[] newTiles = new Tile[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];
#region SA
if ( (tile.m_ItemID & 0x7FFF) == (short)(itemID & 0x7FFF) && tile.m_OffsetX == (short)x && tile.m_OffsetY == (short)y && tile.m_OffsetZ == (short)z )
{
#endregion
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: Add
public void Add( int itemID, int x, int y, int z )
{
#region SA
itemID &= 0x7FFF;
itemID |= 0x8000; // Note #2 8000 prevented you from walking on them
// 4003 | 8000 = C003 & 7FFF = 4003
// 4003 | 4000 = 3 & 7FFF = 3
itemID &= 0x7FFF;
#endregion
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 )
{
Tile[] oldTiles = m_Tiles[vx][vy];
for ( int i = oldTiles.Length - 1; i >= 0; --i )
{
#region SA
ItemData data = TileData.ItemTable[itemID & 0x7FFF];
#endregion
if ( oldTiles[i].Z == z && (oldTiles[i].Height > 0 == data.Height > 0 ) )
{
bool newIsRoof = ( data.Flags & TileFlag.Roof) != 0;
#region SA
bool oldIsRoof = (TileData.ItemTable[oldTiles[i].ID & 0x7FFF].Flags & TileFlag.Roof ) != 0;
#endregion
if ( newIsRoof == oldIsRoof )
Remove( oldTiles[i].ID, x, y, z );
}
}
oldTiles = m_Tiles[vx][vy];
Tile[] newTiles = new Tile[oldTiles.Length + 1];
for ( int i = 0; i < oldTiles.Length; ++i )
newTiles[i] = oldTiles[i];
newTiles[oldTiles.Length] = new Tile( (short)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( (short)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;
}
}
示例12: Add
public void Add(int itemID, int x, int y, int z, bool ignoreRoof)
{
itemID &= 0x3FFF;
itemID |= 0x4000;
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)
{
Tile[] oldTiles = m_Tiles[vx][vy];
// adam: we added the ignoreRoof override for our StaticHouses
if (ignoreRoof == false)
for (int i = oldTiles.Length - 1; i >= 0; --i)
{
ItemData data = TileData.ItemTable[itemID & 0x3FFF];
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 & 0x3FFF].Flags & TileFlag.Roof) != 0;
if (newIsRoof == oldIsRoof)
Remove(oldTiles[i].ID, x, y, z);
}
}
oldTiles = m_Tiles[vx][vy];
Tile[] newTiles = new Tile[oldTiles.Length + 1];
for (int i = 0; i < oldTiles.Length; ++i)
newTiles[i] = oldTiles[i];
newTiles[oldTiles.Length] = new Tile((short)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((short)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;
}
}