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


C# Rectangle2D类代码示例

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


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

示例1: 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:Grimoric,项目名称:RunUO.T2A,代码行数:27,代码来源:Weather.cs

示例2: SimpleCollisionTest

		/// <summary>
		/// Test whether label collides.
		/// </summary>
		/// <param name="newLabel"></param>
		/// <returns>true if label collided with another (more important or earlier) label</returns>
		public Boolean SimpleCollisionTest(Label2D newLabel)
		{
			if (labelList.Contains(newLabel))
			{
				return false;
			}

			Size2D newSize = TextRenderer.MeasureString(newLabel.Text, newLabel.Font);
			newSize = new Size2D(newSize.Width + 2 * newLabel.CollisionBuffer.Width, newSize.Height + 2 * newLabel.CollisionBuffer.Height);
			Rectangle2D newRect = new Rectangle2D(new Point2D(newLabel.Location.X - newLabel.CollisionBuffer.Width, newLabel.Location.Y - newLabel.CollisionBuffer.Height), newSize);

			foreach (Label2D label in labelList)
			{
				Size2D size = TextRenderer.MeasureString(label.Text, label.Font);
				size = new Size2D(size.Width + 2*label.CollisionBuffer.Width, size.Height + 2*label.CollisionBuffer.Height);
				Rectangle2D rect =
					new Rectangle2D(
						new Point2D(label.Location.X - newLabel.CollisionBuffer.Width, label.Location.Y - label.CollisionBuffer.Height),
						size);

				if (newRect.Intersects(rect))
				{
					return true;
				}
			}

			labelList.Add(newLabel);

			return false;
		}
开发者ID:pobingwanghai,项目名称:SharpMapV2,代码行数:35,代码来源:LabelCollisionDetection2D.cs

示例3: 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,项目名称:last-wish,代码行数:7,代码来源:PresetMap.cs

示例4: ConfirmTentPlacementGump

		public ConfirmTentPlacementGump( Mobile owner, TentAddon tent, TentFlap flap, TentBedroll roll, SecureTentChest chest, Rectangle2D bounds )
			: base( 10, 10 )
		{
			m_Owner = owner;
			m_Tent = tent;
			m_Flap = flap;
			m_Bedroll = roll;
			m_Chest = chest;
			m_RegionBounds = bounds;

			Closable = false;
			Disposable = false;
			Resizable = false;
			Dragable = true;

			AddPage( 1 );
			AddBackground( 10, 10, 325, 305, 9250 );
			AddImageTiled( 25, 25, 295, 11, 50 );
			AddLabel( 90, 35, 0, "Confirm Tent Placement" );

			AddButton( 35, 275, 4020, 4022, 0, GumpButtonType.Reply, 1 ); //Cancel
			AddButton( 280, 275, 4023, 4025, 1, GumpButtonType.Reply, 1 ); //Ok

			AddHtml( 27, 75, 290, 200, String.Format( "<center>You are about to place a travel tent.</center><br> Within, you will find a bedroll "
													 + "and a secure wooden chest.<br> To repack your tent, or to logout safely, double-click "
													 + "your bedroll. When doing so, please make sure that all items are removed from the chest."
													 + "<br> Please press okay to continue, or press cancel to stop tent placement." ), false, false );
		}
开发者ID:greeduomacro,项目名称:hubroot,代码行数:28,代码来源:Gumps.cs

示例5: Rectangle2DEqualityTests

        public void Rectangle2DEqualityTests()
        {
            Rectangle2D r1 = new Rectangle2D();
            Rectangle2D r2 = Rectangle2D.Empty;
            Rectangle2D r3 = Rectangle2D.Zero;
            Rectangle2D r4 = new Rectangle2D(0, 0, 0, 0);
            Rectangle2D r5 = new Rectangle2D(9, 10, -5, -6);
            Rectangle2D r6 = new Rectangle2D(0, 0, 10, 10);
            Rectangle2D r7 = new Rectangle2D(new Point2D(0, 0), new Size2D(10, 10));

            Assert.Equal(r1, r2);
            Assert.NotEqual(r1, r3);
            Assert.Equal(r3, r4);
            Assert.NotEqual(r1, r5);
            Assert.NotEqual(r3, r5);
            Assert.Equal(r6, r7);

            IMatrixD v1 = r1;
            IMatrixD v2 = r2;
            IMatrixD v3 = r3;
            IMatrixD v4 = r4;
            IMatrixD v5 = r5;

            Assert.Equal(v1, v2);
            Assert.NotEqual(v1, v3);
            Assert.Equal(v3, v4);
            Assert.NotEqual(v1, v5);
            Assert.NotEqual(v3, v5);

            Assert.Equal(v5, r5);
        }
开发者ID:pobingwanghai,项目名称:SharpMapV2,代码行数:31,代码来源:Rectangle2DTests.cs

示例6: Create2DElement

        public static void Create2DElement(String name, String texture, Vector2 TopLeft, Vector2 BottomRight)
        {
            MaterialPtr material = MaterialManager.Singleton.Create(name, "General");
                material.GetTechnique(0).GetPass(0).CreateTextureUnitState(texture);
                material.GetTechnique(0).GetPass(0).DepthCheckEnabled = false;
                material.GetTechnique(0).GetPass(0).DepthWriteEnabled = false;
                material.GetTechnique(0).GetPass(0).LightingEnabled = false;
                // Create background rectangle covering the whole screen
                Rectangle2D rect = new Rectangle2D(true);
                rect.SetCorners(TopLeft.x * 2 - 1, 1 - TopLeft.y * 2, BottomRight.x * 2 - 1, 1 - BottomRight.y * 2);
                //rect.SetCorners(-1.0f, 1.0f, 1.0f, -1.0f);
                rect.SetMaterial(name);

                // Render the background before everything else
                rect.RenderQueueGroup = (byte)RenderQueueGroupID.RENDER_QUEUE_OVERLAY;

                // Use infinite AAB to always stay visible
                AxisAlignedBox aab = new AxisAlignedBox();
                aab.SetInfinite();
                rect.BoundingBox = aab;

                // Attach background to the scene
                SceneNode node = _OgreEngine.mMgr.RootSceneNode.CreateChildSceneNode("2D__" + name);
                node.AttachObject(rect);
        }
开发者ID:Serebriakov,项目名称:rybrcoul-games,代码行数:25,代码来源:Drawing2D.cs

示例7: StrongholdDefinition

		public StrongholdDefinition( Rectangle2D[] area, Point3D joinStone, Point3D factionStone, Point3D[] monoliths )
		{
			m_Area = area;
			m_JoinStone = joinStone;
			m_FactionStone = factionStone;
			m_Monoliths = monoliths;
		}
开发者ID:greeduomacro,项目名称:last-wish,代码行数:7,代码来源:StrongholdDefintion.cs

示例8: SerpentPillar

		public SerpentPillar( string word, Rectangle2D destination, bool active ) : base( 0x233F )
		{
			Movable = false;

			m_Active = active;
			m_Word = word;
			m_Destination = destination;
		}
开发者ID:greeduomacro,项目名称:last-wish,代码行数:8,代码来源:SerpentPillar.cs

示例9: SafeZone

		/*public override bool AllowReds{ get{ return true; } }*/

		public SafeZone( Rectangle2D area, Point3D goloc, Map map, bool isGuarded ) : base( null, map, SafeZonePriority, area )
		{
			GoLocation = goloc;

			this.Disabled = !isGuarded;

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

示例10: RandomPointIn

		private static Point3D RandomPointIn( Rectangle2D rect, Map map )
		{
			int x = Utility.Random( rect.X, rect.Width );
			int y = Utility.Random( rect.Y, rect.Height );
			int z = map.GetAverageZ( x, y );

			return new Point3D( x, y, z );
		}
开发者ID:greeduomacro,项目名称:last-wish,代码行数:8,代码来源:PumpkinPatch.cs

示例11: transform

 /**
  * Auto-shapes are defined in the [0,21600] coordinate system.
  * We need to transform it into normal slide coordinates
  *
 */
 public static java.awt.Shape transform(java.awt.Shape outline, Rectangle2D anchor){
     AffineTransform at = new AffineTransform();
     at.translate(anchor.GetX(), anchor.GetY());
     at.scale(
             1.0f/21600*anchor.Width,
             1.0f/21600*anchor.Height
     );
     return at.CreateTransformedShape(outline);
 }
开发者ID:ctddjyds,项目名称:npoi,代码行数:14,代码来源:AutoShapes.cs

示例12: PolygonElementClip

 internal PolygonElementClip(Rectangle2D clipBox)
 {
     this.boundary = clipBox;
     this.Edges = new Edge[]
     {
         new Edge { IsHorisontal = false, IsLeft = true, Value = this.boundary.Left },
         new Edge { IsHorisontal = false, IsLeft = false, Value = this.boundary.Right },
         new Edge { IsHorisontal = true, IsLeft = true, Value = this.boundary.Bottom },
         new Edge { IsHorisontal = true, IsLeft = false, Value = this.boundary.Top }
     };
 }
开发者ID:SuperMap,项目名称:iClient-for-Silverlight,代码行数:11,代码来源:PolygonElementClip.cs

示例13: ViewBoundsChanedEventArgs

 public ViewBoundsChanedEventArgs(Rectangle2D oldViewBounds, Rectangle2D newViewBounds)
 {
     if (oldViewBounds != null)
     {
         _oldViewBounds = new Rectangle2D(oldViewBounds);
     }
     if (_newViewBounds != null)
     {
         _newViewBounds = new Rectangle2D(newViewBounds);
     }
 }
开发者ID:SuperMap,项目名称:iClient-for-DotNet,代码行数:11,代码来源:ViewBoundsChanedEventArgs.cs

示例14: TentValidator

		public TentValidator( Mobile owner, TentAddon tent, TentBedroll bedroll, SecureTentChest chest, TravelTentRegion region, Rectangle2D bounds )
			: base( 0x12B3 )
		{
			Name = "travel tent validator";
			Movable = false;
			Visible = false;

			m_Owner = owner;
			m_Tent = tent;
			m_Bedroll = bedroll;
			m_Chest = chest;
			m_Region = region;
			m_Bounds = bounds;
		}
开发者ID:greeduomacro,项目名称:hubroot,代码行数:14,代码来源:TentValidator.cs

示例15: OnTarget

		public void OnTarget( Mobile from, Map map, Point3D start, Point3D end, object state )
		{
			try
			{
				object[] states = (object[])state;
				BaseCommand command = (BaseCommand)states[0];
				string[] args = (string[])states[1];

				Rectangle2D rect = new Rectangle2D( start.X, start.Y, end.X - start.X + 1, end.Y - start.Y + 1 );

				Extensions ext = Extensions.Parse( from, ref args );

				bool items, mobiles;

				if ( !CheckObjectTypes( command, ext, out items, out mobiles ) )
					return;

				IPooledEnumerable eable;

				if ( items && mobiles )
					eable = map.GetObjectsInBounds( rect );
				else if ( items )
					eable = map.GetItemsInBounds( rect );
				else if ( mobiles )
					eable = map.GetMobilesInBounds( rect );
				else
					return;

				ArrayList objs = new ArrayList();

				foreach ( object obj in eable )
				{
					if ( mobiles && obj is Mobile && !BaseCommand.IsAccessible( from, obj ) )
						continue;

					if ( ext.IsValid( obj ) )
						objs.Add( obj );
				}

				eable.Free();

				ext.Filter( objs );

				RunCommand( from, objs, command, args );
			}
			catch ( Exception ex )
			{
				from.SendMessage( ex.Message );
			}
		}
开发者ID:FreeReign,项目名称:imaginenation,代码行数:50,代码来源:AreaCommandImplementor.cs


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