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


C# Item.Bounce方法代码示例

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


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

示例1: Execute

		public override void Execute( CommandEventArgs args, object o )
		{
			if( o is AddonComponent )
			{
				BaseAddon addon = ((AddonComponent)o).Addon;

				if( addon.Components.Count > 0 )
				{
					for( int i = 0; i < addon.Components.Count; i++ )
					{
						AddonComponent component = addon.Components[i];
						Item newItem = new Item( component.ItemID );

						newItem.Hue = component.Hue;
						newItem.Light = component.Light;
						newItem.Movable = true;
						newItem.Name = component.Name;

						newItem.MoveToWorld( component.Location, component.Map );
					}
				}

				addon.Delete();

				AddResponse( "The add-on has been converted into individual items." );
			}
			else if( o is Item )
			{
				Item i = (Item)o;
				Item newItem = new Item( i.ItemID );

				newItem.Hue = i.Hue;
				newItem.Layer = i.Layer;
				newItem.Light = i.Light;
				newItem.Movable = true;
				newItem.Name = i.Name;

				newItem.MoveToWorld( i.Location, i.Map );

				if( i.Parent == args.Mobile )
					newItem.Bounce( args.Mobile );

				if( i is Container )
					((Container)i).Destroy();
				else
					i.Delete();

				AddResponse( "The item has been converted to an item." );
			}
			else
			{
				LogFailure( "This command only works with item objects." );
			}
		}
开发者ID:greeduomacro,项目名称:hubroot,代码行数:54,代码来源:ToItem.cs

示例2: Execute

		public override void Execute( Server.Commands.CommandEventArgs args, object o )
		{
			if( o is AddonComponent )
			{
				BaseAddon addon = ((AddonComponent)o).Addon;
				
				if( addon.Components.Count > 0 )
				{
					for( int i = 0; i < addon.Components.Count; i++ )
					{
						AddonComponent component = (addon.Components)[i];
                        Item newItem = new Item( component.ItemID) {Hue = component.Hue, Name = component.Name};

					    newItem.MoveToWorld( new Point3D( component.Location ), component.Map );
					}
				}
				
				addon.Delete();
				
				AddResponse( "The add-on has been converted to an item." );
			}
			else if( o is Static )
			{
				Static s = (Static)o;
				Item newItem = new Item( s.ItemID ) {Hue = s.Hue, Layer = s.Layer, Light = s.Light, Name = s.Name};

			    newItem.MoveToWorld( new Point3D( s.Location ), s.Map );
				
				if( s.Parent == args.Mobile )
					newItem.Bounce( args.Mobile );

				s.Delete();
				
				AddResponse( "The static has been converted to an item." );
			}
			else
			{
				LogFailure( "This command only works with static items or add-ons." );
			}
		}
开发者ID:FreeReign,项目名称:imaginenation,代码行数:40,代码来源:ToItem.cs

示例3: OnDragDrop

		public override bool OnDragDrop( Mobile from, Item item )
		{
			if( item is BasePotion )
			{
				BasePotion pot = (BasePotion)item;
				int toHold = Math.Min( 100 - m_Held, pot.Amount );


				if( toHold <= 0 )
				{
					from.SendLocalizedMessage( 502233 ); // The keg will not hold any more!
					return false;
				}
				else if( m_Held == 0 )
				{
					if( GiveBottle( from, toHold ) )
					{
						m_Type = pot.PotionEffect;
						Held = toHold;

						from.PlaySound( 0x240 );

						from.SendLocalizedMessage( 502237 ); // You place the empty bottle in your backpack.

						item.Consume( toHold );

						if( !item.Deleted )
							item.Bounce( from );

						return true;
					}
					else
					{
						from.SendLocalizedMessage( 502238 ); // You don't have room for the empty bottle in your backpack.
						return false;
					}
				}
				else if( pot.PotionEffect != m_Type )
				{
					from.SendLocalizedMessage( 502236 ); // You decide that it would be a bad idea to mix different types of potions.
					return false;
				}
				else
				{
					if( GiveBottle( from, toHold ) )
					{
						Held += toHold;

						from.PlaySound( 0x240 );

						from.SendLocalizedMessage( 502237 ); // You place the empty bottle in your backpack.

						item.Consume( toHold );

						if( !item.Deleted )
							item.Bounce( from );

						return true;
					}
					else
					{
						from.SendLocalizedMessage( 502238 ); // You don't have room for the empty bottle in your backpack.
						return false;
					}
				}
			}
			else
			{
				from.SendLocalizedMessage( 502232 ); // The keg is not designed to hold that type of object.
				return false;
			}
		}
开发者ID:greeduomacro,项目名称:hubroot,代码行数:72,代码来源:PotionKeg.cs


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