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


C# Map.GetTilesAt方法代码示例

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


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

示例1: HasTileSurface

		private static bool HasTileSurface( Map map, int X, int Y, int Z )
		{
			if( map == null ) return false;
#if(RUNUO2RC1)
			ArrayList tiles = map.GetTilesAt(new Point2D(X, Y), true, true, true);
#else
			LandTile tile = map.Tiles.GetLandTile( X, Y );
			StaticTile[] statics = map.Tiles.GetStaticTiles( X, Y, true );
#endif
			if( statics == null ) return false;

			// go through the tiles and see if any are at the Z location
			for( int i = 0; i < statics.Length; i++ )
			{
				StaticTile st = statics[i];

				if( (st.Z + st.Height) == Z )
				{
					return true;
				}
			}

			return false;
		}
开发者ID:greeduomacro,项目名称:hubroot,代码行数:24,代码来源:XmlSpawner2.cs

示例2: HasTileSurface

        private static bool HasTileSurface(Map map, int X, int Y, int Z)
        {
            if (map == null) return false;
#if(RUNUO2RC1)
			ArrayList tiles = map.GetTilesAt(new Point2D(X, Y), true, true, true);
#else
            StaticTile[] tiles = map.Tiles.GetStaticTiles(X, Y, true);
            //List<Server.Tile> tiles = map.GetTilesAt(new Point2D(X, Y), true, true, true);
#endif
            if (tiles == null) return false;

            // go through the tiles and see if any are at the Z location
            foreach (object o in tiles)
            {

                if (o is StaticTile)
                {
                    StaticTile i = (StaticTile)o;

                    if ((i.Z + i.Height) == Z)
                    {
                        return true;
                    }
                }
            }

            return false;
        }
开发者ID:ArchangelUO,项目名称:XMLSpawner,代码行数:28,代码来源:XmlSpawner2.cs

示例3: HasTileSurface

		private static bool HasTileSurface(Map map, int X, int Y, int Z)
		{
			if (map == null) return false;

			ArrayList tiles = map.GetTilesAt(new Point2D(X, Y), true, true, true);

			if (tiles == null) return false;

			// go through the tiles and see if any are at the Z location
			foreach (object o in tiles)
			{

				if (o is Tile)
				{
					Tile i = (Tile)o;

					if ((i.Z + i.Height) == Z)
					{
						return true;
					}
				}
			}

			return false;
		}
开发者ID:cynricthehun,项目名称:UOLegends,代码行数:25,代码来源:XmlSpawner2.cs

示例4: AddRangeCallback

		/// <summary>
		/// Callback for the bounding box picker
		/// </summary>
		private void AddRangeCallback( Mobile m, Map map, Point3D start, Point3D end, object state )
		{
			for ( int x = Math.Min( start.X, end.X ); x <= Math.Max( start.X, end.X ); x++ )
			{
				for ( int y = Math.Min( start.Y, end.Y ); y <= Math.Max( start.Y, end.Y ); y++ )
				{
					Point2D p = new Point2D( x, y );
					ArrayList tiles = map.GetTilesAt( p, false, false, true );

					#region Z Range Filter
					if ( m_ZRange )
					{
						ArrayList remove = new ArrayList();

						foreach( Tile t in tiles )
						{
							if ( t.Z < m_MinZ || t.Z > m_MaxZ )
								remove.Add( t );
						}

						foreach( Tile t in remove )
						{
							tiles.Remove( t );
						}
					}
					#endregion

					if ( tiles.Count == 0 )
						continue;

					ArrayList current = m_Tiles[ p ] as ArrayList;

					if ( current != null )
					{
						foreach( Tile t in tiles )
						{
							if ( ! current.Contains( t ) )
							{
								current.Add( t );
							}
						}
					}
					else
					{
						m_Tiles[ p ] = tiles;
					}
				}
			}

			ResendGump();
		}
开发者ID:kamronbatman,项目名称:DefianceUO-Pre1.10,代码行数:54,代码来源:CopyStatics.cs

示例5: PickerCallback

        private static void PickerCallback(Mobile from, Map map, Point3D start, Point3D end, object state)
        {
            object[] args = state as object[];
            int m_SimpleComponents = 0;
            int m_ComplexComponents = 0;
            int m_NamedComponents = 0;
            int m_TotalComponents = 0;

            if (start.X > end.X)
            {
                int x = start.X;
                start.X = end.X;
                end.X = x;
            }

            if (start.Y > end.Y)
            {
                int y = start.Y;
                start.Y = end.Y;
                end.Y = y;
            }

            Rectangle2D bounds = new Rectangle2D(start, end);

            string name = args[0] as string;
            string ns = args[1] as string;

            bool getStatics = (bool)args[2];
            bool getItems = (bool)args[3];
            bool getTiles = (bool)args[4];
            bool includeStaticRange = (bool)args[5];
            bool includeItemRange = (bool)args[6];
            bool includeTileRange = (bool)args[7];
            bool includeZRange = (bool)args[8];
            bool generateTest = (bool)args[17];

            sbyte min = sbyte.MinValue;
            sbyte max = sbyte.MaxValue;

            short minStaticID = 2;
            short maxStaticID = 16384;
            short minItemID = 2;
            short maxItemID = 16384;
            short minTileID = 2;
            short maxTileID = 16384;

            try { min = sbyte.Parse(args[9] as string); }
            catch { }
            try { max = sbyte.Parse(args[10] as string); }
            catch { }
            try { minStaticID = short.Parse(args[11] as string); }
            catch { }
            try { maxStaticID = short.Parse(args[12] as string); }
            catch { }
            try { minItemID = short.Parse(args[13] as string); }
            catch { }
            try { maxItemID = short.Parse(args[14] as string); }
            catch { }
            try { minTileID = short.Parse(args[15] as string); }
            catch { }
            try { maxTileID = short.Parse(args[16] as string); }
            catch { }

            Hashtable tiles = new Hashtable();

            if (getTiles)
            {
                for (int x = start.X; x <= end.X; x++)
                {
                    for (int y = start.Y; y <= end.Y; y++)
                    {
#if RC2
                        List<Server.Tile> list = map.GetTilesAt(new Point2D(x, y), false, false, true);
                        List<Server.Tile> remove = new List<Server.Tile>();
#else
                        ArrayList list = map.GetTilesAt(new Point2D(x, y), false, false, true);
                        ArrayList remove = new ArrayList();
#endif

                        foreach (Tile t in list)
                        {
                            int id = t.ID - 16384;
                            if (id < 2 || id > 16382)
                                remove.Add(t);
                            else if (includeZRange && (t.Z < min || t.Z > max))
                                remove.Add(t);
                            else if (!includeZRange && (t.Z >= min && t.Z <= max))
                                remove.Add(t);
                            else if (includeTileRange && (id < minTileID || id > maxTileID))
                                remove.Add(t);
                            else if (!includeTileRange && (id >= minTileID && id <= maxTileID))
                                remove.Add(t);
                        }

                        foreach (Tile t in remove)
                        {
                            list.Remove(t);
                        }

                        if (list != null && list.Count > 0)
//.........这里部分代码省略.........
开发者ID:greeduomacro,项目名称:annox,代码行数:101,代码来源:AddonGenerator.cs

示例6: PickerCallback

        private static void PickerCallback( Mobile from, Map map, Point3D start, Point3D end, object state )
        {
            object[] args = state as object[];

            if ( start.X > end.X )
            {
                int x = start.X;
                start.X = end.X;
                end.X = x;
            }

            if ( start.Y > end.Y )
            {
                int y = start.Y;
                start.Y = end.Y;
                end.Y = y;
            }

            Rectangle2D bounds = new Rectangle2D( start, end );

            string name = args[ 0 ] as string;
            string ns = args[ 1 ] as string;

            bool items = (bool) args[ 2 ];
            bool statics = (bool) args[ 3 ];
            bool range = (bool) args[ 4 ];

            sbyte min = sbyte.MinValue;
            sbyte max = sbyte.MaxValue;

            try { min = sbyte.Parse( args[ 5 ] as string ); }
            catch {}
            try { max = sbyte.Parse( args[ 6 ] as string ); }
            catch {}

            if ( max < min )
            {
                sbyte temp = max;
                max = min;
                min = temp;
            }

            Hashtable tiles = new Hashtable();

            if ( statics )
            {
                for ( int x = start.X; x <= end.X; x++ )
                {
                    for ( int y = start.Y; y <= end.Y; y++ )
                    {
                        ArrayList list = map.GetTilesAt( new Point2D( x, y ), items, false, statics );

                        if ( range )
                        {
                            ArrayList remove = new ArrayList();

                            foreach ( Tile t in list )
                            {
                                if ( t.Z < min || t.Z > max )
                                    remove.Add( t );
                            }

                            foreach( Tile t in remove )
                                list.Remove( t );
                        }

                        if ( list != null && list.Count > 0 )
                        {
                            tiles[ new Point2D( x, y ) ] = list;
                        }
                    }
                }
            }

            IPooledEnumerable en = map.GetItemsInBounds( bounds );
            ArrayList target = new ArrayList();
            bool fail = false;

            try
            {
                foreach( object o in en )
                {
                    Static s = o as Static;

                    if ( s == null )
                        continue;

                    if ( range && ( s.Z < min || s.Z > max ) )
                        continue;

                    target.Add( o );
                }
            }
            catch ( Exception err )
            {
                Console.WriteLine( err.ToString() );
                from.SendMessage( 0x40, "The targeted items have been modified. Please retry." );
                fail = true;
            }
            finally
//.........这里部分代码省略.........
开发者ID:justdanofficial,项目名称:khaeros,代码行数:101,代码来源:AddonGenerator.cs

示例7: PickerCallback


//.........这里部分代码省略.........
							regionElement.AppendChild(CoordsElement);
						}
					}

					newHouse.AppendChild(regionElement);
				}
			}

			sbyte min = sbyte.MinValue;
			sbyte max = sbyte.MaxValue;

			try { min = sbyte.Parse(args[5] as string); }
			catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }
			try { max = sbyte.Parse(args[6] as string); }
			catch (Exception ex) { EventSink.InvokeLogException(new LogExceptionEventArgs(ex)); }

			if (max < min)
			{
				sbyte temp = max;
				max = min;
				min = temp;
			}

			Hashtable tiles = new Hashtable();

			// (x == end.X || y == end.Y) will be steps or other deco outside the plot
			// see below where we output statics and set TileType 'flags'
			if (statics)
			{
				for (int x = start.X; x <= end.X; x++)
				{
					for (int y = start.Y; y <= end.Y; y++)
					{
						ArrayList list = map.GetTilesAt(new Point2D(x, y), items, land, statics);

						if (range)
						{
							ArrayList remove = new ArrayList();

							foreach (Tile t in list)
							{
								if (t.Z < min || t.Z > max)
									remove.Add(t);
							}

							foreach (Tile t in remove)
								list.Remove(t);
						}

						if (list != null && list.Count > 0)
						{
							tiles[new Point2D(x, y)] = list;
						}
					}
				}
			}

			// we increase the bounds by one here to match the way we scan for static above, that is: including end.X and end.Y
			//	the end.X and end.Y allows us to pick up things on the steps, and the house sign hanger
			Rectangle2D iBounds = new Rectangle2D(bounds.X, bounds.Y, bounds.Width + 1, bounds.Height + 1);
			IPooledEnumerable en = map.GetItemsInBounds(iBounds);
			ArrayList target = new ArrayList();
			bool foundSign = false;

			// info pulled from captured house  
			DateTime BuiltOn = DateTime.MaxValue;
开发者ID:zerodowned,项目名称:angelisland,代码行数:67,代码来源:HouseGen.cs

示例8: PickerCallback

        private static void PickerCallback( Mobile from, Map map, Point3D start, Point3D end, object state )
        {
            object[] args = state as object[];

            if ( start.X > end.X )
            {
                int x = start.X;
                start.X = end.X;
                end.X = x;
            }

            if ( start.Y > end.Y )
            {
                int y = start.Y;
                start.Y = end.Y;
                end.Y = y;
            }

            Rectangle2D bounds = new Rectangle2D( start, end );

            string name = args[ 0 ] as string;
            string ns = args[ 1 ] as string;

            bool items = (bool) args[ 2 ];
            bool statics = (bool) args[ 3 ];
            bool range = (bool) args[ 4 ];

            sbyte min = sbyte.MinValue;
            sbyte max = sbyte.MaxValue;

            try { min = sbyte.Parse( args[ 5 ] as string ); }
            catch {}
            try { max = sbyte.Parse( args[ 6 ] as string ); }
            catch {}

            if ( max < min )
            {
                sbyte temp = max;
                max = min;
                min = temp;
            }

            Hashtable tiles = new Hashtable();

            if ( statics )
            {
                for ( int x = start.X; x <= end.X; x++ )
                {
                    for ( int y = start.Y; y <= end.Y; y++ )
                    {
                        ArrayList list = map.GetTilesAt( new Point2D( x, y ), items, false, statics );

                        if ( range )
                        {
                            ArrayList remove = new ArrayList();

                            foreach ( Tile t in list )
                            {
                                if ( t.Z < min || t.Z > max )
                                    remove.Add( t );
                            }

                            foreach( Tile t in remove )
                                list.Remove( t );
                        }

                        if ( list != null && list.Count > 0 )
                        {
                            tiles[ new Point2D( x, y ) ] = list;
                        }
                    }
                }
            }

            IPooledEnumerable en = map.GetItemsInBounds( bounds );
            ArrayList target = new ArrayList();
            bool fail = false;

            try
            {
                foreach( object o in en )
                {
                    Static s = o as Static;

                    if ( s == null )
                        continue;

                    if ( range && ( s.Z < min || s.Z > max ) )
                        continue;

                    target.Add( o );
                }
            }
            catch ( Exception err )
            {
                Console.WriteLine( err.ToString() );
                from.SendMessage( 0x40, "The targeted items have been modified. Please retry." );
                fail = true;
            }
            finally
//.........这里部分代码省略.........
开发者ID:justdanofficial,项目名称:khaeros,代码行数:101,代码来源:MultiGenerator.cs


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