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


C# Server.Rectangle2D类代码示例

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


Rectangle2D类属于Server命名空间,在下文中一共展示了Rectangle2D类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: MarkBounds

        public void MarkBounds(Rectangle2D rec)
        {
            m_Markers = new List<Item>();

            int w = rec.X + rec.Width;
            int h = rec.Y + rec.Height;
            int t = 0;

            for (int x = rec.X; x <= w; x++)
            {
                for (int y = rec.Y; y <= h; y++)
                {
                    if (x == rec.X || x == rec.X + rec.Width || y == rec.Y || y == rec.Y + rec.Height)
                    {
                        if (t >= 10)
                        {
                            MarkerItem i = new MarkerItem(14089);
                            i.MoveToWorld(new Point3D(x, y, 0), this.Map);
                            m_Markers.Add(i);
                            t = 0;
                        }
                        else
                            t++;
                    }
                }
            }
        }
开发者ID:Crome696,项目名称:ServUO,代码行数:27,代码来源:CorgulRegion.cs

示例2: GoldPrintCarpetAddon

		public GoldPrintCarpetAddon( Rectangle2D rect )
		{
				
			for ( int x = 0; x < rect.Width; x++ )
				for ( int y = 0; y < rect.Height; y++ )
				{
					if ( y == 0 && x != 0 && x != rect.Width - 1 )
						AddComponent( new AddonComponent( RugPieceId(  RugPiece.Top ) ), x, y, 0 );
					if ( y == rect.Height - 1 && x != 0 && x != rect.Width - 1 )
						AddComponent( new AddonComponent( RugPieceId(  RugPiece.Bottom ) ), x, y, 0 );
					if ( x == 0 && y != 0 && y != rect.Height - 1 )
						AddComponent( new AddonComponent( RugPieceId(  RugPiece.Left ) ), x, y, 0 );
					if ( x == rect.Width - 1 && y != 0 && y != rect.Height - 1 )
						AddComponent( new AddonComponent( RugPieceId(  RugPiece.Right ) ), x, y, 0 );
					if ( y == 0 && x == 0 )
						AddComponent( new AddonComponent( RugPieceId(  RugPiece.TopLeft ) ), x, y, 0 );
					if ( y == 0 && x == rect.Width - 1 )
						AddComponent( new AddonComponent( RugPieceId(  RugPiece.TopRight ) ), x, y, 0 );
					if ( y == rect.Height - 1 && x == 0 )
						AddComponent( new AddonComponent( RugPieceId(  RugPiece.BottomLeft ) ), x, y, 0 );
					if ( y == rect.Height - 1 && x == rect.Width - 1 )
						AddComponent( new AddonComponent( RugPieceId(  RugPiece.BottomRight ) ), x, y, 0 );
					if ( y != 0 && x != 0  && x != rect.Width - 1  && y != rect.Height - 1 )
						AddComponent( new AddonComponent( RugPieceId(  RugPiece.Center ) ), x, y, 0 );
				}
				
			Hue = 1710; // Set Hue of Rug Here
				
		}
开发者ID:greeduomacro,项目名称:cov-shard-svn-1,代码行数:29,代码来源:GoldPrintCarpet.cs

示例3: SetDisplay

        public override void SetDisplay(int x1, int y1, int x2, int y2, int w, int h)
        {
            Width = w;
            Height = h;

            Bounds = new Rectangle2D(5121 ,2305, 1020, 1788);
        }
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:7,代码来源:CacheChestMap.cs

示例4: OnExit

		public override void OnExit( Mobile m )
		{
			if ( m.IsPlayer && !m.Alive )
			{
				Rectangle2D rect = new Rectangle2D( 342, 168, 16, 16 );

				int x = Utility.Random( rect.X, rect.Width );
				int y = Utility.Random( rect.Y, rect.Height );

				if ( x >= 345 && x <= 352 && y >= 173 && y <= 179 )
				{
					x = 353;
					y = 172;
				}

				m.MoveToWorld( new Point3D( x, y, -1 ), Map.Malas );

				if ( m.Corpse != null )
				{
					Region region = Region.Find( m.Corpse.Location, Map.Malas );

					if ( region.Name == "Doom Dark Guardians Room" )
					{
						m.Corpse.MoveToWorld( new Point3D( x, y, -1 ), Map.Malas );
					}
				}
			}
		}
开发者ID:xrunuo,项目名称:xrunuo,代码行数:28,代码来源:GuardiansRoom.cs

示例5: CorgulWarpRegion

 public CorgulWarpRegion(CorgulAltar ped, Rectangle2D rec)
     : base("Corgul Warp Region", ped.Map, Region.DefaultPriority, new Rectangle2D[] { rec })
 {
     m_Pedestal = ped;
     m_Bounds = rec;
     //MarkBounds(rec);
 }
开发者ID:Crome696,项目名称:ServUO,代码行数:7,代码来源:WarpRegion.cs

示例6: Ensure

        public void Ensure()
        {
            m_Blocks = new List<Item>();

            foreach ( Rectangle3D r3d in Area )
            {
                Rectangle2D r2d = new Rectangle2D( r3d.Start, r3d.End );

                foreach ( Item item in Map.GetItemsInBounds( r2d ) )
                {
                    if ( item is Static )
                        m_Blocks.Add( item );
                }
            }

            if ( m_Blocks.Count == 0 )
            {
                m_Blocks = null;
                return;
            }

            foreach ( Item item in m_Blocks )
            {
                item.Hue = 0x807;
                item.Visible = false;
            }

            m_FadingTimer = Timer.DelayCall( TimeSpan.Zero, TimeSpan.FromSeconds( 0.33 ), new TimerCallback( OnTick ) );
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:29,代码来源:ToKBridgeRegion.cs

示例7: SafeZone

        /*public override bool AllowReds{ get{ return true; } }*/
        public SafeZone( Rectangle2D area, Point3D goloc, Map map )
            : base(null, map, SafeZonePriority, area)
        {
            GoLocation = goloc;

            Register();
        }
开发者ID:greeduomacro,项目名称:divinity,代码行数:8,代码来源:SafeZone.cs

示例8: OnExportBounds2D

		public static void OnExportBounds2D(Mobile m, string speech, string comment)
		{
			if (m == null || m.Deleted || !(m is PlayerMobile))
			{
				return;
			}

			if (String.IsNullOrWhiteSpace(speech))
			{
				speech = "Bounds";
			}

			BoundingBoxPicker.Begin(
				m,
				(from, map, start, end, state) =>
				{
					var r = new Rectangle2D(start, end.Clone2D(1, 1));

					IOUtility.EnsureFile(
						VitaNexCore.DataDirectory + "/Exported Bounds/2D/" + IOUtility.GetSafeFileName(speech) + ".txt")
							 .AppendText(
								 false,
								 String.Format(
									 "new Rectangle2D({0}, {1}, {2}, {3}), //{4}",
									 //
									 r.Start.X,
									 r.Start.Y,
									 r.Width,
									 r.Height,
									 comment ?? String.Empty));
				},
				null);
		}
开发者ID:greeduomacro,项目名称:RuneUO,代码行数:33,代码来源:ExportBounds.cs

示例9: CorgulRegion

 public CorgulRegion(Rectangle2D rec, CorgulAltar altar)
     : base("Corgul Boss Region", altar.Map, Region.DefaultPriority, new Rectangle2D[] { rec })
 {
     //MarkBounds(rec);
     m_Altar = altar;
     m_Bounds = rec;
 }
开发者ID:Crome696,项目名称:ServUO,代码行数:7,代码来源:CorgulRegion.cs

示例10: OnExportBounds2D

		public static void OnExportBounds2D(Mobile m, string speech)
		{
			if (m == null || m.Deleted || !(m is PlayerMobile))
			{
				return;
			}

			if (String.IsNullOrWhiteSpace(speech))
			{
				speech = TimeStamp.UtcNow.ToString();
			}

			BoundingBoxPicker.Begin(
				m,
				(from, map, start, end, state) =>
				{
					var r = new Rectangle2D(start, end.Clone3D(1, 1));

					using (
						StreamWriter w =
							IOUtility.EnsureFile(
								VitaNexCore.DataDirectory + "/Exported Bounds/2D/" + IOUtility.GetSafeFileName(speech) + ".txt").AppendText())
					{
						w.WriteLine("new Rectangle2D({0}, {1}, {2}, {3}),", r.Start.X, r.Start.Y, r.Width, r.Height);
						w.Close();
					}
				},
				null);
		}
开发者ID:greeduomacro,项目名称:UO-Forever,代码行数:29,代码来源:ExportBounds.cs

示例11: FindEntity

		public static bool FindEntity( Type type, Point3D p, Map map, bool mob )
		{
			IPooledEnumerable loc;
			Rectangle2D rect = new Rectangle2D( p.X, p.Y, 1, 1 );
			if( mob )
				loc = map.GetMobilesInBounds( rect );
			else
				loc = map.GetItemsInBounds( rect );

			bool found = false;

			try
			{
				foreach( object o in loc )
					if( o != null && o.GetType() == type || o.GetType().IsSubclassOf( type ) )
					{
						found = true;
						break;
					}
			}
			catch
			{
			}

			loc.Free();

			return found;
		}
开发者ID:greeduomacro,项目名称:GoUO,代码行数:28,代码来源:Utilities.cs

示例12: PresetMapEntry

		public PresetMapEntry( int name, int width, int height, int xLeft, int yTop, int xRight, int yBottom )
		{
			m_Name = name;
			m_Width = width;
			m_Height = height;
			m_Bounds = new Rectangle2D( xLeft, yTop, xRight - xLeft, yBottom - yTop );
		}
开发者ID:greeduomacro,项目名称:hubroot,代码行数:7,代码来源:PresetMap.cs

示例13: AddDynamicWeather

		public static void AddDynamicWeather( int temperature, int chanceOfPercipitation, int chanceOfExtremeTemperature, int moveSpeed, int width, int height, Rectangle2D bounds )
		{
			for ( int i = 0; i < m_Facets.Length; ++i )
			{
				Rectangle2D area = new Rectangle2D();
				bool isValid = false;

				for ( int j = 0; j < 10; ++j )
				{
					area = new Rectangle2D( bounds.X + Utility.Random( bounds.Width - width ), bounds.Y + Utility.Random( bounds.Height - height ), width, height );

					if ( !CheckWeatherConflict( m_Facets[i], null, area ) )
						isValid = true;

					if ( isValid )
						break;
				}

				if ( !isValid )
					continue;

				Weather w = new Weather( m_Facets[i], new Rectangle2D[]{ area }, temperature, chanceOfPercipitation, chanceOfExtremeTemperature, TimeSpan.FromSeconds( 30.0 ) );

				w.m_Bounds = bounds;
				w.m_MoveSpeed = moveSpeed;
			}
		}
开发者ID:Godkong,项目名称:Origins,代码行数:27,代码来源:Weather.cs

示例14: FixRect

		public static Rectangle2D FixRect( Rectangle2D rect )
		{
			Point3D pointOne = Point3D.Zero;
			Point3D pointTwo = Point3D.Zero;

			if ( rect.Start.X < rect.End.X )
			{
				pointOne.X = rect.Start.X;
				pointTwo.X = rect.End.X;
			}
			else
			{
				pointOne.X = rect.End.X;
				pointTwo.X = rect.Start.X;
			}

			if ( rect.Start.Y < rect.End.Y )
			{
				pointOne.Y = rect.Start.Y;
				pointTwo.Y = rect.End.Y;
			}
			else
			{
				pointOne.Y = rect.End.Y;
				pointTwo.Y = rect.Start.Y;
			}

			return new Rectangle2D( pointOne, pointTwo );
		}
开发者ID:greeduomacro,项目名称:annox,代码行数:29,代码来源:TownHouseSetupGump.cs

示例15: TheHuntRegion

        public TheHuntRegion(TheHuntStone pTheHuntStone, string name, Map map, Rectangle2D[] area)
            : base(name, map, 50, area)
        {
            this.TheHuntStone = pTheHuntStone;

            this.playerMobileBackupList = new List<Mobile>();
        }
开发者ID:greeduomacro,项目名称:DimensionsNewAge,代码行数:7,代码来源:TheHuntRegion.cs


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