当前位置: 首页>>代码示例>>C#>>正文


C# MultiComponentList.Add方法代码示例

本文整理汇总了C#中Server.MultiComponentList.Add方法的典型用法代码示例。如果您正苦于以下问题:C# MultiComponentList.Add方法的具体用法?C# MultiComponentList.Add怎么用?C# MultiComponentList.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Server.MultiComponentList的用法示例。


在下文中一共展示了MultiComponentList.Add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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;
        }
开发者ID:BackupTheBerlios,项目名称:sunuo-svn,代码行数:18,代码来源:HouseFoundation.cs

示例2: 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 );
                }
            }
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:sunuo-svn,代码行数:101,代码来源:HouseFoundation.cs

示例3: 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 );
        }
开发者ID:BackupTheBerlios,项目名称:sunuo-svn,代码行数:14,代码来源:HouseFoundation.cs

示例4: 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 );
            }
        }
开发者ID:BackupTheBerlios,项目名称:sunuo-svn,代码行数:28,代码来源:HouseFoundation.cs

示例5: 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;
        }
开发者ID:zerodowned,项目名称:angelisland,代码行数:29,代码来源:StaticHouse.cs


注:本文中的Server.MultiComponentList.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。