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

C# Pocket类代码示例

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

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



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

示例1: Item

		public Item(int itemId, Pocket pocket, uint color1, uint color2, uint color3)
		{
			this.Info.Id = itemId;
			this.Info.Pocket = pocket;
			this.Info.Color1 = color1;
			this.Info.Color2 = color2;
			this.Info.Color3 = color3;
		}
开发者ID:xKamuna,项目名称:aura,代码行数:8,代码来源:Item.cs


示例2: EquipmentMoved

        /// <summary>
        /// Broadcasts EquipmentMoved in creature's range.
        /// </summary>
        /// <param name="creature"></param>
        /// <param name="from"></param>
        public static void EquipmentMoved(Creature creature, Pocket from)
        {
            var packet = new Packet(Op.EquipmentMoved, creature.EntityId);
            packet.PutByte((byte)from);
            packet.PutByte(1);

            creature.Region.Broadcast(packet, creature);
        }
开发者ID:pie3467,项目名称:aura,代码行数:13,代码来源:Send.Items.cs


示例3: Item

 public Item(string n, string d, ushort p, Pocket b, Action<Pokemon, int> a)
 {
     name = n;
     description = d;
     price = p;
     pocket = b;
     battleEffect = a;
     fieldEffect = a;
 }
开发者ID:filialpails,项目名称:Syllogomania,代码行数:9,代码来源:Item.cs


示例4: EquipItem

        protected virtual void EquipItem(Pocket slot, string itemName, uint color1 = 0, uint color2 = 0, uint color3 = 0)
        {
            var dbInfo = MabiData.ItemDb.Find(itemName);
            if (dbInfo == null)
            {
                Logger.Warning("Unknown item '" + itemName + "' cannot be eqipped. Try specifying the ID manually.");
                return;
            }

            this.EquipItem(slot, dbInfo.Id, color1, color2, color3);
        }
开发者ID:nvrlcky,项目名称:aura,代码行数:11,代码来源:CreatureScript.cs


示例5: EquipItem

        protected virtual void EquipItem(Pocket pocket, uint itemClass, uint color1 = 0, uint color2 = 0, uint color3 = 0)
        {
            var item = new MabiItem(itemClass);
            item.Info.ColorA = color1;
            item.Info.ColorB = color2;
            item.Info.ColorC = color3;
            item.Info.Pocket = (byte)pocket;

            //var inPocket = this.Creature.GetItemInPocket(slot);
            //if (inPocket != null)
            //    this.Creature.Items.Remove(inPocket);

            this.Creature.Items.Add(item);

            Send.EquipmentChanged(this.Creature, item);
        }
开发者ID:pjm0616,项目名称:aura,代码行数:16,代码来源:CreatureScript.cs


示例6: ItemMoveInfo

		/// <summary>
		/// Sends ItemMoveInfo or ItemSwitchInfo to creature's client,
		/// depending on whether collidingItem is null.
		/// </summary>
		/// <param name="creature"></param>
		/// <param name="item"></param>
		/// <param name="source"></param>
		/// <param name="target"></param>
		/// <param name="collidingItem"></param>
		public static void ItemMoveInfo(Creature creature, Item item, Pocket source, Item collidingItem)
		{
			var packet = new Packet((collidingItem == null ? Op.ItemMoveInfo : Op.ItemSwitchInfo), creature.EntityId);
			packet.PutLong(item.EntityId);
			packet.PutByte((byte)source);
			packet.PutByte((byte)item.Info.Pocket);
			packet.PutByte(2);
			packet.PutByte((byte)item.Info.X);
			packet.PutByte((byte)item.Info.Y);
			if (collidingItem != null)
			{
				packet.PutLong(collidingItem.EntityId);
				packet.PutByte((byte)item.Info.Pocket);
				packet.PutByte((byte)collidingItem.Info.Pocket);
				packet.PutByte(2);
				packet.PutByte((byte)collidingItem.Info.X);
				packet.PutByte((byte)collidingItem.Info.Y);
			}

			creature.Client.Send(packet);
		}
开发者ID:Rai,项目名称:aura,代码行数:30,代码来源:Send.Items.cs


示例7: Move

		/// <summary>
		/// Modifies position in inventory.
		/// </summary>
		/// <param name="pocket"></param>
		/// <param name="x"></param>
		/// <param name="y"></param>
		public void Move(Pocket pocket, int x, int y)
		{
			this.Info.Pocket = pocket;
			this.Info.Region = 0;
			this.Info.X = x;
			this.Info.Y = y;
		}
开发者ID:tkiapril,项目名称:aura,代码行数:13,代码来源:Item.cs


示例8: CheckLeftHand

        /// <summary>
        /// Unequips item in left hand/magazine, if item in right hand is moved.
        /// </summary>
        /// <param name="item"></param>
        /// <param name="source"></param>
        /// <param name="target"></param>
        private void CheckLeftHand(Item item, Pocket source, Pocket target)
        {
            var pocketOfInterest = Pocket.None;

            if (source == Pocket.RightHand1 || source == Pocket.RightHand2)
                pocketOfInterest = source;
            if (target == Pocket.RightHand1 || target == Pocket.RightHand2)
                pocketOfInterest = target;

            if (pocketOfInterest == Pocket.None)
                return;

            // Check LeftHand first, switch to Magazine if it's empty
            var leftPocket = pocketOfInterest + 2; // Left Hand 1/2
            var leftItem = _pockets[leftPocket].GetItemAt(0, 0);
            if (leftItem == null)
            {
                leftPocket += 2; // Magazine 1/2
                leftItem = _pockets[leftPocket].GetItemAt(0, 0);

                // Nothing to remove
                if (leftItem == null)
                    return;
            }

            // Try inventory first.
            // TODO: List of pockets stuff can be auto-moved to.
            var success = _pockets[Pocket.Inventory].Add(leftItem);

            // Fallback, temp inv
            if (!success)
                success = _pockets[Pocket.Temporary].Add(leftItem);

            if (success)
            {
                _pockets[leftPocket].Remove(leftItem);

                Send.ItemMoveInfo(_creature, leftItem, leftPocket, null);
                Send.EquipmentMoved(_creature, leftPocket);
            }
        }
开发者ID:pie3467,项目名称:aura,代码行数:47,代码来源:CreatureInventory.cs


示例9: MovePet

        /// <summary>
        /// Moving item between char and pet, used from handler.
        /// </summary>
        /// <param name="pet">Always the pet</param>
        /// <param name="item"></param>
        /// <param name="other">The "other" creature, player when taking out, pet when putting in.</param>
        /// <param name="target"></param>
        /// <param name="targetX"></param>
        /// <param name="targetY"></param>
        /// <returns></returns>
        public bool MovePet(Creature pet, Item item, Creature other, Pocket target, int targetX, int targetY)
        {
            if (!this.Has(target) || !other.Inventory.Has(target))
                return false;

            var source = item.Info.Pocket;
            var amount = item.Info.Amount;

            // We have to copy the item to get a new id, otherwise there could
            // be collisions when saving, because the moved item is still in
            // the inventory of the pet/character (from the pov of the db).
            // http://dev.mabinoger.com/forum/index.php/topic/804-pet-inventory/
            var newItem = new Item(item);

            Item collidingItem = null;
            if (!other.Inventory._pockets[target].TryAdd(newItem, (byte)targetX, (byte)targetY, out collidingItem))
                return false;

            // If amount differs (item was added to stack)
            if (collidingItem != null && newItem.Info.Amount != amount)
            {
                Send.ItemAmount(other, collidingItem);

                // Left overs, update
                if (newItem.Info.Amount > 0)
                {
                    Send.ItemAmount(_creature, item);
                }
                // All in, remove from cursor.
                else
                {
                    _pockets[item.Info.Pocket].Remove(item);
                    Send.ItemRemove(_creature, item);
                }
            }
            else
            {
                // Remove the item from the source pocket
                _pockets[source].Remove(item);
                Send.ItemRemove(_creature, item, source);

                if (collidingItem != null)
                {
                    // Remove colliding item
                    Send.ItemRemove(other, collidingItem, target);

                    // Toss it in, it should be the cursor.
                    _pockets[source].Add(collidingItem);
                    Send.ItemNew(_creature, collidingItem);
                }

                Send.ItemNew(other, newItem);

                Send.ItemMoveInfo(_creature, item, source, collidingItem);
            }

            pet.Inventory.UpdateInventory(newItem, source, target);

            return true;
        }
开发者ID:pie3467,项目名称:aura,代码行数:70,代码来源:CreatureInventory.cs


示例10: Has

 /// <summary>
 /// Returns true if pocket exists in this inventory.
 /// </summary>
 /// <param name="pocket"></param>
 /// <returns></returns>
 public bool Has(Pocket pocket)
 {
     return _pockets.ContainsKey(pocket);
 }
开发者ID:pie3467,项目名称:aura,代码行数:9,代码来源:CreatureInventory.cs


示例11: Add

        /// <summary>
        /// Tries to add item to pocket. Returns false if the pocket
        /// doesn't exist or there was no space.
        /// </summary>
        public bool Add(int itemId, Pocket pocket)
        {
            var item = new Item(itemId);

            if (!this.Add(item, pocket))
                return false;

            this.CheckEquipMoved(item, Pocket.None, pocket);
            return true;
        }
开发者ID:pie3467,项目名称:aura,代码行数:14,代码来源:CreatureInventory.cs


示例12: GetItemAt

		/// <summary>
		/// Returns item at the location, or null.
		/// </summary>
		/// <param name="pocket"></param>
		/// <param name="x"></param>
		/// <param name="y"></param>
		/// <returns></returns>
		public Item GetItemAt(Pocket pocket, int x, int y)
		{
			return !this.Has(pocket) ? null : _pockets[pocket].GetItemAt(x, y);
		}
开发者ID:ripxfrostbite,项目名称:aura,代码行数:11,代码来源:CreatureInventory.cs


示例13: CheckEquipMoved

		/// <summary>
		/// Runs equipment updates if necessary.
		/// </summary>
		/// <param name="item"></param>
		/// <param name="source"></param>
		/// <param name="target"></param>
		private void CheckEquipMoved(Item item, Pocket source, Pocket target)
		{
			if (source.IsEquip())
				Send.EquipmentMoved(_creature, source);

			if (target.IsEquip())
				Send.EquipmentChanged(_creature, item);

			// Send stat update when moving equipment
			if (source.IsEquip() || target.IsEquip())
				this.UpdateEquipStats();
		}
开发者ID:ripxfrostbite,项目名称:aura,代码行数:18,代码来源:CreatureInventory.cs


示例14: InventoryPocketStack

		public InventoryPocketStack(Pocket pocket)
			: base(pocket)
		{
			_items = new List<Item>();
		}
开发者ID:Vinna,项目名称:aura,代码行数:5,代码来源:InventoryPockets.cs


示例15: GetAllItemsFrom

		/// <summary>
		/// Returns list of all items in pocket. Returns null if the pocket
		/// doesn't exist.
		/// </summary>
		/// <param name="pocket"></param>
		/// <returns></returns>
		public List<Item> GetAllItemsFrom(Pocket pocket)
		{
			if (!_pockets.ContainsKey(pocket))
				return null;

			return _pockets[pocket].Items.Where(a => a != null).ToList();
		}
开发者ID:ripxfrostbite,项目名称:aura,代码行数:13,代码来源:CreatureInventory.cs


示例16: GetItemAt

        /// <summary>
        /// Returns item at the location, or null.
        /// </summary>
        /// <param name="pocket"></param>
        /// <param name="x"></param>
        /// <param name="y"></param>
        /// <returns></returns>
        public Item GetItemAt(Pocket pocket, int x, int y)
        {
            if (!this.Has(pocket))
                return null;

            return _pockets[pocket].GetItemAt(x, y);
        }
开发者ID:pie3467,项目名称:aura,代码行数:14,代码来源:CreatureInventory.cs


示例17: Remove

		/// <summary>
		/// Removes pocket from inventory.
		/// </summary>
		/// <param name="pocket"></param>
		/// <returns></returns>
		public bool Remove(Pocket pocket)
		{
			if (pocket == Pocket.None || !_pockets.ContainsKey(pocket))
				return false;

			_pockets.Remove(pocket);

			return true;
		}
开发者ID:ripxfrostbite,项目名称:aura,代码行数:14,代码来源:CreatureInventory.cs


示例18: Move

        // Handlers
        // ------------------------------------------------------------------
        /// <summary>
        /// Used from MoveItem handler.
        /// </summary>
        /// <remarks>
        /// The item is the one that's interacted with, the one picked up
        /// when taking it, the one being put into a packet when it's one
        /// the cursor. Colliding items switch places with it.
        /// </remarks>
        /// <param name="item">Item to move</param>
        /// <param name="target">Pocket to move it to</param>
        /// <param name="targetX"></param>
        /// <param name="targetY"></param>
        /// <returns></returns>
        public bool Move(Item item, Pocket target, byte targetX, byte targetY)
        {
            if (!this.Has(target))
                return false;

            var source = item.Info.Pocket;
            var amount = item.Info.Amount;

            Item collidingItem = null;
            if (!_pockets[target].TryAdd(item, targetX, targetY, out collidingItem))
                return false;

            // If amount differs (item was added to stack)
            if (collidingItem != null && item.Info.Amount != amount)
            {
                Send.ItemAmount(_creature, collidingItem);

                // Left overs, update
                if (item.Info.Amount > 0)
                {
                    Send.ItemAmount(_creature, item);
                }
                // All in, remove from cursor.
                else
                {
                    _pockets[item.Info.Pocket].Remove(item);
                    Send.ItemRemove(_creature, item);
                }
            }
            else
            {
                // Remove the item from the source pocket
                _pockets[source].Remove(item);

                // Toss it in, it should be the cursor.
                if (collidingItem != null)
                    _pockets[source].Add(collidingItem);

                Send.ItemMoveInfo(_creature, item, source, collidingItem);
            }

            this.UpdateInventory(item, source, target);

            return true;
        }
开发者ID:pie3467,项目名称:aura,代码行数:60,代码来源:CreatureInventory.cs


示例19: Add

		// Adding
		// ------------------------------------------------------------------

		// TODO: Add central "Add" method that all others use, for central stuff
		//   like adding bag pockets. This wil require a GetFreePosition
		//   method in the pockets.

		/// <summary>
		/// Tries to add item to pocket. Returns false if the pocket
		/// doesn't exist or there was no space.
		/// </summary>
		public bool Add(Item item, Pocket pocket)
		{
			if (!_pockets.ContainsKey(pocket))
				return false;

			var success = _pockets[pocket].Add(item);
			if (success)
			{
				Send.ItemNew(_creature, item);
				this.UpdateEquipReferences(pocket);

				// Add bag pocket if it doesn't already exist.
				if (item.OptionInfo.LinkedPocketId != Pocket.None && !this.Has(item.OptionInfo.LinkedPocketId))
					this.AddBagPocket(item);
			}

			return success;
		}
开发者ID:ripxfrostbite,项目名称:aura,代码行数:29,代码来源:CreatureInventory.cs


示例20: CheckEquipMoved

        /// <summary>
        /// Runs equipment updates if necessary.
        /// </summary>
        /// <param name="item"></param>
        /// <param name="source"></param>
        /// <param name="target"></param>
        private void CheckEquipMoved(Item item, Pocket source, Pocket target)
        {
            if (source.IsEquip())
                Send.EquipmentMoved(_creature, source);

            if (target.IsEquip())
                Send.EquipmentChanged(_creature, item);

            // Send stat update when moving equipment
            if (source.IsEquip() || target.IsEquip())
            {
                Send.StatUpdate(_creature, StatUpdateType.Private,
                    Stat.AttackMinBaseMod, Stat.AttackMaxBaseMod,
                    Stat.WAttackMinBaseMod, Stat.WAttackMaxBaseMod,
                    Stat.BalanceBaseMod, Stat.CriticalBaseMod,
                    Stat.DefenseBaseMod, Stat.ProtectionBaseMod
                );
            }
        }
开发者ID:pie3467,项目名称:aura,代码行数:25,代码来源:CreatureInventory.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Point类代码示例发布时间:2022-05-24
下一篇:
C# PnPMonitoredScope类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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