當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。