本文整理汇总了C#中Server.MultiComponentList类的典型用法代码示例。如果您正苦于以下问题:C# MultiComponentList类的具体用法?C# MultiComponentList怎么用?C# MultiComponentList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MultiComponentList类属于Server命名空间,在下文中一共展示了MultiComponentList类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: DesignState
public DesignState( HouseFoundation foundation, GenericReader reader )
{
m_Foundation = foundation;
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
m_Components = new MultiComponentList( reader );
int length = reader.ReadInt();
m_Fixtures = new MultiTileEntry[length];
for ( int i = 0; i < length; ++i )
{
m_Fixtures[i].m_ItemID = reader.ReadShort();
m_Fixtures[i].m_OffsetX = reader.ReadShort();
m_Fixtures[i].m_OffsetY = reader.ReadShort();
m_Fixtures[i].m_OffsetZ = reader.ReadShort();
m_Fixtures[i].m_Flags = reader.ReadInt();
}
m_Revision = reader.ReadInt();
break;
}
}
}
示例3: GetEmptyFoundation
public MultiComponentList GetEmptyFoundation()
{
// Copy original foundation layout
MultiComponentList mcl = new MultiComponentList( MultiData.GetComponents( ItemID ) );
mcl.Resize( mcl.Width, mcl.Height + 1 );
int xCenter = mcl.Center.X;
int yCenter = mcl.Center.Y;
int y = mcl.Height - 1;
ApplyFoundation( m_Type, mcl );
for ( int x = 1; x < mcl.Width; ++x )
mcl.Add( 0x751, x - xCenter, y - yCenter, 0 );
return mcl;
}
示例4: CheckWall
public bool CheckWall( MultiComponentList mcl, int x, int y )
{
x += mcl.Center.X;
y += mcl.Center.Y;
if ( x >= 0 && x < mcl.Width && y >= 0 && y < mcl.Height )
{
Tile[] tiles = mcl.Tiles[x][y];
for ( int i = 0; i < tiles.Length; ++i )
{
Tile tile = tiles[i];
if ( tile.Z == 7 && tile.Height == 20 )
return true;
}
}
return false;
}
示例5: DeleteStairs
public static bool DeleteStairs( MultiComponentList mcl, int id, int x, int y, int z )
{
int ax = x + mcl.Center.X;
int ay = y + mcl.Center.Y;
if ( ax < 0 || ay < 0 || ax >= mcl.Width || ay >= (mcl.Height - 1) || z < 7 || ((z - 7) % 5) != 0 )
return false;
if ( IsStairBlock( id ) )
{
Tile[] tiles = mcl.Tiles[ax][ay];
for ( int i = 0; i < tiles.Length; ++i )
{
Tile tile = tiles[i];
if ( tile.Z == (z + 5) )
{
id = tile.ID;
z = tile.Z;
if ( !IsStairBlock( id ) )
break;
}
}
}
int dir = 0;
if ( !IsStair( id, ref dir ) )
return false;
int height = ((z - 7) % 20) / 5;
int xStart, yStart;
int xInc, yInc;
switch ( dir )
{
default:
case 0: // North
{
xStart = x;
yStart = y + height;
xInc = 0;
yInc = -1;
break;
}
case 1: // West
{
xStart = x + height;
yStart = y;
xInc = -1;
yInc = 0;
break;
}
case 2: // South
{
xStart = x;
yStart = y - height;
xInc = 0;
yInc = 1;
break;
}
case 3: // East
{
xStart = x - height;
yStart = y;
xInc = 1;
yInc = 0;
break;
}
}
int zStart = z - (height * 5);
for ( int i = 0; i < 4; ++i )
{
x = xStart + (i * xInc);
y = yStart + (i * yInc);
for ( int j = 0; j <= i; ++j )
mcl.RemoveXYZH( x, y, zStart + (j * 5), 5 );
ax = x + mcl.Center.X;
ay = y + mcl.Center.Y;
if ( ax >= 1 && ax < mcl.Width && ay >= 1 && ay < mcl.Height - 1 )
{
Tile[] tiles = mcl.Tiles[ax][ay];
bool hasBaseFloor = false;
for ( int j = 0; !hasBaseFloor && j < tiles.Length; ++j )
hasBaseFloor = ( tiles[j].Z == 7 && (tiles[j].ID & 0x3FFF) != 1 );
if ( !hasBaseFloor )
mcl.Add( 0x31F4, x, y, 7 );
}
}
//.........这里部分代码省略.........
示例6: ApplyFoundation
public static void ApplyFoundation( FoundationType type, MultiComponentList mcl )
{
int east, south, post, corner;
GetFoundationGraphics( type, out east, out south, out post, out corner );
int xCenter = mcl.Center.X;
int yCenter = mcl.Center.Y;
mcl.Add( post, 0 - xCenter, 0 - yCenter, 0 );
mcl.Add( corner, mcl.Width - 1 - xCenter, mcl.Height - 2 - yCenter, 0 );
for ( int x = 1; x < mcl.Width; ++x )
{
mcl.Add( south, x - xCenter, 0 - yCenter, 0 );
if ( x < mcl.Width-1 )
mcl.Add( south, x - xCenter, mcl.Height - 2 - yCenter, 0 );
}
for ( int y = 1; y < mcl.Height - 1; ++y )
{
mcl.Add( east, 0 - xCenter, y - yCenter, 0 );
if ( y < mcl.Height - 2 )
mcl.Add( east, mcl.Width - 1 - xCenter, y - yCenter, 0 );
}
}
示例7: AddStairsTo
public static void AddStairsTo( ref MultiComponentList mcl )
{
// copy the original..
mcl = new MultiComponentList( mcl );
mcl.Resize( mcl.Width, mcl.Height + 1 );
int xCenter = mcl.Center.X;
int yCenter = mcl.Center.Y;
int y = mcl.Height - 1;
for ( int x = 0; x < mcl.Width; ++x )
mcl.Add( 0x63, x - xCenter, y - yCenter, 0 );
}
示例8: MultiData
static MultiData()
{
string idxPath = Core.FindDataFile( "multi.idx" );
string mulPath = Core.FindDataFile( "multi.mul" );
if ( File.Exists( idxPath ) && File.Exists( mulPath ) )
{
m_Index = new FileStream( idxPath, FileMode.Open, FileAccess.Read, FileShare.Read );
m_IndexReader = new BinaryReader( m_Index );
m_Stream = new FileStream( mulPath, FileMode.Open, FileAccess.Read, FileShare.Read );
m_StreamReader = new BinaryReader( m_Stream );
m_Components = new MultiComponentList[(int)(m_Index.Length / 12)];
string vdPath = Core.FindDataFile( "verdata.mul" );
if ( File.Exists( vdPath ) )
{
using ( FileStream fs = new FileStream( vdPath, FileMode.Open, FileAccess.Read, FileShare.Read ) )
{
BinaryReader bin = new BinaryReader( fs );
int count = bin.ReadInt32();
for ( int i = 0; i < count; ++i )
{
int file = bin.ReadInt32();
int index = bin.ReadInt32();
int lookup = bin.ReadInt32();
int length = bin.ReadInt32();
int extra = bin.ReadInt32();
if ( file == 14 && index >= 0 && index < m_Components.Length && lookup >= 0 && length > 0 )
{
bin.BaseStream.Seek( lookup, SeekOrigin.Begin );
m_Components[index] = new MultiComponentList( bin, length / 12 );
bin.BaseStream.Seek( 24 + (i * 20), SeekOrigin.Begin );
}
}
bin.Close();
}
}
}
else
{
Console.WriteLine( "Warning: Multi data files not found" );
m_Components = new MultiComponentList[0];
}
}
示例9: Deserialize
public override void Deserialize(GenericReader reader)
{
m_Components = new MultiComponentList(reader);
base.Deserialize(reader);
}
示例10: GetMultiMinSector
public Sector GetMultiMinSector( Point3D loc, MultiComponentList mcl )
{
return GetSector( Bound( new Point2D( loc.m_X + mcl.Min.m_X, loc.m_Y + mcl.Min.m_Y ) ) );
}
示例11: SetInitialState
public override void SetInitialState()
{
m_Current = new DesignState(this, GetEmptyFoundation());
// explicitly unused in StaticHousing
m_Design = null;
m_Backup = null;
//init the other two design states just so they don't crash the base's serilization
MultiComponentList y = new MultiComponentList(m_Current.Components);
MultiComponentList x = new MultiComponentList(StaticHouseHelper.GetComponents(m_HouseBlueprintID));
//merge x into y.
//first, remove all in y
for (int i = y.List.Length - 1; i >= 0; i--)
{
y.Remove(y.List[i].m_ItemID, y.List[i].m_OffsetX, y.List[i].m_OffsetY, y.List[i].m_OffsetZ);
}
//then add all the ones we want to the list
for (int i = 0; i < x.List.Length; ++i)
{
y.Add(x.List[i].m_ItemID, x.List[i].m_OffsetX, x.List[i].m_OffsetY, x.List[i].m_OffsetZ,true);
}
m_Current.Components = y;
return;
}
示例12: ErectBuilding
public virtual void ErectBuilding()
{
m_Components = EmptyList;
}