• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Server.Rectangle2D类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: 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];

                ObjectConditional cond = ObjectConditional.Parse( from, ref args );

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

                bool items, mobiles;

                if ( !CheckObjectTypes( command, cond, out items, out mobiles ) )
                {
                    return;
                }

                IEnumerable<object> 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 ( cond.CheckCondition( obj ) )
                    {
                        objs.Add( obj );
                    }
                }

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


示例17: CraftInit

		public override void CraftInit( Mobile from )
		{
			// Unlike the others, world map is not based on crafted location
            Facet = from.Map;

			double skillValue = from.Skills[SkillName.Cartography].Value;
			int x20 = (int)(skillValue * 20);
			int size = 25 + (int)(skillValue * 6.6);

			if ( size < 200 )
				size = 200;
			else if ( size > 400 )
				size = 400;

            if (Facet == Map.Trammel || Facet == Map.Felucca)
            {
                if (Server.Spells.SpellHelper.IsAnyT2A(Facet, from.Location))
                {
                    Bounds = new Rectangle2D(5120, 2304, 1024, 1792);
                    Width = size;
                    Height = size;
                }
                else
                    SetDisplay(1344 - x20, 1600 - x20, 1472 + x20, 1728 + x20, size, size);
            }
            else
                SetDisplayByFacet();
		}
开发者ID:Crome696,项目名称:ServUO,代码行数:28,代码来源:WorldMap.cs


示例18: DoWipe

        public static void DoWipe( Mobile from, Map map, Point3D start, Point3D end, WipeType type )
        {
            CommandLogging.WriteLine( from, "{0} {1} wiping from {2} to {3} in {5} ({4})", from.AccessLevel, CommandLogging.Format( from ), start, end, type, map );

            bool mobiles = ( ( type & WipeType.Mobiles ) != 0 );
            bool multis = ( ( type & WipeType.Multis ) != 0 );
            bool items = ( ( type & WipeType.Items ) != 0 );

            ArrayList toDelete = new ArrayList();

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

            IEnumerable<object> eable;

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

            foreach ( object obj in eable )
            {
                if ( items && ( obj is Item ) && !( ( obj is BaseMulti ) || ( obj is HouseSign ) ) )
                {
                    toDelete.Add( obj );
                }
                else if ( multis && ( obj is BaseMulti ) )
                {
                    toDelete.Add( obj );
                }
                else if ( mobiles && ( obj is Mobile ) && !( (Mobile) obj ).IsPlayer )
                {
                    toDelete.Add( obj );
                }
            }

            for ( int i = 0; i < toDelete.Count; ++i )
            {
                if ( toDelete[i] is Item )
                {
                    ( (Item) toDelete[i] ).Delete();
                }
                else if ( toDelete[i] is Mobile )
                {
                    ( (Mobile) toDelete[i] ).Delete();
                }
            }
        }
开发者ID:Ravenwolfe,项目名称:xrunuo,代码行数:59,代码来源:Wipe.cs


示例19: OnLocationChange

		public override void OnLocationChange( Point3D oldLocation )
		{
			if ( !Enabled )
				return; 
				
			regionpoint = new Rectangle2D( X - 5, Y - 5, 11, 11 );
			StartManaRegen();
		}
开发者ID:nick12344356,项目名称:The-Basement,代码行数:8,代码来源:RVSFountains.cs


示例20: SafeZone

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

			this.Disabled = !isGuarded;

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Server.Region类代码示例发布时间:2022-05-26
下一篇:
C# Server.Poison类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap