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


C# InventorySlot类代码示例

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


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

示例1: GetSlotPosition

 protected Rectangle GetSlotPosition(InventorySlot slot)
 {
     switch (slot)
     {
         case InventorySlot.Head:
             return new Rectangle(48, 8, 34, 34);
         case InventorySlot.Necklace:
             return new Rectangle(8, 30, 34, 34);
         case InventorySlot.Backpack:
             return new Rectangle(88, 30, 34, 34);
         case InventorySlot.Armor:
             return new Rectangle(48, 50, 34, 34);
         case InventorySlot.Right:
             return new Rectangle(88, 70, 34, 34);
         case InventorySlot.Left:
             return new Rectangle(8, 70, 34, 34);
         case InventorySlot.Legs:
             return new Rectangle(48, 90, 34, 34);
         case InventorySlot.Feet:
             return new Rectangle(48, 130, 34, 34);
         case InventorySlot.Ring:
             return new Rectangle(8, 110, 34, 34);
         case InventorySlot.Ammo:
             return new Rectangle(88, 110, 34, 34);
     }
     return new Rectangle();
 }
开发者ID:hjnilsson,项目名称:sharptibiaclient,代码行数:27,代码来源:InventoryPanel.cs

示例2: UseShortcutSlotItem

    /// <summary>
    /// Utilise le consommable ou équipe l'arme du slot de raccourci envoyé en paramètres
    /// </summary>
    /// <param name="slot"></param>
    public void UseShortcutSlotItem(InventorySlot slot)
    {
        if (slot.IsEmpty)
            return;

        if (slot.Item.Type.Equals(ItemType.weapon))             // S'il s'agit d'une arme, on l'équipe
        {
            if (Inventory.leftHand.IsEmpty)
                Inventory.MoveOrMergeItem(slot, Inventory.leftHand, false);
            else
                Inventory.ExchangeItems(slot, Inventory.leftHand);

            LoadPlayingShortcutsSlots();
            return;
        }

        if (isBoostActive || !slot.Item.Type.Equals(ItemType.consumable))
            return;

        Inventory.UseConsumable(slot.Item, ref boostTimer, false);
        isBoostActive = true;

        boostItem = slot.Item;      // conservation pour enlever les bonus à la fin du temps de boost
        slot.Amount--;
        if (slot.Amount <= 0)       // On en enlève un en quantité, et supprime s'il s'agissait du dernier
        {
            slot.IsEmpty = true;
            slot.Item = new Item();
        }

        LoadPlayingShortcutsSlots();
    }
开发者ID:CalvoR,项目名称:2016_3A_Unity_Calvo_GodVSMan,代码行数:36,代码来源:gvmUI_PlayingShortcuts.cs

示例3: CreateNewSplittedResource

    ResourceItem CreateNewSplittedResource(InventorySlot slotScript, int times = -1)
    {
        int id = this._splitSlot._inventoryRef._itemInfoList[this._splitSlot._slotNum - 1]._itemInfo._uniqueItemID;
        ResourceItem resource = slotScript._inventoryRef._itemContainerObject.GetComponent<ItemContainer>().GetItem(id).GetComponent<ResourceItem>();
        int firstPopID = resource.PopStack();
        int splitCount = 0;
        if (times == -1)
        {
            splitCount = this._splitCount - 1;
        }
        else
        {
            splitCount = times - 1;
        }
        GameObject splitResource = this._splitSlot._inventoryRef._itemContainerObject.GetComponent<ItemContainer>().GetItem(firstPopID);
        ResourceItem splitResourceScript = splitResource.GetComponent<ResourceItem>();
        splitResourceScript.MaintainStack();

        for (int i = 0; i < splitCount; i++)
        {
            int idToAdd = this._splitSlot._inventoryRef._itemContainerObject.GetComponent<ItemContainer>().GetItem(resource.PopStack()).GetComponent<ResourceItem>()._uniqueItemID;
            splitResourceScript.AddToStack(idToAdd);
        }
        return splitResourceScript;
    }
开发者ID:TenorioDan,项目名称:TenorioTieuGame,代码行数:25,代码来源:ResourceSplit.cs

示例4: DropInventoryItem

 public static PacketWriter DropInventoryItem(InventorySlot slot, byte amount)
 {
     var pw = GetWriter(ClientPacketID.DropInventoryItem);
     pw.Write(slot);
     pw.Write(amount);
     return pw;
 }
开发者ID:Furt,项目名称:netgore,代码行数:7,代码来源:ClientPacket.cs

示例5: HUDInventory

        public HUDInventory()
        {
            InventorySlot.Width = InventorySlot.Size / Engine.Singleton.Camera.AspectRatio;
            Slots = new InventorySlot[SlotsCount];
            for (int i = 0; i < SlotsCount; i++)
                Slots[i] = new InventorySlot(SlotsSpacing, SlotsSpacing + i * (InventorySlot.Size + SlotsSpacing));

            SelectQuad = Engine.Singleton.Labeler.NewSimpleQuad("HighlightMaterial", SlotsSpacing, SlotsSpacing, InventorySlot.Width, InventorySlot.Size, new ColourValue(1, 1, 1), 4);

            DescriptionBg = Engine.Singleton.Labeler.NewSimpleQuad("QuadMaterial", 0.2f, 0.5f, 0.6f, 0.45f, ColourValue.White, 1);
            SelectedPicture = Engine.Singleton.Labeler.NewSimpleQuad("QuadMaterial",
                0.21f,
                0.58f,
                0.3f / Engine.Singleton.Camera.AspectRatio,
                0.3f, ColourValue.White, 2);
            DescriptionLabel = Engine.Singleton.Labeler.NewTextLabel("Primitive", 0.03f, new ColourValue(0.7f, 0.4f, 0), new ColourValue(1, 1.0f, 0.6f), 2);
            DescriptionLabel.SetPosition(0.45f, 0.51f);

            GoldBg = Engine.Singleton.Labeler.NewSimpleQuad("QuadMaterial", 0.7f, 0.1f, 0.2f, 0.1f, new ColourValue(1, 1, 1), 1);
            GoldLabel = Engine.Singleton.Labeler.NewTextLabel("Primitive", 0.05f, new ColourValue(0.7f, 0.4f, 0), new ColourValue(1, 1.0f, 0.6f), 2);
            GoldLabel.SetPosition(0.71f, 0.13f);

            InventoryBg = Engine.Singleton.Labeler.NewSimpleQuad("InventoryBgMaterial", 0.01f, 0.01f, 0.98f, 0.98f, new ColourValue(1, 1, 1), 0);
            CharacterPicture = Engine.Singleton.Labeler.NewSimpleQuad("Default", 0.4f, 0.1f, 0.2f / Engine.Singleton.Camera.AspectRatio, 0.2f, new ColourValue(1, 1, 1), 1);

            IsVisible = false;
        }
开发者ID:janPierdolnikParda,项目名称:RPG,代码行数:27,代码来源:HUDInventory.cs

示例6: RemoveItem

 public void RemoveItem(InventorySlot iS)
 {
     if (iS != null)
     {
         iS.UnHighlight();
         iS.m_currentHeldItem = null;
     }
 }
开发者ID:Dunnings,项目名称:ProceduralJam,代码行数:8,代码来源:InventoryManager.cs

示例7: OnBeginDrag

	public void OnBeginDrag (PointerEventData eventData)
	{
		homeSlot = GetComponentInParent<InventorySlot> ();
		transform.SetParent (GetComponentInParent<Canvas> ().transform);
		GameManager.InventoryManager.Select (gameObject);
		GameManager.TakeTag (HasTag);
		GameManager.GiveTag (HoldTag);
		GetComponent<CanvasGroup> ().blocksRaycasts = false;
	}
开发者ID:imann24,项目名称:cs327-bestmobilegameever,代码行数:9,代码来源:InventoryItem.cs

示例8: PlaceItemInSlot

 public void PlaceItemInSlot(InventoryItem iI, InventorySlot iS)
 {
     iI.transform.position = iS.transform.position;
     iI.InventorySlot = iS;
     iS.m_currentHeldItem = iI;
     if (QuestManager.Instance.IsThisItemRequired(iI.gameObject))
     {
         iS.Highlight();
         QuestManager.Instance.PickedUpObject();
     }
 }
开发者ID:Dunnings,项目名称:ProceduralJam,代码行数:11,代码来源:InventoryManager.cs

示例9: Update

        /// <summary>
        /// Updates the client with the changes that have been made to the UserInventory.
        /// </summary>
        public void Update()
        {
            // Don't actually grab the PacketWriter from the pool until we know we will need it
            PacketWriter pw = null;

            try
            {
                // Loop through all slots
                for (var slot = 0; slot < GameData.MaxInventorySize; slot++)
                {
                    // Skip unchanged slots
                    if (!_slotChanged[slot])
                        continue;

                    // Get the item in the slot
                    var invSlot = new InventorySlot(slot);
                    var item = UserInventory[invSlot];

                    // Get the values to send, which depends on if the slot is empty (item == null) or not
                    GrhIndex sendItemGraphic;
                    byte sendItemAmount;

                    if (item == null)
                    {
                        sendItemGraphic = GrhIndex.Invalid;
                        sendItemAmount = 0;
                    }
                    else
                    {
                        sendItemGraphic = item.GraphicIndex;
                        sendItemAmount = item.Amount;
                    }

                    // Grab the PacketWriter if we have not already, or clear it if we have
                    if (pw == null)
                        pw = ServerPacket.GetWriter();
                    else
                        pw.Reset();

                    // Pack the data and send it
                    ServerPacket.SetInventorySlot(pw, invSlot, sendItemGraphic, sendItemAmount);
                    OwnerUser.Send(pw, ServerMessageType.GUIItems);
                }
            }
            finally
            {
                // If we grabbed a PacketWriter, make sure we dispose of it!
                if (pw != null)
                    pw.Dispose();
            }

            // Changes complete
            _slotChanged.SetAll(false);
        }
开发者ID:mateuscezar,项目名称:netgore,代码行数:57,代码来源:UserInventoryUpdater.cs

示例10: Read

        public override void Read(StreamHandler reader)
        {
            ContainerSlot = (InventorySlot)reader.ReadByte();
            Slot = (InventorySlot)reader.ReadByte();
            CastId = reader.ReadByte();
            SpellId = reader.ReadUInt32();
            ItemGuid = reader.ReadGuid();
            GlyphSlot = reader.ReadUInt32();
            UnkFlags = reader.ReadByte();

            TargetData.Read(reader);
        }
开发者ID:CarlosX,项目名称:Kamilla.Wow,代码行数:12,代码来源:UseItem.cs

示例11: InventoryChangeInfo

        public InventoryChangeInfo(ItemEntity item, ItemValueTracker oldValues, InventorySlot slot)
        {
            _slot = slot;
            _item = item;

            if (oldValues == null || oldValues.IsNull)
                _oldValues = null;
            else
                _oldValues = oldValues;

            Debug.Assert(_item != null || _oldValues != null,
                "item and oldValues can not both be null. " + "This would imply that the item changed from null to null.");
        }
开发者ID:wtfcolt,项目名称:game,代码行数:13,代码来源:InventoryChangeInfo.cs

示例12: Resize

    public void Resize( int size, InventorySlot c )
    {
        int cur = m_Slots.Count;
        if( size < cur )
            m_Slots.RemoveRange( size, cur - size );
        else if( size > cur )
        {
            if( size > m_Slots.Capacity )//this bit is purely an optimisation, to avoid multiple automatic capacity changes.
                m_Slots.Capacity = size;

            m_Slots.AddRange( Enumerable.Repeat( c, size - cur ) );
        }
    }
开发者ID:LogicalDragonGames,项目名称:Star_Bloom,代码行数:13,代码来源:Inventory.cs

示例13: ActivateSplit

 public void ActivateSplit(GameObject splitObj, Sprite sprite)
 {
     if (this._splitItem == null)
     {
         this._splitItem = splitObj;
         this._splitSlot = splitObj.transform.parent.GetComponent<InventorySlot>();
         this._splitItemSprite = sprite;
         this.transform.GetChild(0).GetComponent<Image>().sprite = this._splitItemSprite;
         this._splitSlotNum = this._splitItem.transform.parent.GetComponent<InventorySlot>()._slotNum;
         this.gameObject.SetActive(true);
     }
     this._splitCount++;
     this.transform.GetChild(0).GetChild(0).GetComponent<Text>().text = this._splitCount.ToString();
 }
开发者ID:TenorioDan,项目名称:TenorioTieuGame,代码行数:14,代码来源:ResourceSplit.cs

示例14: HandleDrop

    public void HandleDrop(InventorySlot slot)
    {
        if (Inventory == null)
        {
            Debug.LogError("AlchemyCircleUI has no Inventory reference");
            return;
        }

        if (Inventory.SelectedItem != null &&
            !HasItem(Inventory.SelectedItem.ID))
        {
            slot.Item = Inventory.SelectedItem;
            Inventory.SelectedItem = null;
        }
    }
开发者ID:JakeClark1129,项目名称:GlobalGameJamVancouver,代码行数:15,代码来源:AlchemyCircleUI.cs

示例15: MoveTo

	/// <summary>
	/// Moves the item to the specified slot. If that slot is full, tries to move to an unoccupied slot. If there aren't any, does nothing.
	/// </summary>
	/// <param name="slot">Slot.</param>
	public void MoveTo(InventorySlot slot){
		if (!slot.Contents) {
			homeSlot = slot;
			transform.SetParent (slot.transform);
			transform.position = slot.transform.position;
			GetComponent<CanvasGroup> ().blocksRaycasts = true;
			GameManager.GiveTag (HasTag);
			GameManager.InventoryManager.Deselect ();
		} else if (GameManager.InventoryManager.FirstEmptySlot) {
			MoveTo (GameManager.InventoryManager.FirstEmptySlot);
		} else {
			#if (DEBUG)
			Debug.Log("Cannot put " + gameObject.name + " into inventory. There are no empty slots.");
			#endif
		}
	}
开发者ID:imann24,项目名称:cs327-bestmobilegameever,代码行数:20,代码来源:InventoryItem.cs


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